Documentation ¶
Index ¶
Constants ¶
const ( // PrivKeySize defines the size of the PrivKey bytes PrivKeySize = 32 // KeyType is the string constant for the EthSecp256k1 algorithm KeyType = "eth_secp256k1" )
const ( // PrivKeyName defines the amino encoding name for the EthSecp256k1 private key PrivKeyName = "ethermint/PrivKeyEthSecp256k1" // PubKeyName defines the amino encoding name for the EthSecp256k1 public key PubKeyName = "ethermint/PubKeyEthSecp256k1" )
Amino encoding names
Variables ¶
var CryptoCodec = codec.New()
CryptoCodec is the default amino codec used by ethermint
Functions ¶
func RegisterCodec ¶
RegisterCodec registers all the necessary types with amino for the given codec.
Types ¶
type PrivKey ¶
type PrivKey []byte
PrivKey defines a type alias for an ecdsa.PrivateKey that implements Tendermint's PrivateKey interface.
func GenerateKey ¶
GenerateKey generates a new random private key. It returns an error upon failure.
func (PrivKey) Equals ¶
Equals returns true if two ECDSA private keys are equal and false otherwise.
func (PrivKey) Sign ¶
Sign creates a recoverable ECDSA signature on the secp256k1 curve over the Keccak256 hash of the provided message. The produced signature is 65 bytes where the last byte contains the recovery ID.
func (PrivKey) ToECDSA ¶
func (privkey PrivKey) ToECDSA() *ecdsa.PrivateKey
ToECDSA returns the ECDSA private key as a reference to ecdsa.PrivateKey type. The function will panic if the private key is invalid.
type PubKey ¶
type PubKey []byte
PubKey defines a type alias for an ecdsa.PublicKey that implements Tendermint's PubKey interface. It represents the 33-byte compressed public key format.
func (PubKey) Address ¶
Address returns the address of the ECDSA public key. The function will panic if the public key is invalid.
func (PubKey) Bytes ¶
Bytes returns the raw bytes of the ECDSA public key. The function panics if the key cannot be marshaled to bytes.