btcs

command module
v0.0.0-...-7abacdd Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 22, 2022 License: Unlicense Imports: 3 Imported by: 0

README

btcs

Simplified Bitcoin implementation, for educational purposes.

Features

  • Proof of work scheme: block rewards, halvings, difficulty adjustments and transaction fees
  • Peer-to-peer network simulation (based on Docker)
  • Unconfirmed transactions pool (mempool)
  • Transactions merkle tree structure
  • Blocks and UTXOs index storage
  • RPC API
  • Hierarchical deterministic wallet (BIP32)
  • Mnemonic phrases (BIP39)

Quickstart

# Start network
docker build -t btcs .
docker compose up

# Get an address from node2
# By default, all nodes have the account "satoshi" created
docker exec -it node2 sh
btcs wallet getnewaddress satoshi

# Log into the miner node and send coins to node2
docker exec -it node1 sh
btcs sendtx satoshi --to <node2 address> --amount <amount>

Usage

btcs

Chain parameters
  • Block rewards start at 50 BTC and are halved every 21 blocks.
  • The initial difficulty is set to 0x1e04ffff (~2^234), adjustments occur every 16 blocks.
  • The target time per block is 20 seconds.
Special thanks to

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
encoding
gob
Package gob provides the functions necessary for encoding and decoding Go structs using encoding/gob standard library package.
Package gob provides the functions necessary for encoding and decoding Go structs using encoding/gob standard library package.
rpc
tx
utxo
Package utxo implements operations related to unspent transaction outputs (UTXO), which allow us to check for the balance of every wallet of the network.
Package utxo implements operations related to unspent transaction outputs (UTXO), which allow us to check for the balance of every wallet of the network.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL