Skip to content
Official Go implementation of PalletOne
Go HTML JavaScript RobotFramework Shell Python Other
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github contract console variable parameter Sep 11, 2018
adaptor add deployment shell and modify ContractAddress BtcHost tokenAmount t… Nov 27, 2018
bdd Add createaccount.sh in node dir Sep 16, 2019
build User local vendor code to build gptn Aug 7, 2019
cmd modify deploy.sh Aug 29, 2019
common add blacklist contract Sep 10, 2019
configure Fix meger conflict Sep 5, 2019
consensus
contracts Fix merge conflict Sep 16, 2019
core Fix UT Sep 10, 2019
dag Fix merge conflict Sep 16, 2019
examples add transferPtn Aug 21, 2019
images Modify build goimg shell Aug 29, 2019
internal wallet.getBalance2 split stable&unstable Sep 11, 2019
light wallet.getBalance2 split stable&unstable Sep 11, 2019
ptn merge blacklist feature Sep 12, 2019
ptnclient add ptn decodejsontx Sep 5, 2019
ptnjson wallet.getBalance2 split stable&unstable Sep 11, 2019
statistics modify get genesis hash before p2p start Aug 13, 2019
tokenengine add tokenengine mock file Aug 23, 2019
validator merge blacklist feature Sep 12, 2019
vendor update vendor code Aug 23, 2019
vm Add pull image with gptn version Sep 6, 2019
.drone.yml Enable lint in drone Sep 5, 2019
.gitignore User local vendor code to build gptn Aug 7, 2019
.golangci.yml Fix lint interfacer check. Aug 16, 2019
.travis.yml Modify deposit_test_cases Sep 16, 2019
AUTHORS update tx create and sign struct and function Sep 5, 2018
CODE_OF_CONDUCT.md fix bug no create tokenHolder in modifyjson.sh Jan 22, 2019
COPYING
Dockerfile update tx create and sign struct and function Sep 5, 2018
Dockerfile.alltools update tx create and sign struct and function Sep 5, 2018
LICENSE update tx create and sign struct and function Sep 5, 2018
Makefile make mainnet Aug 23, 2019
README.md Update README to go1.12 Jul 29, 2019
VERSION update tx create and sign struct and function Sep 5, 2018
appveyor.yml
bindatagen.sh fix bug no create tokenHolder in modifyjson.sh Jan 22, 2019
check_license.sh
gitpull.sh add more log for jury sign May 15, 2019
go.mod Fix UT errors. Sep 11, 2019
go.sum update vendor code Aug 23, 2019
gomockgen.sh
interfaces.go Fix more lint check errors. Aug 15, 2019
jurySec.sh Modify jurySec.sh Aug 2, 2019
protogogen.sh update proto files. Nov 9, 2018
update_vendor.sh Update vendor code bash script Aug 6, 2019

README.md

Go PalletOne

Official golang implementation of the palletone protocol.

Build Status Codacy Badge Coverage Status Build status Code Count.

version

Building the source

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

Building gptn requires both a Go (version 1.12 or later) and a C compiler. You can install them using your favourite package manager. set GO111MODULE:

export GO111MODULE=on

Once the dependencies are installed, run

make gptn

or, to build the full suite of utilities:

make all

but, to build the full suite of utilities in window,you should:

go get ./...
go get -u ./...
go build

Executables

The go-palletone project comes with several wrappers/executables found in the cmd directory.

Command Description
gptn Our main palletone CLI client. It is the entry point into the palletone network (main-, test- or private net), capable of running as a full node (default) archive node (retaining all historical state) or a light node (retrieving data live). It can be used by other processes as a gateway into the palletone network via JSON RPC endpoints exposed on top of HTTP, WebSocket and/or IPC transports. gptn --help and the CLI Wiki page for command line options.

Running gptn

Going through all the possible command line flags is out of scope here (please consult our CLI Wiki page), but we've enumerated a few common parameter combos to get you up to speed quickly on how you can run your own Gptn instance.

Full node on the main palletone network

By far the most common scenario is people wanting to simply interact with the palletone network: create accounts; transfer funds; deploy and interact with contracts. For this particular use-case the user doesn't care about years-old historical data, so we can fast-sync quickly to the current state of the network. To do so:

$ mkdir your_dir
$ gptn --datadir="your_dir" newgenesis path/to/your-genesis.json
$ gptn --datadir="your_dir" init path/to/your-genesis.json
$ gptn --datadir="your_dir" --configfile /path/to/your_config.toml

This command will:

  • Start gptn in fast sync mode (default, can be changed with the --syncmode flag), causing it to download more data in exchange for avoiding processing the entire history of the palletone network, which is very CPU intensive.
  • Start up Gptn's built-in interactive JavaScript console, (via the trailing console subcommand) through which you can invoke all official web3 methods as well as Gptn's own management APIs. This too is optional and if you leave it out you can always attach to an already running Gptn instance with gptn attach.

Configuration

As an alternative to passing the numerous flags to the gptn binary, you can also pass a configuration file via:

$ gptn --configfile /path/to/your_config.toml

To get a template configuration file you can use the dumpconfig subcommand to export current default configurations:

$ gptn dumpconfig /path/to/your_config.toml

Open the /path/to/your_config.toml file in your favorite text editor, and set the field values what you want to change, uncommenting them if necessary.

Operating a private network

Maintaining your own private network is more involved as a lot of configurations taken for granted in the official networks need to be manually set up.

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 JSON file (e.g. call it genesis.json):

You can create a JSON file for the genesis state of a new chain with an existing account or a newly created account named your-genesis.json by running this command:

$ gptn newgenesis path/to/your-genesis.json

Defining the private mediator parameters

First, you'll need to create the mediator parameters of your networks, which all nodes need to be aware of and agree upon. This consists of a TOML file (e.g. call it palletone.toml):

[MediatorPlugin]
EnableProducing = true
EnableStaleProduction = true
EnableConsecutiveProduction = false

[[MediatorPlugin.Mediators]]
Address = ""
Password = ""
InitPrivKey = ""
InitPubKey = ""

Get InitPrivKey and InitPubKey with the following command

$ gptn mediator initdks

InitPrivKey = private key, InitPubKey = public key

When running command gptn --datadir="your_dir" newgenesis will create Address and input your password.

Customization of the genesis file

If you want to customize the network’s genesis state, edit the newly created your-genesis.json file. This allows you to control things such as:

  • The initial values of chain parameters
  • Assets and their initial distribution

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

$ gptn init path/to/your-genesis.json

Contribution

Thank you for considering to help out with the source code! We welcome contributions from anyone on the internet, and are grateful for even the smallest of fixes!

If you'd like to contribute to go-palletone, please fork, fix, commit and send a pull request for the maintainers to review and merge into the main code base. If you wish to submit more complex changes though, please check up with the core devs first on our gitter channel to ensure those changes are in line with the general philosophy of the project and/or get some early feedback which can make both your efforts much lighter as well as our review and merge procedures quick and simple.

Please make sure your contributions adhere to our coding guidelines:

  • Code must adhere to the official Go formatting guidelines (i.e. uses gofmt).
  • Code must be documented adhering to the official Go commentary guidelines.
  • Pull requests need to be based on and opened against the master branch.
  • Commit messages should be prefixed with the package(s) they modify.
    • E.g. "ptn, rpc: make trace configs optional"

Please see the Developers' Guide for more details on configuring your environment, managing project dependencies and testing procedures.

License

The go-palletone binaries (i.e. all code inside of the cmd directory) is licensed under the GNU General Public License v3.0, also included in our repository in the COPYING file.

You can’t perform that action at this time.