3

I'm trying to figure out how to interact with the current version of the Casper contract from Solidity. The vote-function in the casper contract takes an array of bytes, which represents the RLP-encoded vote message. Is there a straightforward way of encoding messages using RLP in Solidity?

1

I don't know if there is any native library available in Solidity, but there are node-js libraries available will help you do that. I also found this solidity code when doing a search on RLP, have a look at the code snippet below:

https://github.com/Giveth/milestonetracker/blob/master/contracts/RLP.sol

Libraries:

https://www.npmjs.com/package/rlp

articles:

http://wanderer.github.io/ethereum/nodejs/code/2014/05/21/using-ethereums-tries-with-node/

https://medium.com/@phansnt/data-structure-in-ethereum-episode-1-recursive-length-prefix-rlp-encoding-decoding-d1016832f919

Here is a thread on RLP Encoding:

RLP decoding question

Hope this helps.

2

https://www.npmjs.com/package/solidity-rlp

Here is a package I am maintaining to decode rlp bytes in solidity. you can checkout the code and usage instructions here: https://github.com/hamdiallam/solidity-rlp

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.