I did not get in on Bitcoin when it was getting started. I thought it had some interesting libertarian principles, but I was skeptical of all computer software and determined that it was only one software flaw or mathematical proof away from being rendered completely worthless. Lets face it, entire empires have fallen due to misplaced faith in their cryptographic capabilities. Bitcoin was just too risky.
With the collapse of another crypto-currency exchange, and the release of Andy Greeenberg’s new book Tracers in the Dark: The Global Hunt for the Crime Lords of Cryptocurrency, I decided it was worth spending a few hours and AWS credits to check out this blockchain all the crypto-bros are raving about.
What is Bitcoin?
Bitcoin is mathematically created scarcity with a shared-belief of value. Basically, you program a bunch of computers, to do a bunch of math, and when one of them finds a special number, that becomes a coin and the computer who found it can add that coin to its wallet and is rich.
In practice, groups pool their computing resource (and from all those IAM Keys you commit to GitHub), into syndicates and when one member of the syndicate finds the next coin, all the members share in the bounty based on how many compute cycles they donated or stole.
In theory, bitcoin are kept in wallets, which I’m going to hand-wave and say are private-keys for the blockchain. I’ll discuss wallets more below.
All of this math uses a lot of electricity and generates a lot of heat, so it’s not the most environmentally friendly thing out there.
What is the Blockchain?
This is where it gets a bit more interesting for nerds who aren’t into drugs, murder, or human trafficking. The Blockchain is a cryptographicly signed distributed ledger of all the transactions that ever occurred. It consists of a bunch of transactions, pooled into a block. That block is then signed with data from the previous block. Thus each new block is authenticated by the previous one forming a chain.
As of this writing there are about 764520 blocks on the chain dating back to when the Moses of Crypto, Satoshi Nakamoto, came down from the crypto-mountain and created the genesis block (9-Jan-2009). Yes, my biblical references are all messed up. Moses was Exodus, blah, blah.
According to this website, the blockchain is now about 436GB in size. As it turned out, it was closer to 474.3GB comprised of 11768 files.
How do I download the Blockchain?
Is there an S3 Bucket somewhere?
Nope - to download the entire blockchain, one must join the distributed ledger and pull each block in and verify it against the previous block. To do that myself, I spun up a c6g.xlarge and an EFS filesystem. I installed what I think is the original software Bitcoin Core running it as a full node. When you first start bitcoind, it must download the entire ledger. This took about four days, but I wasn’t sure I did the best job of optimization.
This was the status after about 12 hours. I think the verification started taking more time per block and progress slowed.
ubuntu@bitcoin-core-dev1:~$ /efs/bitcoin/bitcoin-23.0/bin/bitcoin-cli -getinfo Chain: main Blocks: 504255 Headers: 762887 Verification progress: ▒▒▒▒▒▒▒▒░░░░░░░░░░░░░ 37.5867% Difficulty: 2227847638503.628 Network: in 0, out 10, total 10 Version: 230000 Time offset (s): -2 Proxies: n/a Min tx relay fee rate (BTC/kvB): 0.00001000 Warnings:
Meanwhile the EFS is starting to fill up.
ubuntu@bitcoin-core-dev1:~$ df -h /efs/ Filesystem Size Used Avail Use% Mounted on fs-xxxxx.efs.eu-central-1.amazonaws.com:/ 8.0E 160G 8.0E 1% /efs
Once the blockchain finally finished downloading, I copied it all off the EFS into an S3 bucket.
How do I read the Blockchain
So I’ve got half a terabyte of crap costing me $65/mo sitting on EFS. What can I do with that?
The primary purpose of download the blockchain is so you can add things to it by sending bitcoin to other addresses.
However, creative nerds have managed to do other things. Someone base64 encoded a picture of Nelson Mandela and used the ASCII output to sent a series of small transactions to those non-existent addresses. When a bitcoin is mined, the miner can add a message. The first coin apparently has some snark relating to the Bank of England during the 2008 Financial Crisis. The website BitcoinStrings has a bunch of extractions.
At first I thought it might be interesting to search for other things in the block chain. However SDKs for directly reading the files don’t seem to be actively maintained. Maybe someday I’ll come back here and mess around with them, but the links I’ve found on this topic are:
- Breakdown of the block structure
- Commands for interacting with Bitcoin core
If you’re so inclined, I took the entire blockchain as of 2022-November-19 and copied it into the public S3 bucket
pht-blockchain. This S3 Bucket is configured as Requester Pays and is located in eu-central-1. I considered the irony of putting the data in eu-central-2 (Zurich), but being an opt-in region, any account looking to access the data would also need to opt-in to the Zurich region and that seems like too much work.
Warning at 474GB and with a 1¢ Infrequent Access fee and a 9¢ egress charge, it would cost you about $48 to download the entire blockchain.
Pipin: “What about second warning?"
Second Warning: don’t use that blockchain for your own transactions. You have no idea if I tampered with it. If you plan to move BTC, download and verify the entire blockchain from scratch. I put that S3 Bucket out there for anyone who wants to mess around with the data and doesn’t want to wait 4 days for it to download and verify.
How do Wallets work?
According to the WSJ, 20% of Bitcoin are lost and permanently inaccessible. There are 7,500 Bitcoin sitting in a landfill somewhere. That’s $127M in today’s price, and nearly half a billion when bitcoin was at its peak. Oof.
Before, I described a wallet as a private key for the blockchain. That was an oversimplification based on my understanding at the time. In the Bitcoin Core software, a wallet is a collection of private keys for a number of unique bitcoin addresses.
In order to get some bitcoin I could move around, I went to Coinbase and opened an account. Why Coinbase? Well… First, it hasn’t yet gone out of business. Second, they were featured prominently in the Google Cloud Next 2022 Keynote, and I figured if Google was doing business with them they probably weren’t a front for the Russian Yakuza.
Opening an account with Coinbase required me to connect my bank account via something called Plaid (which I’d done previously to buy my Tesla), and then send them a copy of my driver’s license as part of US Know Your Customer (KYC) laws.
I then transferred $100 from my bank to Coinbase and got 0.00589985 BTC in exchange. Actually I sent $103, because they wanted a $3 transfer fee. However as a reward for my first transaction, they gave me 0.00030719 BTC (~$5). My $100 was frozen for 10 days (not sure why, probably to make sure I didn’t reverse the transaction or something), but I was able send about half of my reward BTC once my KYC paperwork was validated. You can check out that transaction here and see the balance of my test address
I now have 0.00617252 BTC. Likely not enough to commission a murder, but probably enough to buy drugs with. Alcohol and Shitposting are my drugs, so AlphaBay2.0 isn’t going to be getting any of my BTC. My goal here was to learn how this all works.
For various reasons, I’m highly skeptical of anyone managing my BTC private keys. As I told a friend when I did this, “I gave coinbase $103 from my bank account, and they own 0.00589951 BTC which they claim is mine”. To make these BTC mine I need to transfer them to a wallet I control. And once I do that, I need to do something with that wallet so if AWS nukes the EFS partition the wallet is stored on, I can recover the funds.
Creating a wallet in Bitcoin Core is pretty easy. Click on “File” and “Create Wallet”. I can give the wallet a name “jcf-wallet-2”, and then I can encrypt it. You have a number of options, which I’ve not seen clearly explained. This page has some info on what the Descriptor Wallet is.
I only checked the “Encrypt Wallet” option, because in this case Encryption is not worthless.
Ok, so I have my wallet, now what? I guess I should try and receive some “money”.
So now that I have a BTC Address (
bc1q0jzl25psn9dx9j2y9q64tpqmkc0r2rslhnk4lr), I can go to Coinbase and send it some BTC.
Looks like I paid a 69¢ transaction fee, and it will take 30m.
Over in my wallet, I pretty quickly see my transaction appear, but it’s not yet confirmed. In other words, someone’s computer has to solve my soduku puzzle and add it to the block chain.
As far as I know, the “Note” on the Coinbase side, and the “Label” and “Message” on the Wallet side are not part of the transaction and don’t show up in the Blockchain. If I’m wrong, I guess the DEA agents busting down my door will correct me.
How do I protect my wallet?
I recommend copying it into a public S3 Bucket. This way you have the protection of AWS’s 11 9s of durability, and if you lose the AKIA, you can still download it. For a small donation to the address above, I’ll create and host one for you.
There seems to be a lot of folks suggesting you do not use a paper wallet. It seems like paper wallets are generated by websites (I’m sure they’re secure and trustworthy, this is the bitcoin community), and not recommended. Others provide examples of water damaged QR codes and the like.
However, at some point I will die, and my bitcoin and AWS illiterate family will want to get access to the $25m in appreciated gains from my 0.00617252 BTC investment. I still think the best way to ensure I or they will have access is via a paper copy of the private key(s). Ok, so how do I do that?
chris@crypto:/efs/blockchain-data/wallets$ du -sh jcf-wallet-2/ 1.3M jcf-wallet-2/
I suppose I could Base64 encode this and print it out.
But really, I just need the private keys, right? So I’ll try this. It seems to work, I got back some strings.
I’ll just go add those to my will and all is good, right?
Haha. Nope. I’m a sysadmin. I know my backups are useless till they’re restored.
This post is getting long, and soon I’ve got to go have Turkey, so I’m going to end this post.
In my next edition of Bitcoin for old people, I’m gonna restore those private keys into a new wallet, then send some money from my Bitcoin Core wallet to a new address.
Oh, and 45 minutes after sending my money from Coinbase, my transaction still isn’t fully confirmed. I’ll let you know how long it took in the next post.
- While I was writing this article Tim Bray posted this story about AWS and Blockchain.
- Here is an except from the book I referenced above: Inside the Bitcoin Bust That Took Down the Web’s Biggest Child Abuse Site. Surprise, surprise, child abusers are dumb, and Bitcoin isn’t anonymous.