Official golang implementation of the palletone protocol.
For prerequisites and detailed build instructions please read the Installation Instructions on the wiki.
Building gptn requires both a Go (version 1.7 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
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. |
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.
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:
$ gptn --config /path/to/your_config.toml console
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 officialweb3
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 withgptn attach
.
As an alternative to passing the numerous flags to the gptn
binary, you can also pass a configuration file via:
$ gptn --config /path/to/your_config.toml
To get an idea how the file should look like you can use the dumpconfig
subcommand to export your existing configuration:
$ gptn --your-favourite-flags dumpconfig
e.g. call it palletone.toml:
[Consensus]
Engine="solo"
[Log]
OutputPaths =["stdout","./log/all.log"]
ErrorOutputPaths= ["stderr","./log/error.log"]
LoggerLvl="info" # ("debug", "info", "warn","error", "dpanic", "panic", and "fatal")
Encoding="console" # console,json
Development =true
[Dag]
DbPath="./leveldb"
DbName="palletone.db"
[Ada]
Ada1="ada1_config"
Ada2="ada2_config"
[Node]
DataDir = "./data1"
KeyStoreDir="./data1/keystore"
IPCPath = "./data1/gptn.ipc"
HTTPPort = 8541
HTTPVirtualHosts = ["0.0.0.0"]
HTTPCors = ["*"]
[Ptn]
NetworkId = 3369
[P2P]
ListenAddr = "0.0.0.0:30301"
#BootstrapNodes = ["pnode://228f7e50031457d804ce6021f4a211721bacb9abba9585870efea55780bb744005a7f22e22938040684cdec32c748968f5dbe19822d4fbb44c6aaa69e7abdfee@127.0.0.1:30301"]
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.
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 my-genesis.json
by running this command:
$ gptn create-genesis-json path/to/my-genesis.json
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/my-genesis.json
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.
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.