If you have tried to store strings on the blockchain, you know that storage is expensive. In the future, it could get even more expensive with storage rent. We've built a smart contract that lets everyone work together to save on rent.
Anyone can compress a word by uploading it to the Word DAO contract, which is running on Ropsten at 0x4DC1ABd5181C0256E57cB7215b73781C5D10D224. Once a word is compressed, anyone can save gas by saving a pointer to the word in Word DAO instead of saving the whole word.
In our benchmarking, uploaders save 15-20% of the gas costs by saving pointers instead of whole words.
Uploaders have an incentive to create words: they receive a WORD token for each word they upload. WORD tokens will have a claim on the cashflow from looking up words.
We built a canonical contract to store all words, referenced by an integer. Instead of putting an entire string in your contract like "hello world", you can reference two integers: 1 and 4.
The contract maps those keys to those words: { 1 => "hello", 4 => "world"}
This repo consists of three contracts:
WordDAOToken: Issues a coin for anyone contributing a word Registry: Stores all the words in uint32 -> bytes32 Manager: Owner of both of the above contract and interface to access them. Charges a tiny fee to get a word back, which is planned to go to owners of WordDAOToken (last part not implemented yet). Also, check out this repo for a contract that utilizes this manager: Ethnewyork-poi-tagger
Instructions to get this running Terminal Window 1:
npm requirements
npm install -g truffle npm install -g zos npm install
Run ganache in one terminal
ganache-cli --deterministic Terminal Window 2:
truffle migrate truffle console --network development
let managerInstance = await Manager.at("0xCfEB869F69431e42cdB54A4F4f105C19C080A601") managerInstance.getDictionarySize() let txn = await managerInstance.addBytes(web3.utils.asciiToHex("Ethereum")) let word = await managerInstance.getBytesByKey(2) 0x33834030300000000 \ returns in bytes (maybe different than what you put into addBytes) TODOs Upgrade Manager to withdraw Eth for WordDAOTokens Test withdrawl
Log in or sign up for Devpost to join the conversation.