Hritik Raj
Kushal
Supriyam Agarwal
Paidisetty Sai Aditya
Kochuri Akshay
/register
/users
/mine
/chain
/add/transaction
/list/transaction
CLone the repo using https-web-url
Run the app.py
Open post-man to run the following api calls to test:
http://127.0.0.1:5001/register
http://127.0.0.1:5001/add/transaction
http://127.0.0.1:5001/mine
http://127.0.0.1:5001/show/users
http://127.0.0.1:5001/chain
To register a node:
{
"M1" : {
"name" : " Manufacturer1" ,
"type" : " Manufacturer"
},
"d2" : {
"name" : " Distributor2" ,
"type" : " distributor" ,
"id" : " D2" ,
"property" : [" normal-chair" , " office-chair" ]
},
"c1" : {
"name" : " Client1" ,
"type" : " client" ,
"id" : " C1"
},
}
To add a new Transaction:
{
"sender" :" d1" ,
"client" :" c1" ,
"product" :" wood" ,
"amount" :20
}
Sample output of the blockchain:
{
"chain" : [
{
"index" : 1 ,
"merkle_root" : " 37896e033a0c55e240d34dc05257b5210e429f802787005fdfa511ba595ceff6" ,
"nonce" : 157 ,
"previous_hash" : " c642a5c0a8580fa12c8aef88bae18a6a7864bf02444ccaa4bf156f389a6c4ea9" ,
"timestamp" : 1713954595.334674 ,
"transactions" : []
},
{
"index" : 2 ,
"merkle_root" : " 65343264303538306163663239636235326537626566316262386634383237653039633661363437313439613566386539383032306130633261613830326535" ,
"nonce" : 46920 ,
"previous_hash" : " 54dfde8bcd61bcc8808426521346d604b99c62369f0225417b6926666fe6867e" ,
"timestamp" : 1713954607.363752 ,
"transactions" : [
{
"amount" : " 300" ,
"product" : " wood" ,
"receiver" : " c2" ,
"sender" : " d1"
}
]
},
{
"index" : 3 ,
"merkle_root" : null ,
"nonce" : 13587 ,
"previous_hash" : " 0000b5516a09443c2d2da3cc591460b825781dde5df424170d48fd2c0262cc9c" ,
"timestamp" : 1713954608.9361548 ,
"transactions" : []
}
],
"length" : 3
}