Documentation
¶
Overview ¶
Package hexutil implements hex encoding with 0x prefix. This encoding is used by the Ethereum RPC API to transport binary data in JSON payloads.
Encoding Rules ¶
All hex data must have prefix "0x".
For byte slices, the hex data must be of even length. An empty byte slice encodes as "0x".
Integers are encoded using the least amount of digits (no leading zero digits). Their encoding may be of uneven length. The number zero encodes as "0x0".
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrEmptyString = &decError{"empty hex string"} ErrSyntax = &decError{"invalid hex string"} ErrMissingPrefix = &decError{"hex string without 0x prefix"} ErrOddLength = &decError{"hex string of odd length"} ErrEmptyNumber = &decError{"hex string \"0x\""} // ErrLeadingZero = &decError{"hex number with leading zero digits"} ErrUint64Range = &decError{"hex number > 64 bits"} )
Errors
Functions ¶
func MustDecode ¶
MustDecode decodes a hex string with 0x prefix. It panics for invalid input.
Types ¶
Click to show internal directories.
Click to hide internal directories.