Documentation ¶
Index ¶
- Variables
- func BLSSecretKeyToPubkeyBytes(key *bls_sig.SecretKey) ([]byte, error)
- func BytesToBLSPublicKey(input string) (*bls_sig.PublicKey, error)
- func BytesToBLSSecretKey(input []byte) (*bls_sig.SecretKey, error)
- func BytesToECDSAPrivateKey(input []byte) (*ecdsa.PrivateKey, error)
- func CreateAddress(addr types.Address, nonce uint64) types.Address
- func CreateAddress2(addr types.Address, salt [32]byte, inithash []byte) types.Address
- func Ecrecover(hash, sig []byte) ([]byte, error)
- func GenerateAndEncodeBLSSecretKey() (*bls_sig.SecretKey, []byte, error)
- func GenerateAndEncodeECDSAPrivateKey() (*ecdsa.PrivateKey, []byte, error)
- func GenerateBLSKey() (*bls_sig.SecretKey, error)
- func GenerateECDSAKey() (*ecdsa.PrivateKey, error)
- func GenerateOrReadPrivateKey(path string) (*ecdsa.PrivateKey, error)
- func GetAddressFromKey(key goCrypto.PrivateKey) (types.Address, error)
- func Keccak256(v ...[]byte) []byte
- func Keccak256Hash(v ...[]byte) (hash types.Hash)
- func MarshalECDSAPrivateKey(priv *ecdsa.PrivateKey) ([]byte, error)
- func MarshalPublicKey(pub *ecdsa.PublicKey) []byte
- func ParseECDSAPrivateKey(buf []byte) (*ecdsa.PrivateKey, error)
- func ParsePublicKey(buf []byte) (*ecdsa.PublicKey, error)
- func PubKeyToAddress(pub *ecdsa.PublicKey) types.Address
- func ReadConsensusKey(manager secrets.SecretsManager) (*ecdsa.PrivateKey, error)
- func RecoverPubkey(signature, hash []byte) (*ecdsa.PublicKey, error)
- func Sign(priv *ecdsa.PrivateKey, hash []byte) ([]byte, error)
- func SignByBLS(prv *bls_sig.SecretKey, msg []byte) ([]byte, error)
- func UnmarshalBLSPublicKey(input []byte) (*bls_sig.PublicKey, error)
- func UnmarshalBLSSignature(input []byte) (*bls_sig.Signature, error)
- func ValidateSignatureValues(v, r, s *big.Int, isHomestead bool) bool
- func VerifyBLSSignature(pubkey *bls_sig.PublicKey, sig *bls_sig.Signature, message []byte) error
- func VerifyBLSSignatureFromBytes(rawPubkey, rawSig, message []byte) error
- type EIP155Signer
- type FrontierSigner
- type KeccakState
- type KeyType
- type LondonSigner
- type TxSigner
Constants ¶
This section is empty.
Variables ¶
var (
ErrInvalidBLSSignature = errors.New("invalid BLS Signature")
)
var S256 = btcec.S256()
S256 is the secp256k1 elliptic curve
Functions ¶
func BLSSecretKeyToPubkeyBytes ¶
BLSSecretKeyToPubkeyBytes returns bytes of BLS Public Key corresponding to the given secret key
func BytesToBLSPublicKey ¶
BytesToBLSPublicKey decodes given hex string and returns BLS Public Key
func BytesToBLSSecretKey ¶
BytesToECDSAPrivateKey reads the input byte array and constructs a private key if possible
func BytesToECDSAPrivateKey ¶
func BytesToECDSAPrivateKey(input []byte) (*ecdsa.PrivateKey, error)
BytesToECDSAPrivateKey reads the input byte array and constructs a private key if possible
func CreateAddress ¶
CreateAddress creates an Ethereum address.
func CreateAddress2 ¶
CreateAddress2 creates an Ethereum address following the CREATE2 Opcode.
func GenerateAndEncodeECDSAPrivateKey ¶
func GenerateAndEncodeECDSAPrivateKey() (*ecdsa.PrivateKey, []byte, error)
GenerateAndEncodeECDSAPrivateKey returns a newly generated private key and the Base64 encoding of that private key
func GenerateBLSKey ¶
GenerateBLSKey generates a new BLS key
func GenerateECDSAKey ¶
func GenerateECDSAKey() (*ecdsa.PrivateKey, error)
GenerateECDSAKey generates a new key based on the secp256k1 elliptic curve.
func GenerateOrReadPrivateKey ¶
func GenerateOrReadPrivateKey(path string) (*ecdsa.PrivateKey, error)
GenerateOrReadPrivateKey generates a private key at the specified path, or reads it if a key file is present
func GetAddressFromKey ¶
func GetAddressFromKey(key goCrypto.PrivateKey) (types.Address, error)
GetAddressFromKey extracts an address from the private key
func Keccak256Hash ¶
Keccak256Hash calculates and returns the Keccak256 hash of the input data, converting it to an internal Hash data structure.
func MarshalECDSAPrivateKey ¶
func MarshalECDSAPrivateKey(priv *ecdsa.PrivateKey) ([]byte, error)
MarshalECDSAPrivateKey serializes the private key's D value to a []byte
func MarshalPublicKey ¶
MarshalPublicKey marshals a public key on the secp256k1 elliptic curve.
func ParseECDSAPrivateKey ¶
func ParseECDSAPrivateKey(buf []byte) (*ecdsa.PrivateKey, error)
func ParsePublicKey ¶
ParsePublicKey parses bytes into a public key on the secp256k1 elliptic curve.
func PubKeyToAddress ¶
PubKeyToAddress returns the Ethereum address of a public key
func ReadConsensusKey ¶
func ReadConsensusKey(manager secrets.SecretsManager) (*ecdsa.PrivateKey, error)
func RecoverPubkey ¶
RecoverPubkey verifies the compact signature "signature" of "hash" for the secp256k1 curve.
func Sign ¶
func Sign(priv *ecdsa.PrivateKey, hash []byte) ([]byte, error)
Sign produces a compact signature of the data in hash with the given private key on the secp256k1 curve.
func UnmarshalBLSPublicKey ¶
UnmarshalBLSPublicKey unmarshal bytes data into BLS Public Key
func UnmarshalBLSSignature ¶
UnmarshalBLSSignature unmarshal bytes data into BLS Signature
func ValidateSignatureValues ¶
ValidateSignatureValues checks if the signature values are correct
func VerifyBLSSignature ¶
VerifyBLSSignature verifies the given signature from Public Key and original message
func VerifyBLSSignatureFromBytes ¶
VerifyBLSSignatureFromBytes verifies BLS Signature from BLS PublicKey, signature, and original message in bytes
Types ¶
type EIP155Signer ¶
type EIP155Signer struct {
// contains filtered or unexported fields
}
func NewEIP155Signer ¶
func NewEIP155Signer(chainID uint64, isHomestead bool) *EIP155Signer
NewEIP155Signer returns a new EIP155Signer object
func (*EIP155Signer) Hash ¶
func (e *EIP155Signer) Hash(tx *types.Transaction) types.Hash
Hash is a wrapper function that calls calcTxHash with the EIP155Signer's chainID
func (*EIP155Signer) Sender ¶
func (e *EIP155Signer) Sender(tx *types.Transaction) (types.Address, error)
Sender returns the transaction sender
func (*EIP155Signer) SignTx ¶
func (e *EIP155Signer) SignTx( tx *types.Transaction, privateKey *ecdsa.PrivateKey, ) (*types.Transaction, error)
SignTx signs the transaction using the passed in private key
type FrontierSigner ¶
type FrontierSigner struct {
// contains filtered or unexported fields
}
FrontierSigner implements tx signer interface
func NewFrontierSigner ¶
func NewFrontierSigner(isHomestead bool) *FrontierSigner
NewFrontierSigner is the constructor of FrontierSigner
func (*FrontierSigner) Hash ¶
func (f *FrontierSigner) Hash(tx *types.Transaction) types.Hash
Hash is a wrapper function for the calcTxHash, with chainID 0
func (*FrontierSigner) Sender ¶
func (f *FrontierSigner) Sender(tx *types.Transaction) (types.Address, error)
Sender decodes the signature and returns the sender of the transaction
func (*FrontierSigner) SignTx ¶
func (f *FrontierSigner) SignTx( tx *types.Transaction, privateKey *ecdsa.PrivateKey, ) (*types.Transaction, error)
SignTx signs the transaction using the passed in private key
type KeccakState ¶
KeccakState wraps sha3.state. In addition to the usual hash methods, it also supports Read to get a variable amount of data from the hash state. Read is faster than Sum because it doesn't copy the internal state, but also modifies the internal state.
type LondonSigner ¶
type LondonSigner struct {
// contains filtered or unexported fields
}
LondonSigner implements signer for EIP-1559
func NewLondonSigner ¶
func NewLondonSigner(chainID uint64, isHomestead bool, fallbackSigner TxSigner) *LondonSigner
NewLondonSigner returns a new LondonSigner object
func (*LondonSigner) Hash ¶
func (e *LondonSigner) Hash(tx *types.Transaction) types.Hash
Hash is a wrapper function that calls calcTxHash with the LondonSigner's fields
func (*LondonSigner) Sender ¶
func (e *LondonSigner) Sender(tx *types.Transaction) (types.Address, error)
Sender returns the transaction sender
func (*LondonSigner) SignTx ¶
func (e *LondonSigner) SignTx(tx *types.Transaction, pk *ecdsa.PrivateKey) (*types.Transaction, error)
SignTx signs the transaction using the passed in private key
type TxSigner ¶
type TxSigner interface { // Hash returns the hash of the transaction Hash(tx *types.Transaction) types.Hash // Sender returns the sender of the transaction Sender(tx *types.Transaction) (types.Address, error) // SignTx signs a transaction SignTx(tx *types.Transaction, priv *ecdsa.PrivateKey) (*types.Transaction, error) }
TxSigner is a utility interface used to recover data from a transaction