XRPL Binary Codec

Functions for encoding objects into the XRP Ledger’s canonical binary format and decoding them.

exception xrpl.core.binarycodec.XRPLBinaryCodecException

Bases: xrpl.constants.XRPLException

General XRPL Binary Codec Exception.

xrpl.core.binarycodec.decode(buffer: str)Dict[str, Any]

Decode a transaction from binary format to a JSON-like dictionary representation.

Parameters

buffer – The encoded transaction binary, as a hexadecimal string.

Returns

A JSON-like dictionary representation of the transaction.

xrpl.core.binarycodec.encode(json: Dict[str, Any])str

Encode a transaction or other object into the canonical binary format.

Parameters

json – A JSON-like dictionary representation of an object.

Returns

The binary-encoded object, as a hexadecimal string.

xrpl.core.binarycodec.encode_for_multisigning(json: Dict[str, Any], signing_account: str)str

Encode a transaction into binary format in preparation for providing one signature towards a multi-signed transaction. (Only encodes fields that are intended to be signed.)

Parameters
  • json – A JSON-like dictionary representation of a transaction.

  • signing_account – The address of the signer who’ll provide the signature.

Returns

A hex string of the encoded transaction.

xrpl.core.binarycodec.encode_for_signing(json: Dict[str, Any])str

Encode a transaction into binary format in preparation for signing. (Only encodes fields that are intended to be signed.)

Parameters

json – A JSON-like dictionary representation of a transaction.

Returns

The binary-encoded transaction, ready to be signed.

xrpl.core.binarycodec.encode_for_signing_claim(json: Dict[str, Any])str

Encode a payment channel Claim to be signed.

Parameters

json – A JSON-like dictionary representation of a Claim.

Returns

The binary-encoded claim, ready to be signed.