-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into dependabot/go_modules/github.com/aws/aws-s…
…dk-go-v2/config-1.27.16
- Loading branch information
Showing
17 changed files
with
516 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package operatorid | ||
|
||
import ( | ||
"encoding/hex" | ||
"fmt" | ||
|
||
"github.com/Layr-Labs/eigensdk-go/crypto/bls" | ||
"github.com/Layr-Labs/eigensdk-go/types" | ||
"github.com/urfave/cli/v2" | ||
) | ||
|
||
var ( | ||
PrivateKey = &cli.StringFlag{ | ||
Name: "private-key", | ||
Usage: "(bn254) private key from which to derive operatorId from", | ||
Required: true, | ||
} | ||
) | ||
|
||
var Command = &cli.Command{ | ||
Name: "derive-operator-id", | ||
Aliases: []string{"d"}, | ||
Description: `Given a private key, output its associated operatorId (hash of bn254 G1 pubkey).`, | ||
Action: derive, | ||
Flags: []cli.Flag{ | ||
PrivateKey, | ||
}, | ||
} | ||
|
||
func derive(c *cli.Context) error { | ||
sk := c.String(PrivateKey.Name) | ||
keypair, err := bls.NewKeyPairFromString(sk) | ||
if err != nil { | ||
return err | ||
} | ||
operatorId := types.OperatorIdFromKeyPair(keypair) | ||
fmt.Println("0x" + hex.EncodeToString(operatorId[:])) | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.