Documentation ¶
Index ¶
- func CheckPoW(hash Hash, difficulty int) bool
- func EthBytesToUint32(b []byte) uint32
- func EthBytesToUint64(b []byte) uint64
- func GetPkFromKeyStore(ks *keystore.KeyStore, addr common.Address) (*ecdsa.PublicKey, error)
- func Sign(h Hash, ks *keystore.KeyStore, acc accounts.Account) ([]byte, error)
- func Uint32ToEthBytes(u uint32) []byte
- func Uint64ToEthBytes(u uint64) []byte
- func VerifySig(addr common.Address, sig *Signature, msgHash []byte) bool
- func VerifySigEthMsg(addr common.Address, sig *SignatureEthMsg, msg []byte) bool
- func VerifySigEthMsgDate(addr common.Address, sig *SignatureEthMsg, msg []byte, date int64) bool
- func VerifyTimestamp(timestamp int64, timelimit int) bool
- type Hash
- type PoWData
- type PublicKey
- type Signature
- type SignatureEthMsg
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EthBytesToUint32 ¶
EthBytesToUint32 converts bytes as big endian to uint32.
func EthBytesToUint64 ¶
EthBytesToUint64 converts bytes as big endian to uint64.
func GetPkFromKeyStore ¶ added in v0.0.3
GetPkFromKeyStore is a hack to obtain the public key of an addres who's private key is stored in a key store. It does this by signing an empty hash and recovering the public key from the signature.
func Uint32ToEthBytes ¶
Uint32ToEthBytes converts a uint32 to bytes in big endian.
func Uint64ToEthBytes ¶
Uint64ToEthBytes convets a uint64 to bytes in big endian.
func VerifySigEthMsg ¶
func VerifySigEthMsg(addr common.Address, sig *SignatureEthMsg, msg []byte) bool
func VerifySigEthMsgDate ¶
VerifySigEthMsgDate verifies the signature of a byte array with a date appended given an ethereum address.
func VerifyTimestamp ¶
Types ¶
type Hash ¶
type Hash [32]byte
Hash used in this tree, is the [32]byte keccak()
type PoWData ¶
type PoWData interface {
IncrementNonce() PoWData
}
PoWData is the interface for the data that have the Nonce parameter to calculate the Proof-of-Work
type PublicKey ¶
PublicKey is a secp256k1 public key used to verify ecdsa signatures.
func (*PublicKey) MarshalJSON ¶
MarshalJSON serializes the public key as a hex string.
func (*PublicKey) UnmarshalJSON ¶
UnmarshalJSON deserializes the public key from a hex string.
type Signature ¶
type Signature [65]byte
Signature is a secp256k1 ecdsa signature.
func (*Signature) MarshalJSON ¶
MarshalJSON serializes a signature as a hex string.
func (*Signature) UnmarshalJSON ¶
UnmarshalJSON deserializes a signature from a hex string.
type SignatureEthMsg ¶
type SignatureEthMsg [65]byte
SignatureEthMsg is a secp256k1 ecdsa signature of an ethereum message: https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_sig://github.com/ethereum/wiki/wiki/JSON-RPC#eth_sign
func SignEthMsg ¶
SignEthMsg performs an ethereum message signature over a Hash.
func (*SignatureEthMsg) MarshalJSON ¶
func (s *SignatureEthMsg) MarshalJSON() ([]byte, error)
MarshalJSON serializes a signature as a hex string.
func (*SignatureEthMsg) UnmarshalJSON ¶
func (s *SignatureEthMsg) UnmarshalJSON(bs []byte) error
UnmarshalJSON deserializes a signature from a hex string.