$25
Implementing BTC Blocks
I. Assignment
Implement Bitcoin blockchain data structure. This will be done in the following steps:
Define 6 users – requires creating elliptic curve (EC) public key pairs for six different users. Can be done either in a program using OpenSSL or in a program using OpenSSL libraries. Requires: understanding EC key generation and storage.
Create transactions for the 6 users. Since different types of transactions have different formats. You can use the general format given in [2]. Start initially with one user having all the coins, which are then transferred to other users and then traded between users. Requires: Understanding BTC transaction data structures, EC encryption, decryption and EC signatures.
Create a Merkle tree for the transactions. What a Merkle tree is and how to create one is covered in class. Requires: Hashing and DSA signatures.
Create genesis block.
Add set of five blocks to the genesis block
Provide within the program verification that each cryptographic primitive is being done correctly
Expected Environment
The preferred programming environment for this assignment is C. It may be possible to do the entire assignment in Python or another language, but that is not supported by the instructor. If you decide to use another language, then questions regarding calling of ssl primitives and programming will not be supported by the instructor. To do this assignment you will need:
· a C compiler (preferably GNU C in a Linux environment. Other programming languages are allowed, but you may have to tutor the instructor.)
· Debugger, like GDB, suggested,
· Open SSL (Used for calling cryptography primitives)
To compile with gcc
· gcc –g –o block block.c –lssl -lcrypto
To run either:
· ./block
· gdb ./block
· Emacs block.c
o $x gdb-many-windows
o $x gdb
o $x gdb-display-memory-buffer
o break main
o r
Reference
[1] Bitcoin Block. https://en.bitcoin.it/wiki/Block
[2] Bitcoin Transaction. https://en.bitcoin.it/wiki/Transaction
o s