___|  _ \   |  |    |   |_ _|\ \     / ____|
 |     |   |  |  |    |   |  |  \ \   /  __|
 |   | |   | ___ __|  ___ |  |   \ \ /   |
\____|\___/     _|   _|  _|___|   \_/   _____| 

 --- A GOPHER-LIKE INTERFACE FOR HIVE BLOCKCHAIN ---

Managing the storage problem in Solidity — the Split vault algorithm

BY: @abhinavramesh12 | CREATED: July 4, 2018, 12:11 p.m. | VOTES: 0 | PAYOUT: $0.00 | [ VOTE ]

While preparing for the WandX mainnet release after our prototype release, we were exploring scalable smart contracts for Order Management. While planning and thinking about our orders storage, we came across a few issues -

Sample soldity code

We started exploring standard patterns in smart contracts to resolve the above issues, shortlisted a few options, but none were satisfactory. So we turned to a traditional database related solution of a History Table and Transaction Table concept. Still there is one limitation with History Tables which is the number of records and size of a single table; we came up with a solution for this by including partitioning or sharding.

Hence, we combined the concept of History/Transaction tables with Partitioning/Sharding and came up with new concept for Smart Contracts called “The Split Vault Algorithm”.

What is the Split Vault algorithm?

Consider the array as a Vault, which stores some information in it. Each vault can have operations like open,close, and seal. In a smart contract it will be a single giant vault with all orders.

Instead of having one array with all orders, we will have to split the same array into two or more based on the size and the number of orders and offload all the arrays as individual vaults. The keys we can use to split the storage are depends on the use case and the need. At WandX, we’ve used “time” as the key.

The main contract can refer to these vault addresses and retrieve the data when needed. Also, we can maintain an active reference for the current vault for easier access and a decent performance.

Benefits

Originally posted on WandX blog. Checkout WandX marketplace here - https://www.wandx.co/

TAGS: [ #cryptocurrencies ] [ #blockchain ] [ #scaling ] [ #dex ] [ #er20 ]

Replies

@cheetah | July 4, 2018, 12:12 p.m. | Votes: 0 | [ VOTE ]

Hi! I am a robot. I just upvoted you! I found similar content that readers might be interested in:
https://blog.wandx.co/managing-the-storage-problem-in-solidity-the-split-vault-algorithm-b4c64dc6d10b

[ BACK TO TRENDING ] [ BACK TO MENU ]
CMD>