This is just a proof of concept.
This is not an endorsement of storing data on-chain, in fact I think it's generally harmful and stupid. However, my goal is to illustrate the futility of trying to filter these things.
It is perfectly legitimate for a taproot spend to be arbitrarily deep (up to the consensus limit of 128 levels), and it is wildly contrary to the privacy preserving intent of taproot to require revealing the preimages of any other tap leaves, besides the one being spent. Therefore, filtering a transaction like this is completely unacceptable. My point is that eventually the filter crowd will either have to give up in places like this, or censor valid, legitimate transations, to combat spam that looks like this.
- Create an address and save the private key.
$ cargo run create-address payload.bin
secret_key: 91c8e970e034adb2d2a224cf63aeb4cce0f78911dee37aef3a85603d98112292
address: tb1pmkcmqvv8fhsgra493usdcrp4yd0kl79shv2yl4rlep7s59kgfmlq6dyxxa
- Send (signet) bitcoin to the address
- Get the (hex) rawtransaction of the transaction created in #2
- Get the index of the output going to your address from the tx created in #2 (the
decoderawtransaction
RPC can help you figure this out, it's always been 0 for me but I thought Bitcoin Core randomized this...) - Get a new address where you can send some of these coins.
- Create a transaction spending the output created in #2 and revealing the "inscription"
# cargo run spend payload.bin <secret_key from #1> <rawtransaction hex from #3> <outpoint index from #4> <destination address from #5>
$ cargo run spend payload.bin 91c8e970e034adb2d2a224cf63aeb4cce0f78911dee37aef3a85603d98112292 020000000001025fb33aab1a79bf93e915b364fd21d2e6ec995e5e5400aced333e250934eb384d0000000000fdffffff5ee7e35610be1d8ff8123e05557031ab5dce18603daeb96080ce2e817d2bdc870000000000fdffffff0220a1070000000000225120ddb1b031874de081f6a58f20dc0c35235f6ff8b0bb144fd47fc87d0a16c84efe78e216000000000022512009d177c91c7ff826bd12743987da8d81a7d41d77b52021ce7f4b86163bfe427502473044022027eb6daad7e4489acb720f857e80a78ac1e0dcd1afa6ee1219235c5de51e6927022012f6e061299210ed8cc653e60ab54651cfbf9a80d142ddba6e311df4fde9a25e01210220063e970aaab5e6cd4547d1ecaefc7d1d8608a48986666a1cda6e4f04d66a480247304402200f21850ec9de7004df23f3ad038d08496d4a2240e39a78dab17745f116e06f5702205cde4f6365db3d54a9058c53e5cc79cedff1c67d26892207c0a83285431be235012102a26ace48fb73c802728cb0ec756ce06e9948ed4a49dbb7d33cdc35fdd8307726eed70300 0 tb1qh387sg4xedc9sdhgefgu4sp52r0gv9ghfeu6ql
02000000000101d8e9ab78bbc1cc4dde67b678322f8c48960f252a1eaef6c4701d57aff60632eb00000000000000000001569b070000000000160014bc4fe822a6cb705836e8ca51cac03450de86151703415a11b202438b4429fc546cb3040b5e38de436b20d75722304155859ff5b14d9e61d5152f0da559209000b1c639f3bb5bdd58f5ad51c7fef6de5d6a32104a2608012220130d00096f38582780d6c72a25d733235a7e45e8832fc8bd270cc36498a64f93acfde109c0130d00096f38582780d6c72a25d733235a7e45e8832fc8bd270cc36498a64f93416e6420686520736169642c20225468657265207761732061206d616e2077686f206861642074776f20736f6e732e20416e642074686520796f756e676572206f66207468656d207361696420746f20686973206661746865722c20274661746865722c2067697665206d6520746865207368617265206f662070726f7065727479207468617420697320636f6d696e6720746f206d652e2720416e642068652064697669646564206869732070726f7065727479206265747765656e207468656d2e204e6f74206d616e792064617973206c617465722c2074686520796f756e67657220736f6e20676174686572656420616c6c2068652068616420616e6420746f6f6b2061206a6f75726e657920696e746f20612066617220636f756e7472792c20616e6420746865726520686520737175616e6465726564206869732070726f706572747920696e207265636b6c657373206c6976696e672e20416e64207768656e20686520686164207370656e742065766572797468696e672c2061207365766572652066616d696e652061726f736520696e207468617420636f756e7472792c20616e6420686520626567616e20746f20626520696e206e6565642e20536f2068652077656e7420616e642068697265642068696d73656c66206f757420746f206f6e65206f662074686520636974697a656e73206f66207468617420636f756e7472792c2077686f2073656e742068696d20696e746f20686973206669656c647320746f206665656420706967732e20416e6420686520776173206c6f6e67696e6720746f2062652066656420776974682074686520706f64732074686174207468652070696773206174652c20616e64206e6f206f6e6520676176652068696d20616e797468696e672e0a0a22427574207768656e2068652063616d6520746f2068696d73656c662c20686520736169642c2027486f77206d616e79206f66206d792066617468657227732068697265642073657276616e74732068617665206d6f7265207468616e20656e6f7567682062726561642c20627574204920706572697368206865726520776974682068756e6765722120492077696c6c20617269736520616e6420676f20746f206d79206661746865722c20616e6420492077696c6c2073617920746f2068696d2c20224661746865722c204920686176652073696e6e656420616761696e73742068656176656e20616e64206265666f726520796f752e204920616d206e6f206c6f6e67657220776f7274687920746f2062652063616c6c656420796f757220736f6e2e205472656174206d65206173206f6e65206f6620796f75722068697265642073657276616e74732e222720416e642068652061726f736520616e642063616d6520746f20686973206661746865722e20427574207768696c6520686520776173207374696c6c2061206c6f6e6720776179206f66662c2068697320666174686572207361772068696d20616e642066656c7420636f6d70617373696f6e2c20616e642072616e20616e6420656d6272616365642068696d20616e64206b69737365642068696d2e20416e642074686520736f6e207361696420746f2068696d2c20274661746865722c204920686176652073696e6e656420616761696e73742068656176656e20616e64206265666f726520796f752e204920616d206e6f206c6f6e67657220776f7274687920746f2062652063616c6c656420796f757220736f6e2e27204275742074686520666174686572207361696420746f206869732073657276616e74732c20274272696e6720717569636b6c7920746865206265737420726f62652c20616e6420707574206974206f6e2068696d2c20616e642070757420612072696e67206f6e206869732068616e642c20616e642073686f6573206f6e2068697320666565742e20416e64206272696e67207468652066617474656e65642063616c6620616e64206b696c6c2069742c20616e64206c65742075732065617420616e642063656c6562726174652e20466f722074686973206d7920736f6e2077617320646561642c20616e6420697320616c69766520616761696e3b20686520776173206c6f73742c20616e6420697320666f756e642e2720416e64207468657920626567616e20746f2063656c6562726174652e0a0a224e6f7720686973206f6c64657220736f6e2077617320696e20746865206669656c642c20616e642061732068652063616d6520616e642064726577206e65617220746f2074686520686f7573652c206865206865617264206d7573696320616e642064616e63696e672e20416e642068652063616c6c6564206f6e65206f66207468652073657276616e747320616e642061736b65642077686174207468657365207468696e6773206d65616e742e20416e64206865207361696420746f2068696d2c2027596f75722062726f746865722068617320636f6d652c20616e6420796f75722066617468657220686173206b696c6c6564207468652066617474656e65642063616c662c2062656361757365206865206861732072656365697665642068696d206261636b207361666520616e6420736f756e642e27204275742068652077617320616e67727920616e64207265667573656420746f20676f20696e2e20486973206661746865722063616d65206f757420616e6420656e747265617465642068696d2c2062757420686520616e73776572656420686973206661746865722c20274c6f6f6b2c207468657365206d616e79207965617273204920686176652073657276656420796f752c20616e642049206e65766572206469736f626579656420796f757220636f6d6d616e642c2079657420796f75206e657665722067617665206d65206120796f756e6720676f61742c20746861742049206d696768742063656c6562726174652077697468206d7920667269656e64732e20427574207768656e207468697320736f6e206f6620796f7572732063616d652c2077686f20686173206465766f7572656420796f75722070726f706572747920776974682070726f73746974757465732c20796f75206b696c6c6564207468652066617474656e65642063616c6620666f722068696d212720416e64206865207361696420746f2068696d2c2027536f6e2c20796f752061726520616c776179732077697468206d652c20616e6420616c6c2074686174206973206d696e6520697320796f7572732e204974207761732066697474696e6720746f2063656c65627261746520616e6420626520676c61642c20666f72207468697320796f75722062726f746865722077617320646561642c20616e6420697320616c6976653b20686520776173206c6f73742c20616e6420697320666f756e642e27220a0a0a0a0a0a0a0a0a0a0a00000000
- Collect the hex rawtransaction result from #6 and broadcast it (for instance with the
sendrawtransaction
RPC) - Contemplate how your life came to this.
- Turn away from degen token trading.
(I will never do these, I've already spent more time on this garbage than I intended)
- Encrypt payload
- If you use this tool with a maliciously constructed, unencrypted payload, it could steal funds by encoding a valid tap leaf hash somewhere unlocked by a signature the attacker can produce.
- Add reveal step
- Encryption is easiest added using a key that can be derived from the internal key, but in theory this pattern could be detectable.
- It would be completely undetectable (until it's too late) if the encryption key is revealed in a separate, later transaction after the inscription is already too confirmed to reorg out.