This is a simplified blockchain implementation in C++. It creates 1000 users and generates 10000 transactions. Each block contains 100 transactions.
After running the program, you will see blocks, users and transactions information in the results
directory.
See secp256k1 building.
make
./main
-
Transaction contains:
- sender's public key
- receiver's public key
- inputs
- outputs
- signature
-
Transaction signing and verification is implemented using secp256k1 library and my hashing algorith
- Block contains:
- previous block hash
- merkle root hash
- timestamp
- nonce
- version
- difficulty
- transactions
- Blockchain contains:
- chain of blocks
- transaction pool
- unspent transaction outputs
- User contains:
- name
- private key
- public key
- Block is mined using Proof of Work algorithm.
- Mining is implemented using my hashing algorith.
- Mining is multithreaded. Each thread tries to mine a block with a different nonce. The first thread that finds a valid block wins.
- Blockchain uses UTXO model.
- UTXO is implemented using std::unordered_map.
- UTXO is updated after each block is mined.