cppcoin is an educational implementation of a cryptocurrency using C++. It is not meant to provide a reliable system to transfer value nor generating cryptographic keys for real life use cases.
- Simple to use menu using the command line
- Create ECC public and private keys
- Transfer money to and from local cppcoin addresses
- Transactions performed on the blockchain are saved in the host's machine
- Clone the repo:
git clone --recurse-submodules -j8 https://github.com/javierramoss/cppcoin.git
- cd into the cppcoin folder
- Remove line 11 from
./lib/hash-library/sha256.cpp
- Create a bin folder
- Compile using the command:
make
- Click on the executable
cppcoin.exe
or use the command:
cppcoin.exe
- Select option 1 to generate a new pair of public and private keys
- Use the keys to mine blocks or transfer cppcoins
The blockchain starts off by mining the genesis block and adding it to the ledger saved to blockchain.txt
. A block contains an id, nonce, previous block, time of creation, and transactions if any. Since it is the first block, no transfer transactions have been performed and the previous block is "0".
Address A mines a block for the first time, the block is immediately pushed to the blockchain but the reward coins will be pushed in the next mined block's transactions,
Address A mines another block, making the first 100 cppcoin reward for the first mined block available in their balance.
Address A transfers 50 cppcoins to Address B, then Address A mines another block so the transaction is pushed with this block. Now the 50 cppcoins transaction is contained in this block along with the 100 cppcoin reward from the second block mined.
Now Address A's balance is 150 cppcoins and Address B's is 50 cppcoins.
Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b NewBranch
) - Commit your Changes (
git commit -m 'Add x'
) - Push to the Branch (
git push origin NewBranch
) - Open a Pull Request
Distributed under the MIT License. See LICENSE
for more information.