github.com/ethereumproject/go-ethereum@v5.5.2+incompatible/README.md (about) 1 [![MacOS Build Status](https://circleci.com/gh/ethereumproject/go-ethereum/tree/master.svg?style=shield)](https://circleci.com/gh/ethereumproject/go-ethereum/tree/master) 2 [![Windows Build Status](https://ci.appveyor.com/api/projects/status/github/ethereumproject/go-ethereum?svg=true)](https://ci.appveyor.com/project/splix/go-ethereum) 3 [![Go Report Card](https://goreportcard.com/badge/github.com/ethereumproject/go-ethereum)](https://goreportcard.com/report/github.com/ethereumproject/go-ethereum) 4 [![API Reference](https://camo.githubusercontent.com/915b7be44ada53c290eb157634330494ebe3e30a/68747470733a2f2f676f646f632e6f72672f6769746875622e636f6d2f676f6c616e672f6764646f3f7374617475732e737667 5 )](https://godoc.org/github.com/ethereumproject/go-ethereum) 6 [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/ethereumproject/go-ethereum?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) 7 8 ## Ethereum Go (Ethereum Classic Blockchain) 9 10 Official Go language implementation of the Ethereum protocol supporting the 11 _original_ chain. Ethereum Classic (ETC) offers a censorship-resistant and powerful application platform for developers in parallel to Ethereum (ETHF), while differentially rejecting the DAO bailout. 12 13 ## Install 14 15 ### :rocket: From a release binary 16 The simplest way to get started running a node is to visit our [Releases page](https://github.com/ethereumproject/go-ethereum/releases) and download a zipped executable binary (matching your operating system, of course), then moving the unzipped file `geth` to somewhere in your `$PATH`. Now you should be able to open a terminal and run `$ geth help` to make sure it's working. For additional installation instructions please check out the [Installation Wiki](https://github.com/ethereumproject/go-ethereum/wiki/Home#Developers). 17 18 #### :beers: Using Homebrew (OSX only) 19 ``` 20 $ brew install ethereumproject/classic/geth 21 ``` 22 23 ### :hammer: Building the source 24 25 If your heart is set on the bleeding edge, install from source. However, please be advised that you may encounter some strange things, and we can't prioritize support beyond the release versions. Recommended for developers only. 26 27 #### Dependencies 28 Building geth requires both Go >=1.9 and a C compiler. On Linux systems, 29 a C compiler can, for example, by installed with `sudo apt-get install 30 build-essential`. On Mac: `xcode-select --install`. 31 32 #### Get source and package dependencies 33 ``` 34 $ go get -v github.com/ethereumproject/go-ethereum/...` 35 ``` 36 37 #### Install and build command executables 38 39 Executables installed from source will, by default, be installed in `$GOPATH/bin/`. 40 41 ##### With go: 42 43 - the full suite of utilities: 44 ``` 45 $ go install github.com/ethereumproject/go-ethereum/cmd/...` 46 ``` 47 48 - just __geth__: 49 ``` 50 $ go install github.com/ethereumproject/go-ethereum/cmd/geth` 51 ``` 52 53 ##### With make: 54 ``` 55 $ cd $GOPATH/src/github.com/ethereumproject/go-ethereum 56 ``` 57 58 - the full suite of utilities: 59 ``` 60 $ make install 61 ``` 62 63 - just __geth__: 64 ``` 65 $ make install_geth 66 ``` 67 68 > For further `make` information, use `make help` to see a list and description of available make 69 > commands. 70 71 72 ##### Building a specific release 73 All the above commands results with building binaries from `HEAD`. To use a specific release/tag, use the following before installing: 74 75 ```shell 76 $ go get -d github.com/ethereumproject/go-ethereum/... 77 $ cd $GOPATH/src/github.com/ethereumproject/go-ethereum 78 $ git checkout <TAG OR REVISION> 79 # Use a go or make command above. 80 ``` 81 82 ##### Using a release source code tarball 83 Because of strict Go directory structure, the tarball needs to be extracted into the proper subdirectory under `$GOPATH`. 84 The following commands are an example of building the v4.1.1 release: 85 86 ```shell 87 $ mkdir -p $GOPATH/src/github.com/ethereumproject 88 $ cd $GOPATH/src/github.com/ethereumproject 89 $ tar xzf /path/to/go-ethereum-4.1.1.tar.gz 90 $ mv go-ethereum-4.1.1 go-ethereum 91 $ cd go-ethereum 92 # Use a go or make command above. 93 ``` 94 95 ## Executables 96 97 This repository includes several wrappers/executables found in the `cmd` directory. 98 99 | Command | Description | 100 |:----------:|-------------| 101 | **`geth`** | The main Ethereum CLI client. It is the entry point into the Ethereum 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 Ethereum network via JSON RPC endpoints exposed on top of HTTP, WebSocket and/or IPC transports. Please see our [Command Line Options](https://github.com/ethereumproject/go-ethereum/wiki/Command-Line-Options) wiki page for details. | 102 | `abigen` | Source code generator to convert Ethereum contract definitions into easy to use, compile-time type-safe Go packages. It operates on plain [Ethereum contract ABIs](https://github.com/ethereumproject/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/ethereumproject/go-ethereum/wiki/Native-DApps-in-Go) wiki page for details. | 103 | `bootnode` | Stripped down version of our Ethereum 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. | 104 | `disasm` | Bytecode disassembler to convert EVM (Ethereum Virtual Machine) bytecode into more user friendly assembly-like opcodes (e.g. `echo "6001" | disasm`). For details on the individual opcodes, please see pages 22-30 of the [Ethereum Yellow Paper](http://gavwood.com/paper.pdf). | 105 | `evm` | Developer utility version of the EVM (Ethereum Virtual Machine) that is capable of running bytecode snippets within a configurable environment and execution mode. Its purpose is to allow insolated, fine graned debugging of EVM opcodes (e.g. `evm --code 60ff60ff --debug`). | 106 | `gethrpctest` | Developer utility tool to support our [ethereum/rpc-test](https://github.com/ethereumproject/rpc-tests) test suite which validates baseline conformity to the [Ethereum JSON RPC](https://github.com/ethereumproject/wiki/wiki/JSON-RPC) specs. Please see the [test suite's readme](https://github.com/ethereumproject/rpc-tests/blob/master/README.md) for details. | 107 | `rlpdump` | Developer utility tool to convert binary RLP ([Recursive Length Prefix](https://github.com/ethereumproject/wiki/wiki/RLP)) dumps (data encoding used by the Ethereum protocol both network as well as consensus wise) to user friendlier hierarchical representation (e.g. `rlpdump --hex CE0183FFFFFFC4C304050583616263`). | 108 109 ## :green_book: Geth: the basics 110 111 ### Data directory 112 By default, geth will store all node and blockchain data in a __parent directory__ depending on your OS: 113 114 - Linux: `$HOME/.ethereum-classic/` 115 - Mac: `$HOME/Library/EthereumClassic/` 116 - Windows: `$HOME/AppData/Roaming/EthereumClassic/` 117 118 __You can specify this directory__ with `--data-dir=$HOME/id/rather/put/it/here`. 119 120 Within this parent directory, geth will use a __/subdirectory__ to hold data for each network you run. The defaults are: 121 122 - `/mainnet` for the Mainnet 123 - `/morden` for the Morden Testnet 124 125 __You can specify this subdirectory__ with `--chain=mycustomnet`. 126 127 > __Migrating__: If you have existing data created prior to the [3.4 Release](https://github.com/ethereumproject/go-ethereum/releases), geth will attempt to migrate your existing standard ETC data to this structure. To learn more about managing this migration please read our [3.4 release notes on our Releases page](https://github.com/ethereumproject/go-ethereum/wiki/Release-3.4.0-Notes). 128 129 ### Full node on the main Ethereum network 130 131 ``` 132 $ geth 133 ``` 134 135 It's that easy! This will establish an ETC blockchain node and download ("sync") the full blocks for the entirety of the ETC blockchain. __However__, before you go ahead with plain ol' `geth`, we would encourage reviewing the following section... 136 137 #### :speedboat: `--fast` 138 139 The most common scenario is users wanting to simply interact with the Ethereum Classic network: create accounts; transfer funds; deploy and interact with contracts, and mine. For this particular use-case the user doesn't care about years-old historical data, so we can _fast-sync_ to the current state of the network. To do so: 140 141 ``` 142 $ geth --fast 143 ``` 144 145 Using geth in fast sync mode causes it to download only block _state_ data -- leaving out bulky transaction records -- which avoids a lot of CPU and memory intensive processing. 146 147 Fast sync will be automatically __disabled__ (and full sync enabled) when: 148 149 - your chain database contains *any* full blocks 150 - your node has synced up to the current head of the network blockchain 151 152 In case of using `--mine` together with `--fast`, geth will operate as described; syncing in fast mode up to the head, and then begin mining once it has synced its first full block at the head of the chain. 153 154 *Note:* To further increase geth's performace, you can use a `--cache=2054` flag to bump the memory allowance of the database (e.g. 2054MB) which can significantly improve sync times, especially for HDD users. This flag is optional and you can set it as high or as low as you'd like, though we'd recommend the 1GB - 2GB range. 155 156 ### Create or manage account(s) 157 158 Geth is able to create, import, update, unlock, and otherwise manage your private (encrypted) key files. Key files are in JSON format and, by default, stored in the respective chain folder's `/keystore` directory; you can specify a custom location with the `--keystore` flag. 159 160 ``` 161 $ geth account new 162 ``` 163 164 This command will create a new account and prompt you to enter a passphrase to protect your account. 165 166 Other `account` subcommands include: 167 ``` 168 SUBCOMMANDS: 169 170 list print account addresses 171 new create a new account 172 update update an existing account 173 import import a private key into a new account 174 175 ``` 176 177 Learn more at the [Accounts Wiki Page](https://github.com/ethereumproject/go-ethereum/wiki/Managing-Accounts). If you're interested in using geth to manage a lot (~100,000+) of accounts, please visit the [Indexing Accounts Wiki page](https://github.com/ethereumproject/go-ethereum/wiki/Indexing-Accounts). 178 179 180 ### Interact with the Javascript console 181 ``` 182 $ geth console 183 ``` 184 185 This command will start up Geth's built-in interactive [JavaScript console](https://github.com/ethereumproject/go-ethereum/wiki/JavaScript-Console), through which you can invoke all official [`web3` methods](https://github.com/ethereumproject/wiki/wiki/JavaScript-API) as well as Geth's own [management APIs](https://github.com/ethereumproject/go-ethereum/wiki/Management-APIs). This too is optional and if you leave it out you can always attach to an already running Geth instance with `geth attach`. 186 187 Learn more at the [Javascript Console Wiki page](https://github.com/ethereumproject/go-ethereum/wiki/JavaScript-Console). 188 189 190 ### And so much more! 191 192 For a comprehensive list of command line options, please consult our [CLI Wiki page](https://github.com/ethereumproject/go-ethereum/wiki/Command-Line-Options). 193 194 ## :orange_book: Geth: developing and advanced useage 195 196 ### Morden Testnet 197 If you'd like to play around with creating Ethereum contracts, you 198 almost certainly would like to do that without any real money involved until you get the hang of the entire system. In other words, instead of attaching to the main network, you want to join the **test** network with your node, which is fully equivalent to the main network, but with play-Ether only. 199 200 ``` 201 $ geth --chain=morden --fast console 202 ``` 203 204 The `--fast` flag and `console` subcommand have the exact same meaning as above and they are equally useful on the testnet too. Please see above for their explanations if you've skipped to here. 205 206 Specifying the `--chain=morden` flag will reconfigure your Geth instance a bit: 207 208 - As mentioned above, Geth will host its testnet data in a `morden` subfolder (`~/.ethereum-classic/morden`). 209 - Instead of connecting the main Ethereum network, the client will connect to the test network, which uses different P2P bootnodes, different network IDs and genesis states. 210 211 You may also optionally use `--testnet` or `--chain=testnet` to enable this configuration. 212 213 > *Note: Although there are some internal protective measures to prevent transactions from crossing over between the main network and test network (different starting nonces), you should make sure to always use separate accounts for play-money and real-money. Unless you manually move accounts, Geth 214 will by default correctly separate the two networks and will not make any accounts available between them.* 215 216 ### Programatically interfacing Geth nodes 217 218 As a developer, sooner rather than later you'll want to start interacting with Geth and the Ethereum 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 ([standard APIs](https://github.com/ethereumproject/wiki/wiki/JSON-RPC) and 219 [Geth specific APIs](https://github.com/ethereumproject/go-ethereum/wiki/Management-APIs)). These can be exposed via HTTP, WebSockets and IPC (unix sockets on unix based platroms, and named pipes on Windows). 220 221 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. 222 223 HTTP based JSON-RPC API options: 224 225 * `--rpc` Enable the HTTP-RPC server 226 * `--rpc-addr` HTTP-RPC server listening interface (default: "localhost") 227 * `--rpc-port` HTTP-RPC server listening port (default: 8545) 228 * `--rpc-api` API's offered over the HTTP-RPC interface (default: "eth,net,web3") 229 * `--rpc-cors-domain` Comma separated list of domains from which to accept cross origin requests (browser enforced) 230 * `--ws` Enable the WS-RPC server 231 * `--ws-addr` WS-RPC server listening interface (default: "localhost") 232 * `--ws-port` WS-RPC server listening port (default: 8546) 233 * `--ws-api` API's offered over the WS-RPC interface (default: "eth,net,web3") 234 * `--ws-origins` Origins from which to accept websockets requests 235 * `--ipc-disable` Disable the IPC-RPC server 236 * `--ipc-api` API's offered over the IPC-RPC interface (default: "admin,debug,eth,miner,net,personal,shh,txpool,web3") 237 * `--ipc-path` Filename for IPC socket/pipe within the datadir (explicit paths escape it) 238 239 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](http://www.jsonrpc.org/specification) on all transports. You can reuse the same connection for multiple requests! 240 241 > Note: Please understand the security implications of opening up an HTTP/WS based transport before doing so! Hackers on the internet are actively trying to subvert Ethereum nodes with exposed APIs! Further, all browser tabs can access locally running webservers, so malicious webpages could try to subvert locally available APIs!* 242 243 ### Operating a private/custom network 244 245 As of [Geth 3.4](https://github.com/ethereumproject/go-ethereum/releases) you are now able to configure a private chain by specifying an __external chain configuration__ JSON file, which includes necessary genesis block data as well as feature configurations for protocol forks, bootnodes, and chainID. 246 247 Please find full [example external configuration files representing the Mainnet and Morden Testnet specs in the /config subdirectory of this repo](). You can use either of these files as a starting point for your own customizations. 248 249 It is important for a private network that all nodes use compatible chains. In the case of custom chain configuration, the chain configuration file (`chain.json`) should be equivalent for each node. 250 251 #### Define external chain configuration 252 253 Specifying an external chain configuration file will allow fine-grained control over a custom blockchain/network configuration, including the genesis state and extending through bootnodes and fork-based protocol upgrades. 254 255 ```shell 256 $ geth --chain=morden dump-chain-config <datadir>/customnet/chain.json 257 $ sed s/mainnet/customnet/ <datadir>/customnet/chain.json 258 $ vi <datadir>/customnet/chain.json # make your custom edits 259 $ geth --chain=customnet [--flags] [command] 260 ``` 261 262 The external chain configuration file specifies valid settings for the following top-level fields: 263 264 | JSON Key | Notes | 265 | --- | --- | 266 | `chainID` | Chain identity. Determines local __/subdir__ for chain data, with required `chain.json` located in it. It is required, but must not be identical for each node. Please note that this is _not_ the chainID validation introduced in _EIP-155_; that is configured as a protocal upgrade within `forks.features`. | 267 | `name` | _Optional_. Human readable name, ie _Ethereum Classic Mainnet_, _Morden Testnet._ | 268 | `state.startingNonce` | _Optional_. Initialize state db with a custom nonce. | 269 | `network` | Determines Network ID to identify valid peers. | 270 | `consensus` | _Optional_. Proof of work algorithm to use, either "ethash" or "ethast-test" (for development) | 271 | `genesis` | Determines __genesis state__. If running the node for the first time, it will write the genesis block. If configuring an existing chain database with a different genesis block, it will overwrite it. | 272 | `chainConfig` | Determines configuration for fork-based __protocol upgrades__, ie _EIP-150_, _EIP-155_, _EIP-160_, _ECIP-1010_, etc ;-). Subkeys are `forks` and `badHashes`. | 273 | `bootstrap` | _Optional_. Determines __bootstrap nodes__ in [enode format](https://github.com/ethereumproject/wiki/wiki/enode-url-format). | 274 | `include` | _Optional_. Other configuration files to include. Paths can be relative (to the config file with `include` field, or absolute). Each of configuration files has the same structure as "main" configuration. Included files are processed after the "main" configuration in the same order as specified in the array; values processed later overwrite the previously defined ones. | 275 276 277 *Fields `name`, `state.startingNonce`, and `consensus` are optional. Geth will panic if any required field is missing, invalid, or in conflict with another flag. This renders `--chain` __incompatible__ with `--testnet`. It remains __compatible__ with `--data-dir`.* 278 279 To learn more about external chain configuration, please visit the [External Command Line Options Wiki page](https://github.com/ethereumproject/go-ethereum/wiki/Command-Line-Options). 280 281 ##### Create the rendezvous point 282 283 Once all participating nodes have been initialized to the desired genesis state, you'll need to start a __bootstrap node__ that others can use to find each other in your network and/or over the internet. The clean way is to configure and run a dedicated bootnode: 284 285 ``` 286 $ bootnode --genkey=boot.key 287 $ bootnode --nodekey=boot.key 288 ``` 289 290 With the bootnode online, it will display an `enode` URL that other nodes can use to connect to it and exchange peer information. Make sure to replace the 291 displayed IP address information (most probably `[::]`) with your externally accessible IP to get the actual `enode` URL. 292 293 *Note: You could also use a full fledged Geth node as a bootnode, but it's the less recommended way.* 294 295 To learn more about enodes and enode format, visit the [Enode Wiki page](https://github.com/ethereumproject/wiki/wiki/enode-url-format). 296 297 ##### Starting up your member nodes 298 299 With the bootnode operational and externally reachable (you can try `telnet <ip> <port>` to ensure it's indeed reachable), start every subsequent Geth node pointed to the bootnode for peer discovery via the `--bootnodes` flag. It will probably be desirable to keep private network data separate from defaults; to do so, specify a custom `--datadir` and/or `--chain` flag. 300 301 ``` 302 $ geth --datadir=path/to/custom/data/folder \ 303 --chain=kittynet \ 304 --bootnodes=<bootnode-enode-url-from-above> 305 ``` 306 307 *Note: Since your network will be completely cut off from the main and test networks, you'll also need to configure a miner to process transactions and create new blocks for you.* 308 309 #### Running a private miner 310 311 Mining on the public Ethereum network is a complex task as it's only feasible using GPUs, requiring an OpenCL or CUDA enabled `ethminer` instance. For information on such a setup, please consult the [EtherMining subreddit](https://www.reddit.com/r/EtherMining/) and the [Genoil miner](https://github.com/Genoil/cpp-ethereum) repository. 312 313 In a private network setting however, a single CPU miner instance is more than enough for practical purposes as it can produce a stable stream of blocks at the correct intervals without needing heavy resources (consider running on a single thread, no need for multiple ones either). To start a Geth instance for mining, run it with all your usual flags, extended by: 314 315 ``` 316 $ geth <usual-flags> --mine --minerthreads=1 --etherbase=0x0000000000000000000000000000000000000000 317 ``` 318 319 Which will start mining blocks and transactions on a single CPU thread, crediting all proceedings to the account specified by `--etherbase`. You can further tune the mining by changing the default gas limit blocks converge to (`--targetgaslimit`) and the price transactions are accepted at (`--gasprice`). 320 321 For more information about managing accounts, please see the [Managing Accounts Wiki page](https://github.com/ethereumproject/go-ethereum/wiki/Managing-Accounts). 322 323 324 ## Contribution 325 326 Thank you for considering to help out with the source code! 327 328 The core values of democratic engagement, transparency, and integrity run deep with us. We welcome contributions from everyone, and are grateful for even the smallest of fixes. :clap: 329 330 This project is migrated from the now hard-forked [Ethereum (ETHF) Github project](https://github.com/ethereum), and we will need to incrementally migrate pieces of the infrastructure required to maintain the project. 331 332 If you'd like to contribute to go-ethereum, please fork, fix, commit and send a pull request for the maintainers to review and merge into the main code base. If you wish to submit more complex changes, please check up with the core devs first on [our Slack channel (#development)](http://ethereumclassic.herokuapp.com/) or [our Discord channel (#development)](https://discord.gg/wpwSGWn) to ensure those changes are in line with the general philosophy of the project and/or get some early feedback which can make both your efforts much lighter as well as our review and merge procedures quick and simple. 333 334 Please see the [Wiki](https://github.com/ethereumproject/go-ethereum/wiki) for more details on configuring your environment, managing project dependencies, and testing procedures. 335 336 ## License 337 338 The go-ethereum library (i.e. all code outside of the `cmd` directory) is licensed under the [GNU Lesser General Public License v3.0](http://www.gnu.org/licenses/lgpl-3.0.en.html), also included in our repository in the `COPYING.LESSER` file. 339 340 The go-ethereum binaries (i.e. all code inside of the `cmd` directory) is licensed under the [GNU General Public License v3.0](http://www.gnu.org/licenses/gpl-3.0.en.html), also included in our repository in the `COPYING` file.