Created
July 8, 2020 09:14
-
-
Save MariusVanDerWijden/1d599de41a326cd97eabdd346290ae11 to your computer and use it in GitHub Desktop.
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
// Use secret key hex string to sign a raw transaction | |
SK := "0x0000" | |
sk := crypto.ToECDSAUnsafe(common.FromHex(SK))// Sign the transaction | |
signedTx, err := types.SignTx(tx, types.NewEIP155Signer(nil), sk) | |
// You could also create a TransactOpts object | |
opts := bind.NewKeyedTransactor(sk) | |
// To get the address corresponding to your private key | |
addr := crypto.PubkeyToAddress(sk.PublicKey) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment