hexutil

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".

Last updated

Was this helpful?