Documentation ¶
Index ¶
- Constants
- Variables
- func EthSecp256k1Option() keyring.Option
- func GetEIP712BytesForMsg(signDocBytes []byte) ([]byte, error)
- func GetEIP712TypedDataForMsg(signDocBytes []byte) (apitypes.TypedData, error)
- func ParseChainID(chainID string) (*big.Int, error)
- func RegisterInterfaces(registry codectypes.InterfaceRegistry)
- func WrapTxToTypedData(cdc codectypes.AnyUnpacker, chainID uint64, msg sdk.Msg, data []byte, ...) (apitypes.TypedData, error)
- type EthAccount
- func (*EthAccount) Descriptor() ([]byte, []int)
- func (m *EthAccount) Marshal() (dAtA []byte, err error)
- func (m *EthAccount) MarshalTo(dAtA []byte) (int, error)
- func (m *EthAccount) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*EthAccount) ProtoMessage()
- func (m *EthAccount) Reset()
- func (m *EthAccount) Size() (n int)
- func (m *EthAccount) Unmarshal(dAtA []byte) error
- func (m *EthAccount) XXX_DiscardUnknown()
- func (m *EthAccount) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *EthAccount) XXX_Merge(src proto.Message)
- func (m *EthAccount) XXX_Size() int
- func (m *EthAccount) XXX_Unmarshal(b []byte) error
- type ExtensionOptionDynamicFeeTx
- func (*ExtensionOptionDynamicFeeTx) Descriptor() ([]byte, []int)
- func (m *ExtensionOptionDynamicFeeTx) Marshal() (dAtA []byte, err error)
- func (m *ExtensionOptionDynamicFeeTx) MarshalTo(dAtA []byte) (int, error)
- func (m *ExtensionOptionDynamicFeeTx) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*ExtensionOptionDynamicFeeTx) ProtoMessage()
- func (m *ExtensionOptionDynamicFeeTx) Reset()
- func (m *ExtensionOptionDynamicFeeTx) Size() (n int)
- func (m *ExtensionOptionDynamicFeeTx) String() string
- func (m *ExtensionOptionDynamicFeeTx) Unmarshal(dAtA []byte) error
- func (m *ExtensionOptionDynamicFeeTx) XXX_DiscardUnknown()
- func (m *ExtensionOptionDynamicFeeTx) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *ExtensionOptionDynamicFeeTx) XXX_Merge(src proto.Message)
- func (m *ExtensionOptionDynamicFeeTx) XXX_Size() int
- func (m *ExtensionOptionDynamicFeeTx) XXX_Unmarshal(b []byte) error
- type ExtensionOptionsWeb3Tx
- func (*ExtensionOptionsWeb3Tx) Descriptor() ([]byte, []int)
- func (m *ExtensionOptionsWeb3Tx) Marshal() (dAtA []byte, err error)
- func (m *ExtensionOptionsWeb3Tx) MarshalTo(dAtA []byte) (int, error)
- func (m *ExtensionOptionsWeb3Tx) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*ExtensionOptionsWeb3Tx) ProtoMessage()
- func (m *ExtensionOptionsWeb3Tx) Reset()
- func (m *ExtensionOptionsWeb3Tx) Size() (n int)
- func (m *ExtensionOptionsWeb3Tx) String() string
- func (m *ExtensionOptionsWeb3Tx) Unmarshal(dAtA []byte) error
- func (m *ExtensionOptionsWeb3Tx) XXX_DiscardUnknown()
- func (m *ExtensionOptionsWeb3Tx) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *ExtensionOptionsWeb3Tx) XXX_Merge(src proto.Message)
- func (m *ExtensionOptionsWeb3Tx) XXX_Size() int
- func (m *ExtensionOptionsWeb3Tx) XXX_Unmarshal(b []byte) error
- type FeeDelegationOptions
- type PrivKey
- func (privKey PrivKey) Bytes() []byte
- func (*PrivKey) Descriptor() ([]byte, []int)
- func (privKey PrivKey) Equals(other cryptotypes.LedgerPrivKey) bool
- func (m *PrivKey) GetKey() []byte
- func (m *PrivKey) Marshal() (dAtA []byte, err error)
- func (privKey PrivKey) MarshalAmino() ([]byte, error)
- func (privKey PrivKey) MarshalAminoJSON() ([]byte, error)
- func (m *PrivKey) MarshalTo(dAtA []byte) (int, error)
- func (m *PrivKey) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*PrivKey) ProtoMessage()
- func (privKey PrivKey) PubKey() cryptotypes.PubKey
- func (m *PrivKey) Reset()
- func (privKey PrivKey) Sign(digestBz []byte) ([]byte, error)
- func (m *PrivKey) Size() (n int)
- func (m *PrivKey) String() string
- func (privKey PrivKey) ToECDSA() (*ecdsa.PrivateKey, error)
- func (privKey PrivKey) Type() string
- func (m *PrivKey) Unmarshal(dAtA []byte) error
- func (privKey *PrivKey) UnmarshalAmino(bz []byte) error
- func (privKey *PrivKey) UnmarshalAminoJSON(bz []byte) error
- func (m *PrivKey) XXX_DiscardUnknown()
- func (m *PrivKey) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *PrivKey) XXX_Merge(src proto.Message)
- func (m *PrivKey) XXX_Size() int
- func (m *PrivKey) XXX_Unmarshal(b []byte) error
- type PubKey
- func (pubKey PubKey) Address() tmcrypto.Address
- func (pubKey PubKey) Bytes() []byte
- func (*PubKey) Descriptor() ([]byte, []int)
- func (pubKey PubKey) Equals(other cryptotypes.PubKey) bool
- func (m *PubKey) GetKey() []byte
- func (m *PubKey) Marshal() (dAtA []byte, err error)
- func (pubKey PubKey) MarshalAmino() ([]byte, error)
- func (pubKey PubKey) MarshalAminoJSON() ([]byte, error)
- func (m *PubKey) MarshalTo(dAtA []byte) (int, error)
- func (m *PubKey) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*PubKey) ProtoMessage()
- func (m *PubKey) Reset()
- func (m *PubKey) Size() (n int)
- func (pubKey PubKey) String() string
- func (pubKey PubKey) Type() string
- func (m *PubKey) Unmarshal(dAtA []byte) error
- func (pubKey *PubKey) UnmarshalAmino(bz []byte) error
- func (pubKey *PubKey) UnmarshalAminoJSON(bz []byte) error
- func (pubKey PubKey) VerifySignature(msg, sig []byte) bool
- func (m *PubKey) XXX_DiscardUnknown()
- func (m *PubKey) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *PubKey) XXX_Merge(src proto.Message)
- func (m *PubKey) XXX_Size() int
- func (m *PubKey) XXX_Unmarshal(b []byte) error
Constants ¶
const ( // PrivKeySize defines the size of the PrivKey bytes PrivKeySize = 32 // PubKeySize defines the size of the PubKey bytes PubKeySize = 33 // KeyType is the string constant for the Secp256k1 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
const ( // EthSecp256k1Type defines the ECDSA secp256k1 used on Ethereum EthSecp256k1Type = hd.PubKeyType(KeyType) )
Variables ¶
var ( ErrInvalidLengthAccount = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowAccount = fmt.Errorf("proto: integer overflow") ErrUnexpectedEndOfGroupAccount = fmt.Errorf("proto: unexpected end of group") )
var ( // SupportedAlgorithms defines the list of signing algorithms used on Ethermint: // - eth_secp256k1 (Ethereum) // - secp256k1 (Tendermint) SupportedAlgorithms = keyring.SigningAlgoList{EthSecp256k1, hd.Secp256k1} // SupportedAlgorithmsLedger defines the list of signing algorithms used on Ethermint for the Ledger device: // - eth_secp256k1 (Ethereum) // - secp256k1 (Tendermint) SupportedAlgorithmsLedger = keyring.SigningAlgoList{EthSecp256k1, hd.Secp256k1} )
var ( ErrInvalidLengthDynamicFee = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowDynamicFee = fmt.Errorf("proto: integer overflow") ErrUnexpectedEndOfGroupDynamicFee = fmt.Errorf("proto: unexpected end of group") )
var ( ErrInvalidLengthKeys = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowKeys = fmt.Errorf("proto: integer overflow") ErrUnexpectedEndOfGroupKeys = fmt.Errorf("proto: unexpected end of group") )
var ( ErrInvalidLengthWeb3 = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowWeb3 = fmt.Errorf("proto: integer overflow") ErrUnexpectedEndOfGroupWeb3 = fmt.Errorf("proto: unexpected end of group") )
var (
// EthSecp256k1 uses the Bitcoin secp256k1 ECDSA parameters.
EthSecp256k1 = ethSecp256k1Algo{}
)
Functions ¶
func EthSecp256k1Option ¶
EthSecp256k1Option defines a function keys options for the ethereum Secp256k1 curve. It supports eth_secp256k1 and secp256k1 keys for accounts.
func GetEIP712BytesForMsg ¶
Get the EIP-712 object bytes for the given SignDoc bytes by first decoding the bytes into an EIP-712 object, then hashing the EIP-712 object to create the bytes to be signed. See https://eips.ethereum.org/EIPS/eip-712 for more.
func GetEIP712TypedDataForMsg ¶
GetEIP712TypedDataForMsg returns the EIP-712 TypedData representation for either Amino or Protobuf encoded signature doc bytes.
func ParseChainID ¶
ParseChainID parses a string chain identifier's epoch to an Ethereum-compatible chain-id in *big.Int format. The function returns an error if the chain-id has an invalid format
func RegisterInterfaces ¶
func RegisterInterfaces(registry codectypes.InterfaceRegistry)
RegisterInterfaces register the Ethermint key concrete types.
func WrapTxToTypedData ¶
func WrapTxToTypedData( cdc codectypes.AnyUnpacker, chainID uint64, msg sdk.Msg, data []byte, feeDelegation *FeeDelegationOptions, ) (apitypes.TypedData, error)
WrapTxToTypedData is an ultimate method that wraps Amino-encoded Cosmos Tx JSON data into an EIP712-compatible TypedData request.
Types ¶
type EthAccount ¶
type EthAccount struct { // base_account is an authtypes.BaseAccount *types.BaseAccount `` /* 136-byte string literal not displayed */ // code_hash is the hash calculated from the code contents CodeHash string `protobuf:"bytes,2,opt,name=code_hash,json=codeHash,proto3" json:"code_hash,omitempty" yaml:"code_hash"` }
EthAccount implements the authtypes.AccountI interface and embeds an authtypes.BaseAccount type. It is compatible with the auth AccountKeeper.
func (*EthAccount) Descriptor ¶
func (*EthAccount) Descriptor() ([]byte, []int)
func (*EthAccount) Marshal ¶
func (m *EthAccount) Marshal() (dAtA []byte, err error)
func (*EthAccount) MarshalToSizedBuffer ¶
func (m *EthAccount) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*EthAccount) ProtoMessage ¶
func (*EthAccount) ProtoMessage()
func (*EthAccount) Reset ¶
func (m *EthAccount) Reset()
func (*EthAccount) Size ¶
func (m *EthAccount) Size() (n int)
func (*EthAccount) Unmarshal ¶
func (m *EthAccount) Unmarshal(dAtA []byte) error
func (*EthAccount) XXX_DiscardUnknown ¶
func (m *EthAccount) XXX_DiscardUnknown()
func (*EthAccount) XXX_Marshal ¶
func (m *EthAccount) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*EthAccount) XXX_Merge ¶
func (m *EthAccount) XXX_Merge(src proto.Message)
func (*EthAccount) XXX_Size ¶
func (m *EthAccount) XXX_Size() int
func (*EthAccount) XXX_Unmarshal ¶
func (m *EthAccount) XXX_Unmarshal(b []byte) error
type ExtensionOptionDynamicFeeTx ¶
type ExtensionOptionDynamicFeeTx struct { // max_priority_price is the same as `max_priority_fee_per_gas` in eip-1559 spec MaxPriorityPrice github_com_cosmos_cosmos_sdk_types.Int `` /* 151-byte string literal not displayed */ }
ExtensionOptionDynamicFeeTx is an extension option that specifies the maxPrioPrice for cosmos tx
func (*ExtensionOptionDynamicFeeTx) Descriptor ¶
func (*ExtensionOptionDynamicFeeTx) Descriptor() ([]byte, []int)
func (*ExtensionOptionDynamicFeeTx) Marshal ¶
func (m *ExtensionOptionDynamicFeeTx) Marshal() (dAtA []byte, err error)
func (*ExtensionOptionDynamicFeeTx) MarshalTo ¶
func (m *ExtensionOptionDynamicFeeTx) MarshalTo(dAtA []byte) (int, error)
func (*ExtensionOptionDynamicFeeTx) MarshalToSizedBuffer ¶
func (m *ExtensionOptionDynamicFeeTx) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*ExtensionOptionDynamicFeeTx) ProtoMessage ¶
func (*ExtensionOptionDynamicFeeTx) ProtoMessage()
func (*ExtensionOptionDynamicFeeTx) Reset ¶
func (m *ExtensionOptionDynamicFeeTx) Reset()
func (*ExtensionOptionDynamicFeeTx) Size ¶
func (m *ExtensionOptionDynamicFeeTx) Size() (n int)
func (*ExtensionOptionDynamicFeeTx) String ¶
func (m *ExtensionOptionDynamicFeeTx) String() string
func (*ExtensionOptionDynamicFeeTx) Unmarshal ¶
func (m *ExtensionOptionDynamicFeeTx) Unmarshal(dAtA []byte) error
func (*ExtensionOptionDynamicFeeTx) XXX_DiscardUnknown ¶
func (m *ExtensionOptionDynamicFeeTx) XXX_DiscardUnknown()
func (*ExtensionOptionDynamicFeeTx) XXX_Marshal ¶
func (m *ExtensionOptionDynamicFeeTx) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*ExtensionOptionDynamicFeeTx) XXX_Merge ¶
func (m *ExtensionOptionDynamicFeeTx) XXX_Merge(src proto.Message)
func (*ExtensionOptionDynamicFeeTx) XXX_Size ¶
func (m *ExtensionOptionDynamicFeeTx) XXX_Size() int
func (*ExtensionOptionDynamicFeeTx) XXX_Unmarshal ¶
func (m *ExtensionOptionDynamicFeeTx) XXX_Unmarshal(b []byte) error
type ExtensionOptionsWeb3Tx ¶
type ExtensionOptionsWeb3Tx struct { // typed_data_chain_id is used only in EIP712 Domain and should match // Ethereum network ID in a Web3 provider (e.g. Metamask). TypedDataChainID uint64 `protobuf:"varint,1,opt,name=typed_data_chain_id,json=typedDataChainId,proto3" json:"typedDataChainID,omitempty"` // fee_payer is an account address for the fee payer. It will be validated // during EIP712 signature checking. FeePayer string `protobuf:"bytes,2,opt,name=fee_payer,json=feePayer,proto3" json:"feePayer,omitempty"` // fee_payer_sig is a signature data from the fee paying account, // allows to perform fee delegation when using EIP712 Domain. FeePayerSig []byte `protobuf:"bytes,3,opt,name=fee_payer_sig,json=feePayerSig,proto3" json:"feePayerSig,omitempty"` }
ExtensionOptionsWeb3Tx is an extension option that specifies the typed chain id, the fee payer as well as its signature data.
func (*ExtensionOptionsWeb3Tx) Descriptor ¶
func (*ExtensionOptionsWeb3Tx) Descriptor() ([]byte, []int)
func (*ExtensionOptionsWeb3Tx) Marshal ¶
func (m *ExtensionOptionsWeb3Tx) Marshal() (dAtA []byte, err error)
func (*ExtensionOptionsWeb3Tx) MarshalTo ¶
func (m *ExtensionOptionsWeb3Tx) MarshalTo(dAtA []byte) (int, error)
func (*ExtensionOptionsWeb3Tx) MarshalToSizedBuffer ¶
func (m *ExtensionOptionsWeb3Tx) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*ExtensionOptionsWeb3Tx) ProtoMessage ¶
func (*ExtensionOptionsWeb3Tx) ProtoMessage()
func (*ExtensionOptionsWeb3Tx) Reset ¶
func (m *ExtensionOptionsWeb3Tx) Reset()
func (*ExtensionOptionsWeb3Tx) Size ¶
func (m *ExtensionOptionsWeb3Tx) Size() (n int)
func (*ExtensionOptionsWeb3Tx) String ¶
func (m *ExtensionOptionsWeb3Tx) String() string
func (*ExtensionOptionsWeb3Tx) Unmarshal ¶
func (m *ExtensionOptionsWeb3Tx) Unmarshal(dAtA []byte) error
func (*ExtensionOptionsWeb3Tx) XXX_DiscardUnknown ¶
func (m *ExtensionOptionsWeb3Tx) XXX_DiscardUnknown()
func (*ExtensionOptionsWeb3Tx) XXX_Marshal ¶
func (m *ExtensionOptionsWeb3Tx) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*ExtensionOptionsWeb3Tx) XXX_Merge ¶
func (m *ExtensionOptionsWeb3Tx) XXX_Merge(src proto.Message)
func (*ExtensionOptionsWeb3Tx) XXX_Size ¶
func (m *ExtensionOptionsWeb3Tx) XXX_Size() int
func (*ExtensionOptionsWeb3Tx) XXX_Unmarshal ¶
func (m *ExtensionOptionsWeb3Tx) XXX_Unmarshal(b []byte) error
type FeeDelegationOptions ¶
type FeeDelegationOptions struct {
FeePayer sdk.AccAddress
}
type PrivKey ¶
type PrivKey struct { // key is the private key in byte form Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` }
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) Descriptor ¶
func (PrivKey) Equals ¶
func (privKey PrivKey) Equals(other cryptotypes.LedgerPrivKey) bool
Equals returns true if two ECDSA private keys are equal and false otherwise.
func (PrivKey) MarshalAmino ¶
MarshalAmino overrides Amino binary marshaling.
func (PrivKey) MarshalAminoJSON ¶
MarshalAminoJSON overrides Amino JSON marshaling.
func (*PrivKey) MarshalToSizedBuffer ¶
func (*PrivKey) ProtoMessage ¶
func (*PrivKey) ProtoMessage()
func (PrivKey) PubKey ¶
func (privKey PrivKey) PubKey() cryptotypes.PubKey
PubKey returns the ECDSA private key's public key. If the privkey is not valid it returns a nil value.
func (PrivKey) Sign ¶
Sign creates a recoverable ECDSA signature on the secp256k1 curve over the provided hash of the message. The produced signature is 65 bytes where the last byte contains the recovery ID.
func (PrivKey) ToECDSA ¶
func (privKey PrivKey) ToECDSA() (*ecdsa.PrivateKey, error)
ToECDSA returns the ECDSA private key as a reference to ecdsa.PrivateKey type.
func (*PrivKey) UnmarshalAmino ¶
UnmarshalAmino overrides Amino binary marshaling.
func (*PrivKey) UnmarshalAminoJSON ¶
UnmarshalAminoJSON overrides Amino JSON marshaling.
func (*PrivKey) XXX_DiscardUnknown ¶
func (m *PrivKey) XXX_DiscardUnknown()
func (*PrivKey) XXX_Marshal ¶
func (*PrivKey) XXX_Unmarshal ¶
type PubKey ¶
type PubKey struct { // key is the public key in byte form Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` }
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 return an empty address if the public key is invalid.
func (*PubKey) Descriptor ¶
func (PubKey) Equals ¶
func (pubKey PubKey) Equals(other cryptotypes.PubKey) bool
Equals returns true if the pubkey type is the same and their bytes are deeply equal.
func (PubKey) MarshalAmino ¶
MarshalAmino overrides Amino binary marshaling.
func (PubKey) MarshalAminoJSON ¶
MarshalAminoJSON overrides Amino JSON marshaling.
func (*PubKey) MarshalToSizedBuffer ¶
func (*PubKey) ProtoMessage ¶
func (*PubKey) ProtoMessage()
func (*PubKey) UnmarshalAmino ¶
UnmarshalAmino overrides Amino binary marshaling.
func (*PubKey) UnmarshalAminoJSON ¶
UnmarshalAminoJSON overrides Amino JSON marshaling.
func (PubKey) VerifySignature ¶
VerifySignature verifies that the ECDSA public key created a given signature over the provided message. It will calculate the Keccak256 hash of the message prior to verification and approve verification if the signature can be verified from either the original message or its EIP-712 representation.
CONTRACT: The signature should be in [R || S] format.
func (*PubKey) XXX_DiscardUnknown ¶
func (m *PubKey) XXX_DiscardUnknown()