Store your tweets in the Bitcoin blockchain forever!

Yes, you can send a tweet and store it in the Bitcoin blockchain forever, and it is kind of cheap! I will show you how to do it less than 30 lines of Python!

Why would you want to do it? Well, maybe you want to engrave something romantic ❤️ without hurting a tree, or perhaps you just tweeted about a startup you founded with a partner, and you want a timestamped backup proof of the partnership agreement 🔏.

Who knows! The imagination is the limit!

Hackers sent messages to each other in the Bitcoin blocking chain during the Twitter hack

As probably all of you know, last week, there was a hack around Twitter requesting Bitcoin from famous accounts. I took a look at the BTC addresses on the blockchain, and I found this, which caught my attention:

Someone replied to the hackers by sending some BTC to two of their addresses (number 2 yellow on the image), even he/she signed with 0.00001337. 1337 (LEET), which is a typical term used in hacker communities since the 80s. Also (in red), someone added an extra message to the hackers, to let them know that Bitcoin is traceable and that they should have used Monero.

But ok, how someone managed to create a valid Bitcoin address with custom text? I wanted to know!

How to write text on valid Bitcoin addresses?

Bitcoin addresses use BASE58 encoding; this only means that there is a small group of characters you can use to write: the numbers, the alphabet in lower and upper case, but not the l, I, 0, or O, to avoid mistakes when reading.

The only thing you need to use a valid Bitcoin address is to calculate the last part of the address, the checksum. This is an example of a valid address: 1YourMessageHerexxxxxxxxxxxyjN1vE (You can check if is valid here).

This type of address is called a black hole address, because you will lose the funds sent there if you don’t calculate the private key, which is kind of impossible for this length (for now).

There is an alternative to create a personalized address where you can access your funds by calculating the private key, but with very few characters at the beginning, they are called vanity addresses, and you can’t use too many characters because of the time it takes to calculate the private key:

If you want your own short vanity address, you can create it with Vanitygen and a GPU. But I want to tweet long phrases, so I will create a script that transforms a 280 character tweet into a unique transaction containing multiple addresses with the text:

Easy step-by-step Python code explanation

If you like the theory, read this, but here I have written a simplified script with comments, seems difficult, but I promise it has been easier than I expected, what the code does is:

  • Because I can’t store spaces, I convert the tweet ToATitle SoYouCanStillReadWords.
  • Then i repLace the aLphabet with the BASE58 f0rmat
  • [I cut the message in chuncks] [to store it in different addresses] [of the same transaction]
  • And apply the algorithm to each chunk to calculate the checksum and 1CreateAVaLidBitcoinAddress89wgnB
  • Tweet the original message and print the output of valid addresses related to the tweet.

Let’s store a HeLLoWorLd!

The hacker used 1s or 7s to fill the empty characters, but I preferred something more artistic 🎨, so I have used the first digits of π. That could be an easy way to find these addresses in the Bitcoin blockchain!

So I created these two first messages as a “Hello World”:

1HeLLoWorLdxxAsierxx31415925DBZi7
1tweetingonTheBLockchain3142LzKPN

To post them together as a single transaction to the Bitcoin blockchain, you only need to use the Electrum client and Tools>PayToMany, and sort them by sending incremental amounts: 0.0051mBTC, 0.0052mBTC, etc.

And here they are in the Bitcoin blockchain!! 👇

[Link to the transaction in the Blockchain]

A Hello World isn’t the most EPIC thing to store on the blockchain, so…

Let’s store the first Quantum Circuit in the blockchain!

The “Hello World” of quantum computing is the Bell State:

The code on the left is QASM, a representation of quantum computing instructions; and on the right, we have the circuit, which has a Hadamard gate (creates superposition), and a CNOT gate (creates entanglement), followed by a measure gate in each qubit. You can play with these quantum computing circuits and examples here.

To save some space, I am going to store it in a pseudo-QASM, together with the graphical representation of the qubit lines in one address per qubit.

1QASMHoCXo1M11MooQuantum313zvTc29
1xxxxHxxxxCXo1xxxxMxxxx31411bN1fQ
1xxxxxxxxxCXo1xxxxMxxxx31412t2aNR
1Pi31415926535897932384626414M4MA
# Let's sign with PI! Elegant, right?
[Link to the Transaction on the blockchain]

And how much it costs?

The long tweet I wrote to promote this post cost me $0.89, which is $0.4/characeter. Expensive? Maybe. Valuable? Yes!

[Link to the transaction in the blockchain]

Maybe pushing the fees to the limit I can do it cheaper, but there is a threshold where the Bitcoin blockchain doesn’t allow you to send, called Bitcoin dust, to not to over saturate the network.

⛓️ What would you record on the blockchain? ⛓️

I am thinking about something… maybe for the next post 😉

--

--

Robotics & Embedded AI at @NVIDIA | GenerativeAI Dev | Formerly at IBM Quantum | I love AI, XR, robotics, and specially humans! | Bio: asierarranz.com

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Asier Arranz

Robotics & Embedded AI at @NVIDIA | GenerativeAI Dev | Formerly at IBM Quantum | I love AI, XR, robotics, and specially humans! | Bio: asierarranz.com