go-pbfcoin

module
v0.0.0-...-3d231e9 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2020 License: GPL-3.0

README

pbfcoin Go

Go-pbfcoin was modified based on Go-Ethereum. Official Golang implementation of the pbfcoin protocol.

      | Linux   | OSX | ARM | Windows | Tests

----------|---------|-----|-----|---------|------ develop | (http://www.paybf.com/) master | (http://www.paybf.com/)

Automated development builds

The following builds are build automatically by our build servers after each push to the develop branch.

Building the source

For prerequisites and detailed build instructions please read the Installation Instructions on the wiki.

Building gpbf requires two external dependencies, Go and GMP. You can install them using your favourite package manager. Once the dependencies are installed, run

make gpbf

Executables

Go pbfcoin comes with several wrappers/executables found in the cmd directory:

Command
gpbf pbfcoin CLI (pbfcoin command line interface client)
bootnode runs a bootstrap node for the Discovery Protocol
pbftest test tool which runs with the tests suite: /path/to/test.json > pbftest --test BlockTests --stdin.
evm is a generic pbfcoin Virtual Machine: evm -code 60ff60ff -gas 10000 -price 0 -dump. See -h for a detailed description.
disasm disassembles EVM code: `echo "6001"
rlpdump prints RLP structures
Defining the private genesis state

First, you'll need to create the genesis state of your networks, which all nodes need to be aware of and agree upon. This consists of a small JSON file (e.g. call it genesis.json):

{
  "config": {
    "chainId": <arbitrary positive integer>,
    "homesteadBlock": 0,
    "eip150Block": 0,
    "eip155Block": 0,
    "eip158Block": 0,
    "byzantiumBlock": 0,
    "constantinopleBlock": 0,
    "petersburgBlock": 0
  },
  "alloc": {},
  "coinbase": "0x0000000000000000000000000000000000000000",
  "difficulty": "0x20000",
  "extraData": "",
  "gasLimit": "0x2fefd8",
  "nonce": "0x0000000000000042",
  "mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000",
  "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
  "timestamp": "0x00"
}

The above fields should be fine for most purposes, although we'd recommend changing the nonce to some random value so you prevent unknown remote nodes from being able to connect to you. If you'd like to pre-fund some accounts for easier testing, create the accounts and populate the alloc field with their addresses.

"alloc": {
  "0x0000000000000000000000000000000000000001": {
    "balance": "111111111"
  },
  "0x0000000000000000000000000000000000000002": {
    "balance": "222222222"
  }
}

With the genesis state defined in the above JSON file, you'll need to initialize every gpbf node with it prior to starting it up to ensure all blockchain parameters are correctly set:

$ gpbf init path/to/genesis.json
Creating the rendezvous point

With all nodes that you want to run initialized to the desired genesis state, you'll need to start a bootstrap node that others can use to find each other in your network and/or over the internet. The clean way is to configure and run a dedicated bootnode:

$ bootnode --genkey=boot.key
$ bootnode --nodekey=boot.key

With the bootnode online, it will display an enode URL that other nodes can use to connect to it and exchange peer information. Make sure to replace the displayed IP address information (most probably [::]) with your externally accessible IP to get the actual enode URL.

Note: You could also use a full-fledged gpbf node as a bootnode, but it's the less recommended way.

Starting up your member nodes

With the bootnode operational and externally reachable (you can try telnet <ip> <port> to ensure it's indeed reachable), start every subsequent gpbf node pointed to the bootnode for peer discovery via the --bootnodes flag. It will probably also be desirable to keep the data directory of your private network separated, so do also specify a custom --datadir flag.

$ gpbf --datadir=path/to/custom/data/folder --bootnodes=<bootnode-enode-url-from-above>

Note: Since your network will be completely cut off from the main and test networks, you'll also need to configure a miner to process transactions and create new blocks for you.

Command line options

gpbf can be configured via command line options, environment variables and config files.

To get the options available:

gpbf help

For further details on options, see the wiki

Contribution

Contribution to PBFCoin is welcomed. Please commit on the develop branch instead of master when sending pull requests.

Directories

Path Synopsis
Godeps
Package implements a private key management facility.
Package implements a private key management facility.
abi
Package abi implements the pbfcoin ABI (Application Binary Interface).
Package abi implements the pbfcoin ABI (Application Binary Interface).
cmd
bootnode
bootnode runs a bootstrap node for the pbfcoin Discovery Protocol.
bootnode runs a bootstrap node for the pbfcoin Discovery Protocol.
disasm
disasm is a pretty-printer for EVM bytecode.
disasm is a pretty-printer for EVM bytecode.
evm
evm executes EVM code snippets.
evm executes EVM code snippets.
gpbf
gpbf is the official command-line client for pbfcoin.
gpbf is the official command-line client for pbfcoin.
pbftest
pbftest executes pbfcoin JSON tests.
pbftest executes pbfcoin JSON tests.
rlpdump
rlpdump is a pretty-printer for RLP data.
rlpdump is a pretty-printer for RLP data.
utils
Package utils contains internal helper functions for go-pbfcoin commands.
Package utils contains internal helper functions for go-pbfcoin commands.
Package common contains various helper functions.
Package common contains various helper functions.
compression
rle
Package rle implements the run-length encoding used for pbfcoin data.
Package rle implements the run-length encoding used for pbfcoin data.
core
state
Package state provides a caching layer atop the pbfcoin state trie.
Package state provides a caching layer atop the pbfcoin state trie.
types
Package types contains data types related to pbfcoin consensus.
Package types contains data types related to pbfcoin consensus.
vm
Package vm implements the pbfcoin Virtual Machine.
Package vm implements the pbfcoin Virtual Machine.
vm/runtime
Package runtime provides a basic execution model for executing EVM code.
Package runtime provides a basic execution model for executing EVM code.
sha3
Package sha3 implements the SHA3 hash algorithm (formerly called Keccak) chosen by NIST in 2012.
Package sha3 implements the SHA3 hash algorithm (formerly called Keccak) chosen by NIST in 2012.
Package event implements an event multiplexer.
Package event implements an event multiplexer.
filter
Package filter implements event filters.
Package filter implements event filters.
Package jsre provides execution environment for JavaScript.
Package jsre provides execution environment for JavaScript.
Package logger implements a multi-output leveled logger.
Package logger implements a multi-output leveled logger.
glog
Package glog implements logging analogous to the Google-internal C++ INFO/ERROR/V setup.
Package glog implements logging analogous to the Google-internal C++ INFO/ERROR/V setup.
Package metrics provides general system and process level metrics collection.
Package metrics provides general system and process level metrics collection.
Package miner implements pbfcoin block creation and mining.
Package miner implements pbfcoin block creation and mining.
p2p
Package p2p implements the pbfcoin p2p network protocols.
Package p2p implements the pbfcoin p2p network protocols.
discover
Package discover implements the Node Discovery Protocol.
Package discover implements the Node Discovery Protocol.
nat
Package nat provides access to common network port mapping protocols.
Package nat provides access to common network port mapping protocols.
pbf
Package pbf implements the pbfcoin protocol.
Package pbf implements the pbfcoin protocol.
downloader
Package downloader contains the manual full chain synchronisation.
Package downloader contains the manual full chain synchronisation.
filters
package filters implements an pbfcoin filtering system for block, transactions and log events.
package filters implements an pbfcoin filtering system for block, transactions and log events.
pow
ezp
rpc
Package rpc implements the pbfcoin JSON-RPC API.
Package rpc implements the pbfcoin JSON-RPC API.
api
useragent
package user agent provides frontends and agents which can interact with the user
package user agent provides frontends and agents which can interact with the user
Package tests implements execution of pbfcoin JSON tests.
Package tests implements execution of pbfcoin JSON tests.
Package trie implements Merkle Patricia Tries.
Package trie implements Merkle Patricia Tries.
Package whisper implements the Whisper PoC-1.
Package whisper implements the Whisper PoC-1.
Package xpbf is the interface to all pbfcoin functionality.
Package xpbf is the interface to all pbfcoin functionality.

Jump to

Keyboard shortcuts

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