Redis-like storage


I'm generally very excited about Ethereum, however, I do have some thoughts on the storage system.

My general understanding is that only a simple KV storage will be provided to contracts, with only string/integers as both keys and values. I can see some shortcomings of this approach. Take reputation system as an example (suppose we are porting bitcoin-otc to Ethereum). Any user can leave a rating for another. Essentially, they send a tx with data (1, 'ratee_address', -5, 'rating comment') (1 is command number, -5 is rating). It would be reasonable to expect that such an app will update ratee's rating as well as store the rating entry (sender, rating, comment) in such a way that it could be retrieved easily.

If contract storage was behaving more like Redis with its list & set manipulation commands, one could do[ratee_address] =[ratee_address] + rating['comments_' + ratee_address].lpush([ tx.sender, rating, comment ])

Without list manipulation operations, one would have to first get the list, then manually prepend/append to it, then set the resulting list to the key, all manually in contract. Which, on more or less big contracts, can mean pulling a really huge list inside the contract, which is no good.

Sets also may be useful. Ability to get all the keys from storage might be too.

Maybe this more advanced functionality can charge the contract a few ether more for this, but it is definitely needed for some applications.


  • Jam10oJam10o Member Posts: 61 ✭✭
    Oh, god yes. However, I'd imagine something like this is in the pipeline for EHLL (ECLL is meant to be low-level, and complex operations have to be implemented manually).
  • yoyoyoyo Member Posts: 34 ✭✭✭
    edited January 2014
    At the lowest level keys and values are all integers in range [0 .. 2^256-1]. The language constructs available at higher levels will entirely depend on implementations.

    I can easily imagine a future with several languages compiling into Ethereum bytecode. You would code, test and debug in a high level language of your choice in a sandbox environment, then compile and publish. These high level languages need not be affiliated with the Ethereum core project, as long as they produce proper bytecode for you to create the transaction with. (And there will always be that low level hacker that think in opcodes and beats the compiler optimizations.)

Sign In or Register to comment.