Can I put my blog into blockchain?
My twitter feed be like:
Blockchain! NFTs! Distributed governance! Get rich quick!
We all know NFTs with URLs to someone’s HTTP server are silly1. True cryptopunks store everything in blockchain directly! So how much would it cost me if I immortalized this blog in the Ethereum blockchain? Think about it! All my typos and rants immutable and preserved forever, that’d be cool!
Disclaimer: I have no idea what I’m talking about. I never actually used Ethereum for anything, and all I know about it I’ve learned in a couple of hours of random googling.
So, how can I store stuff in Ethereum? According to Ethereum StackExchange there are two ways to store arbitrary data in its blockchain:
- As a static input for a transaction.
- As a part of a contract code.
Option #1 seems to be more reasonable for the purpose of my blog: it’s essentially static content and I probably don’t want to pay overhead of the contract compiler. I just want the raw data.
Let’s assume I can find a way to generate a valid transaction with an arbitrary byte array as a payload2. Transacting in Ethereum costs “gas”. Appendix G in the Ethereum yellowpaper specifies gas costs for various operations. According to another answer on StackExchange I’d have to pay 21000 base fee for the transaction, 68 for every non-zero byte, and 4 for every zero byte.
Before sending my blog into the ether (pun intended), I would compress its contents to reduce the amount of data I need to write into the blockchain, and therefore my costs. Compressed data tends to have high entropy, so it’s unlikely to have any significant number of zero bytes in it, hence my calculation I will assume the non-zero byte price as the only relevant one.
There’s also a limited amount of gas that can be included in a block, which seems to fluctuate around 30M according to ethstats.net3. Assuming I can get an entire block to myself, I can fit up to ~430KiB of non-zero data into a single transaction. An xz-compressed fully rendered version of my blog is 31869492 bytes (~31 MiB), so I will need ~73 full blocks to store it, which adds up to ~2170 000 000 gas.
According to EtherScan gas price is currently hovering at ~100 gwei (1 gwei = 10-9 ETH), which means storing the entire blog would cost me ~217 ETH (I don’t like where this is going 😕). At the time of writing 1 ETH costs ~2390 USD, so the total price tag for me would be or ~523000 USD, unless I messed the math up. Bummer, this is way out of my budget 🤔
If I can’t preserve my entire blog, can I at least present a meaningful part of it? Pictures and other random assets are a large contributor to the archive size. Arguably, all of this is secondary and the true value of the blog is in the post text. Can we at least store those? A compressed XZ archive of only markdown files is only 258364 bytes, which is indeed a lot less. By the same calculation, I would need ~17.6M gas, or ~1.76 ETH, which is “only” ~4200 USD. Dang it, being a true cryptopunk is expensive! 😖
Well, you know, this blog is more than a decade old. Surely if the cost is
spread over time it isn’t that bad. Let’s see how much it would cost me to
publish just this one post. Just the compressed text of this post is 2676 bytes,
which would cost me ~0.02 ETH or ~50 USD to publish. If I dare include the image
at the beginning of the post (which was ruthlessly crushed with
price tag jumps up to ~580 USD. (ノ ಠ 益 ಠ)ノ彡 ┻━┻
But wait! My blog is already on blockchain!
Bet you didn’t expect that! It isn’t Ethereum, and it’s a private blockchain, but blocks are very much chained and have some moderate crypto inside. Yup. ┬─┬ ノ( º _ º ノ)
In fact, it has been for… (checks
git log) just over 9 years. Blockchains
come in many flavors and technically Git’s journal is one of the family. I
suppose all that to say that blockchains are not magical, they are just a tool
which can be used to create hype and speculation, or help building useful
software and services. Which way cryptocurrencies pan out? We’ll wait and see.
(╭ರ_ ⊙ )
I’m sure it can be done, so figuring out details is outside if the scope for this thought experiment. ↩︎
Apparently the limit used to be fixed, but became dynamic (and much bigger) recently. Because of this I’m not sure my calculations here are 100% correct, but they are probably in the right ballpark. ↩︎