Documentation
¶
Index ¶
- func BytesFromECDSAPrivateKey(privateKey *ecdsa.PrivateKey) []byte
- func ECDSAKeysFromPrivateKeyBytes(pk []byte) (*ecdsa.PrivateKey, *ecdsa.PublicKey)
- func ECDSAKeysFromPrivateKeyHex(pk string) (priv *ecdsa.PrivateKey, pub *ecdsa.PublicKey, err error)
- func ECDSAPublicKeyCompressedToBytes(pub *ecdsa.PublicKey) []byte
- func ECDSAPublicKeyToBytes(pub *ecdsa.PublicKey) []byte
- func Keccak256(data ...[]byte) []byte
- func PubKeyToAddressBytes(p ecdsa.PublicKey) []byte
- func SignEcdsaRfc6979(priv *ecdsa.PrivateKey, hash []byte, alg func() hash.Hash) (v byte, r, s *big.Int)
- func SignEcdsaRfc6979Bytes(privateKey *ecdsa.PrivateKey, hash []byte, alg func() hash.Hash) (sig []byte)
- type EthTxSigner
- type KeccakState
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BytesFromECDSAPrivateKey ¶
func BytesFromECDSAPrivateKey(privateKey *ecdsa.PrivateKey) []byte
func ECDSAKeysFromPrivateKeyBytes ¶
func ECDSAKeysFromPrivateKeyBytes(pk []byte) (*ecdsa.PrivateKey, *ecdsa.PublicKey)
func ECDSAPublicKeyToBytes ¶
func Keccak256 ¶
Keccak256 calculates and returns the Keccak256 hash of the input data or few pieces of data.
func PubKeyToAddressBytes ¶
func SignEcdsaRfc6979 ¶
func SignEcdsaRfc6979Bytes ¶
Types ¶
type EthTxSigner ¶
type EthTxSigner struct {
Nonce uint64 // nonce of sender account
GasPrice *big.Int // wei per gas
Gas uint64 // gas limit
To *[]byte `rlp:"nil"` // nil means contract creation
Value *big.Int // wei amount
Data []byte // contract invocation input data
V, R, S *big.Int // signature values
// contains filtered or unexported fields
}
func NewEthTxSigner ¶
func (*EthTxSigner) EncodeRPL ¶
func (tx *EthTxSigner) EncodeRPL() (data []byte, err error)
func (*EthTxSigner) Hash ¶
func (tx *EthTxSigner) Hash() []byte
func (*EthTxSigner) SetChainId ¶
func (tx *EthTxSigner) SetChainId(id *big.Int)
func (*EthTxSigner) Sign ¶
func (tx *EthTxSigner) Sign(privateKey *ecdsa.PrivateKey) (sig []byte)
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. imported from go-ethereum, modified to remove dependency on go-ethereum/common because "A little copying is better than a little dependency." (https://go-proverbs.github.io) ;)
func NewKeccakState ¶
func NewKeccakState() KeccakState
Click to show internal directories.
Click to hide internal directories.