Ethereum Columnar Data Storage Format.
Rinkeby: 0xdbeb21dc05613bda3da2b1f1dbde8741d39ba46a.
Optimizing smart contract storage usage for structured data.
NodeJS 8+, npm, Python 3.
npm i
# if not started:
./node_modules/.bin/ganache-cli -l 10000000 >&/tmp/ganache.log &
./node_modules/.bin/truffle compile && ./node_modules/.bin/truffle testWrite your solidity struct to a file, i. e. my_struct.sol:
struct ValidatorMetadata {
string firstName;
string lastName;
string licenseId;
string fullAddress;
string zipcode;
}Generate contract and write it to a file:
./generate-storage-driver.py my_struct.sol > contracts/MyStructureIO.solUse generated contract as a base contract.
- maximum 6 fields
- supported field types: string, address, uint32
- append-only
- in some cases higher gas usage during write
- higher read overhead
- search by hash
- optional fields
- unlimited fields
- fields which are not known beforehand
- caching data in memory and performing better packing (dict-based, etc)
- marking deletion of entries using packed ints
- secondary indexes -> column-oriented DB for EVM! -> better upgradability!