This repository contains the golang code of a simple blockchain implementation.
This blockchain consists of three parts:
- A simple wallet that you can get address, scan utxos, sign transaction.
- A simple blockchain can sync block from other known nodes, mining new block, send transaction and broadcast to other node.
- A simple restful server you can query blocks and utxos from blockchain.
There are many part are not like real blockchain because it's just simple implementation, still insecure and incomplete. you can learn the basic operation of the blockchain through this project.
go build ./cmd/cli
./cli wallet create -walletname "alice"
./cli wallet create -walletname "bob"
./cli server start -nodeport 3000 -apiport 8080 -walletname "alice" -ismining=true
./cli server start -nodeport 3001 -apiport 8081 -walletname "bob" -ismining=true
./cli server miningblock --apiport 8080
./cli server sendtransaction --apiport 8080 --to "172wJyiJZxXWyBW7CYSVddsR5e7ZMxtja9" -amount 100000
threr are still have other blockchain command, you can find out by type ./cli server
.
./cli wallet create -walletname "alice"
./cli server start -nodeport 3000 -apiport 8080 -walletname "alice" -ismining=true
./cli server getblocks -apiport 8080
./cli server getblockhashes -apiport 8080
./cli server getblockheight -apiport 8080
./cli server getutxos -apiport 8080
./cli server getwalletaddress -apiport 8080
./cli server getwalletutxos -apiport 8080
./cli server getwalletbalance -apiport 8080
./cli server sendtransaction --apiport 8080 --to "172wJyiJZxXWyBW7CYSVddsR5e7ZMxtja9" -amount 100000
./cli server miningblock -apiport 8080