Skip to content
Official Go implementation of PalletOne
Branch: master
Clone or download
Latest commit 39b17cd Jul 18, 2019
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 Merge branch 'master' of https://github.com/palletone/go-palletone Jul 18, 2019
build ci go1.10 and go1.12 May 27, 2019
cmd modify console UT TestWelcome Jul 18, 2019
common Fix mediatorbdd bug Jul 18, 2019
configure Tuning validator performance. Jul 4, 2019
consensus add election node repeated filtering Jul 18, 2019
contracts test map contract Jul 18, 2019
core modify AddCorsPeer to private Jul 18, 2019
dag fixed dag.CurrentUnit Jul 18, 2019
examples/e2e_cli Update bash use Linux format Jun 28, 2019
images/gptn fix bug no create tokenHolder in modifyjson.sh Jan 22, 2019
internal Update wallet API Jul 18, 2019
light add deploy request tx extend data Jul 17, 2019
ptn add election node repeated filtering Jul 18, 2019
ptnclient dismiss client cmdcreatetx Jul 18, 2019
ptnjson Merge branch 'audit' Jul 18, 2019
statistics
tokenengine Update sign func for sign msg, not sign hash. Jul 5, 2019
validator merge master 75a6288 Jul 17, 2019
vendor move gmsm code from vendor to crypto folder Jul 4, 2019
vm Adjust the container startup process Jul 8, 2019
.gitignore Ignore sm2.ofile Jul 15, 2019
.travis.yml Add application bdd Jul 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 update tx create and sign struct and function Sep 5, 2018
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 Add make golang-baseimage-dev in Makefile May 8, 2019
README.md Start to refactor txpool May 28, 2019
VERSION update tx create and sign struct and function Sep 5, 2018
appveyor.yml Fix a ptn UT error May 29, 2019
bindatagen.sh fix bug no create tokenHolder in modifyjson.sh Jan 22, 2019
check_license.sh update tx create and sign struct and function Sep 5, 2018
gitpull.sh add more log for jury sign May 15, 2019
go.mod update adaptor version Jul 18, 2019
go.sum update adaptor version Jul 18, 2019
gomockgen.sh Update for go1.12 May 21, 2019
interfaces.go update tx create and sign struct and function Sep 5, 2018
protogogen.sh update proto files. Nov 9, 2018

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.10 or later) and a C compiler. You can install them using your favourite package manager. 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.