Blockchain implementation in Python for fun.
- Human readable JSON-based protocol
- In/out transactions & fast verification using UTXO
- Built-in miner
- P2P communication
- Syncing the block tree to new clients on connect
- RSA2048 keys and SHA256 hashes
$ python.py picoblockchain.py <listening port> <peer address:port> <peer address:port> ...
For example, to listen on port 44444 and connect to another peer on localhost port 44445, use:
$ python.py picoblockchain.py 44444 localhost:44445
This will automatically generate your address, start a miner and start a prompt where you can issue some commands:
send <amount> <address>
to sendamount
coins toaddress
address
to view your own addressbalance
to view your balancereorg
to perform a manual reorganization (recalculation of UTXO)quit
to stop the program
- twisted
- pycrypto
- simplejson
- Variable proof of work difficulty (difficulty is fixed now, so more nodes = more blocks)
- Spending coins from unverified transactions
- Disk persistance (quit the program = coins gone)
- Miner fees
- Much more
Try increasing the DIFFICULTY on top of the file. You need to do this for all nodes for them to be compatible.
Unverified coins do not show up on the balance. Wait for the next block.
Disk persistence is not implemented. Keys are kept in memory and are lost on a restart.
Mozilla Public License Version 2.0