You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Usage:
createwallet -----------------------------------> Create a new wallet
listaddresses ----------------------------------> List wallet addressses
createblockchain -address ADDRESS --------------> Create a blockchain and sends genesis reward to address
updateblockchain -------------------------------> Update blockchain via other nodes
printblockchain --------------------------------> Print the blocks in the blockchain
printlastblock ---------------------------------> Print last block
removelastblock --------------------------------> Remove last block from the blockchain
getbalance -address ADDRESS --------------------> Get the balance for an address
send -from FROM -to TO -amount AMOUNT -mine ----> Send amount of coins. Then -mine flag is set, mine off of this node
reindexutxo ------------------------------------> Rebuilds the UTXO set
startnode -miner ADDRESS -----------------------> Start a node with TxID specified in NODE_ID env. var. -miner enables mining
Create Wallet
Node 1
$ export NODE_ID=3000
$ go run main.go createwallet
New address is: 15uQXdzyY8Bki98UQgeXcLtXaDhW4szBjp
Node 2
$ export NODE_ID=4000
$ go run main.go createwallet
New address is: 14sLJH78gy27wSEaWDTHNrhUxLa3yXYVzS
Node 3
$ export NODE_ID=5000
$ go run main.go createwallet
New address is: 1NEnVj4RVVjjZjRqoXBBqoCV5BXneMo97S
Initialize Blockchain
Node 1
$ go run main.go createblockchain -address 14sLJH78gy27wSEaWDTHNrhUxLa3yXYVzS
$ go run main.go getbalance -address 14sLJH78gy27wSEaWDTHNrhUxLa3yXYVzS
Balance of 14sLJH78gy27wSEaWDTHNrhUxLa3yXYVzS: 20
Start Full Node and Miner Node
Node 1
$ go run main.go startnode
Node 3
$ go run main.go startnode -miner 1NEnVj4RVVjjZjRqoXBBqoCV5BXneMo97S
Send Funds
Node 2
$ go run main.go updateblockchain
$ go run main.go send -from 14sLJH78gy27wSEaWDTHNrhUxLa3yXYVzS -to 15uQXdzyY8Bki98UQgeXcLtXaDhW4szBjp -amount 5
Node 1 (Full Node)
Node 2 (Miner Node)
Get Final Balances
Node 2
$ go run main.go updateblockchain
$ go run main.go getbalance -address 14sLJH78gy27wSEaWDTHNrhUxLa3yXYVzS
$ go run main.go getbalance -address 1NEnVj4RVVjjZjRqoXBBqoCV5BXneMo97S
$ go run main.go getbalance -address 15uQXdzyY8Bki98UQgeXcLtXaDhW4szBjp
Balance of 14sLJH78gy27wSEaWDTHNrhUxLa3yXYVzS: 15
Balance of 1NEnVj4RVVjjZjRqoXBBqoCV5BXneMo97S: 20 //Mining Reward
Balance of 15uQXdzyY8Bki98UQgeXcLtXaDhW4szBjp: 5