I've been playing around with writing data to the chain. Su…
I've been playing around with writing data to the chain. Super fun to see how all that works. Gonna do a video on it but in short -
1. I did it the traditional way, with a zero satoshi output. Rendering it un-spendable, and technically not money anymore, so while its on chain (for now), it is not in the global UTXO set, because it is not a UTXO. But no harm no foul, no satoshis burned. Just a payment to the miners.
2.I also played with another way to write the script using Op Return - thinking I would trick it into being spendable. But no bueno. Op Return halts the script (by design) so it stopped running after that code - so I burnt some satoshi dust in the process. But the data was written.
3.Then - i did a custom script without op return. Same data on chain, similar cost to method #1. This is the superior method in my opinion because the coin is *spendable* .. transferable. And the data lives in the UTXO set. I don't know how the architecture folks feel about this, but it makes more sense to me because, from what I understand, Op Return was not designed to store data. (there's more to this interesting story but this post is getting long)
Why did I care if the data was in the UTXO set or not? Because of future architecture and pruning. When we get billions of transactions per day (or second!), the miners are not gonna store the block data forever, they can't. They will prune, meaning they will discard older unneeded data and keep just the UTXO set and the block headers. And I actually am fine with only hashes representing data personally, but I wanted to see all the ways to store data on chain. So that's what I did. :)
Addendum: I also tried to fit data into the ScriptSig (unlocking script) but gave up after a few tries. It's probably possible but I didn't want it that bad.
Replies
Ah! no way to edit, I get it. But #1 above was also Op Return!
looking forward to the video!