Coder Social home page Coder Social logo

zhangrongjin / platon-go Goto Github PK

View Code? Open in Web Editor NEW

This project forked from platonnetwork/platon-go

0.0 1.0 0.0 129.03 MB

Golang implementation of the PlatON protocol

License: GNU Lesser General Public License v3.0

Dockerfile 0.03% Makefile 0.11% Go 87.81% Shell 0.20% NSIS 0.20% Ruby 0.01% Python 0.32% HTML 0.11% JavaScript 4.10% Solidity 0.12% Assembly 0.40% C 5.17% C++ 0.84% M4 0.22% Java 0.26% Rust 0.04% CMake 0.01% WebAssembly 0.03% CSS 0.01% Perl 0.01%

platon-go's Introduction

Go PlatON

Welcome to the PlatON source code repository! This software is Ethereum-based and it has changed some peculiarities according the PlatON's whitepaper.

Building the source

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

Building platon 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 platon

or, to build the full suite of utilities:

make all

If you want to Building platon with MPC function, run

make platon-with-mpc

or:

make all-with-mpc

If you want to Building platon with VC function, run

make platon-with-vc

or:

make all-with-vc

Executables

The project comes with several executables found in the cmd directory.

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

Running a platon node

Config the chain data

first, you need to get an account:

$ ./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}

second, generate a private node's key pair and save the PrivateKey as a file named 'nodekey' into the ./data

$ ./ethkey genkeypair
Address   :  0xA9051ACCa5d9a7592056D07659f3F607923173ad
PrivateKey:  1abd1200759d4693f4510fbcf7d5caad743b11b5886dc229da6c0747061fca36
PublicKey :  8917c748513c23db46d23f531cc083d2f6001b4cc2396eb8412d73a3e4450ffc5f5235757abf9873de469498d8cf45f5bb42c215da79d59940e17fcb22dfc127

then, edit the following content and save it as json file, such as genesis.json:

{
    "config": {
    "chainId": 300,
    "homesteadBlock": 1,
    "eip150Block": 2,
    "eip150Hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "eip155Block": 3,
    "eip158Block": 3,
    "byzantiumBlock": 4,
    "cbft": {
      "initialNodes": ["enode://8917c748513c23db46d23f531cc083d2f6001b4cc2396eb8412d73a3e4450ffc5f5235757abf9873de469498d8cf45f5bb42c215da79d59940e17fcb22dfc127@127.0.0.1:16789"]
      }
  },
  "nonce": "0x0",
  "timestamp": "0x5c074288",
  "extraData": "0x00",
  "gasLimit": "0x99947b760",
  "difficulty": "0x40000",
  "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
  "coinbase": "0x0000000000000000000000000000000000000000",
  "alloc": {
    "0x566c274db7ac6d38da2b075b4ae41f4a5c481d21": {
      "balance": "999000000000000000000"
    }
  },
  "number": "0x0",
  "gasUsed": "0x0",
  "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000"
}

at last, init the chain as follow:

$ ./platon --datadir ./data init platon.json

and it will output msg as:

...
Successfully wrote genesis state

so we can launch the node:

$ ./platon --identity "platon" --datadir ./data --nodekey ./data/platon/nodekey --rpcaddr 0.0.0.0 --rpcport 6789 --rpcapi "db,eth,net,web3,admin,personal" --rpc --nodiscover

Send a transaction

> eth.sendTransaction({from:"0x566c274db7ac6d38da2b075b4ae41f4a5c481d21",to:"0x3dea985c48e82ce4023263dbb380fc5ce9de95fd",value:10,gas:88888,gasPrice:3333})
"0xa8a79933511158c2513ae3378ba780bf9bda9a12e455a7c55045469a6b856c1b"

Check the balance:

> eth.getBalance("0x3dea985c48e82ce4023263dbb380fc5ce9de95fd")
10

OK, it seems that the chain is running correctly

For more information, please visit our Docs.

platon-go's People

Contributors

obscuren avatar karalabe avatar fjl avatar tgerring avatar zelig avatar cjentzsch avatar debris avatar zsfelfoldi avatar holiman avatar rjl493456442 avatar gavofyork avatar nonsense avatar gluk256 avatar arachnid avatar vbuterin avatar cubedro avatar gballet avatar janos avatar kielbarry avatar jsvisa avatar raventrov avatar egonelbre avatar acud avatar lmars avatar benbaley avatar ethers avatar jimenezrick avatar ligi avatar ebuchman avatar winsvega avatar

Watchers

James Cloos 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.