github.com/cheng762/PlatON-Go@v1.8.17-0.20190529111256-7deff2d7be26/README.md (about)

     1  ## Go PlatON
     2  
     3  Welcome to the PlatON source code repository! This software is Ethereum-based and it has changed some peculiarities according the PlatON's [whitepaper](https://www.platon.network/static/pdf/en/PlatON_A%20High-Efficiency%20Trustless%20Computing%20Network_Whitepaper_EN.pdf).
     4  
     5  [![Build Status](https://travis-ci.com/PlatONnetwork/PlatON-Go.svg?branch=master)](https://travis-ci.com/PlatONnetwork/PlatON-Go)
     6  
     7  ## Building the source
     8  
     9  For prerequisites and detailed build instructions please read the
    10  [Installation Instructions](https://platonnetwork.github.io/Docs/#/en-us/basics/[English]-Installation-Instructions)
    11  on the Docs.
    12  
    13  Building platon requires both a Go (version 1.7 or later) and a C compiler.
    14  You can install them using your favourite package manager.
    15  Once the dependencies are installed, run
    16  
    17      make platon
    18  
    19  or, to build the full suite of utilities:
    20  
    21      make all
    22  
    23  If you want to Building platon with MPC function, run
    24  
    25      make platon-with-mpc
    26  
    27  or:
    28  
    29      make all-with-mpc
    30  
    31  If you want to Building platon with VC function, run
    32  
    33      make platon-with-vc
    34  
    35  or:
    36  
    37      make all-with-vc
    38  
    39  ## Executables
    40  
    41  The project comes with several executables found in the `cmd` directory.
    42  
    43  | Command    | Description |
    44  |:----------:|-------------|
    45  | **`platon`** | Our main PlatON CLI client. It is the entry point into the PlatON network |
    46  | `ethkey`    | a key related tool. |
    47  
    48  ## Running a platon node
    49  
    50  ### Config the chain data
    51  
    52  first, you need to get an account:
    53  
    54  ```
    55  $ ./platon --datadir ./data account new
    56  Your new account is locked with a password. Please give a password. Do not forget this password.
    57  Passphrase:
    58  Repeat passphrase:
    59  Address: {566c274db7ac6d38da2b075b4ae41f4a5c481d21}
    60  ```
    61  
    62  second, generate a private node's key pair and save the PrivateKey as a file named 'nodekey' into the ./data
    63  
    64  ```
    65  $ ./ethkey genkeypair
    66  Address   :  0xA9051ACCa5d9a7592056D07659f3F607923173ad
    67  PrivateKey:  1abd1200759d4693f4510fbcf7d5caad743b11b5886dc229da6c0747061fca36
    68  PublicKey :  8917c748513c23db46d23f531cc083d2f6001b4cc2396eb8412d73a3e4450ffc5f5235757abf9873de469498d8cf45f5bb42c215da79d59940e17fcb22dfc127
    69  ```
    70  
    71  then, edit the following content and save it as json file, such as genesis.json:
    72  
    73  ```
    74  {
    75      "config": {
    76      "chainId": 300,
    77      "homesteadBlock": 1,
    78      "eip150Block": 2,
    79      "eip150Hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
    80      "eip155Block": 3,
    81      "eip158Block": 3,
    82      "byzantiumBlock": 4,
    83      "cbft": {
    84        "initialNodes": ["enode://8917c748513c23db46d23f531cc083d2f6001b4cc2396eb8412d73a3e4450ffc5f5235757abf9873de469498d8cf45f5bb42c215da79d59940e17fcb22dfc127@127.0.0.1:16789"]
    85        }
    86    },
    87    "nonce": "0x0",
    88    "timestamp": "0x5c074288",
    89    "extraData": "0x00",
    90    "gasLimit": "0x99947b760",
    91    "difficulty": "0x40000",
    92    "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
    93    "coinbase": "0x0000000000000000000000000000000000000000",
    94    "alloc": {
    95      "0x566c274db7ac6d38da2b075b4ae41f4a5c481d21": {
    96        "balance": "999000000000000000000"
    97      }
    98    },
    99    "number": "0x0",
   100    "gasUsed": "0x0",
   101    "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000"
   102  }
   103  ```
   104  
   105  at last, init the chain as follow:
   106  
   107  ```
   108  $ ./platon --datadir ./data init platon.json
   109  ```
   110  
   111  and it will output msg as:
   112  
   113  ```
   114  ...
   115  Successfully wrote genesis state
   116  ```
   117  
   118  so we can launch the node: 
   119  
   120  ```
   121  $ ./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
   122  ```
   123  
   124  ### Send a transaction
   125  
   126  ```
   127  > eth.sendTransaction({from:"0x566c274db7ac6d38da2b075b4ae41f4a5c481d21",to:"0x3dea985c48e82ce4023263dbb380fc5ce9de95fd",value:10,gas:88888,gasPrice:3333})
   128  "0xa8a79933511158c2513ae3378ba780bf9bda9a12e455a7c55045469a6b856c1b"
   129  ```
   130  
   131  Check the balance:
   132  
   133  ```
   134  > eth.getBalance("0x3dea985c48e82ce4023263dbb380fc5ce9de95fd")
   135  10
   136  ```
   137   
   138  OK, it seems that the chain is running correctly
   139  
   140  For more information, please visit our [Docs](https://platonnetwork.github.io/Docs/#/en-us/basics/[English]-Getting-Started).