github.com/reapchain/go-reapchain@v0.2.15-0.20210609012950-9735c110c705/README.md (about) 1 # REAP CHAIN 2 3 ***[백서 참조](https://reapchain.com/file/en/YellowPaper_ver1.pdf)*** 4 5 REAP CHAIN intends to improve speed, stability, and security, all at the same time by employing consensus processes which consists of nodes selected by applying quantum random numbers from authorized nodes and general nodes to overcome disadvantages of consensus algorithms previously proposed in various blockchain platforms. 6 7 8 9 ## Contents 10 11 - [System Requirements](#System-Requirements) 12 - [H/W Specification](#H/W-Specification) 13 - [Storage Requirements](#Storage-Requirements) 14 - [Operaing System](#Operaing-System) 15 - [Installation Guide](#Installation-Guide) 16 - [Building the source](#Building-the-source) 17 - [Executables](#Executables) 18 - [Startup Endpoint Node](#Startup-Endpoint-Node) 19 - [Programmatically interfacing geth nodes](#Programmatically-interfacing-geth-nodes) 20 - [Account Management](#Account-Management) 21 - [Managing Accounts](#Managing-Accounts) 22 - [Examples](#Examples) 23 - [License](#License) 24 25 26 27 --- 28 29 30 31 ## System Requirements 32 33 For running an REAP CHAIN Endpoint Node requires following specifications. 34 35 ### H/W Specification 36 37 ##### Cloud VM 38 39 ###### Recommended Specification Based on Hanaro-Hosting 40 41 | vCPU | Memory(G) | Storage | Network Bandwidth(Gbps) | Basic Traffic(G) | Region | VM Total Price(Won/hour) | VM Total Price(Won/Month) | 42 | ---- | --------- | ------- | ------------------------ | ----------------- | ------ | ------------------------- | -------------------------- | 43 | 4 | 4 | 1,000 | 1 | 600 | Seoul | 129 | 93,120 | 44 45 The information above is from **Hanaro Hosting** and may be changed by **Hanaro Hosting**. 46 47 ##### Bare-metal Machine 48 49 ***[klaytn 내용 참조](https://docs.klaytn.com/node/endpoint-node/system-requirements#bare-metal-machine)*** 50 51 We do not specify the exact physical machine specification for EN, but any physical machine having hardware configuration similar to the one in the Cloud VM section would be sufficient to operate an EN. 52 53 54 55 ### Storage Requirements 56 57 ***[klaytn 내용 참조](https://docs.klaytn.com/node/endpoint-node/system-requirements#storage-requirements)*** 58 59 Assuming 100 TPS in average, 300 bytes average transaction size, and 1-second block latency, the expected EN daily storage requirement is 2.5 GB/day (=300x100x86400). 60 61 62 63 ### Operating System 64 65 Recommended environment is Ubuntu 18.04.4 LTS. REAP CHAIN binaries are fully tested on Ubuntu 18.04.4 LTS. macOS binaries are also provided for development purpose. 66 67 68 69 --- 70 71 72 73 ## Installation Guide 74 75 ### Building the source 76 77 ##### Linux/Unix 78 79 Clone the repository to a directory of your choosing: 80 81 ``` 82 git clone https://github.com/reapchain/go-reapchain.git 83 ``` 84 85 Install latest distribution of [Go](https://golang.org/) if you don't have it already. 86 87 Building `geth` requires Go and C compilers to be installed: 88 89 ``` 90 sudo apt-get install -y build-essential 91 ``` 92 93 Finally, build the `geth` program using the following command. 94 95 ``` 96 cd go-reapchain 97 make geth 98 ``` 99 100 You can now run `build/bin/geth` to start your node. 101 102 103 104 ##### macOS 105 106 Clone the repository to a directory of your choosing: 107 108 ``` 109 git clone https://github.com/reapchain/go-reapchain.git 110 ``` 111 112 Building `geth` requires the Go compiler: 113 114 ``` 115 brew install go 116 ``` 117 118 Finally, build the `geth` program using the following command. 119 120 ``` 121 cd go-reapchain 122 make geth 123 ``` 124 125 If you see some errors related to header files of Mac OS system library, install XCode Command Line Tools, and try again. 126 127 ``` 128 xcode-select --install 129 ``` 130 131 You can now run `build/bin/geth` to start your node. 132 133 134 135 ### Executables 136 137 | Command | Description | 138 | ---------- | ------------------------------------------------------------ | 139 | **`geth`** | It is the entry point into the REAP CHAIN network, 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 REAP CHAIN network via JSON RPC endpoints exposed on top of HTTP, WebSocket and/or IPC transports. `geth --help` for command line options. | 140 141 142 143 --- 144 145 146 147 ## Startup Endpoint Node 148 149 ### Overview 150 151 An Endpoint Node has the following roles and functions. 152 153 ***[참조 링크](https://docs.ethhub.io/using-ethereum/running-an-ethereum-node/)*** 154 155 ##### A full node: 156 157 - Stores the full blockchain data available on disk and can serve the network with any data on request. 158 159 - Receives new transactions and blocks while participating in block validation. 160 161 - Verifies all blocks and states. 162 163 - Stores recent state only for more efficient initial sync. 164 165 - All state can be derived from a full node. 166 167 - Once fully synced, stores all state moving forward. 168 169 170 171 ##### A light node: 172 173 - Stores the header chain and requests everything else on demand. 174 - Can verify the validity of the data against the state roots in the block headers. 175 176 Light nodes are useful for low capacity devices, such as embedded devices or mobile phones, which can't afford to store multiple dozen Gigabytes of blockchain data. 177 178 179 180 ### Quick Start for running Endpoint Node 181 182 Following information is about setting up a REAP CHAIN endpoint node. 183 184 ##### Endpoint Node directory tree example 185 186 ``` 187 ./node1 188 ├── genesis.json 189 ├── keystore 190 │ └── node1-account-keystore-file 191 └── qmanager-nodes.json 192 ``` 193 194 195 196 ##### create Endpoint Node directory 197 198 ``` 199 $ mkdir ./node1 200 ``` 201 202 203 204 ##### create account 205 206 ``` 207 $ geth account new --datadir ./node1 208 209 // type passphrase 210 Your new account is locked with a password. Please give a password. Do not forget this password. 211 Passphrase: 212 Repeat passphrase: 213 214 // return address 215 Address: {79180f870c1af86256b024add471f4ed301162d8} 216 ``` 217 218 219 220 ##### genesis.json 221 222 The genesis block is created using the **genesis state file** or `genesis.json` in Geth. This file contains all the data that will be needed to generate block 0, including who starts out with how much ether. 223 224 ###### create genesis.json file 225 226 ``` 227 $ touch ./node1/genesis.json 228 ``` 229 230 ###### REAP CHAIN Main-Network genesis configuration example 231 232 Here’s an example of a REAP CHAIN Main-Network genesis state file that initializes block. 233 234 ```json 235 { 236 "config": { 237 "chainId": 2017, 238 "homesteadBlock": 1, 239 "eip150Block": 2, 240 "eip150Hash": "0x0000000000000000000000000000000000000000000000000000000000000000", 241 "eip155Block": 3, 242 "eip158Block": 3, 243 "podc": { 244 "epoch": 30000, 245 "policy": 0 246 } 247 }, 248 "nonce": "0x0", 249 "timestamp": "0x5e574cb5", 250 "extraData": "0x0000000000000000000000000000000000000000000000000000000000000000f902bdf90276940585dbbaaeb850ccfec7c90401c24cc31f7a951694090577163d513cdda29106ccc8d71b80d6e0600e940d5d39f8fb9a2139c83af97e1a11749881e97462943305caef9d0195e4ea8f3022a00895543a2d4ca59433c5dfbf34e1b160acddf67375e70f209a65078a9438e62b655c2d767b9f7125d4974fcb5dee93f7c9943accaa82d076d88150365b501d30f996fcd3a49194431d8b17e7e1b766311b70ad336d4851b5b38f2d944c78d3c0441238da9c8ef1548b7e8aeb32b9244a94502775730802f92e7fc44d7ed1da59a5fa1feb0b9456c4e586290b62defeed5c43c8c4e642805fde9e946882edfcd3e95d337966cf1526e338a11a3df43d9477d5bd84fe34b6e716e8d9b8e613e964328442a5947a82f90f9e2e509afe2dd5e66a4781012d4da0e6947bfeaf9a75f1d2af11c3107285e01197ea9f1d239482ecf9e81c2c89751f660e34fc6a0616ba74d86f9484a9986497529a2e217ac021d319c565b16082cf9485b6a2054e660795233979c06601f745b9ac66109499ba3c8d4cc107c5633768c67687eb178aef9081949c7670c1773cd57688efb9bdd92587823df7df2e94a4d4ffaec1965b34360b7f1fdef96883b340cb1f94b007173a6b6c05f3bd3b24d297c6cd3a8423b72594b6761ff2c7e9f5f76d6669eb1b8e38ee9c91806094bf0117d537937e8384f23b5322709d7143436f5894c6119ee3d531a6a67f4c92e85368ec86c333759894cbcc554284c19dd0075b0114b7605732261428e594d11425f73fd6f15cbd9b28b7b90541f904fe27d694e7088f828f59f13f43fa68cbd447c1e99a9b379594e81f66e2a1f34af9cd62890aec815a7724dc031e94fd80e6ead0605d8c4df7b0cabd1c662b036e3292b8410000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c0", 251 "gasLimit": "0x9886E0", 252 "difficulty": "0x1", 253 "mixHash": "0x63746963616c2062797a616e74696e65206661756c7420746f6c6572616e6365", 254 "coinbase": "0x0000000000000000000000000000000000000000", 255 "alloc": { 256 "0585dbbaaeb850ccfec7c90401c24cc31f7a9516": { 257 "balance": "0x446c3b15f9926687d2c40534fdb564000000000000" 258 }, 259 "090577163d513cdda29106ccc8d71b80d6e0600e": { 260 "balance": "0x446c3b15f9926687d2c40534fdb564000000000000" 261 }, 262 "0d5d39f8fb9a2139c83af97e1a11749881e97462": { 263 "balance": "0x446c3b15f9926687d2c40534fdb564000000000000" 264 }, 265 "3305caef9d0195e4ea8f3022a00895543a2d4ca5": { 266 "balance": "0x446c3b15f9926687d2c40534fdb564000000000000" 267 }, 268 "33c5dfbf34e1b160acddf67375e70f209a65078a": { 269 "balance": "0x446c3b15f9926687d2c40534fdb564000000000000" 270 }, 271 "38e62b655c2d767b9f7125d4974fcb5dee93f7c9": { 272 "balance": "0x446c3b15f9926687d2c40534fdb564000000000000" 273 }, 274 "3accaa82d076d88150365b501d30f996fcd3a491": { 275 "balance": "0x446c3b15f9926687d2c40534fdb564000000000000" 276 }, 277 "431d8b17e7e1b766311b70ad336d4851b5b38f2d": { 278 "balance": "0x446c3b15f9926687d2c40534fdb564000000000000" 279 }, 280 "4c78d3c0441238da9c8ef1548b7e8aeb32b9244a": { 281 "balance": "0x446c3b15f9926687d2c40534fdb564000000000000" 282 }, 283 "502775730802f92e7fc44d7ed1da59a5fa1feb0b": { 284 "balance": "0x446c3b15f9926687d2c40534fdb564000000000000" 285 }, 286 "56c4e586290b62defeed5c43c8c4e642805fde9e": { 287 "balance": "0x446c3b15f9926687d2c40534fdb564000000000000" 288 }, 289 "6882edfcd3e95d337966cf1526e338a11a3df43d": { 290 "balance": "0x446c3b15f9926687d2c40534fdb564000000000000" 291 }, 292 "77d5bd84fe34b6e716e8d9b8e613e964328442a5": { 293 "balance": "0x446c3b15f9926687d2c40534fdb564000000000000" 294 }, 295 "7a82f90f9e2e509afe2dd5e66a4781012d4da0e6": { 296 "balance": "0x446c3b15f9926687d2c40534fdb564000000000000" 297 }, 298 "7bfeaf9a75f1d2af11c3107285e01197ea9f1d23": { 299 "balance": "0x446c3b15f9926687d2c40534fdb564000000000000" 300 }, 301 "82ecf9e81c2c89751f660e34fc6a0616ba74d86f": { 302 "balance": "0x446c3b15f9926687d2c40534fdb564000000000000" 303 }, 304 "84a9986497529a2e217ac021d319c565b16082cf": { 305 "balance": "0x446c3b15f9926687d2c40534fdb564000000000000" 306 }, 307 "85b6a2054e660795233979c06601f745b9ac6610": { 308 "balance": "0x446c3b15f9926687d2c40534fdb564000000000000" 309 }, 310 "99ba3c8d4cc107c5633768c67687eb178aef9081": { 311 "balance": "0x446c3b15f9926687d2c40534fdb564000000000000" 312 }, 313 "9c7670c1773cd57688efb9bdd92587823df7df2e": { 314 "balance": "0x446c3b15f9926687d2c40534fdb564000000000000" 315 }, 316 "a4d4ffaec1965b34360b7f1fdef96883b340cb1f": { 317 "balance": "0x446c3b15f9926687d2c40534fdb564000000000000" 318 }, 319 "b007173a6b6c05f3bd3b24d297c6cd3a8423b725": { 320 "balance": "0x446c3b15f9926687d2c40534fdb564000000000000" 321 }, 322 "b6761ff2c7e9f5f76d6669eb1b8e38ee9c918060": { 323 "balance": "0x446c3b15f9926687d2c40534fdb564000000000000" 324 }, 325 "bf0117d537937e8384f23b5322709d7143436f58": { 326 "balance": "0x446c3b15f9926687d2c40534fdb564000000000000" 327 }, 328 "c6119ee3d531a6a67f4c92e85368ec86c3337598": { 329 "balance": "0x446c3b15f9926687d2c40534fdb564000000000000" 330 }, 331 "cbcc554284c19dd0075b0114b7605732261428e5": { 332 "balance": "0x446c3b15f9926687d2c40534fdb564000000000000" 333 }, 334 "d11425f73fd6f15cbd9b28b7b90541f904fe27d6": { 335 "balance": "0x446c3b15f9926687d2c40534fdb564000000000000" 336 }, 337 "e7088f828f59f13f43fa68cbd447c1e99a9b3795": { 338 "balance": "0x446c3b15f9926687d2c40534fdb564000000000000" 339 }, 340 "e81f66e2a1f34af9cd62890aec815a7724dc031e": { 341 "balance": "0x446c3b15f9926687d2c40534fdb564000000000000" 342 }, 343 "fd80e6ead0605d8c4df7b0cabd1c662b036e3292": { 344 "balance": "0x446c3b15f9926687d2c40534fdb564000000000000" 345 } 346 }, 347 "number": "0x0", 348 "gasUsed": "0x0", 349 "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000" 350 } 351 ``` 352 353 354 355 ##### qmanager-nodes.json 356 357 ***[백서 참조](https://reapchain.com/file/en/YellowPaper_ver1.pdf)*** 358 359 REAP CHAIN introduces **Qmanager** that generates quantum random numbers that is more secure than pseudorandom numbers in order to implement security enhanced random selection. By using hardware generating quantum random numbers, Qmanager is basically safer than a system that use pseudorandom number generating software algorithms. Qmanager mainly creates and manages quantum random numbers, and manages node information provided by the governance while selecting candidates for steering committee and the coordinator. To make this following qmanager-nodes.json file is needed for REAP CHAIN Main-Network. 360 361 ###### create qmanager-nodes.json file 362 363 ``` 364 $ touch ./node1/qmanager-nodes.json 365 ``` 366 367 ###### REAP CHAIN Main-Network Qmanager configuration example 368 369 ```json 370 [ "enode://f09cb0d2104cf26555c39f47654eec233901b2f2066991bf5bc7c5e6ab44165a1a5db73721433c3820f002df45adb42b2d7a44c1ef310011b810df75a2bb9006@116.126.85.24:30501" 371 ] 372 ``` 373 374 375 376 ##### init geth with genesis.json 377 378 * ###### example 379 380 ``` 381 $ geth --datadir ./node1 init ./node1/genesis.json 382 ``` 383 384 385 386 ##### run geth node 387 388 Finally, you can run `geth` node via following example commands. It starts to listening REAP CHAIN Main-Network through `30303` port. Also you can manage your geth node via JSON-RPC API with `127.0.0.1` IP address and `8545` port. 389 390 - ###### example 391 392 ``` 393 $ geth --datadir ./node1 --networkid 2017 --port 30303 --nat any --rpc --rpcaddr 127.0.0.1 --rpcport 8545 --syncmode full --rpcapi "eth,net,web3,personal,miner,admin,debug" --ipcdisable 394 ``` 395 396 397 398 --- 399 400 401 402 ## Programmatically interfacing geth nodes 403 404 ***[Ethereum README 참조](https://github.com/ethereum/go-reapchain#programmatically-interfacing-geth-nodes)*** 405 406 As a developer, sooner rather than later you'll want to start interacting with `geth` and the REAP CHAIN network via your own programs and not manually through the console. To aid this, `geth` has built-in support for a JSON-RPC based APIs. These can be exposed via HTTP, WebSockets and IPC (UNIX sockets on UNIX based platforms, and named pipes on Windows). 407 408 The IPC interface is enabled by default and exposes all the APIs supported by `geth`, whereas the HTTP and WS interfaces need to manually be enabled and only expose a subset of APIs due to security reasons. These can be turned on/off and configured as you'd expect. 409 410 HTTP based JSON-RPC API options: 411 412 - `--rpc` Enable the HTTP-RPC server 413 - `--rpcaddr` HTTP-RPC server listening interface (default: `localhost`) 414 - `--rpcport` HTTP-RPC server listening port (default: `8545`) 415 - `--rpcapi` API's offered over the HTTP-RPC interface (default: `eth,net,web3`) 416 - `--rpccorsdomain` Comma separated list of domains from which to accept cross origin requests (browser enforced) 417 - `--ws` Enable the WS-RPC server 418 - `--wsaddr` WS-RPC server listening interface (default: `localhost`) 419 - `--wsport` WS-RPC server listening port (default: `8546`) 420 - `--wsapi` API's offered over the WS-RPC interface (default: `eth,net,web3`) 421 - `--wsorigins` Origins from which to accept websockets requests 422 - `--ipcdisable` Disable the IPC-RPC server 423 - `--ipcapi` API's offered over the IPC-RPC interface (default: `admin,debug,eth,miner,net,personal,shh,txpool,web3`) 424 - `--ipcpath` Filename for IPC socket/pipe within the datadir (explicit paths escape it) 425 426 You'll need to use your own programming environments' capabilities (libraries, tools, etc) to connect via HTTP, WS or IPC to a `geth` node configured with the above flags and you'll need to speak [JSON-RPC](https://www.jsonrpc.org/specification) on all transports. You can reuse the same connection for multiple requests! 427 428 429 430 --- 431 432 433 434 ## Account Management 435 436 ***[Ethereum Account Management 참조](https://github.com/ethereum/go-reapchain/wiki/Managing-your-accounts)*** 437 438 ### Managing Accounts 439 440 If you lose the password you use to encrypt your account, you will not be able to access that account. Repeat: It is NOT possible to access your account without a password and there is no *forgot my password* option here. Do not forget it. 441 442 The CLI `geth` provides account management via the `account` command: 443 444 ``` 445 $ geth account <command> [options...] [arguments...] 446 ``` 447 448 Manage accounts lets you create new accounts, list all existing accounts, import a private key into a new account, migrate to newest key format and change your password. 449 450 It supports interactive mode, when you are prompted for password as well as non-interactive mode where passwords are supplied via a given password file. Non-interactive mode is only meant for scripted use on test networks or known safe environments. 451 452 Make sure you remember the password you gave when creating a new account (with new, update or import). Without it you are not able to unlock your account. 453 454 Note that exporting your key in unencrypted format is NOT supported. 455 456 Keys are stored under `<DATADIR>/keystore`. Make sure you backup your keys regularly! See [Ethereum DATADIR backup & restore](https://github.com/ethereum/go-reapchain/wiki/Backup-&-restore) for more information. If a custom datadir and keystore option are given the keystore option takes preference over the datadir option. 457 458 The newest format of the keyfiles is: `UTC--<created_at UTC ISO8601>-<address hex>`. The order of accounts when listing, is lexicographic, but as a consequence of the timespamp format, it is actually order of creation 459 460 It is safe to transfer the entire directory or the individual keys therein between `geth`nodes. Note that in case you are adding keys to your node from a different node, the order of accounts may change. So make sure you do not rely or change the index in your scripts or code snippets. 461 462 And again. **DO NOT FORGET YOUR PASSWORD** 463 464 ``` 465 COMMANDS: 466 list Print summary of existing accounts 467 new Create a new account 468 update Update an existing account 469 import Import a private key into a new account 470 ``` 471 472 You can get info about subcommands by `geth account <command> --help`. 473 474 ``` 475 $ geth account list --help 476 list [command options] [arguments...] 477 478 Print a short summary of all accounts 479 480 OPTIONS: 481 --datadir "/home/bas/.reapchain" Data directory for the databases and keystore 482 --keystore Directory for the keystore (default = inside the datadir) 483 ``` 484 485 Accounts can also be managed via the [Ethereum Javascript Console](https://github.com/ethereum/go-reapchain/wiki/JavaScript-Console) 486 487 488 489 ### Examples 490 491 #### Interactive use 492 493 ##### creating an account 494 495 ``` 496 $ geth account new 497 Your new account is locked with a password. Please give a password. Do not forget this password. 498 Passphrase: 499 Repeat Passphrase: 500 Address: {168bc315a2ee09042d83d7c5811b533620531f67} 501 ``` 502 503 ##### Listing accounts in a custom keystore directory 504 505 ``` 506 $ geth account list --keystore /tmp/mykeystore/ 507 Account #0: {5afdd78bdacb56ab1dad28741ea2a0e47fe41331} keystore:///tmp/mykeystore/UTC--2017-04-28T08-46-27.437847599Z--5afdd78bdacb56ab1dad28741ea2a0e47fe41331 508 Account #1: {9acb9ff906641a434803efb474c96a837756287f} keystore:///tmp/mykeystore/UTC--2017-04-28T08-46-52.180688336Z--9acb9ff906641a434803efb474c96a837756287f 509 ``` 510 511 ##### Import private key into a node with a custom datadir 512 513 ``` 514 $ geth account import --datadir /someOtherEthDataDir ./key.prv 515 The new account will be encrypted with a passphrase. 516 Please enter a passphrase now. 517 Passphrase: 518 Repeat Passphrase: 519 Address: {7f444580bfef4b9bc7e14eb7fb2a029336b07c9d} 520 ``` 521 522 ##### Account update 523 524 ``` 525 $ geth account update a94f5374fce5edbc8e2a8697c15331677e6ebf0b 526 Unlocking account a94f5374fce5edbc8e2a8697c15331677e6ebf0b | Attempt 1/3 527 Passphrase: 528 0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b 529 Account 'a94f5374fce5edbc8e2a8697c15331677e6ebf0b' unlocked. 530 Please give a new password. Do not forget this password. 531 Passphrase: 532 Repeat Passphrase: 533 0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b 534 ``` 535 536 537 538 #### Non-interactive use 539 540 You supply a plaintext password file as argument to the `--password` flag. The data in the file consists of the raw characters of the password, followed by a single newline. 541 542 **Note**: Supplying the password directly as part of the command line is not recommended, but you can always use shell trickery to get round this restriction. 543 544 ``` 545 $ geth account new --password /path/to/password 546 547 $ geth account import --datadir /someOtherEthDataDir --password /path/to/anotherpassword ./key.prv 548 ``` 549 550 See [Ethereum Managing Accounts](https://github.com/ethereum/go-reapchain/wiki/Managing-your-accounts) for more information. 551 552 553 554 --- 555 556 557 558 ## License 559 560 The go-reapchain library (i.e. all code outside of the `cmd` directory) is licensed under the [GNU Lesser General Public License v3.0](https://www.gnu.org/licenses/lgpl-3.0.en.html), also included in our repository in the `COPYING.LESSER` file. 561 562 The go-reapchain binaries (i.e. all code inside of the `cmd` directory) is licensed under the [GNU General Public License v3.0](https://www.gnu.org/licenses/gpl-3.0.en.html), also included in our repository in the `COPYING` file. 563