New Storage In Ethereum/RSK (2)

Previous Post

Having the feature of storing arbitrary data into an storage cell, we could save dynamic length values in a different way. Actually, saving an string into contract storage in the Etherem Virtual Machine is very convoluted: the string is saved in may cells, with addresses calculated via a hash (see… ).

Now, in RSK contract storage, the string could be saved in a single cell:

A single string should be saved in a single cell of variable length. This feature is not implemented, yet. This post is a proposal. I think it is possible to implement this new feature without changing the normal storage. Two things are needed: some new opcodes and a solidity (or other contract programming language) compiler that uses those new opcodes.

Even the arrays could be saved in a SINGLE cell. The cell address points to a value that describes the array (the length in the below image) and additional storage trie keys had the array values:

The internal storage trie is not limited to 32-bytes keys. It could have keys of arbitrary length.  In the above figure, the index of the array elements are appended to the array address.

Even a map of addresses to balances could be storage in that way:

To discuss in next posts: the new opcodes to implement, storage costs, new compiler output.

Stay tuned!

Angel “Java” Lopez


1 thought on “New Storage In Ethereum/RSK (2)

  1. Pingback: New Storage in Ethereum/RSK (1) | Angel "Java" Lopez on Blog

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s