Goal
Buy a Raspberry Pi and appropriate peripherals. Set it up, copy the Edgecase Bitcoin code toolset onto it, and test that it works.
Contents
- Goal
- Contents
- Brief Summary
- Summary
- Project Log
Brief Summary
I set up two Raspberry Pi computers as Bitcoin storage systems and tested them.
Summary
On ModMyPi, I bought:
- Raspberry Pi [Model B+] (x2)
- Power Supply [UK Plug 5.1V 2.5A with Switch] (x2)
- 8GB Micro SD [Class 10 Pre-Loaded with NOOBS] (x2)
- ModMyPi Modular RPi 2/3 Case [Black] (x2)
-- Add-on: Micro SD Card Cover (x2)
On Amazon, I bought:
- HDMI-male-to-VGA-female cable (x2)
-- Actual product name: [HDMI to VGA, Benfei Gold-Plated HDMI to VGA Adapter (Male to Female) for Computer, Desktop, Laptop, PC, Monitor, Projector, HDTV, Chromebook, Raspberry Pi, Roku, Xbox and More - Black]
- Logitech B100 Optical USB Ambidextrous Mouse for Windows, Mac and Linux [Black] (x2)
I bought two of each item, so as to have spares.
I already had:
- a screen available, with a VGA port.
- a VGA male-male connector cable.
- a screen power cable
- a USB keyboard
- 5 dice
- Bitcoin software (the Edgecase Bitcoin toolset)
- Pen and paper
On the first Raspberry Pi:
- I used the NOOBS installer system to install the included operating system Raspbian. (Takes about 35-40 minutes.)
- I checked the Python version (2.7.13).
- [On my workstation] I downloaded the various components of the Edgecase Bitcoin toolset. I followed the additional instructions in a preface and made several small edits to prevent the erroneous appending of the hash type to the final signed form of the transaction.
- I used a memory stick to transfer the Edgecase Bitcoin toolset to the Raspberry Pi, and to ferry information back and forth during the rest of this project.
- I also transferred a Bitcoin transaction test set to the Raspberry Pi and confirmed that the toolset produced identical results for two of the transactions. Transactions 3-5 in the test set have multiple inputs or outputs, which is not supported by version 1 of the Edgecase Bitcoin toolset.
- I generated a private key using dice and derived a Bitcoin address from it: the "test address".
- [On my workstation] I transferred a small amount of bitcoin from a work address to the test address. Waited for 6-block confirmation.
- [On my workstation] I gathered the pieces of information from the Bitcoin blockchain that were required to make a second transaction back out from the test address.
- I constructed and signed a second transaction that moved the bitcoin back from the test address to the work address. I moved the final signed transaction back to my workstation, broadcast it, and waited for 6-block confirmation.
On the second Raspberry Pi:
- I used the NOOBS installer system to install the included operating system Raspbian. (Takes about 35-40 minutes.)
- I transferred the Edgecase Bitcoin toolset to the Raspberry Pi.
- I confirmed that using the toolset to create the second transaction (using the same inputs) produced the same result (the final signed transaction) as on the first Raspberry Pi.
To store bitcoin using one of these Raspberry Pis, I would simply write down the private key of the test address on paper and store the paper carefully (i.e. 2 waterproof containers in different places, each holding 2 paper copies of the private key). I could choose to either delete it from the Raspberry Pi (and type it in again for each new transaction) or store the Raspberry Pi as carefully as the paper copies of the private key.
Notes:
- I formatted the USB memory stick as FAT.
- Now that the memory stick is going to be used for moving Bitcoin software onto offline Bitcoin storage machines, and transactions back to online broadcast machines, it should not be used for anything else ever again.
Total money spent (GBP):
102.17 + 20.45 = 122.62 UK pounds (£)
Total money spent (BTC):
0.00000558 * 2 = 0.00001116 bitcoin
Then-current exchange rates:
8,420.00 USB / 1 BTC
6597.70 GBP / 1 BTC
Project Log
My work machine:
System details:
- Name: Shovel
- Specifications: HP 6005 Pro SFF. 3 GHz x86_64 processor (AMD II x4 B95 Quad Core), 4 GB RAM, 1 TB hard drive. Running CentOS 7.6.1810 (Core).
- More information: New computer: Shovel
- Installed items: GCC 4.8.5, Make 3.82, Vim 7.4, Python 2.7.5, Python 3.3.2, Gnome 3.28.2, gedit 3.28.1, GPG 1.4.10.
Browse to:
edgecase.net/pages/how_to_store_bitcoin
Excerpt:
Equipment
You will need:
- Some dice (e.g. 5)
- An offline computer
- Bitcoin software
- Pen and paper
- Two sealed waterproof containers
Before setting up an offline computer, you can use an online computer to test this entire approach using a small amount of bitcoin.
The offline computer must have Python 2.7.x installed. The current code tools have been developed under Python 2.7.13 running on Mac OS X 10.6.8 (Snow Leopard), and should run successfully on other versions of Python 2.7.
Please visit the following page to see equipment combinations that Edgecase has successfully used to store bitcoin.
Equipment for storing bitcoin
Edgecase suggests that you use a Raspberry Pi Model B+ as your offline computer. It is small, portable, and does not have built-in WiFi.
Edgecase has published a recipe for using the Raspberry Pi Model B+ to store bitcoin.
Recipe for storing bitcoin on paper using a Raspberry Pi
Browse to:
Equipment for storing bitcoin
Excerpts:
Notes
You will need suitable peripherals for your offline computer. Ideally, these peripherals should be dedicated to the offline computer and never connected to an online computer. Edgecase suspects that it is or will become possible to attack the chips within computer peripherals.
[...]
Raspberry Pi Model B+
Details of the Raspberry Pi used by Edgecase:
- Model B+ V1.2 [circa 2014]. It has various ports, including 4 USB ports (which allows simultaneous use of a mouse, a keyboard, and a flash drive) and an HDMI port. It does not have an onboard WiFi chip.
- Peripherals: An 8GB micro SD card with an installed operating system, a Raspberry Pi power cable, a screen with a DVI port, a screen power cable, a DVI male-male connector cable, a DVI female to HDMI male converter, a USB keyboard, a USB mouse, and a plastic case customised for the Raspberry Pi Model B+.
- The installed operating system is Raspbian GNU/Linux 7 (wheezy) and the Linux kernel version is 4.1.13+. Tools: nano 2.2.6, Python 2.7.3.
- The default credentials are username = "pi" and password = "raspberry".
Edgecase suggests that you purchase an 8GB micro SD card that already has NOOBS preinstalled. NOOBS is an operating system installer that allows you to select from a number of operating systems for Raspberry Pi. Edgecase recommends the Raspbian operating system (a variant of Debian customised for the Raspberry Pi). According to the documentation, Raspbian is the only operating system that is actually fully contained within NOOBS (a network connection is required in order to install any of the other systems). The default login should be "pi" and the default password should be "raspberry".
If the Raspberry Pi OS does not have Python 2.7.x installed already, you can connect the Raspberry Pi to the Internet, download and install Python 2.7.x, and then disconnect it permanently.
I already have:
- a screen available, with a VGA port.
- a VGA male-male connector cable.
- a screen power cable
- a USB keyboard
I also have:
- 5 dice
- Bitcoin software (the Edgecase toolset)
- Pen and paper
So: Equipment-to-buy list:
- a Raspberry Pi Model B+ V1.2
- an 8GB micro SD card with NOOBS preinstalled
- a Raspberry Pi power cable (UK plug)
- a plastic case customised for the Raspberry Pi Model B+
- a VGA female to HDMI male converter
- a USB mouse
I'll buy two of each item, so as to have a set of spares. I'll set up and test both units.
Browse to:
www.modmypi.com
Choose "Raspberry Pi".
I can see various "Raspberry Pi 3" and a few "Raspberry Pi 2" items. Perhaps the original Raspberry Pi B+ is no longer sold.
Unfortunately, reading the descriptions, I see that the Model 3 (A+, B, B+ variants) includes built-in WiFi.
Ah. The Raspberry Pi 2 (Model B V1.2) does not include built-in WiFi. I can see from the picture that it has 4 USB ports (allowing simultaneous use of a mouse, a keyboard, and a flash drive) and an HDMI port.
Link:
www.modmypi.com/raspberry-pi/raspberry-pi-a-plusb-plus23-1015/raspberry-pi-2-model-b-new
Excerpts:
Back-Compatibility note: The Raspberry Pi 2 Model B has the same footprint and layout as the previous Model B+ version, so will fit all Model B+ items.
[...]
Identical board layout and footprint as the Model B+, so all cases and 3rd party add-on boards designed for the Model B+ will be fully compatible.
[...]
Technical Specification:
- Broadcom BCM2836 ARMv7 Quad Core Processor powered Single Board Computer running at 900MHz
- 1GB RAM
- 40pin extended GPIO
- 4 x USB ports
- 4 pole Stereo output and Composite video port
- Full size HDMI
- CSI camera port for connecting the Raspberry Pi camera
- DSI display port for connecting the Raspberry Pi touch screen display
- Micro SD port for loading your operating system and storing data
- Micro USB power source
Log in to ModMyPi. (I already have an account.)
Add 2x [Raspberry Pi 2 - Model B (V1.2)] to Shopping Bag.
Ah. I was mistaken. Looking further down in the original search page, I see that the Raspberry Pi Model B+ is still available.
Link:
www.modmypi.com/raspberry-pi/raspberry-pi-a-plusb-plus23-1015/raspberry-pi-model-b-plus-new
Excerpts:
The new Model B+ also requires a 5V 2A or greater power supply for best results [...]
Case Fitment Note - The Raspberry Pi Model B+ Features a completely revised layout. Model B cases WILL NOT FIT. Please ensure that any case purchase is for a Model B+ Case.
[...]
The Raspberry Pi Model B+ Features:
- Model B+ Raspberry Pi with Mounting Points and 512MB RAM
- Broadcom BCM2835 ARM11 700Mhz
- Integrated Videocore 4 Graphics GPU capable of playing Full 1080p HD Video
- 4 x USB Ports (Max Output 1.2A)
- Board Power Draw: 600mA
- HDMI Video Output
- 4 Pole Stereo & Composite Video Output
- 10/100Mb Ethernet Port for Internet Access
- 5V 2A Micro USB Power Input Jack
- MicroSD Flash Memory Card Slot
- 40-pin 2.54mm Header Expansion Slot (Which allow for peripherals and expansion boards)
- Dimensions 85 x 56 x 17mm
In one of the accompanying pictures, I can see this text on the Raspberry Pi board "Raspberry Pi Model B+ V1.2".
Remove 2x [Raspberry Pi 2 - Model B (V1.2)] from Shopping Bag.
Add 2x [Raspberry Pi - Model B+] to Shopping Bag.
From the left-hand navigation menu, choose Raspberry Pi / Accessories / Power Supplies.
I'll choose:
Power Supply - UK Plug 5.1V 2.5A with Switch
Link:
www.modmypi.com/raspberry-pi/power-1051/power-supplies-1088/power-supply-uk-plug-5v-2a
Excerpts:
This 5.1V 2.5A power supply (UK Pin) with switch is perfectly suited for use with the Raspberry Pi 3 and all previous models. Tested on multiple Pi's under different loads and conditions, this quality charger delivers a stable voltage to the Pi of 4.95 to 5.15V, which sits nicely withinin the stable range that the Raspberry Pi requires. This charger is the perfect low cost solution to make sure that your Pi doesn't suffer from low power cut-outs, which many low quality chargers can cause.
We've added an in-line on/off rocker switch so you can now hard power your Pi on or off with ease!
[...]
Features:
- In-line on/off rocker switch
- Tested for Compatibility with all revisions of Raspberry Pi (including Zero)
- Input: 100-240V
- Ripple Voltage ~ 100mV
- This Compact, energy efficient USB charger has a high 5.1V @ 2.5A output.
- Uses 25% less power compared to standard chargers. Please note a lot of chargers do not meet safety standards!
- CE approved, and conforms to British Standards.
- Materials used to manufacture this charger is environmentally friendly. This charger conforms to RoHs material standards.
- Suitable for charging ebooks, ipods, iphones, PSP's, PDA's, digital cameras and mobile phones.
- Cable Length 1.8m (Pi to Switch ~ 0.2m, Switch to Wall ~1.6m)
- Blue LED Power Light
Note. This Raspberry Pi charger features a UK type plug socket.
On the right-hand "Compatible With:" list, "Raspberry Pi - Model B+" is included.
Add 2x [Power Supply - UK Plug 5.1V 2.5A with Switch] to Shopping Bag.
From the left-hand navigation menu, choose Raspberry Pi / SD Cards and Adaptors / Pre-loaded SD Cards.
Choose:
8GB Micro SD - Class 10 Pre-Loaded with NOOBS
On the right-hand "Compatible With:" list, "Raspberry Pi - Model B+" is included.
From the picture, it appears that this item comes with an optional microSD-normalSD adaptor.
Add 2x [8GB Micro SD - Class 10 Pre-Loaded with NOOBS] to Shopping Bag.
From the left-hand navigation menu, choose Raspberry Pi / Cases / Raspberry Pi B+,2, 3 & 3B+ Cases.
Choose:
ModMyPi Modular RPi 2/3 Case (Black)
On the right-hand "Compatible With:" list, "Raspberry Pi - Model B+" is included.
The description includes a list of Modular Add-On options.
Two of these options are:
- Micro SD Card Cover
- USB & HDMI Security Cover
Each option has a linked page.
In the linked pages, I see:
The Micro SD card cover is a tamperproof, clip fit part and can only be removed by taking the top off the case first. It's designed to protect the Micro SD card from accidental knocks and bangs, in addition to securing the card from theft and unwanted removal.
The USB/HDMI security cover is a dual-use shroud that can be utilised to protect access to all the external inputs and outputs. Two covers can be used simultaneously if only very limited access is required, and "punch-out" access hatches are available for both the Ethernet and Micro USB power port if these inputs are required. Security covers are tamperproof and can only be removed from inside the case.
In addition to protecting the Raspberry Pi ports, the shroud is offset from the body by 12mm.
Choose both these options. Choose 2x USB & HDMI Security Cover, because one is used for the side with the USB ports and one is used for the side with the HDMI port.
In the right-hand menu "Available Options", these are called:
- SD Card Cover
- USB/LAN/HDMI Shroud
Add 2x [ModMyPi Modular RPi 2/3 Case (Black)] to Shopping Bag.
From the left-hand navigation menu, choose Raspberry Pi / Accessories / Video (HDMI/DVI/VGA).
Can't see an HDMI-VGA converter.
New browser tab. Browse to amazon.co.uk. Search for "vga hdmi converter". Yup, they're available.
Log in to amazon.co.uk. (I already have an account.)
Add a 2-pack of
{
HDMI to VGA, Benfei Gold-Plated HDMI to VGA Adapter (Male to Female) for Computer, Desktop, Laptop, PC, Monitor, Projector, HDTV, Chromebook, Raspberry Pi, Roku, Xbox and More - Black
}
to Shopping Basket.
Last item: 2x USB mouse.
I'll search on Amazon for Logitech B100.
Found and added 2x
{
Logitech B100 Optical USB Ambidextrous Mouse for Windows, Mac and Linux - Black
}
to Shopping Basket.
That's everything.
Make the two purchases.
- Datetime: 2019-05-14 16:17
I'm in the UK.
- ModMyPi says that its delivery will come on 2019-05-16 (2 days)
- Amazon.co.uk says that its delivery will come within 3-5 business days.
Here is some of the order information, including the prices. All prices are in UK pounds (£).
ModMyPi:
1) Raspberry Pi - Model B+
Model: MMP-0318
Quantity: 2
Price: 28.99
Total: 57.98
2) Power Supply - UK Plug 5.1V 2.5A with Switch
Model: MMP-0019
Quantity: 2
Price: 6.50
Total: 13.01
3) 8GB Micro SD - Class 10 Pre-Loaded with NOOBS
Model: MMP-1282
Quantity: 2
Price: 6.00
Total: 12.00
4) ModMyPi Modular RPi 2/3 Case (Black)
- Add SD Card Cover?: Yes **RB-SDBLK**
- Add USB/LAN/HDMI Shroud?: Yes - Qty. 2 **RB-US..
- Add Spacer Plate?: No
- Spacer Screw Set: No
Model: RB-BLACK
Quantity: 2
Price: 9.59
Total: 19.18
Sub-Total: 85.14
Standard Tracked **Royal Mail 48 Tracked** (2 Day): 0.00
UK VAT (20%): 17.03
Total: 102.17
[Note: The "Model" values here are presumably the ModMyPi internal "model" values. I.e. "MMP" = "ModMyPi".]
Amazon.co.uk:
1) 2 of Logitech B100 Optical USB Ambidextrous Mouse for Windows, Mac and Linux - Black
Price: 4.73
2) HDMI to VGA 2 Pack, Benfei Gold-Plated HDMI to VGA Adapter (Male to Female) for Computer, Desktop, Laptop, PC, Monitor, Projector, HDTV, Chromebook, R
Price: 10.99
Item(s) Subtotal: 17.04
Postage & Packing: 3.74
Total Before VAT: 20.78
VAT: 4.16
Total: 24.94
Promotion Applied: -4.49
Grand Total: 20.45
date is now: 2019-05-19
modmypi delivery arrived on 2019-05-17.
amazon delivery arrived on 2019-05-19.
All components present.
Total money spent:
102.17 + 20.45 = 122.62 UK pounds (£)
[I'm coming back to this project now on 2019-10-12 after a long delay]
Ok. All equipment still present.
Choose 1 Raspberry Pi.
Place the Raspberry Pi in its case. Careful - it has to be maneuvered into place in a particular way.
The normal-SD adaptor is unnecessary. The Raspberry Pi accepts a micro SD card directly. Insert the micro SD card.
Clip on the SD card cover.
I won't use the shroud. There's no punch-out option for access to the HDMI port and the USB ports.
Insert the HDMI-to-VGA adaptor. Connect to the VGA port of an external monitor.
Plug in a USB keyboard (which I already had) and the USB mouse.
Power on the Raspberry Pi.
It boots up.
NOOBS menu is displayed.
Choose between:
- Raspbian (Recommended) "A port of Debian Stretch for the Raspberry Pi (full desktop version)"
- LibreELEC_RPi "LibreELEC is a fast and user-friendly Kodi Entertainment Center distribution"
Choose Raspbian and click the Install button.
Pop-up warning that installing this OS will overwrite the data on the drive. Click Yes.
Installation takes about 30-45 minutes (didn't time this very accurately).
Pop-up: OS installed successfully. Click OK.
OS starts. lots of scrolling terminal text.
Desktop loads.
Pop-up: Welcome, "a few things to set up". Click Next.
- Location details. Click Next.
- Change password. I'll keep it as 'raspberry' for now. Click Next.
- Check for updates. Click Skip.
- Setup complete. Click Done.
Open a terminal.
pi@raspberrypi:~ $ python --version
Python 2.7.13
Next: Download the Edgecase Bitcoin toolset and transfer it to the Raspberry Pi.
Browse to:
Recipe for storing bitcoin on paper using a Raspberry Pi
Follow the recipe.
On Shovel, create a "work" directory. Create a "toolset" directory within it.
Go to the Downloadable Assets section and download all the listed assets. Save them in the toolset directory.
Above the article, there is this preface:
I have discovered errors in these two assets:
- nonstandard_transaction.py
- transaction.py
The hash type (4-byte version) is erroneously appended to the final signed form of the transaction.
To resolve the issue, delete these lines:
- nonstandard_transaction.py: [Line 237, line 269]
- transaction.py: [Line 289, line 312]
For further details, see the Bitcoin Transaction Toolset Hash Type Problem section of the following article:
Creating a Bitcoin transaction with two outputs
~ StJohn Piano
Open the files nonstandard_transaction.py and transaction.py and delete the specified lines. In each file, delete the lines in reverse order (i.e. delete later lines first).
Choose a USB memory stick. Now that it is going to be used for moving Bitcoin software onto offline Bitcoin storage machines, and transactions back to online broadcast machines, it should not be used for anything else ever again.
Format the USB memory stick as FAT. [I have not recorded this step]
Copy the toolset directory onto the memory stick.
Plug the memory stick into the Raspberry Pi.
Pop-up: Removable medium is inserted. Click OK. A new file browser is opened.
Copy the toolset directory onto the Desktop.
Create a new directory "archive". Copy the toolset directory into it, to preserve a authoritative copy.
Extract ecdsa directory from ecdsa-0.10.tar.gz file.
Slight detour here from the recipe:
Download the article
Bitcoin transaction test set
and transfer it to the Raspberry Pi.
Create a new "work" directory on the Raspberry Pi, and store the article file in it.
Go through each transaction, set the inputs in create_transaction.py to be the inputs recorded in the article, run the script, and confirm that the output matches the recorded output.
Transactions 1 & 2 tested. All fine.
Transaction 3 has two outputs, which is not supported by this toolset, so I can't test this one. Later articles include development work on the toolset to handle multiple inputs and outputs.
Transaction 4 also has two outputs. Transaction 5 has two inputs. Can't test them.
End of detour.
Back to recipe. Next step: 17.
pi@raspberrypi:~/Desktop/toolset $ python convert_dice_rolls_to_hex_bytes_2.py
### START CONVERSION OF DICE ROLLS TO HEX BYTES
- number of dice rolls: 215
- number of dice rolls in the list [1234]: 131
- there is one extra base4 dice roll that can't be used for conversion to base16.
- number of hex characters after conversion: 65
- there is one extra hex character that can't be used to form an entire 8-bit byte.
- number of hex bytes: 32
- desired number of hex bytes: 32
- the hex bytes produced are sufficient.
- hex byte output:
dd23f217012efd9ac3dec71d0c2b42212a58bff75d9e97af900403cf5657bad3
- hex byte output shortened to the desired length (32 bytes):
dd23f217012efd9ac3dec71d0c2b42212a58bff75d9e97af900403cf5657bad3
- remaining hex bytes:
[None]
Result: Desired amount of entropy (32 bytes) has been produced.
Entropy (32 bytes):
dd23f217012efd9ac3dec71d0c2b42212a58bff75d9e97af900403cf5657bad3
### END CONVERSION OF DICE ROLLS TO HEX BYTES
pi@raspberrypi:~/Desktop/toolset $ python generate_bitcoin_address_3.py
### START GENERATION OF BITCOIN ADDRESS
Private key (hex bytes): dd23f217012efd9ac3dec71d0c2b42212a58bff75d9e97af900403cf5657bad3
Private key (32 hex bytes): dd23f217012efd9ac3dec71d0c2b42212a58bff75d9e97af900403cf5657bad3
Private key (WIF): 5KVgKK8ZxrT1D3HxooFT19JbciLuLSU6pW5BKw7xresM5yrnE3k
Bitcoin address: 15BLTZb6uQr24MrxqXJaPpRGz1tKrzq7iC
### END GENERATION OF BITCOIN ADDRESS
Result:
Test address:
Private key (32 hex bytes):
dd23f217012efd9ac3dec71d0c2b42212a58bff75d9e97af900403cf5657bad3
Bitcoin address:
15BLTZb6uQr24MrxqXJaPpRGz1tKrzq7iC
I used the memory stick to transfer this information back to my work machine.
Next: Transfer a small amount of bitcoin to the test address.
Browse to:
bitcoinfees.earn.com
relatively high fee rate (in satoshi / byte): 8
approximate size in bytes of a single-input single-output Bitcoin transaction: 225
approximate relatively high fee: 8 * 225 = 1800 satoshi
add some extra to have some room to manoeuvre: 2000 satoshi.
On my work machine, I've generated a bitcoin address, and transferred some bitcoin to it from an exchange account. I'll call it my "work address".
Work address:
1KYtin5SrnZTwKJyRCtjHvzpevjZaGjCg
Next: On my work machine, use the toolset to create a transaction that transfers this bitcoin to the test address. This corresponds to step 21 in the recipe.
Transaction:
---
destination address:
15BLTZb6uQr24MrxqXJaPpRGz1tKrzq7iC
0100000001ea86c442a1d8f92c7b00e73615682eb82183463f2b502ffe20464d23f189cdf2000000008b483045022100be62086b8f4d51d06ec1b39577b480316a24fe8d092a5ee1ee241090324f004702201241eeb60d5712890116eb005fb5b53ad6e34011d017e372f5993eceef813d7c014104b88bf3ca706224242521cd4762c96c095168dc37d173a6706d3637469f0e7d8011113b2bca93f19773d73c9a1a5265729e56912d138036cce9812fde1cf4620effffffff0172840100000000001976a9142dd4e7cb16d982f3420168462d175dda1af0bc4888ac00000000
---
Ok. Transaction has 6+ confirmations.
Note: Transaction fee = 0.00000558 BTC.
Next: Step 22. Send it back to the work address.
Current exchange rates:
8,420.00 USB / 1 BTC
6597.70 GBP / 1 BTC
txid:
dd616e2b18e41606e9990b19fa6adb21bb4eacb26c54c141d2b703d7571056a3
output index: 0
value: 99442 satoshi
output address:
1KYtin5SrnZTwKJyRCtjHvzpevjZaGjCg
fee_rate = 2.5 satoshi / byte
create_transaction.py
##### START CONTROLS | |
# Note: Hex characters in input variable values must be lowercase. | |
random_value = "706eaef9f357ad6f1ddd0536eaec027a2a218094db8db781601d9ad4e486c61b" | |
# random_value must be between 1 and 32 bytes. If random_value_type is "raw_bytes", then random_value must be between 1 and 32 ASCII characters. If random_value_type is "hex_bytes", then random_value must be an even number of hex characters and between 2 and 64 hex characters (1 byte is represented by 2 hex characters). | |
# Note: Every ECDSA signature (one for each input in a transaction) requires new random entropy. | |
# random_value_type options: ["raw_bytes", "hex_bytes"] | |
random_value_type = "hex_bytes" | |
input_data = { | |
"txid": "dd616e2b18e41606e9990b19fa6adb21bb4eacb26c54c141d2b703d7571056a3", | |
"previous_output_index": "0", | |
"private_key_hex": "dd23f217012efd9ac3dec71d0c2b42212a58bff75d9e97af900403cf5657bad3", | |
"satoshi_amount": "99442", | |
#"bitcoin_amount": "0.006", | |
} | |
output_data = { | |
"address": "1KYtin5SrnZTwKJyRCtjHvzpevjZaGjCg", | |
"satoshi_amount": "99442", | |
#"bitcoin_amount": "0.002", | |
} | |
# note: all inputs and outputs are assumed to be Pay-To-Public-Key-Hash (P2PKH). | |
change_address = "1KYtin5SrnZTwKJyRCtjHvzpevjZaGjCg" | |
# note: the fee will be subtracted from the amount that is being sent to the change address. | |
fee = "223" # satoshi | |
fee_rate = "2.5" # satoshi / byte | |
# fee_type options: ["fee", "fee_rate"] | |
fee_type = "fee_rate" | |
##### END CONTROLS |
pi@raspberrypi:~/Desktop/toolset $ python create_transaction.py
### START CREATION OF BITCOIN TRANSACTION
- Fee type: fee_rate
- Fee rate: 2.5 (satoshi / byte)
- Number of inputs (i.e. as-yet-unspent outputs): 1
- Number of outputs: 1
- Change address: 1KYtin5SrnZTwKJyRCtjHvzpevjZaGjCg
- Amount to be sent to the change address: 0.00099442
- Input addresses, with total-value-to-be-sent:
-- 15BLTZb6uQr24MrxqXJaPpRGz1tKrzq7iC: 0.00099442
- Output addresses, with total-value-to-be-received:
-- 1KYtin5SrnZTwKJyRCtjHvzpevjZaGjCg: 0.00099442
- Total value of all inputs: 0.00099442
- Total value of all outputs: 0.00099442
- Total value of all inputs exactly matches total value of all outputs.
- Estimated transaction size: 223 bytes
- Fee rate: 2.5 (satoshi / byte)
- Calculate 223 * 2.5 and round up to nearest satoshi.
- Final fee: 558 (satoshi)
- Final fee rate (using estimated transaction size): 2.5022 (satoshi per byte)
- Fee subtracted from amount to be sent to change address.
- New amount to be sent to change address: 98884 (satoshi)
Input 0:
Input (without signature):
- previous_output_hash: a3561057d703b7d241c1546cb2ac4ebb21db6afa190b99e90616e4182b6e61dd
- previous_output_index: 00000000
- sequence: ffffffff
- private_key_hex: dd23f217012efd9ac3dec71d0c2b42212a58bff75d9e97af900403cf5657bad3
- public_key_hex: 041cbd3a52ecb96d2e39cb7b85d1b6b3d671e348fbc767a756606fffa69ab6dd3719740c88c0c5893082c15ca9c71c0b17225f0930f3c2b891180372d70aed1cec
- script_length_scriptPubKey: 19
- scriptPubKey: 76a9142dd4e7cb16d982f3420168462d175dda1af0bc4888ac
- script_length: None
- scriptSig: None
- address: 15BLTZb6uQr24MrxqXJaPpRGz1tKrzq7iC
- previous_output_index_int: 0
- txid: dd616e2b18e41606e9990b19fa6adb21bb4eacb26c54c141d2b703d7571056a3
Output 0:
Output:
- value: 4482010000000000
- script_length: 19
- scriptPubKey: 76a91403821bf3afc86ee1590de7c879c3ea5434e6d51d88ac
- address: 1KYtin5SrnZTwKJyRCtjHvzpevjZaGjCg
- bitcoin_amount: 0.00098884
- satoshi_amount: 98884
- public_key_hash_hex: 03821bf3afc86ee1590de7c879c3ea5434e6d51d
Transaction (unsigned form):
- version: 01000000
- input_count: 01
- Input:
-- previous_output_hash: a3561057d703b7d241c1546cb2ac4ebb21db6afa190b99e90616e4182b6e61dd
-- previous_output_index: 00000000
-- script_length: None
-- scriptSig: None
-- sequence: ffffffff
- output_count: 01
- Output:
-- value: 4482010000000000
-- script_length: 19
-- scriptPubKey: 76a91403821bf3afc86ee1590de7c879c3ea5434e6d51d88ac
- block_lock_time: 00000000
Transaction (signable form):
- version: 01000000
- input_count: 01
- Input [to be used to sign this signable form]:
-- previous_output_hash: a3561057d703b7d241c1546cb2ac4ebb21db6afa190b99e90616e4182b6e61dd
-- previous_output_index: 00000000
-- script_length_scriptPubKey: 19
-- scriptPubKey: 76a9142dd4e7cb16d982f3420168462d175dda1af0bc4888ac
-- sequence: ffffffff
- output_count: 01
- Output:
-- value: 4482010000000000
-- script_length: 19
-- scriptPubKey: 76a91403821bf3afc86ee1590de7c879c3ea5434e6d51d88ac
- block_lock_time: 00000000
- hash_type_4_byte: 01000000
Transaction (signed form):
- version: 01000000
- input_count: 01
- Input:
-- previous_output_hash: a3561057d703b7d241c1546cb2ac4ebb21db6afa190b99e90616e4182b6e61dd
-- previous_output_index: 00000000
-- script_length: 8b
-- scriptSig: 483045022100c317199690d5bf20f90d6a6250f919f27a0767ac6d824451951eb1ff19595d1902205e337c880937833f2feb8887917974c3f96595ce7af000ad2938504bae4e3c540141041cbd3a52ecb96d2e39cb7b85d1b6b3d671e348fbc767a756606fffa69ab6dd3719740c88c0c5893082c15ca9c71c0b17225f0930f3c2b891180372d70aed1cec
-- sequence: ffffffff
- output_count: 01
- Output:
-- value: 4482010000000000
-- script_length: 19
-- scriptPubKey: 76a91403821bf3afc86ee1590de7c879c3ea5434e6d51d88ac
- block_lock_time: 00000000
Signed transaction:
0100000001a3561057d703b7d241c1546cb2ac4ebb21db6afa190b99e90616e4182b6e61dd000000008b483045022100c317199690d5bf20f90d6a6250f919f27a0767ac6d824451951eb1ff19595d1902205e337c880937833f2feb8887917974c3f96595ce7af000ad2938504bae4e3c540141041cbd3a52ecb96d2e39cb7b85d1b6b3d671e348fbc767a756606fffa69ab6dd3719740c88c0c5893082c15ca9c71c0b17225f0930f3c2b891180372d70aed1cecffffffff0144820100000000001976a91403821bf3afc86ee1590de7c879c3ea5434e6d51d88ac00000000
### END CREATION OF BITCOIN TRANSACTION
Next: Step 28: Broadcast and manage the transaction.
live.blockcypher.com/btc/tx/82b4f898b02a557de3f10efee491e3aaff6c461a335a21feec383df749967555
Confirmed.
Next: Step 35:
Set up and test the duplicate Raspberry Pi.
It's now in its case.
Turn it on and go through the installation process.
I'll reproduce the transaction I just made (step 25) that transferred the bitcoin from the test address back to the work address.
Installation has frozen at 0% ("Extracting filesystem"). Mouse won't move.
Unplug and replug power supply.
Go through installation process again.
It's quickly reached 2%. Not sure why it jammed.
Time taken to install: 35 minutes.
(timed it more carefully this time)
Transferred create_transaction.py (still with its previous settings, including the private key and random value) via dedicated memory stick to second Raspberry Pi. Ran it and confirmed that the signed transaction hex value was equal to the expected value.
To store bitcoin using one of these Raspberry Pis, I would simply write down the private key used during this project on paper and store the paper carefully (i.e. 2 waterproof containers in different places, each holding 2 paper copies of the private key). I could choose to either delete it from the Raspberry Pi (and type it in again for each use) or store the Raspberry Pi as carefully as I store the paper.
Excellent. That's the end of this project.
1KYtin5SrnZTwKJyRCtjHvzpevjZaGjCg
The work address still contains 0.00098884 bitcoin.
Unfortunately, I did not preserve the private key.