github.com/ebakus/go-ebakus@v1.0.5-0.20200520105415-dbccef9ec421/README.md (about) 1 ## Go Ebakus 2 3 Official golang implementation of the Ebakus protocol. 4 5 [![API Reference]( 6 https://camo.githubusercontent.com/915b7be44ada53c290eb157634330494ebe3e30a/68747470733a2f2f676f646f632e6f72672f6769746875622e636f6d2f676f6c616e672f6764646f3f7374617475732e737667 7 )](https://godoc.org/github.com/ebakus/go-ebakus) 8 [![Go Report Card](https://goreportcard.com/badge/github.com/ebakus/go-ebakus)](https://goreportcard.com/report/github.com/ebakus/go-ebakus) 9 [![Travis](https://travis-ci.org/ebakus/go-ebakus.svg?branch=master)](https://travis-ci.org/ebakus/go-ebakus) 10 [![Discord](https://img.shields.io/badge/discord-join%20chat-blue.svg)](https://discord.me/ebakus) 11 12 Automated builds are available for stable releases and the unstable master branch. Binary 13 archives are published at https://geth.ethereum.org/downloads/. 14 15 ## Building the source 16 17 For prerequisites and detailed build instructions please read the [Installation Instructions](https://github.com/ebakus/go-ebakus/wiki/Building-Ebakus) on the wiki. 18 19 Building `ebakus` requires both a Go (version 1.10 or later) and a C compiler. You can install 20 them using your favourite package manager. Once the dependencies are installed, run 21 22 ```shell 23 make ebakus 24 ``` 25 26 or, to build the full suite of utilities: 27 28 ```shell 29 make all 30 ``` 31 32 ## Executables 33 34 The go-ebakus project comes with several wrappers/executables found in the `cmd` directory. 35 36 | Command | Description | 37 |:----------:|-------------| 38 | **`ebakus`** | Our main Ebakus CLI client. It is the entry point into the Ebakus 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 Ebakus network via JSON RPC endpoints exposed on top of HTTP, WebSocket and/or IPC transports. `ebakus --help` and the [CLI Wiki page](https://github.com/ebakus/go-ebakus/wiki/Command-Line-Options) for command line options. | 39 | `abigen` | Source code generator to convert Ebakus contract definitions into easy to use, compile-time type-safe Go packages. It operates on plain [Ebakus contract ABIs](https://github.com/ethereum/wiki/wiki/Ethereum-Contract-ABI) with expanded functionality if the contract bytecode is also available. However it also accepts Solidity source files, making development much more streamlined. Please see our [Native DApps](https://github.com/ebakus/go-ebakus/wiki/Native-DApps:-Go-bindings-to-Ebakus-contracts) wiki page for details. | 40 | `bootnode` | Stripped down version of our Ebakus client implementation that only takes part in the network node discovery protocol, but does not run any of the higher level application protocols. It can be used as a lightweight bootstrap node to aid in finding peers in private networks. | 41 | `evm` | Developer utility version of the EVM (Ebakus Virtual Machine) that is capable of running bytecode snippets within a configurable environment and execution mode. Its purpose is to allow isolated, fine-grained debugging of EVM opcodes (e.g. `evm --code 60ff60ff --debug`). | 42 | `ebakusrpctest` | Developer utility tool to support our [ebakus/rpc-test](https://github.com/ebakus/rpc-tests) test suite which validates baseline conformity to the [Ebakus JSON RPC](https://github.com/ethereum/wiki/wiki/JSON-RPC) specs. Please see the [test suite's readme](https://github.com/ethereum/rpc-tests/blob/master/README.md) for details. | 43 | `rlpdump` | Developer utility tool to convert binary RLP ([Recursive Length Prefix](https://github.com/ethereum/wiki/wiki/RLP)) dumps (data encoding used by the Ebakus protocol both network as well as consensus wise) to user-friendlier hierarchical representation (e.g. `rlpdump --hex CE0183FFFFFFC4C304050583616263`). | 44 | `puppeth` | a CLI wizard that aids in creating a new Ebakus network. | 45 46 ## Running ebakus 47 48 Going through all the possible command line flags is out of scope here (please consult our 49 [CLI Wiki page](https://github.com/ebakus/go-ebakus/wiki/Command-Line-Options)), 50 but we've enumerated a few common parameter combos to get you up to speed quickly 51 on how you can run your own `ebakus` instance. 52 53 ### Full node on the main Ebakus network 54 55 By far the most common scenario is people wanting to simply interact with the Ebakus network: 56 create accounts; transfer funds; deploy and interact with contracts. For this particular use-case 57 the user doesn't care about years-old historical data, so we can fast-sync quickly to the current 58 state of the network. To do so: 59 60 ```shell 61 $ ebakus console 62 ``` 63 64 This command will: 65 66 * Start `ebakus` in fast sync mode (default, can be changed with the `--syncmode` flag), causing it to 67 download more data in exchange for avoiding processing the entire history of the Ebakus network, 68 which is very CPU intensive. 69 * Start up `ebakus` built-in interactive [JavaScript console](https://github.com/ebakus/go-ebakus/wiki/JavaScript-Console), 70 (via the trailing `console` subcommand) through which you can invoke all official [`web3` methods](https://github.com/ethereum/wiki/wiki/JavaScript-API) 71 as well as Ebakus' own [management APIs](https://github.com/ebakus/go-ebakus/wiki/Management-APIs). 72 This too is optional and if you leave it out you can always attach to an already running `ebakus` instance 73 with `ebakus attach`. 74 75 ### Full node on the Ebakus test network 76 77 Transitioning towards developers, if you'd like to play around with creating Ebakus 78 contracts, you almost certainly would like to do that without any real money involved until 79 you get the hang of the entire system. In other words, instead of attaching to the main 80 network, you want to join the **test** network with your node, which is fully equivalent to 81 the main network, but with play-Ether only. 82 83 ```shell 84 $ ebakus --testnet console 85 ``` 86 87 The `console` subcommand has the exact same meaning as above and they are equally 88 useful on the testnet too. Please see above for their explanations if you've skipped here. 89 90 Specifying the `--testnet` flag, however, will reconfigure your `ebakus` instance a bit: 91 92 * Instead of using the default data directory (`~/.ebakus` on Linux for example), `ebakus` will nest 93 itself one level deeper into a `testnet` subfolder (`~/.ebakus/testnet` on Linux). Note, on OSX 94 and Linux this also means that attaching to a running testnet node requires the use of a custom 95 endpoint since `ebakus attach` will try to attach to a production node endpoint by default. E.g. 96 `ebakus attach <datadir>/testnet/ebakus.ipc`. Windows users are not affected by this. 97 * Instead of connecting the main Ebakus network, the client will connect to the test network, 98 which uses different P2P bootnodes, different network IDs and genesis states. 99 100 *Note: Although there are some internal protective measures to prevent transactions from crossing 101 over between the main network and test network, you should make sure to always use separate accounts 102 for play-money and real-money. Unless you manually move accounts, `ebakus` will by default correctly 103 separate the two networks and will not make any accounts available between them.* 104 105 ### Full node on the Rinkeby test network 106 107 The above test network is a cross-client one based on the ethash proof-of-work consensus 108 algorithm. As such, it has certain extra overhead and is more susceptible to reorganization 109 attacks due to the network's low difficulty/security. Go Ebakus also supports connecting 110 to a proof-of-authority based test network called [*Rinkeby*](https://www.rinkeby.io) 111 (operated by members of the community). This network is lighter, more secure, but is only 112 supported by ebakus/go-ebakus. 113 114 ```shell 115 $ ebakus --rinkeby console 116 ``` 117 118 ### Configuration 119 120 As an alternative to passing the numerous flags to the `ebakus` binary, you can also pass a 121 configuration file via: 122 123 ```shell 124 $ ebakus --config /path/to/your_config.toml 125 ``` 126 127 To get an idea how the file should look like you can use the `dumpconfig` subcommand to 128 export your existing configuration: 129 130 ```shell 131 $ ebakus --your-favourite-flags dumpconfig 132 ``` 133 134 *Note: This works only with `ebakus` v1.6.0 and above.* 135 136 #### Docker quick start 137 138 One of the quickest ways to get Ebakus up and running on your machine is by using 139 Docker: 140 141 ``` 142 docker run -d --name ebakus-node -v /Users/alice/ebakus:/root \ 143 -p 8545:8545 -p 30303:30303 \ 144 ebakus/go-ebakus 145 ``` 146 147 This will start `ebakus` in fast-sync mode with a DB memory allowance of 1GB just as the 148 above command does. It will also create a persistent volume in your home directory for 149 saving your blockchain as well as map the default ports. There is also an `alpine` tag 150 available for a slim version of the image. 151 152 Do not forget `--rpcaddr 0.0.0.0`, if you want to access RPC from other containers 153 and/or hosts. By default, `ebakus` binds to the local interface and RPC endpoints is not 154 accessible from the outside. 155 156 ### Programatically interfacing ebakus nodes 157 158 As a developer, sooner rather than later you'll want to start interacting with `ebakus` and the 159 Ebakus network via your own programs and not manually through the console. To aid 160 this, `ebakus` has built-in support for a JSON-RPC based APIs ([standard APIs](https://github.com/ethereum/wiki/wiki/JSON-RPC) 161 and [`ebakus` specific APIs](https://github.com/ebakus/go-ebakus/wiki/Management-APIs)). 162 These can be exposed via HTTP, WebSockets and IPC (UNIX sockets on UNIX based 163 platforms, and named pipes on Windows). 164 165 The IPC interface is enabled by default and exposes all the APIs supported by `ebakus`, 166 whereas the HTTP and WS interfaces need to manually be enabled and only expose a 167 subset of APIs due to security reasons. These can be turned on/off and configured as 168 you'd expect. 169 170 HTTP based JSON-RPC API options: 171 172 * `--rpc` Enable the HTTP-RPC server 173 * `--rpcaddr` HTTP-RPC server listening interface (default: `localhost`) 174 * `--rpcport` HTTP-RPC server listening port (default: `8545`) 175 * `--rpcapi` API's offered over the HTTP-RPC interface (default: `eth,net,web3`) 176 * `--rpccorsdomain` Comma separated list of domains from which to accept cross origin requests (browser enforced) 177 * `--ws` Enable the WS-RPC server 178 * `--wsaddr` WS-RPC server listening interface (default: `localhost`) 179 * `--wsport` WS-RPC server listening port (default: `8546`) 180 * `--wsapi` API's offered over the WS-RPC interface (default: `eth,net,web3`) 181 * `--wsorigins` Origins from which to accept websockets requests 182 * `--ipcdisable` Disable the IPC-RPC server 183 * `--ipcapi` API's offered over the IPC-RPC interface (default: `admin,debug,eth,miner,net,personal,shh,txpool,web3`) 184 * `--ipcpath` Filename for IPC socket/pipe within the datadir (explicit paths escape it) 185 186 You'll need to use your own programming environments' capabilities (libraries, tools, etc) to 187 connect via HTTP, WS or IPC to a `ebakus` node configured with the above flags and you'll 188 need to speak [JSON-RPC](https://www.jsonrpc.org/specification) on all transports. You 189 can reuse the same connection for multiple requests! 190 191 **Note: Please understand the security implications of opening up an HTTP/WS based 192 transport before doing so! Hackers on the internet are actively trying to subvert 193 Ebakus nodes with exposed APIs! Further, all browser tabs can access locally 194 running web servers, so malicious web pages could try to subvert locally available 195 APIs!** 196 197 ### Operating a private network 198 199 Maintaining your own private network is more involved as a lot of configurations taken for 200 granted in the official networks need to be manually set up. 201 202 #### Defining the private genesis state 203 204 First, you'll need to create the genesis state of your networks, which all nodes need to be 205 aware of and agree upon. This consists of a small JSON file (e.g. call it `genesis.json`): 206 207 ```json 208 { 209 "config": { 210 "chainId": <arbitrary positive integer>, 211 "homesteadBlock": 0, 212 "eip150Block": 0, 213 "eip155Block": 0, 214 "eip158Block": 0, 215 "byzantiumBlock": 0, 216 "constantinopleBlock": 0, 217 "petersburgBlock": 0 218 }, 219 "alloc": {}, 220 "coinbase": "0x0000000000000000000000000000000000000000", 221 "difficulty": "0x20000", 222 "extraData": "", 223 "gasLimit": "0x2fefd8", 224 "nonce": "0x0000000000000042", 225 "mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000", 226 "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000", 227 "timestamp": "0x00" 228 } 229 ``` 230 231 The above fields should be fine for most purposes, although we'd recommend changing 232 the `nonce` to some random value so you prevent unknown remote nodes from being able 233 to connect to you. If you'd like to pre-fund some accounts for easier testing, create 234 the accounts and populate the `alloc` field with their addresses. 235 236 ```json 237 "alloc": { 238 "0x0000000000000000000000000000000000000001": { 239 "balance": "111111111" 240 }, 241 "0x0000000000000000000000000000000000000002": { 242 "balance": "222222222" 243 } 244 } 245 ``` 246 247 With the genesis state defined in the above JSON file, you'll need to initialize **every** 248 `ebakus` node with it prior to starting it up to ensure all blockchain parameters are correctly 249 set: 250 251 ```shell 252 $ ebakus init path/to/genesis.json 253 ``` 254 255 #### Creating the rendezvous point 256 257 With all nodes that you want to run initialized to the desired genesis state, you'll need to 258 start a bootstrap node that others can use to find each other in your network and/or over 259 the internet. The clean way is to configure and run a dedicated bootnode: 260 261 ```shell 262 $ bootnode --genkey=boot.key 263 $ bootnode --nodekey=boot.key 264 ``` 265 266 With the bootnode online, it will display an [`enode` URL](https://github.com/ethereum/wiki/wiki/enode-url-format) 267 that other nodes can use to connect to it and exchange peer information. Make sure to 268 replace the displayed IP address information (most probably `[::]`) with your externally 269 accessible IP to get the actual `enode` URL. 270 271 *Note: You could also use a full-fledged `ebakus` node as a bootnode, but it's the less 272 recommended way.* 273 274 #### Starting up your member nodes 275 276 With the bootnode operational and externally reachable (you can try 277 `telnet <ip> <port>` to ensure it's indeed reachable), start every subsequent `ebakus` 278 node pointed to the bootnode for peer discovery via the `--bootnodes` flag. It will 279 probably also be desirable to keep the data directory of your private network separated, so 280 do also specify a custom `--datadir` flag. 281 282 ```shell 283 $ ebakus --datadir=path/to/custom/data/folder --bootnodes=<bootnode-enode-url-from-above> 284 ``` 285 286 *Note: Since your network will be completely cut off from the main and test networks, you'll 287 also need to configure a miner to process transactions and create new blocks for you.* 288 289 ## Contribution 290 291 Thank you for considering to help out with the source code! We welcome contributions 292 from anyone on the internet, and are grateful for even the smallest of fixes! 293 294 If you'd like to contribute to ebakus/go-ebakus, please fork, fix, commit and send a pull request 295 for the maintainers to review and merge into the main code base. If you wish to submit 296 more complex changes though, please check up with the core devs first on [our gitter channel](https://gitter.im/ebakus/go-ebakus) 297 to ensure those changes are in line with the general philosophy of the project and/or get 298 some early feedback which can make both your efforts much lighter as well as our review 299 and merge procedures quick and simple. 300 301 Please make sure your contributions adhere to our coding guidelines: 302 303 * Code must adhere to the official Go [formatting](https://golang.org/doc/effective_go.html#formatting) 304 guidelines (i.e. uses [gofmt](https://golang.org/cmd/gofmt/)). 305 * Code must be documented adhering to the official Go [commentary](https://golang.org/doc/effective_go.html#commentary) 306 guidelines. 307 * Pull requests need to be based on and opened against the `master` branch. 308 * Commit messages should be prefixed with the package(s) they modify. 309 * E.g. "eth, rpc: make trace configs optional" 310 311 Please see the [Developers' Guide](https://github.com/ebakus/go-ebakus/wiki/Developers'-Guide) 312 for more details on configuring your environment, managing project dependencies, and 313 testing procedures. 314 315 ## License 316 317 The ebakus/go-ebakus library (i.e. all code outside of the `cmd` directory) is licensed under the 318 [GNU Lesser General Public License v3.0](https://www.gnu.org/licenses/lgpl-3.0.en.html), 319 also included in our repository in the `COPYING.LESSER` file. 320 321 The ebakus/go-ebakus binaries (i.e. all code inside of the `cmd` directory) is licensed under the 322 [GNU General Public License v3.0](https://www.gnu.org/licenses/gpl-3.0.en.html), also 323 included in our repository in the `COPYING` file.