Documentation
¶
Index ¶
- Constants
- Variables
- func CopyBytes(b []byte) (copiedBytes []byte)
- func Decode(input string) ([]byte, error)
- func EncodeToBytes(val interface{}) ([]byte, error)
- func FromHex(s string) []byte
- func MustDecode(input string) []byte
- func MustParseBig256(s string) *big.Int
- func PaddedBigBytes(bigint *big.Int, n int) []byte
- func ParseBig256(s string) (*big.Int, bool)
- func UnmarshalFixedJSON(typ reflect.Type, input, out []byte) error
- type Address
- type Bytes
- type Hash
Constants ¶
const ( // HashLength is the expected length of the hash HashLength = 32 // AddressLength is the expected length of the address AddressLength = 20 )
Variables ¶
var ( // Big0 is 0 represented as a big.Int Big0 = big.NewInt(0) // Big1 is 1 represented as a big.Int Big1 = big.NewInt(1) )
Functions ¶
func EncodeToBytes ¶
EncodeToBytes encodes the given values to RLP. This is a minimal implementation specifically for CreateAddress.
func FromHex ¶
FromHex returns the bytes represented by the hexadecimal string s. s may be prefixed with "0x".
func MustDecode ¶
MustDecode decodes a hex string with 0x prefix. It panics for invalid input.
func MustParseBig256 ¶
MustParseBig256 parses a hex or decimal string as a quantity of at most 256 bits. The result has 256 bits (32 bytes). Leading zeros are kept as required.
func PaddedBigBytes ¶
PaddedBigBytes encodes a big integer as a big-endian byte slice. The length of the slice is at least n bytes.
func ParseBig256 ¶
ParseBig256 parses a hex or decimal string as a quantity of at most 256 bits. The result has 256 bits (32 bytes). Leading zeros are kept as required.
Types ¶
type Address ¶
type Address [AddressLength]byte
Address represents the 20 byte address of an Ethereum account.
func BytesToAddress ¶
BytesToAddress returns Address with value b. If b is larger than len(h), b will be cropped from the left.
func HexToAddress ¶
HexToAddress returns Address with byte values of s. If s is larger than len(h), s will be cropped from the left.
type Bytes ¶
type Bytes []byte
Bytes marshals/unmarshals as a JSON string with 0x prefix. The empty slice marshals as "0x".
func (Bytes) MarshalText ¶
MarshalText implements encoding.TextMarshaler
type Hash ¶
type Hash [HashLength]byte
Hash represents the 32 byte Keccak256 hash of arbitrary data.