Angel \”Java\” Lopez on Blog

July 5, 2017

New Storage in Ethereum/RSK (1)

Filed under: Blockchain, Ethereum, RSK, Smart Contracts, Uncategorized — ajlopez @ 12:13 pm

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 Comments »

  1. Pq tem alguns celulares que aparecem ‘próximo a porto alegre” toda vez que escrevem algo no face? O meu não aparece. Pq?

    Comment by JCPenney deals — July 20, 2017 @ 3:57 pm

  2. […] Previous Post […]

    Pingback by New Storage In Ethereum/RSK (2) | Angel "Java" Lopez on Blog — October 3, 2017 @ 8:52 am


RSS feed for comments on this post. TrackBack URI

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s

Blog at WordPress.com.

%d bloggers like this: