Show / Hide Table of Contents

Class Rlp

Utility class for Recursive Length Prefix (RLP) encoding and decoding, used for serializing data in EVM-compatible transactions.

Inheritance
object
Rlp
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: Hiero
Assembly: Hiero.dll
Syntax
public static class Rlp

Methods

| Edit this page View Source

Decode(byte[])

Decodes an RLP-encoded byte array into its constituent data items.

Declaration
public static object[] Decode(byte[] data)
Parameters
Type Name Description
byte[] data

The RLP-encoded byte array to decode.

Returns
Type Description
object[]

An array of decoded objects, where each element is either a byte array or a nested array of objects.

Exceptions
Type Condition
FormatException

If the data is not valid RLP: an item's declared length runs past the end of the data, or a length prefix is too long to describe data held in memory.

| Edit this page View Source

Encode(params object?[])

RLP-encodes one or more data items into a byte array. A single argument is encoded as that item alone; two or more arguments are encoded as an RLP list. Calling with no arguments produces an empty list (0xC0), and a null array produces 0x80.

Declaration
public static byte[] Encode(params object?[] data)
Parameters
Type Name Description
object[] data

The data items to encode: byte[], ReadOnlyMemory<byte>, string, non-negative int, long, ulong, short, ushort, uint and BigInteger values, decimal values (the fractional part is truncated), null (encoded as an empty string), and nested arrays of these (encoded as lists). Other types, such as byte, sbyte, float and double, are not supported.

Returns
Type Description
byte[]

The RLP-encoded byte array.

Exceptions
Type Condition
ArgumentException

If a data item is of an unsupported type.

ArgumentOutOfRangeException

If a numeric data item is negative.

  • Edit this page
  • View Source
In this article
Back to top .NET Client Library for Hiero Network and Hedera Hashgraph