Recursive Length Prefix¶
The Recursive Length Prefix (RLP) encoding scheme is a space efficient object serialization scheme used in Ethereum.
The specification itself is defined in the Yellow Paper, and the following page on the Ethereum Wiki.
The RLP encoder defined two supported types:
The list type can be nested an arbitrary number of times allowing complex data structures to be encoded.
The RLP module in web3j provides RLP encoding capabilities, with the RlpEncoderTest demonstrating encoding of a number of different values.
Within web3j, RLP encoding is used to encode Ethereum transaction objects into a byte array which is signed before submission to the network. The transaction types and signing logic are located within the Crypto module, with the TransactionEncoderTest providing examples of transaction signing and encoding.
This is a very lightweight module, with no other dependencies. The hope is that other projects wishing to work with Ethereum's RLP encoding on the JVM or Android will choose to make use of this module rather then write their own implementations.