Skip to content

wang0618/blockchain_go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Blockchain in Go

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 

Usage

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 区块生成间隔

Screenshot

Screenshot

About

A simplified blockchain implementation with a UI in Golang

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 5