Brief Summary
This article contains the assets for Edgecase Bitcoin Storage Toolset (EBST) version 2. See the Downloadable Assets section.
Capabilities:
- Designed for offline use
- Address generation
- Creation of signed transactions with multiple inputs and multiple outputs
- Can send bitcoin to nonstandard P2SH addresses
Contents
- Brief Summary
- Contents
- Summary
- Downloadable Assets
- Dependency Trees
Summary
Let "EBST" = Edgecase Bitcoin Storage Toolset.
EBST version 1 consists of the set of assets listed in the article Recipe for storing bitcoin on paper using a Raspberry Pi.
- Capabilities: Designed for offline use, address generation, creation of signed transactions, can use a non-standard P2SH address as its destination.
- Limitations: Transactions must have exactly one input and one output.
EBST version 2 is an expansion of version 1 that handles multiple inputs and multiple outputs.
This expansion was developed in these articles:
- Creating a Bitcoin transaction with two outputs
- Creating a Bitcoin transaction with two inputs
In this article, I have gathered together the set of assets that comprise EBST version 2. I've made some additional changes (e.g. removing default values, updating import statements, changing comments).
I've also made the adjustment described in Bitcoin transaction test set, in the Notes section, in the part "Adjustment to transaction_2.py".
I have tested EBST version 2 against:
- the addresses in Bitcoin address test set
- the transactions in Bitcoin transaction test set
- the transactions in Bitcoin nonstandard transaction test set
All tests were successful.
Downloadable Assets
Assets of this article:
List:
- convert_dice_rolls_to_hex_bytes_3.py
- create_nonstandard_transaction_3.py
- create_transaction_3.py
- generate_bitcoin_address_4.py
- nonstandard_bitcoin_functions_2.py
- nonstandard_transaction_3.py
- transaction_3.py
- create_nonstandard_transaction_3.py
- create_transaction_3.py
- generate_bitcoin_address_4.py
- nonstandard_bitcoin_functions_2.py
- nonstandard_transaction_3.py
- transaction_3.py
Asset: A script that converts dice roll results into bytes.
convert_dice_rolls_to_hex_bytes_3.py
Asset: A script that creates and signs a nonstandard Bitcoin transaction with one or more standard P2PKH inputs and one or more outputs. Outputs can be standard P2PKH outputs or nonstandard P2SH outputs.
create_nonstandard_transaction_3.py
Asset: A script that creates and signs a standard Bitcoin transaction with one or more inputs and one or more outputs.
create_transaction_3.py
Asset: A script that generates a standard Bitcoin address from a private key.
generate_bitcoin_address_4.py
Asset: A library of functions for handling nonstandard Bitcoin data types.
nonstandard_bitcoin_functions_2.py
Asset: A library of classes for nonstandard Bitcoin transactions.
nonstandard_transaction_3.py
Asset: A library of classes for standard Bitcoin transactions.
transaction_3.py
Assets of other articles:
List:
- bitcoin_functions_2.py
- bjorn_edstrom_ripemd160.py
- ecdsa-0.10.tar.gz
- pypy_sha256.py
- bjorn_edstrom_ripemd160.py
- ecdsa-0.10.tar.gz
- pypy_sha256.py
Asset: A library of functions for handling standard Bitcoin data types.
bitcoin_functions_2.py [paywalled]
Asset: An implementation of RIPEMD-160, written by Björn Edström.
bjorn_edstrom_ripemd160.py [paywalled]
Asset: A Python implementation of ECDSA cryptography, written by Peter Pearson.
ecdsa-0.10.tar.gz [paywalled]
Asset: A Python implementation of SHA256. Author unknown.
pypy_sha256.py [paywalled]
Dependency Trees
Address generation assets (standard addresses) dependency tree:
- convert_dice_rolls_to_hex_bytes_3.py
- generate_bitcoin_address_4.py
-- bitcoin_functions_2.py
--- bjorn_edstrom_ripemd160.py
--- ecdsa-0.10.tar.gz
--- pypy_sha256.py
- generate_bitcoin_address_4.py
-- bitcoin_functions_2.py
--- bjorn_edstrom_ripemd160.py
--- ecdsa-0.10.tar.gz
--- pypy_sha256.py
Transaction creation assets (standard transactions) dependency tree:
- create_transaction_3.py
-- bitcoin_functions_2.py
--- bjorn_edstrom_ripemd160.py
--- ecdsa-0.10.tar.gz
--- pypy_sha256.py
-- transaction_3.py
--- bitcoin_functions_2.py
[...]
--- ecdsa-0.10.tar.gz
-- bitcoin_functions_2.py
--- bjorn_edstrom_ripemd160.py
--- ecdsa-0.10.tar.gz
--- pypy_sha256.py
-- transaction_3.py
--- bitcoin_functions_2.py
[...]
--- ecdsa-0.10.tar.gz
Transaction creation assets (nonstandard transactions) dependency tree:
- create_nonstandard_transaction_3.py
-- bitcoin_functions_2.py
--- bjorn_edstrom_ripemd160.py
--- ecdsa-0.10.tar.gz
--- pypy_sha256.py
-- nonstandard_bitcoin_functions_2.py
--- bitcoin_functions_2.py
[...]
-- nonstandard_transaction_3.py
--- bitcoin_functions_2.py
[...]
--- ecdsa-0.10.tar.gz
--- nonstandard_bitcoin_functions_2.py
[...]
-- transaction_3.py
--- bitcoin_functions_2.py
[...]
--- ecdsa-0.10.tar.gz
-- bitcoin_functions_2.py
--- bjorn_edstrom_ripemd160.py
--- ecdsa-0.10.tar.gz
--- pypy_sha256.py
-- nonstandard_bitcoin_functions_2.py
--- bitcoin_functions_2.py
[...]
-- nonstandard_transaction_3.py
--- bitcoin_functions_2.py
[...]
--- ecdsa-0.10.tar.gz
--- nonstandard_bitcoin_functions_2.py
[...]
-- transaction_3.py
--- bitcoin_functions_2.py
[...]
--- ecdsa-0.10.tar.gz
Combined list of assets:
- bitcoin_functions_2.py
- bjorn_edstrom_ripemd160.py
- convert_dice_rolls_to_hex_bytes_3.py
- create_nonstandard_transaction_3.py
- create_transaction_3.py
- ecdsa-0.10.tar.gz
- generate_bitcoin_address_4.py
- nonstandard_bitcoin_functions_2.py
- nonstandard_transaction_3.py
- pypy_sha256.py
- transaction_3.py
- bjorn_edstrom_ripemd160.py
- convert_dice_rolls_to_hex_bytes_3.py
- create_nonstandard_transaction_3.py
- create_transaction_3.py
- ecdsa-0.10.tar.gz
- generate_bitcoin_address_4.py
- nonstandard_bitcoin_functions_2.py
- nonstandard_transaction_3.py
- pypy_sha256.py
- transaction_3.py
The asset create_nonstandard_transaction_3.py is missing a line containing:
Lines 57-58 are currently:
Instead, they should be:
In the file
- validate_hex_length_domain()
both contain this line:
which won't handle non-even numbers of hex bytes properly (it will round down).
However, the validate_hex() function, called first in both cases, uses this line:
to check the evenness, and this will catch an odd number of hex bytes and raise an error.
1) The function
Example: The value
This leads to a bug: The function
Example: The value
This bug will not raise an error during operation. If an input amount is incorrect, the resulting transaction will be invalid. However, an incorrect output amount could redirect a large amount of bitcoin from the change address to an external address.
A solution:
^ This can be added just after the "apart from the period, input can contain only digits." check in
2) The function
Example:
The minimum input amount is rounded to 6 decimal places. It should be
A solution: Replace
3) On reflection, the function
A solution: Replace the
This function is also used to validate the random values supplied to the
Note: In transaction_3.py, the