It's our responsibility as developers to do everything we can to reduce our gas footprint on #ethereum, especially with prices so high. Here's an example of the steps we take to save you money: (a thread 👇)
An Ethlings Wearable has 5 pieces of data. Its bonding curve scalar and expiration, its total supply, its reserve balance, and the total royalties accrued.
In #Solidity, all of these values are stored as a number comprised of 256 bits. But Ethereum charges us gas for every bit we use. It's in our users best interest that we optimize every bit of storage!
If we're able to somehow condense our 5 pieces of data into a single one, we could save our users a lot of gas.
So what did we do? The curve's scalar is a value from 0-3 so that only takes 2 bits (00, 01, 10, or 11). The expiration is saved in seconds and we can store that in 40 bits (this gives us roughly 32,000 years of flexibility)
We can assume that the supply will never eclipse 1,000,000 (another 20 bits) so we have 256 - 2 - 40 - 20 = 194 bits left over. That's 97 bits for our remaining royalty and reserve balances.
So we wrote some code to encode all 5 of these values into a single 256 bit space. And it was under 100 lines of code! This extra effort is just one of the ways we're being diligent about gas costs.
We'll be sharing more about our development journey here and in our Discord. Follow along for more tips and stories! discord.gg/MW856HpFhq
• • •
Missing some Tweet in this thread? You can try to
force a refresh
Why @graphprotocol is such an important part of developing user-centric blockchain apps. A thread (👇)
Databases are a standard part of traditional software. You can use them to store and organize data. And what's really valuable about them is your ability to search and retrieve information in a way that makes sense.
An example might be a simple social network. Imagine how hard it might be to show a user feed if you couldn't just ask a database "Send me the most recent 10 posts by people I follow."
We're proud that the Ethlings discord community is so collaborative and thoughtful.
Here are 18 #NFT learning resources curated by the community: tweets, articles, podcasts, and videos to suit your preferred learning style.
(pls also share *your* favorite resources below)
👇🏾
1/ Non-fungible tokens from @ethereum
(The Ethereum community has built a number of constantly evolving guides on DeFi & other topics too. Highly recommend) ethereum.org/en/nft/#what-a…
2/ NFTs - the Modern Finance Podcast by @kevinrose
(You can't go wrong with Kevin's podcasts. He's interviewed the Larva Labs & Art Blocks founders, Beeple, Gary Vee, etc) modern.finance/nfts-blockchai…