GithubHelp home page GithubHelp logo

tomarron / platon-go Goto Github PK

View Code? Open in Web Editor NEW

This project forked from platonnetwork/platon-go

0.0 0.0 0.0 186.85 MB

Golang implementation of the PlatON protocol

License: GNU Lesser General Public License v3.0

Dockerfile 0.02% Makefile 0.11% Go 73.53% Shell 0.09% NSIS 0.19% Ruby 0.01% Python 11.30% HTML 0.10% JavaScript 3.48% Solidity 0.12% Assembly 0.39% C 5.36% C++ 4.76% M4 0.22% Java 0.25% Rust 0.04% CMake 0.01% WebAssembly 0.03% QMake 0.01%

platon-go's Introduction

Go PlatON

Welcome to the PlatON-Go source code repository! This is an Ethereum-based、high-performance and high-security implementation of the PlatON protocol. Most of peculiarities according the PlatON's whitepaper has been developed.

Build Status

Building the source

The requirements to build PlatON-Go are:

  • OS:Windows10/Ubuntu18.04
  • Golang :version 1.11+
  • cmake :version 3.0+
  • g++&gcc :version 7.4.0+

The 'cmake' and 'gcc&g++' are usually included in Ubuntu18.04

In addition, the following libraries needs to be installed manually

sudo apt install libgmp-dev libssl-dev

Then, clone the repository

git clone https://github.com/PlatONnetwork/PlatON-Go.git --recursive

Switch to the PlatON-Go repository root directory.

Ubuntu:

make all

Windows:

go run build\ci.go install 

The resulting binary will be placed in '$PlatON-Go/build/bin'(Ubuntu) or in '%GOPATH%\bin'(Windows) .

Getting Started

The project comes with several executables found in the build/bin directory.

Command Description
platon Our main PlatON CLI client. It is the entry point into the PlatON network
keytool a key related tool.

Generate the keys

Each node requires two pairs of public&private keys, the one is called node's keypair, it's generated based on the secp256k1 curve for marking the node identity and signning the block, and the other is called node's blskeypair, it's based on the BLS_12_381 curve and is used for consensus verifing. These two pairs of public-private key need to be generated by the keytool tool.

Switch to the directory where contains 'keytool.exe'(Windows) or 'keytool'(Ubuntu). Node's keypair(Ubuntu for example):

keytool genkeypair
Address   :  0xA9051ACCa5d9a7592056D07659f3F607923173ad
PrivateKey:  1abd1200759d4693f4510fbcf7d5caad743b11b5886dc229da6c0747061fca36
PublicKey :  8917c748513c23db46d23f531cc083d2f6001b4cc2396eb8412d73a3e4450ffc5f5235757abf9873de469498d8cf45f5bb42c215da79d59940e17fcb22dfc127

Node's blskeypair::

keytool genblskeypair
PrivateKey:  7747ec6876bbf8ca0934f05e45917b4213afc5814639355868bbf06d0b3e0f19
PublicKey :  e5eb9915ed2b5fd52cf5ff760873a75a8562956e176968f3cbe5ea2b22e03a7b5efc07fdd5ad66d433b404cb880b560bed6295fa79f8fa649588be02231de2e70a782751dc28dbf516b7bb5d52053b5cdf985d8961a5baafa467e8dda55fe981

Note: The PublicKey generated by the 'genkeypair' command is the NodeID we needed, the PrivateKey is the corresponding node private key, and the PublicKey generated by the 'genblskeypair' command is the node BLS PublicKey, used in the staking and consensus process, PrivateKey is the Node BLS PrivateKey, these two keypairs are common in different operating systems, that is, the public and private keys generated in Windows above, can be used in Ubuntu.

store the two private keys in files:

mkdir -p ./data
touch ./data/nodekey 
echo "{your-nodekey}" > ./data/nodekey
touch ./data/blskey
echo "{your-blskey}" > ./data/blskey

Generate a wallet

platon --datadir ./data account new
Your new account is locked with a password. Please give a password. Do not forget this password.
Passphrase:
Repeat passphrase:
Address: {566c274db7ac6d38da2b075b4ae41f4a5c481d21}

Do remember the password

Connect to the PlatON network

Options description
--identity Custom node name
--datadir Data directory for the databases and keystore
--rpcaddr HTTP-RPC server listening interface (default: "localhost")
--rpcport HTTP-RPC server listening port (default: 6789)
--rpcapi API's offered over the HTTP-RPC interface
--rpc Enable the HTTP-RPC server
--nodiscover Disables the peer discovery mechanism (manual peer addition)
--nodekey P2P node key file
--cbft.blskey BLS key file

Run the following command to launch a PlatON node connecting to the PlatON's mainnet:

$ ./platon --identity "platon" --datadir ./data --port {your-p2p-port} --rpcaddr 127.0.0.1 --rpcport {your-rpc-port} --rpcapi "db,platon,net,web3,admin,personal" --rpc --nodiscover --nodekey ./data/nodekey --cbft.blskey ./data/blskey

OK, it seems that the chain is running correctly, we can check it as follow:

platon attach http://127.0.0.1:6789
Welcome to the PlatON JavaScript console!

instance: PlatONnetwork/platon/v0.7.3-unstable/linux-amd64/go1.10.4
at block: 26 (Wed, 15 Dec 51802 20:22:44 CST)
 datadir: /home/jht/node1/data
 modules: admin:1.0 debug:1.0 net:1.0 personal:1.0 platon:1.0 rpc:1.0 web3:1.0

> platon.blockNumber
29

For more information, please visit our Docs.

Contributing to PlatON-Go

All of codes for PlatON-Go are open source and contributing are very welcome! Before beginning, please take a look at our contributing guidelines. You can also open an issue by clicking here.

Support

If you have any questions or suggestions please contact us at [email protected].

License

The PlatON-Go library (i.e. all code outside of the cmd directory) is licensed under the GNU Lesser General Public License v3.0, also included in our repository in the COPYING.LESSER file.

The PlatON-Go 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.

platon-go's People

Contributors

arachnid avatar awake006 avatar benbaley avatar bglmmz avatar cheng762 avatar chinese-wu avatar cjentzsch avatar davidromy avatar debris avatar fjl avatar gavinxu520 avatar gavofyork avatar gluk256 avatar holiman avatar karalabe avatar mokeychan avatar mowind avatar niuxiaojie81 avatar nonsense avatar obscuren avatar raventrov avatar rjl493456442 avatar simonhsj avatar tgerring avatar tracebundy avatar vbuterin avatar weiloy avatar zelig avatar zjsunzone avatar zsfelfoldi avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.