## Ethereum Go Official golang implementation of the Ethereum protocol. [![API Reference]( https://camo.githubusercontent.com/915b7be44ada53c290eb157634330494ebe3e30a/68747470733a2f2f676f646f632e6f72672f6769746875622e636f6d2f676f6c616e672f6764646f3f7374617475732e737667 )](https://godoc.org/github.com/ethereum/go-ethereum) [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/ethereum/go-ethereum?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) Automated builds are available for stable releases and the unstable master branch. Binary archives are published at https://geth.ethereum.org/downloads/. ## Building the source For prerequisites and detailed build instructions please read the [Installation Instructions](https://github.com/ethereum/go-ethereum/wiki/Building-Ethereum) on the wiki. Building geth requires both a Go and a C compiler. You can install them using your favourite package manager. Once the dependencies are installed, run make geth or, to build the full suite of utilities: make all ## Executables The go-ethereum project comes with several wrappers/executables found in the `cmd` directory. | Command | Description | |:----------:|-------------| | **`geth`** | Our 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. `geth --help` and the [CLI Wiki page](https://github.com/ethereum/go-ethereum/wiki/Command-Line-Options) for command line options | | `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/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/ethereum/go-ethereum/wiki/Native-DApps:-Go-bindings-to-Ethereum-contracts) wiki page for details. | | `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. | | `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). | | `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-grained debugging of EVM opcodes (e.g. `evm --code 60ff60ff --debug`). | | `gethrpctest` | Developer utility tool to support our [ethereum/rpc-test](https://github.com/ethereum/rpc-tests) test suite which validates baseline conformity to the [Ethereum 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. | | `rlpdump` | Developer utility tool to convert binary RLP ([Recursive Length Prefix](https://github.com/ethereum/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`). | | `swarm` | swarm daemon and tools. This is the entrypoint for the swarm network. `swarm --help` for command line options and subcommands. See https://swarm-guide.readthedocs.io for swarm documentation. | ## Running geth Going through all the possible command line flags is out of scope here (please consult our [CLI Wiki page](https://github.com/ethereum/go-ethereum/wiki/Command-Line-Options)), but we've enumerated a few common parameter combos to get you up to speed quickly on how you can run your own Geth instance. ### Full node on the main Ethereum network By far the most common scenario is people wanting to simply interact with the Ethereum network: create accounts; transfer funds; deploy and interact with contracts. For this particular use-case the user doesn't care about years-old historical data, so we can fast-sync quickly to the current state of the network. To do so: ``` $ geth --fast --cache=512 console ``` This command will: * Start geth in fast sync mode (`--fast`), causing it to download more data in exchange for avoiding processing the entire history of the Ethereum network, which is very CPU intensive. * Bump the memory allowance of the database to 512MB (`--cache=512`), which can help significantly in 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 512MB - 2GB range. * Start up Geth's built-in interactive [JavaScript console](https://github.com/ethereum/go-ethereum/wiki/JavaScript-Console), (via the trailing `console` subcommand) through which you can invoke all official [`web3` methods](https://github.com/ethereum/wiki/wiki/JavaScript-API) as well as Geth's own [management APIs](https://github.com/ethereum/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`. ### Full node on the Ethereum test network Transitioning towards developers, if you'd like to play around with creating Ethereum contracts, you 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. ``` $ geth --testnet --fast --cache=512 console ``` The `--fast`, `--cache` flags and `console` subcommand have the exact same meaning as above and they are equially useful on the testnet too. Please see above for their explanations if you've skipped to here. Specifying the `--testnet` flag however will reconfigure your Geth instance a bit: * Instead of using the default data directory (`~/.ethereum` on Linux for example), Geth will nest itself one level deeper into a `testnet` subfolder (`~/.ethereum/testnet` on Linux). * 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. *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 will by default correctly separate the two networks and will not make any accounts available between them.* #### Docker quick start One of the quickest ways to get Ethereum up and running on your machine is by using Docker: ``` docker run -d --name ethereum-node -v /Users/alice/ethereum:/root \ -p 8545:8545 -p 30303:30303 \ ethereum/client-go --fast --cache=512 ``` This will start geth in fast sync mode with a DB memory allowance of 512MB just as the above command does. It will also create a persistent volume in your home directory for saving your blockchain as well as map the default ports. There is also an `alpine` tag available for a slim version of the image. ### Programatically interfacing Geth nodes 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/ethereum/wiki/wiki/JSON-RPC) and [Geth specific APIs](https://github.com/ethereum/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). 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. HTTP based JSON-RPC API options: * `--rpc` Enable the HTTP-RPC server * `--rpcaddr` HTTP-RPC server listening interface (default: "localhost") * `--rpcport` HTTP-RPC server listening port (default: 8545) * `--rpcapi` API's offered over the HTTP-RPC interface (default: "eth,net,web3") * `--rpccorsdomain` Comma separated list of domains from which to accept cross origin requests (browser enforced) * `--ws` Enable the WS-RPC server * `--wsaddr` WS-RPC server listening interface (default: "localhost") * `--wsport` WS-RPC server listening port (default: 8546) * `--wsapi` API's offered over the WS-RPC interface (default: "eth,net,web3") * `--wsorigins` Origins from which to accept websockets requests * `--ipcdisable` Disable the IPC-RPC server * `--ipcapi` API's offered over the IPC-RPC interface (default: "admin,debug,eth,miner,net,personal,shh,txpool,web3") * `--ipcpath` Filename for IPC socket/pipe within the datadir (explicit paths escape it) 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! **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!** ### Operating a private network Maintaining your own private network is more involved as a lot of configurations taken for granted in the official networks need to be manually set up. #### Defining the private genesis state First, you'll need to create the genesis state of your networks, which all nodes need to be aware of and agree upon. This consists of a small JSON file (e.g. call it `genesis.json`): ```json { "alloc" : {}, "coinbase" : "0x0000000000000000000000000000000000000000", "difficulty" : "0x20000", "extraData" : "", "gasLimit" : "0x2fefd8", "nonce" : "0x0000000000000042", "mixhash" : "0x0000000000000000000000000000000000000000000000000000000000000000", "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000", "timestamp" : "0x00" } ``` The above fields should be fine for most purposes, although we'd recommend changing the `nonce` to some random value so you prevent unknown remote nodes from being able to connect to you. If you'd like to pre-fund some accounts for easier testing, you can populate the `alloc` field with account configs: ```json "alloc": { "0x0000000000000000000000000000000000000001": {"balance": "111111111"}, "0x0000000000000000000000000000000000000002": {"balance": "222222222"} } ``` With the genesis state defined in the above JSON file, you'll need to initialize **every** Geth node with it prior to starting it up to ensure all blockchain parameters are correctly set: ``` $ geth init path/to/genesis.json ``` #### Creating the rendezvous point With all nodes that you want to run 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: ``` $ bootnode --genkey=boot.key $ bootnode --nodekey=boot.key ``` With the bootnode online, it will display an [`enode` URL](https://github.com/ethereum/wiki/wiki/enode-url-format) that other nodes can use to connect to it and exchange peer information. Make sure to replace the displayed IP address information (most probably `[::]`) with your externally accessible IP to get the actual `enode` URL. *Note: You could also use a full fledged Geth node as a bootnode, but it's the less recommended way.* #### Starting up your member nodes With the bootnode operational and externally reachable (you can try `telnet ` 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 also be desirable to keep the data directory of your private network separated, so do also specify a custom `--datadir` flag. ``` $ geth --datadir=path/to/custom/data/folder --bootnodes= ``` *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.* #### Running a private miner 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. 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: ``` $ geth --mine --minerthreads=1 --etherbase=0x0000000000000000000000000000000000000000 ``` Which will start mining bocks 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`). ## Contribution Thank you for considering to help out with the source code! We welcome contributions from anyone on the internet, and are grateful for even the smallest of fixes! 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 though, please check up with the core devs first on [our gitter channel](https://gitter.im/ethereum/go-ethereum) 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. Please make sure your contributions adhere to our coding guidelines: * Code must adhere to the official Go [formatting](https://golang.org/doc/effective_go.html#formatting) guidelines (i.e. uses [gofmt](https://golang.org/cmd/gofmt/)). * Code must be documented adhering to the official Go [commentary](https://golang.org/doc/effective_go.html#commentary) guidelines. * Pull requests need to be based on and opened against the `master` branch. * Commit messages should be prefixed with the package(s) they modify. * E.g. "eth, rpc: make trace configs optional" Please see the [Developers' Guide](https://github.com/ethereum/go-ethereum/wiki/Developers'-Guide) for more details on configuring your environment, managing project dependencies and testing procedures. ## License The go-ethereum 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. The go-ethereum 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. +12 | * ethclient: include block hash from FilterQuery (#17996)tamirms2018-11-082-11/+145 | | | | | ethereum/go-ethereum#16734 introduced BlockHash to the FilterQuery struct. However, ethclient was not updated to include BlockHash in the actual RPC request. * event/filter: delete unused package (#18063)Felix Lange2018-11-083-203/+0 | * Merge pull request #17982 from holiman/polish_contantinople_extcodehashPéter Szilágyi2018-11-081-1/+6 |\ | | | | core/vm: check empty in extcodehash | * core/vm: check empty in extcodehashMartin Holst Swende2018-10-261-1/+6 | | * | internal/web3ext: add eth.getProof (#18052)Ryan Schneider2018-11-081-0/+6 | | * | common/compiler: capture runtime code and source maps (#18020)JoranHonig2018-11-081-8/+16 | | * | core/vm, eth/tracers: use pointer receiver for GetRefund (#18018)Corey Lin2018-11-082-2/+2 | | * | eth, p2p: fix comment typos (#18014)Corey Lin2018-11-082-2/+2 | | * | p2p: fix comment typo (#18027)Liang Ma2018-11-081-1/+1 | | * | event, event/filter: minor code cleanup (#18061)Corey Lin2018-11-082-6/+6 | | * | p2p: use enode.ID type in metered connection (#17933)Kurkó Mihály2018-11-081-6/+5 | | | | | | Change the type of the metered connection's id field from string to enode.ID. * | swarm, cmd/swarm: address ineffectual assignments (#18048)Anton Evangelatov2018-11-0820-24/+61 | | | | | | | | | | | | | | | | * swarm, cmd/swarm: address ineffectual assignments * swarm/network: remove unused vars from testHandshake * swarm/storage/feed: revert cursor changes * | swarm/network: light nodes are not dialed, saved and requested from (#17975)Mark Vujevits2018-11-084-13/+153 | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * RequestFromPeers does not use peers marked as lightnode * fix warning about variable name * write tests for RequestFromPeers * lightnodes should be omitted from the addressbook * resolve pr comments regarding logging, formatting and comments * resolve pr comments regarding comments and added a missing newline * add assertions to check peers in live connections * | eth/downloader: speed up tests by generating chain only once (#17916)Felix Lange2018-11-073-560/+519 | | | | | | | | | | | | | | | | | | | | | | | | * core: speed up GenerateChain Use a mock implementation of ChainReader instead of creating and destroying a BlockChain object for each generated block. * eth/downloader: speed up tests by generating chain only once This change reworks the downloader tests so they share a common test blockchain instead of generating a chain in every test. The tests are roughly twice as fast now. * | swarm/api: Fix #18007, missing signature should return HTTP 400 (#18008)Javier Peletier2018-11-072-6/+38 | | * | eth/downloader: remove the expired id directly (#17963)Wenbiao Zheng2018-11-071-4/+3 | | * | signer: remove ineffectual assignments (#18049)Martin Holst Swende2018-11-072-7/+7 | | | | | | | | | | | | * signer: remove ineffectual assignments * signer: remove ineffectual assignments * | core, eth/downloader: fix validation flaw, fix downloader printout flaw (#17974)Martin Holst Swende2018-11-072-6/+7 | | * | downloader: measure successfull deliveries, not failed (#17983)Martin Holst Swende2018-11-071-8/+11 | | | | | | | | | | | | * downloader: measure successfull deliveries, not failed * downloader: fix typos * | p2p/protocols: use keyed fields for struct instantiation (#18017)Corey Lin2018-11-071-1/+1 | | * | travis, appveyor: bump to Go 1.11.2 (#18031)Samuel Marks2018-11-072-3/+3 | | * | miner: fix miner stress test (#18039)gary rong2018-11-072-30/+16 | | * | swarm: Better syncing and retrieval option definition (#17986)holisticode2018-11-079-58/+147 | | | | | | | | | | | | | | | | * swarm: Better syncing and retrieval option definition * swarm/network/stream: better comments * swarm/network/stream: addressed PR comments * | swarm/api: unexport Respond methods (#18037)Anton Evangelatov2018-11-063-52/+51 | | * | swarm: modify context key (#17925)KimMachineGun2018-11-062-16/+10 | | | | | | | | | | | | * swarm: modify context key * gofmt sctx.go * | cmd/swarm: auto resolve default path according to env flag (#17960)Elad2018-11-042-10/+29 | | * | all: updated code owners file (#17987)Elad2018-11-011-5/+8 | | * | cmd/swarm/swarm-smoke: fix issue that loop variable capture in func (#17992)Roc Yu2018-10-291-8/+5 | | * | swarm: clean up unused private types and functions (#17989)Ferenc Szabo2018-10-2710-108/+13 |/ | | | | | | | | | | * swarm: clean up unused private types and functions Those that were identified by code inspection tool. * swarm/storage: move/add Proximity GoDoc from deleted private function The mentioned proximity() private function was deleted in: 1ca8fc1e6fa0ab4ab1aaca06d6fb32e173cd5f2f * p2p accounting (#17951)holisticode2018-10-265-0/+937 | | | | | | | | | | | | | | | | | | | | * p2p/protocols: introduced protocol accounting * p2p/protocols: added TestExchange simulation * p2p/protocols: add accounting simulation * p2p/protocols: remove unnecessary tests * p2p/protocols: comments for accounting simulation * p2p/protocols: addressed PR comments * p2p/protocols: finalized accounting implementation * p2p/protocols: removed unused code * p2p/protocols: addressed @nonsense PR comments * cmd/clef: replace password arg with prompt (#17897)Johns Beharry2018-10-261-15/+13 | | | | | | | | | | * cmd/clef: replace password arg with prompt (#17829) Entering passwords on the command line is not secure as it is easy to recover from bash_history or the process table. 1. The clef command addpw was renamed to setpw to better describe the functionality 2. The <password> argument was removed and replaced with an interactive prompt * cmd/clef: remove undeclared variable * eth/downloader: SetBlocksIdle is not used (#17962)Wenbiao Zheng2018-10-241-7/+0 | | | | | | __ <(o )___ ( ._> / `---' * core/state: simplify proof methods (#17965)Felix Lange2018-10-242-17/+13 | | | | This fixes the import cycle build error in core/vm tests. There is no need to refer to core/vm for a type definition. * core/vm: adds refund as part of the json standard trace (#17910)Martin Holst Swende2018-10-236-51/+79 | | | | | | | This adds the global accumulated refund counter to the standard json output as a numeric json value. Previously this was not very interesting since it was not used much, but with the new sstore gas changes the value is a lot more interesting from a consensus investigation perspective. * eth/downloader: fix comment typos (#17956)Wenbiao Zheng2018-10-232-6/+6 | * swarm/network/stream: disambiguate chunk delivery messages (retrieval… ↵holisticode2018-10-214-12/+47 | | | | | | | | | | (#17920) * swarm/network/stream: disambiguate chunk delivery messages (retrieval vs syncing) * swarm/network/stream: addressed PR comments * swarm/network/stream: stream protocol version change due to new message types in this PR * swarm/api/http: remove ModTime=now for direct and multipart uploads (#17945)Elad2018-10-191-2/+0 | * cmd/bootnode: fix -writeaddress output (#17932)Felix Lange2018-10-191-2/+2 | * accounts: wallet derivation path comment is mistaken (#17934)Wenbiao Zheng2018-10-191-2/+2 | * core: fix a typo (#17941)Wuxiang2018-10-191-1/+1 | * swarm/network: disallow historical retrieval requests (#17936)Elad2018-10-195-7/+11 | * EIP-1186 eth_getProof (#17737)Simon Jentzsch2018-10-194-0/+105 | | | | | | | | | | | | | | | | * first impl of eth_getProof * fixed docu * added comments and refactored based on comments from holiman * created structs * handle errors correctly * change Value to *hexutil.Big in order to have the same output as parity * use ProofList as return type * swarm: Lightnode mode: disable sync, retrieve, subscription (#17899)Attila Gazso2018-10-187-15/+260 | | | | | | | | | | | | * swarm: Lightnode mode: disable sync, retrieve, subscription * swarm/network/stream: assign error and check in one line * swarm: restructured RegistryOption initializing * swarm: empty commit to retrigger CI build * swarm/network/stream: Added comments explaining RegistryOptions * swarm/tracing: disable stdout logging for opentracing (#17931)Anton Evangelatov2018-10-171-3/+2 | * metrics: added NewCounterForced (#17919)holisticode2018-10-161-1/+33 | * core/types: fix comment for func SignatureValues (#17921)Smilenator2018-10-161-1/+1 | * cmd/geth: don't set GOMAXPROCS by default (#17148)Wenbiao Zheng2018-10-161-3/+0 | | | | This is no longer needed because Go uses all CPUs by default. The change allows setting GOMAXPROCS in environment if needed. * core/vm: add shortcuts for trivial exp cases (#16851)Martin Holst Swende2018-10-161-4/+16 | * ethdb, rpc: support building on js/wasm (#17709)Dmitrij Koniajev2018-10-167-68/+236 | | | The changes allow building WebAssembly applications which use ethclient.Client. * p2p: meter peer traffic, emit metered peer events (#17695)Kurkó Mihály2018-10-163-18/+187 | | | | | | | | | This change extends the peer metrics collection: - traces the life-cycle of the peers - meters the peer traffic separately for every peer - creates event feed for the peer events - emits the peer events * accounts/usbwallet: simplify code using -= operator (#17904)Evgeny2018-10-162-2/+2 | * cmd/clef: fix typos in README (#17908)Grachev Mikhail2018-10-161-3/+3 | * tests: update tests, implement no-pow blocks (#17902)Martin Holst Swende2018-10-165-29/+26 | | | | This commit updates our tests with the latest and greatest from ethereum/tests. It also contains implementation of NoProof for blockchain tests. * rpc: fix client shutdown hang when Close races with Unsubscribe (#17894)Felix Lange2018-10-153-47/+102 | | | Fixes #17837 * swarm/network/stream: generalise setting of next batch (#17818)Viktor Trón2018-10-127-77/+89 | | | | | | | | * swarm/network/stream: generalize SetNextBatch and add Server SessionIndex * swarm/network/stream: fix a typo in comment * swarm/network/stream: remove live argument from NewSwarmSyncerServer * swarm/storage: Add accessCnt for GC (#17845)lash2018-10-122-143/+358 | * cmd/swarm: Smoke test for Swarm Feed (#17892)lash2018-10-123-6/+351 | * cmd/swarm: split flags and cli command declarations to the relevant files ↵Elad2018-10-1211-422/+468 | | | | (#17896) * p2p, p2p/discover: add signed ENR generation (#17753)Felix Lange2018-10-1224-275/+976 | | | | | | | | | | | | | | | This PR adds enode.LocalNode and integrates it into the p2p subsystem. This new object is the keeper of the local node record. For now, a new version of the record is produced every time the client restarts. We'll make it smarter to avoid that in the future. There are a couple of other changes in this commit: discovery now waits for all of its goroutines at shutdown and the p2p server now closes the node database after discovery has shut down. This fixes a leveldb crash in tests. p2p server startup is faster because it doesn't need to wait for the external IP query anymore. * p2p/simulations: fix a deadlock and clean up adapters (#17891)Felix Lange2018-10-129-418/+164 | | | | | | | | | | | | | | | | | | | | | | | | This fixes a rare deadlock with the inproc adapter: - A node is stopped, which acquires Network.lock. - The protocol code being simulated (swarm/network in my case) waits for its goroutines to shut down. - One of those goroutines calls into the simulation to add a peer, which waits for Network.lock. The fix for the deadlock is really simple, just release the lock before stopping the simulation node. Other changes in this PR clean up the exec adapter so it reports node startup errors better and remove the docker adapter because it just adds overhead. In the exec adapter, node information is now posted to a one-shot server. This avoids log parsing and allows reporting startup errors to the simulation host. A small change in package node was needed because simulation nodes use port zero. Node.{HTTP,WS}Endpoint now return the live endpoints after startup by checking the TCP listener. * Merge pull request #17887 from karalabe/warn-failed-account-accessPéter Szilágyi2018-10-101-3/+9 |\ | | | | internal/ethapi: warn on failed account accesses | * internal/ethapi: warn on failed account accessesPéter Szilágyi2018-10-101-3/+9 |/ * rpc: fix subscription corner case and speed up tests (#17874)Felix Lange2018-10-092-71/+68 | | | | | | | | | | | | | | | | Notifier tracks whether subscription are 'active'. A subscription becomes active when the subscription ID has been sent to the client. If the client sends notifications in the request handler before the subscription becomes active they are dropped. The tests tried to work around this problem by always waiting 5s before sending the first notification. Fix it by buffering notifications until the subscription becomes active. This speeds up all subscription tests. Also fix TestSubscriptionMultipleNamespaces to wait for three messages per subscription instead of six. The test now finishes just after all notifications have been received and doesn't hit the 30s timeout anymore. * cmd/swarm: speed up tests (#17878)Elad2018-10-094-31/+38 | | | These minor changes already shaved off around 30s. * swarm, swarm/storage: lower constants for faster tests (#17876)Anton Evangelatov2018-10-096-21/+18 | | | | | | | | * swarm/storage: lower constants for faster tests * swarm: reduce test size for TestLocalStoreAndRetrieve * swarm: reduce nodes for dec_inc_node_count * cmd/clef: encrypt the master seed on disk (#17704)Martin Holst Swende2018-10-096-81/+206 | | | | | | | | | | | | | | * cmd/clef: encrypt master seed of clef Signed-off-by: YaoZengzeng <yaozengzeng@zju.edu.cn> * keystore: refactor for external use of encryption * clef: utilize keystore encryption, check flags correctly * clef: validate master password * clef: add json wrapping around encrypted master seed * params, swarm: begin Geth v1.8.18, Swarm v0.3.6 cyclePéter Szilágyi2018-10-092-8/+8 | * params, swarm: release Geth v1.8.17 and Swar v0.3.5Péter Szilágyi2018-10-092-8/+8 | * core/asm: Use hexadecimal addresses in assembly dumps (#17870)Guillaume Ballet2018-10-091-4/+4 | * Fix retrieval tests and simulation backends (#17723)holisticode2018-10-095-221/+391 | | | | | | | | | | | | | | | | | | | | * swarm/network/stream: introduced visualized snapshot sync test * swarm/network/stream: non-existing hash visualization sim * swarm/network/stream: fixed retrieval tests; new backend for visualization * swarm/network/stream: cleanup of visualized_snapshot_sync_sim_test.go * swarm/network/stream: rebased PR on master * swarm/network/stream: fixed loop logic in retrieval tests * swarm/network/stream: fixed iterations for snapshot tests * swarm/network/stream: address PR comments * swarm/network/stream: addressed PR comments * travis, build: speed up CI runs (#17854)Felix Lange2018-10-082-21/+15 | | | | | | | | | | | | | | | | | | * travis: exclude non-test jobs for PRs We don't usually look at these builders and not starting them removes ~15min of build time. * build: don't run vet before tests Recent versions of Go run vet during 'go test' and we have a dedicated lint job. * build: use -timeout 5m for tests Tests sometimes hang on Travis. CI runs are aborted after 10min with no output. Adding the timeout means we get to see the stack trace for timeouts. * miner: remove intermediate conversion to int in tests (#17853)Felix Lange2018-10-081-2/+2 | | | This fixes the tests on 32bit platforms. * cmd/utils: fix bug when checking for flag value conflicts (#17803)Ryan Schneider2018-10-081-1/+4 | * les, light: reduce les testing stress (#17867)gary rong2018-10-082-15/+15 | * trie: remove unused originalRoot field (#17862)Péter Szilágyi2018-10-081-5/+3 | * core/types: Log.Index is the index in block, not receipt (#17866)Wenbiao Zheng2018-10-081-1/+1 | * core/vm: reuse Keccak-256 hashes across opcode executions (#17863)Péter Szilágyi2018-10-083-6/+48 | * swarm/storage/feed: Expose MaxUpdateDataLength constant (#17858)Javier Peletier2018-10-082-4/+6 | * cmd/abigen: support for --type flag with piped data (#17648)Philip Schlump2018-10-061-3/+8 | * accounts/abi/bind: stop using goimports in the binding generator (#17768)Jeremy Schlatter2018-10-0615-11418/+153 | * tests: use non-constantinople ropsten for difficulty tests (#17850)Martin Holst Swende2018-10-061-3/+16 | | | This is a stopgap until new tests have been generated and imported. * core/vm : fix failing testcase (#17852)Martin Holst Swende2018-10-061-1/+2 | | | | | | * core/vm : fix failing testcase * core/vm: fix nitpick * Merge pull request #17839 from karalabe/downloader-invalid-hash-chain-fixPéter Szilágyi2018-10-052-3/+40 |\ | | | | eth/downloader: fix invalid hash chain error due to head mini reorg | * eth/downloader: fix invalid hash chain error due to head mini reorgPéter Szilágyi2018-10-052-3/+40 | | * | core/vm: SHA3 word cost for CREATE2 (#17812)Martin Holst Swende2018-10-052-0/+87 | | | | | | | | | | | | | | | | * core/vm: create2 address generation tests * core/vm: per byte cost of CREATE2 * core/vm: fix linter issue in test * | tests: do not exit early on log hash mismatch (#17844)Martin Holst Swende2018-10-051-3/+3 | | * | Merge pull request #17843 from karalabe/ropsten-block-and-chtsPéter Szilágyi2018-10-051-13/+13 |\ \ | |/ |/| params: add ropsten fork delay, update les checkpoints | * params: add ropsten fork delay, update les checkpointsPéter Szilágyi2018-10-051-13/+13 |/ * core/vm: faster create/create2 (#17806)Martin Holst Swende2018-10-049-55/+163 | | | | | | | | | | | | | | | | | | | | | | | | * core/vm/runtim: benchmark create/create2 * core/vm: do less hashing in CREATE2 * core/vm: avoid storing jumpdest analysis for initcode * core/vm: avoid unneccesary lookups, remove unused fields * core/vm: go formatting tests * core/vm: save jumpdest analysis locally * core/vm: use common.Hash instead of nil, fix review comments * core/vm: removed type destinations * core/vm: correct check for empty hash * eth: more elegant api_tracer * core/vm: address review concerns * swarm/storage: extract isValid. correctly remove invalid chunks from store ↵Anton Evangelatov2018-10-041-21/+21 | | | | on migration (#17835) * p2p: add enode URL to PeerInfo (#17838)Felix Lange2018-10-041-3/+5 | * Merge pull request #17801 from eosclassicteam/patch-1Péter Szilágyi2018-10-041-1/+1 |\ | | | | Enable constantinople on Ropsten testnet | * params: enable constantinople on ropsten at 4.2MEOS Classic2018-10-011-1/+1 | | * | eth: fixed the minor typo inside the comments (#17830)Liang Ma2018-10-041-1/+1 | | * | cmd/puppeth: fix node URL in health check (#17802)Felix Lange2018-10-041-4/+5 | | | | | | | | | | | | | | | | * cmd/puppeth: fix node URL in health check * cmd/puppeth: set external IP for geth * cmd/puppeth: fix enode cast issue * | cmd/evm: fix state dump (#17832)cdetrio2018-10-041-4/+4 | | * | cmd/swarm: disable tests under Windows until they are fixed (#17827)Anton Evangelatov2018-10-041-0/+17 | | * | core: use ChainHeadEvent subscription in the chain indexer (#17826)Felföldi Zsolt2018-10-031-6/+6 | | * | Merge pull request #17796 from epiclabs-io/mru-feedsViktor Trón2018-10-0344-812/+740 |\ \ | | | | | | swarm/storage/feeds: Renamed MRU to Swarm Feeds | * | swarm/storage/feed: Renamed packageJavier Peletier2018-10-0339-129/+129 | | | | * | swarm/storage/feeds: renamed vars that can conflict with package nameJavier Peletier2018-10-034-19/+19 | | | | * | swarm/storage/feeds: removed capital Feed throughoutJavier Peletier2018-10-0320-60/+60 | | | | * | swarm: Changed owners.Javier Peletier2018-10-032-2/+2 | | | | * | swarm/storage/feeds: Final package rename and moved filesJavier Peletier2018-10-0339-136/+137 | | | | * | swarm/storage/mru: Renamed rest of MRU referencesJavier Peletier2018-10-0319-382/+315 | | | | * | swarm/storage/mru: Renamed all comments to FeedsJavier Peletier2018-10-0314-102/+96 | | | | * | swarm/storage/mru: Renamed all identifiers to FeedsJavier Peletier2018-10-0324-236/+236 | | | * | | swarm: schemas and migrations (#17813)Anton Evangelatov2018-10-037-34/+81 | | | * | | core: fix unnecessary ancestor lookup after a fast sync (#17825)Péter Szilágyi2018-10-031-5/+5 | | | * | | travis, appveyor: bump to Go 1.11.1 (#17820)Samuel Marks2018-10-032-3/+3 |/ / * | cmd/swarm: fix appveyor build (#17808)Elad2018-10-023-7/+24 | | * | travis.yml: remove Go 1.9 (#17807)Anton Evangelatov2018-10-021-11/+0 | | * | Merge pull request #17771 from ethersphere/cmd-config-errorsViktor Trón2018-10-021-13/+30 |\ \ | | | | | | swarm: handle errors in cmdLineOverride and envVarsOverride | * | cmd/swarm: fix TestConfigFileOverridesJanos Guljas2018-09-282-3/+6 | | | | * | Merge branch 'master' into cmd-config-errorsJanos Guljas2018-09-281-5/+5 | |\ \ | * | | cmd/swarm: handle errors in cmdLineOverride and envVarsOverride functionsJanos Guljas2018-09-272-13/+27 | | | | * | | | Merge pull request #17799 from ethersphere/correct_swarm_versionViktor Trón2018-10-021-2/+2 |\ \ \ \ | | | | | | | | | | cmd/swarm: correct swarm version on --help | * | | | cmd/swarm: correct swarm version on --helpAnton Evangelatov2018-10-011-2/+2 | | | | | * | | | | Merge pull request #17800 from ethersphere/disable_cmd_swarm_tests_on_winViktor Trón2018-10-022-0/+4 |\ \ \ \ \ | |_|_|_|/ |/| | | | cmd/swarm: disable export and upload tests on Windows | * | | | cmd/swarm: disable export and upload tests on WindowsAnton Evangelatov2018-10-012-0/+4 | | | | | * | | | | les: limit state ODR retrievals to the last 100 blocks (#17744)Felföldi Zsolt2018-10-015-19/+26 | | | | | * | | | | accounts/abi: fix panic in MethodById lookup. Fixes #17797 (#17798)Martin Holst Swende2018-10-012-1/+13 |/ / / / * / / / cmd/swarm, swarm: cross-platform Content-Type detection (#17782)Alexey Sharov2018-10-0113-90/+3379 |/ / / | | | | | | | | | | | | | | | | | | - Mime types generator (Standard "mime" package rely on system-settings, see mime.osInitMime) - Changed swarm/api.Upload: - simplify I/O throttling by semaphore primitive and use file name where possible - f.Close() must be called in Defer - otherwise panic or future added early return will cause leak of file descriptors - one error was suppressed * | | core, internal/ethapi: add and use LRU cache for receipts (#17610)Ryan Schneider2018-09-302-16/+20 | | | * | | core/types: make tx signature values optional in JSON (#17742)reinerRubin2018-09-302-12/+23 | | | * | | eth: broadcast blocks to at least 4 peers (#17725)ledgerwatch2018-09-302-8/+109 | | | * | | cmd/swarm: remove swarm binary (#17784)Wenbiao Zheng2018-09-301-0/+0 | | | * | | eth/downloader: use intermediate variable for better readability (#17510)Wenbiao Zheng2018-09-301-4/+8 | | | * | | core/types: fix typos (#17762)thumb84322018-09-301-2/+2 | | | * | | internal/ethapi: add eth_chainId method (#17617)HackyMiner2018-09-302-0/+14 | | | | | | | | | This implements EIP-695. * | | internal/debug: support color terminal for cygwin/msys2 (#17740)HackyMiner2018-09-2923-296/+326 | | | | | | | | | | | | | | | - update go-colorable, go-isatty, go-runewidth packages - use go-isatty instead of log/term and remove log/term package * | | cmd/swarm: respect --loglevel in run_test helpers (#17739)Ferenc Szabo2018-09-291-2/+2 | | | | | | | | | | | | | | | | | | | | | When CLI tests were spanning new nodes, the log level verbosity was hard coded as 6. So the Swarm process was always polluting the test output with TRACE level logs. Now `go test -v ./cmd/swarm -loglevel 0` works as expected. * | | accounts/abi/bind/backends: fix typo (#17749)CDsigma2018-09-291-1/+1 | | | * | | contracts/ens: expose Add and SetAddr in ENS (#17661)Javier Peletier2018-09-292-4/+53 | | | | | | | | | I am planning to use this to resolve names to user addresses for Swarm/MRU feeds. * | | tests: update slow test lists, skip on windows/386 (#17758)Felix Lange2018-09-294-15/+28 | | | * | | build: fix typo (#17773)HarryWu2018-09-291-1/+1 | | | * | | swarm/storage: ensure 64bit hasherStore struct alignment (#17766)Janoš Guljaš2018-09-291-1/+4 | | | * | | Merge pull request #17781 from ethersphere/trim_newlineViktor Trón2018-09-294-9/+7 |\ \ \ | | | | | | | | cmd/swarm: trim new lines from files | * | | swarm/storage: make linter happyAnton Evangelatov2018-09-283-7/+5 | | | | | * | | cmd/swarm: trim new lines from filesAnton Evangelatov2018-09-281-2/+2 | | | | * | | | Clef: USB hw wallet support (#17756)Martin Holst Swende2018-09-287-3/+169 |/ / / | | | | | | | | | | | | | | | * signer: implement USB interaction with hw wallets * signer: fix failing testcases * | | Swarm MRUs: Adaptive frequency / Predictable lookups / API simplification ↵Javier Peletier2018-09-28