Created
June 3, 2021 01:31
-
-
Save paralin/34e5d3416fd544fbfb0fb1a4c4146b45 to your computer and use it in GitHub Desktop.
extract go-bee ethereum key from dir
This file contains hidden or 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
| package main | |
| import ( | |
| "fmt" | |
| "github.com/ethersphere/bee/pkg/crypto" | |
| filekeystore "github.com/ethersphere/bee/pkg/keystore/file" | |
| ) | |
| func main() { | |
| keystore := filekeystore.New("./keys") | |
| password := "my-password-here" | |
| swarmPrivateKey, created, err := keystore.Key("swarm", password) | |
| if err != nil { | |
| panic(err) | |
| } | |
| _ = created | |
| signer := crypto.NewDefaultSigner(swarmPrivateKey) | |
| // publicKey := &swarmPrivateKey.PublicKey | |
| overlayEthAddress, err := signer.EthereumAddress() | |
| if err != nil { | |
| panic(err) | |
| } | |
| fmt.Printf("got ethereum address: %x\n", overlayEthAddress) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment