You need :
- Python 3
- the requests and sqlite3 package
- the PyCrypto library available at https://www.dlitz.net/software/pycrypto/
To launch master server, run the following command :
$ python3 master.py
To launch a relay server, run the following command :
$ python3 relay.py RELAY_NUMBER
To launch miner, run the following command :
$ python3 miner.py MINER_ADDRESS
To launch client, run the following command :
$ python3 client.py COMMAND
The following commands are available :
list
to list addresses with amount availablenew
to create new addresstransfer FROM_ADDRESS TO_ADDRESS AMOUNT
to transfer money
Network IP addresses can be setup within lib/network.py
. Requests are made in JSON format over HTTP. Here's the API description :
GET /blocks/PREVIOUS_HASH
get the block after previous_hash
Possible response code:
204: no block next
200: block returned
POST /blocks/
submit the new mined block
Possible response code:
400: bad JSON or bad block (can be too late)
200: block saved
GET /transactions/
get list of pending transactions
Possible response code:
200: transactions returned
POST /transactions/
submit a new transaction to be processed by the network
Possible response code:
400: bad JSON or bad transaction (can be too late)
200: block saved