rlp_codec
Encode structured data (arrays, hex strings, integers) into RLP hex or decode RLP hex back to its original form.
Instructions
RLP-encode structured data, or RLP-decode a hex string.
Encode data is a recursive structure: a leaf (hex string, or a non-negative
integer stored minimal big-endian) or a JSON array of items (nested allowed);
a JSON-array string is parsed too. action=encode -> {encoded:'0x...'}.
Decode data is a 0x-hex string; action=decode -> {decoded} with leaves as
0x-hex and lists as arrays.
Example: rlp_codec("encode", ["0x636174"]) -> encoded="0xc483636174".
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| action | Yes | 'encode' structured data to RLP, or 'decode' a hex RLP. | |
| data | Yes | On encode: a leaf (0x-hex string or non-negative integer) or a (possibly nested) JSON array of items; a stringified JSON array is parsed. On decode: a 0x-prefixed hex string of the RLP payload. |