A toy blockchain implementation in Go:
Base on Jeiwan/blockchain_go
转载自 liuchengxu/blockchain-tutorial
go get github.com/1746199054/blockchain_go
cd $GOPATH/github.com/1746199054/blockchain_go
go build
NODE_ID=3000 ./blockchain_go createwallet # You can use this command create many wallets
NODE_ID=3000 ./blockchain_go startnode -webui &
NODE_ID=3001 ./blockchain_go startnode -miner 168C3RJbprmpnxNry49ftjWGfFGQTNeDsU # to genesis transaction output address
Run ./blockchain_go
to get this help:
Usage:
createwallet - Generates a new key-pair and saves it into the wallet file
getbalance -address ADDRESS - Get balance of ADDRESS
listaddresses - Lists all addresses from the wallet file
printchain - Print all the blocks of the blockchain
reindexutxo - Rebuilds the UTXO set
send -from FROM -to TO -amount AMOUNT -mine - Send AMOUNT of coins from FROM address to TO. Mine on the same node, when -mine is set.
startnode -miner ADDRESS - Start a node with ID specified in NODE_ID env. var. -miner enables mining, var. -webui enables Web UI
creategenesisblock -delta SECOND - Create a genesis block which timestamp is now with given 区块生成间隔