New Storage in Ethereum/RSK (1)

Next Post

An Ethereum Virtual Machine manages a contract storage, in cells, each one having a 32-byte address and a 32-byte value. A simplified view:

But in RSK implementation, there is a new feature: a cell can contain an arbitrary byte array data:

This feature is exposed by new methods included into the original Repository interface:

    /**
     * Put a value in storage of an account at a given key
     *
     * @param addr of the account
     * @param key of the data to store
     * @param value is the data to store
     */
    void addStorageRow(byte[] addr, DataWord key, DataWord value);

    void addStorageBytes(byte[] addr, DataWord key, byte[] value);

    /**
     * Retrieve storage value from an account for a given key
     *
     * @param addr of the account
     * @param key associated with this value
     * @return data in the form of a <code>DataWord</code>
     */
    DataWord getStorageValue(byte[] addr, DataWord key);

    byte[] getStorageBytes(byte[] addr, DataWord key);

The new methods are addStorageBytes and getStorageBytes. It was relatively easy to add, because the internal structure that represents the storage (a trie) is already prepared to store arbitrary data.

RSK implementation is using this features from precompiled contracts, and it is not available from EVM contracts.

In this post series, I want to describe new features that could be added to RSK storage, now it has byte array support.

Stay tuned!

Angel “Java” Lopez
http://www.ajlopez.com
http://twitter.com/ajlopez

2 thoughts on “New Storage in Ethereum/RSK (1)

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

Leave a Reply

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

WordPress.com Logo

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

Google+ photo

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

Twitter picture

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

Facebook photo

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

w

Connecting to %s