Giter VIP home page Giter VIP logo

gochain's Introduction

GoChain Logo

GoChain

Official golang implementation of the GoChain protocol.

API Reference

Mainnet: Live Stats | Block Explorer | Public RPC Endpoint

General Documentation

If you are looking to build DApps, deploy smart contracts, setup a private network or run a node, please see our Documentation Repository, it will be much more useful to you.

If you plan on working on the GoChain core code, then read on.

Building the source

Building gochain requires both a Go (version 1.12 or later) and a C compiler. You can install them using your favourite package manager. Once the dependencies are installed, run:

# build gochain
make gochain

or, to build the full suite of utilities:

make all

Executables

The GoChain project comes with several wrappers/executables found in the cmd directory.

Command Description
gochain Our main GoChain CLI client. It is the entry point into the GoChain 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 GoChain network via JSON RPC endpoints exposed on top of HTTP, WebSocket and/or IPC transports. gochain --help and the CLI Wiki page for command line options.
abigen Source code generator to convert GoChain contract definitions into easy to use, compile-time type-safe Go packages. It operates on plain Ethereum contract ABIs 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 wiki page for details.
bootnode Stripped down version of our GoChain 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.
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 isolated, fine-grained debugging of EVM opcodes (e.g. evm --code 60ff60ff --debug).
gethrpctest Developer utility tool to support our ethereum/rpc-test test suite which validates baseline conformity to the Ethereum JSON RPC specs. Please see the test suite's readme for details.
rlpdump Developer utility tool to convert binary RLP (Recursive Length Prefix) 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 GoChain

Full node on the main GoChain network

By far the most common scenario is people wanting to simply interact with the GoChain 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:

$ gochain console

This command will:

  • Start GoChain in fast sync mode (default, can be changed with the --syncmode flag), causing it to download more data in exchange for avoiding processing the entire history of the GoChain network, which is very CPU intensive.
  • Start up GoChain's built-in interactive JavaScript console, (via the trailing console subcommand) through which you can invoke all official web3 methods as well as GoChain's own management APIs. This too is optional and if you leave it out you can always attach to an already running GoChain instance with gochain attach.

Full node on the GoChain test network

Transitioning towards developers, if you'd like to play around with creating GoChain 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-GOC only.

$ gochain --testnet console

The 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.

Specifying the --testnet flag however will reconfigure your GoChain instance a bit:

  • Instead of using the default data directory (~/.gochain on Linux for example), GoChain will nest itself one level deeper into a testnet subfolder (~/.gochain/testnet on Linux). Note, on OSX and Linux this also means that attaching to a running testnet node requires the use of a custom endpoint since gochain attach will try to attach to a production node endpoint by default. E.g. gochain attach <datadir>/testnet/gochain.ipc. Windows users are not affected by this.
  • Instead of connecting the main GoChain 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, you should make sure to always use separate accounts for play-money and real-money. Unless you manually move accounts, GoChain will by default correctly separate the two networks and will not make any accounts available between them.

Configuration

As an alternative to passing the numerous flags to the gochain binary, you can also pass a configuration file via:

$ gochain --config /path/to/your_config.toml

To get an idea how the file should look like you can use the dumpconfig subcommand to export your existing configuration:

$ gochain --your-favourite-flags dumpconfig

Docker quick start

One of the quickest ways to get GoChain up and running on your machine is by using Docker:

docker run -d --name gochain-node -v /Users/alice/GoChain:/root \
           -p 8545:8545 -p 30303:30303 \
           ghcr.io/gochain/gochain

This will start GoChain in fast-sync mode with a DB memory allowance of 1GB 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.

Do not forget --rpcaddr 0.0.0.0, if you want to access RPC from other containers and/or hosts. By default, gochain binds to the local interface and RPC endpoints is not accessible from the outside.

Programatically interfacing GoChain nodes

As a developer, sooner rather than later you'll want to start interacting with GoChain network via your own programs and not manually through the console. To aid this, GoChain has built in support for a JSON-RPC based APIs (standard APIs and GoChain specific APIs). These can be exposed via HTTP, WebSockets and IPC (unix sockets on unix based platforms, and named pipes on Windows).

The IPC interface is enabled by default and exposes all the APIs supported by GoChain, 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 GoChain node configured with the above flags and you'll need to speak JSON-RPC 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 GoChain 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

See: https://github.com/gochain/docs/tree/master/nodes/custom

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 GoChain, please fork, fix, commit and send a pull request for the maintainers to review and merge into the main code base.

Please make sure your contributions adhere to our coding guidelines:

  • Code must adhere to the official Go formatting guidelines (i.e. uses gofmt).
  • Code must be documented adhering to the official Go 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. "gochain, rpc: make trace configs optional"

License

The gochain library (i.e. all code outside of the cmd directory) is licensed under the GNU Lesser General Public License v3.0, also included in our repository in the COPYING.LESSER file.

The gochain binaries (i.e. all code inside of the cmd directory) is licensed under the GNU General Public License v3.0, also included in our repository in the COPYING file.

gochain's People

Contributors

arachnid avatar bas-vk avatar benbjohnson avatar cjentzsch avatar cubedro avatar debris avatar dependabot[bot] avatar ebuchman avatar egonelbre avatar ethers avatar ferhatelmas avatar fjl avatar gavofyork avatar gballet avatar gluk256 avatar guilhermebr avatar holiman avatar jimenezrick avatar jmank88 avatar karalabe avatar lmars avatar obscuren avatar rjl493456442 avatar tgerring avatar treeder avatar vbuterin avatar wanderer avatar winsvega avatar zelig avatar zsfelfoldi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gochain's Issues

Change Default ExtraData Encoding

By default, extra data is:

// create default extradata
extra, _ = rlp.EncodeToBytes([]interface{}{
	params.Version,
	"gochain",
	runtime.Version(),
	runtime.GOOS,
})

This is not very human readable without decoding:
screenshot from 2018-05-11 11-17-46

We're using string values, so we don't save any space by using RLP, so we should just put a plain string in here, perhaps using slashes to align with netstats:
screenshot from 2018-05-11 11-19-00

Some other sort of distinct identifying information might be good here.

Reduce wasteful block signing

Seems we're pretty CPU bound right now when pushing a high number of transactions so it would be good to find ways to reduce CPU usage.

Currently we have an INTURN flag which is an additional weight for the node that should be signing (next in line), but it doesn't stop others from signing and then throwing out their own block. Thinking we could have a window of nodes in the ring that should sign and the rest don't bother. For example, say node 10 just signed a block, then only node 11-13 would attempt to sign the next block, the rest wouldn't bother.

Could probably do something similar for verifications as well, where only a subset of nodes verify each block.

Test smart contracts

  • Use some common tools like Truffle framework
  • Use the RPC-API servers so users don't have to run nodes
  • Test a common contract like an ERC20 token

Add RPC method for total supply

Add something like eth_totalSupply to get the total GO in circulation at a given block (default to latest).
The current formula is block number * 7 + genesis allocation.

Enable passing in the signing nodes coinbase password/key via ENV vars

See: https://github.com/ethereum/go-ethereum/wiki/Running-in-Docker

We should mount the data dir like at the bottom of that plus enable env vars that will be different for each signing node.

  • Keys created with: geth --datadir node1 account new
  • Then remember account address, password, and copy the key from node1/keystore
  • also needs the bootnodes enode.

This is the starting command: geth --datadir node1 --networkid 8888 --bootnodes "enode://e0d1ada6b37e0d9886d15019eae8f6f123c9a98f4e3308398a848c440f1acd73aebc84215dc252bfcefe1615941dea1c873919b8cd38c4c2956f2c0fcc70ea07@127.0.0.1:30301" --port 30303 console

TODO: attempt that with the --mine option so we dont' have to call miner.start() afterwards.

Lock down RPC protocol

Currently if a wallet is unlocked, anyone who can reach that server can start using that wallet. We should make it so that ONLY localhost can use that wallet OR even better, make every request that needs to use a wallet have to pass in a token/key.

Cannot add signer node

  1. Attach to voter node (devnet node1)
  2. unlock voters account - personal.unlockAccount('0x7aeceb5d345a01f8014a4320ab1f3d467c0c086a', PASSWORD_HERE)
  3. Propose signer - clique.propose('0x42874f007f5d4646c43079056f2a05efe71d2517', true) //node4
  4. Get list of signers - clique.getSigners()

Expected - node added as signer

Actual - no changes in list of signers

Don't log writes to closed connections

We log lines like these often:

Cannot send rlpx disc msg while closing  err="write tcp 172.20.0.3:30303->185.80.48.164:58638: write: connection reset by peer"

Failed to broadcast txs                  id=5e9205a569661d5b conn=trusted-staticdial len=1 err="shutting down"

Cannot set rlpx read deadline            err="set tcp 172.18.0.2:30303: use of closed network connection"

If these are just the result of queued up broadcasts flushing out after a peer connection closes, then there is no need to log them.

Failed to broadcast txs in particular is commonly logged in blocks of hundreds of identical lines.

Run a 10 node cluster for testing

To test network bandwidth requirements and optimize networking/syncing.

While doing this test the voting system too.

  • Add nodes via voting
  • remove/downsize the cluster via voting too

Priority Peer Broadcasting

Some of the peer broadcasts (e.g. tx broadcasts) go out to randomized subsets of peers. This is suboptimal, and we should be able to improve stability by prioritizing peers based on whether they are trusted, known to be a signer, or even based on who is likely to sign upcoming blocks. Essentially, it is more important for signers to be up to date than proxies or third party nodes, and it is most important that the next signer be up to date.

Every node in the network can't connect to the signer nodes at once, but if a node happens to have signing peers connected (randomly, or if it is signing itself), then I think it makes sense to favor those peers. So rather than a random sqrt(n) subset of peers, maybe we send to all signing peers and some others, up to a limit. Then again, maybe we can just send to all peers, and not limit to a subset at all. <- This is costly and scales poorly

Write or find a tool that will start, update and restart containers

This is what we'll deploy to servers, then it will start the gochain container.

  • Checks docker hub for new image (check tags probably)
  • Pull newer tag (semver)
  • Stop and start the gochain container.
  • If version has decreased on docker hub, then rollback to the latest version on docker hub.

This would probably be best as a docker image too with the socket mounted.

This might be close to what we're looking for: https://www.techrepublic.com/article/how-to-automatically-update-docker-containers-with-watchtower/
Or this: https://github.com/binfalse/docker-auto-update
With some mods maybe.

Requires #4

Verify --testnet flag is working

I thought I used --testnet locally before, but I just failed to use it on a testnet signer node. Maybe the genesis got out of date.

Testnet genesis:

JSON
{
  "config": {
    "chainId": 31337,
    "homesteadBlock": 1,
    "eip150Block": 2,
    "eip150Hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "eip155Block": 3,
    "eip158Block": 3,
    "byzantiumBlock": 4,
    "clique": {
      "period": 5,
      "epoch": 3000
    }
  },
  "nonce": "0x0",
  "timestamp": "0x5a7c6cbd",
  "extraData": "0x0000000000000000000000000000000000000000000000000000000000000000",
  "signers": [
    "0x7aeceb5d345a01f8014a4320ab1f3d467c0c086a",
    "0xdd7e460302a911f9162a208370cdcdc37b892453",
    "0x10a8a552c8a8945f32f6fded5e44d9101b3491d8"
  ],
  "voters": [
    "0x7aeceb5d345a01f8014a4320ab1f3d467c0c086a"
  ],
  "signer": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
  "gasLimit": "0xC88AFA0",
  "difficulty": "0x1",
  "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
  "coinbase": "0x0000000000000000000000000000000000000000",
  "alloc": {
    "0x2Fe70F1Df222C85ad6Dd24a3376Eb5ac32136978": {
      "balance": "1000000000000000000000000000"
    }
  },
  "number": "0x0",
  "gasUsed": "0x0",
  "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000"
}
Go
Genesis{
	Config: ChainConfig{
		ChainId:        big.NewInt(31337),
		HomesteadBlock: big.NewInt(1),
		EIP150Block:    big.NewInt(2),
		EIP150Hash:     common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000000"),
		EIP155Block:    big.NewInt(3),
		EIP158Block:    big.NewInt(3),
		ByzantiumBlock: big.NewInt(4),

		Clique: &CliqueConfig{
			Period: 5,
			Epoch:  3000,
		},
	},
	Timestamp:  1518103741,
	ExtraData:  hexutil.MustDecode("0x0000000000000000000000000000000000000000000000000000000000000000"),
	GasLimit:   210284448,
	Difficulty: big.NewInt(1),
	Signers: []common.Address{
		common.HexToAddress("0x7aeceb5d345a01f8014a4320ab1f3d467c0c086a"),
		common.HexToAddress("0xdd7e460302a911f9162a208370cdcdc37b892453"),
		common.HexToAddress("0x10a8a552c8a8945f32f6fded5e44d9101b3491d8"),
	},
	Voters: []common.Address{
		common.HexToAddress("0x7aeceb5d345a01f8014a4320ab1f3d467c0c086a"),
	},
	Signer: hexutil.MustDecode("0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"),
	Alloc:  decodePrealloc(testnetAllocData),
}

Empty Blocks

This issue is for discussion about Empty Blocks.

I suggest a way to decrease the number of empty blocks as follow:

Set a MAX_PERIOD without a block.
When sealing, check for transactions, if have, then seal the block.
If not, check for MAX_PERIOD,
if reached MAX_PERIOD, seal an empty block,
If not reached, do nothing...

Testnet proxy error

panic: runtime error: index out of range

goroutine 96 [running]:
github.com/gochain-io/gochain/core/types.NewTransactionsByPriceAndNonce(0x10ed460, 0xc420038040, 0x10ee2e0, 0xc4a98ca680, 0xc48a3fb2f0, 0xc42033d900)
	/go/src/github.com/gochain-io/gochain/core/types/transaction.go:384 +0x444
github.com/gochain-io/gochain/miner.(*worker).commitNewWork(0xc4200e0a00, 0x10ed460, 0xc420038040)
	/go/src/github.com/gochain-io/gochain/miner/worker.go:436 +0x909
github.com/gochain-io/gochain/miner.(*worker).update(0xc4200e0a00, 0x10ed460, 0xc420038040)
	/go/src/github.com/gochain-io/gochain/miner/worker.go:252 +0x70b
created by github.com/gochain-io/gochain/miner.newWorker
	/go/src/github.com/gochain-io/gochain/miner/worker.go:152 +0x4d2

Finalize and embed mainnet genesis

Testnet genesis, for reference:

JSON
{
  "config": {
    "chainId": 31337,
    "homesteadBlock": 1,
    "eip150Block": 2,
    "eip150Hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "eip155Block": 3,
    "eip158Block": 3,
    "byzantiumBlock": 4,
    "clique": {
      "period": 5,
      "epoch": 3000
    }
  },
  "nonce": "0x0",
  "timestamp": "0x5a7c6cbd",
  "extraData": "0x0000000000000000000000000000000000000000000000000000000000000000",
  "signers": [
    "0x7aeceb5d345a01f8014a4320ab1f3d467c0c086a",
    "0xdd7e460302a911f9162a208370cdcdc37b892453",
    "0x10a8a552c8a8945f32f6fded5e44d9101b3491d8"
  ],
  "voters": [
    "0x7aeceb5d345a01f8014a4320ab1f3d467c0c086a"
  ],
  "signer": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
  "gasLimit": "0xC88AFA0",
  "difficulty": "0x1",
  "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
  "coinbase": "0x0000000000000000000000000000000000000000",
  "alloc": {
    "0x2Fe70F1Df222C85ad6Dd24a3376Eb5ac32136978": {
      "balance": "1000000000000000000000000000"
    }
  },
  "number": "0x0",
  "gasUsed": "0x0",
  "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000"
}
Go
Genesis{
	Config: ChainConfig{
		ChainId:        big.NewInt(31337),
		HomesteadBlock: big.NewInt(1),
		EIP150Block:    big.NewInt(2),
		EIP150Hash:     common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000000"),
		EIP155Block:    big.NewInt(3),
		EIP158Block:    big.NewInt(3),
		ByzantiumBlock: big.NewInt(4),

		Clique: &CliqueConfig{
			Period: 5,
			Epoch:  3000,
		},
	},
	Timestamp:  1518103741,
	ExtraData:  hexutil.MustDecode("0x0000000000000000000000000000000000000000000000000000000000000000"),
	GasLimit:   210284448,
	Difficulty: big.NewInt(1),
	Signers: []common.Address{
		common.HexToAddress("0x7aeceb5d345a01f8014a4320ab1f3d467c0c086a"),
		common.HexToAddress("0xdd7e460302a911f9162a208370cdcdc37b892453"),
		common.HexToAddress("0x10a8a552c8a8945f32f6fded5e44d9101b3491d8"),
	},
	Voters: []common.Address{
		common.HexToAddress("0x7aeceb5d345a01f8014a4320ab1f3d467c0c086a"),
	},
	Signer: hexutil.MustDecode("0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"),
	Alloc:  decodePrealloc(testnetAllocData),
}

Run tests with race detector

In #153, many races were fixed, but the race detector was not left on for the general build because it runs too long for CI. We should find a way to fix this, or at least run -race for a subset of critical packages, like ./core or ./core/...

TxPool configuration should default not zero missing toml fields

If TxPool is configured via the toml file, any omitted fields are zeroed instead of set to defaults. This is inconsistent with other config groups.

Here we see defaults:

gochain dumpconfig

...
[Eth.TxPool]
NoLocals = false
Journal = "transactions.rlp"
Rejournal = 3600000000000
PriceLimit = 1
PriceBump = 10
AccountSlots = 128
GlobalSlots = 32768
AccountQueue = 512
GlobalQueue = 8192
Lifetime = 10800000000000

[Node.P2P]
MaxPeers = 25
NoDiscovery = false
BootstrapNodes = []
StaticNodes = []
TrustedNodes = []
ListenAddr = ":30303"
EnableMsgEvents = false
...

By including this configuration:

[Eth.TxPool]
Lifetime = 1000

[Node.P2P]
StaticNodes = []

We can see that the TxPool fields are zeroed, while the P2P fields are set to defaults:

gochain --config config.toml dumpconfig

...
[Eth.TxPool]
NoLocals = false
Journal = ""
Rejournal = 0
PriceLimit = 0
PriceBump = 0
AccountSlots = 0
GlobalSlots = 0
AccountQueue = 0
GlobalQueue = 0
Lifetime = 1000

[Node.P2P]
MaxPeers = 25
NoDiscovery = false
BootstrapNodes = []
StaticNodes = []
TrustedNodes = []
ListenAddr = ":30303"
EnableMsgEvents = false
...

The omitted TxPool fields should be set to defaults as well.

Update benchmark script

This update will do the following:

  1. create 10 accounts
  2. send each of them a chunk of coin from coinbase (assuming we've funded each coinbase on the nodes from the initial node)
  3. send X tx/second randomly to and from the ten accounts (where X = 1300 / number of nodes)

Offchain storage

At ~1500 tps, we're generating about 0.7 GB per hour.

.7 GB • 24 hours * 7 days = 117.6 GB per week.

We need to enable offchain storage to reduce disk space.

Let's provide an s3 option and if configured it will upload old blocks, default 7 days and older, to s3.

Improve Transaction Throughput

Here are some benchmark results from running distbench against my local 3 node cluster @ 300 tps for 5 minutes:

Block #1539 has 416 transactions - 1520359538
Block #1540 has 1594 transactions - 1520359543
Block #1541 has 1976 transactions - 1520359548
Block #1542 has 1766 transactions - 1520359553
Block #1543 has 1654 transactions - 1520359558
Block #1544 has 1020 transactions - 1520359563
Block #1545 has 1121 transactions - 1520359568
Block #1546 has 1962 transactions - 1520359573
Block #1547 has 1781 transactions - 1520359578
Block #1548 has 1682 transactions - 1520359583
Block #1549 has 1500 transactions - 1520359588
Block #1550 has 810 transactions - 1520359593
Block #1551 has 1255 transactions - 1520359598
Block #1552 has 1487 transactions - 1520359603
Block #1553 has 1840 transactions - 1520359608
Block #1554 has 1562 transactions - 1520359613
Block #1555 has 1230 transactions - 1520359618
Block #1556 has 999 transactions - 1520359623
Block #1557 has 1881 transactions - 1520359628
Block #1558 has 1859 transactions - 1520359633
Block #1559 has 1302 transactions - 1520359638
Block #1560 has 1651 transactions - 1520359643
Block #1561 has 1295 transactions - 1520359648
Block #1562 has 1406 transactions - 1520359653
Block #1563 has 1721 transactions - 1520359658
Block #1564 has 1686 transactions - 1520359663
Block #1565 has 1496 transactions - 1520359668
Block #1566 has 1396 transactions - 1520359673
Block #1567 has 1335 transactions - 1520359678
Block #1568 has 1623 transactions - 1520359683
Block #1569 has 1413 transactions - 1520359688
Block #1570 has 1585 transactions - 1520359693
Block #1571 has 1322 transactions - 1520359698
Block #1572 has 1736 transactions - 1520359703
Block #1573 has 1153 transactions - 1520359708
Block #1574 has 2919 transactions - 1520359714
Block #1575 has 1205 transactions - 1520359719
Block #1576 has 739 transactions - 1520359724
Block #1578 has 2452 transactions - 1520359734
Block #1579 has 2517 transactions - 1520359739
Block #1580 has 1349 transactions - 1520359744
Block #1581 has 1380 transactions - 1520359749
Block #1582 has 1217 transactions - 1520359754
Block #1583 has 1517 transactions - 1520359759
Block #1584 has 1474 transactions - 1520359764
Block #1585 has 1430 transactions - 1520359769
Block #1586 has 1500 transactions - 1520359774
Block #1587 has 1604 transactions - 1520359779
Block #1588 has 1539 transactions - 1520359784
Block #1589 has 1321 transactions - 1520359789
Block #1590 has 1521 transactions - 1520359794
Block #1591 has 1433 transactions - 1520359799
Block #1592 has 1764 transactions - 1520359804
Block #1593 has 1318 transactions - 1520359809
Block #1594 has 1300 transactions - 1520359814
Block #1596 has 2736 transactions - 1520359824
Block #1597 has 2399 transactions - 1520359829
Block #1598 has 1245 transactions - 1520359834
Block #1599 has 156 transactions - 1520359839
Total txs: 89550
Time(s): 306
Tx/s: 293

Sending transactions faster than this tends to bog down the nodes - e.g. 500 tps locked them up for several minutes before blocks started processing again.

Preliminary analysis indicates that managing the TxPool becomes prohibitively expensive as it grows (txPricedList keeps a binary heap priceHeap), and most/all cycles go to managing that structure and related operations, preventing blocks from being mined.

Potential improvements:

  1. Improve performance of TxPool and other related tx ingestion operations
  2. Yield to mining, even if that means rejecting some txs, to prevent death spiral caused by continually growing pool

Gas Price Oracle

We need to recalibrate and possibly refactor the gas price oracle.
The 18gwei default gas price limit can be lowered, and the gas price should remain low under light load, and quickly return to the default under no load.

https://github.com/ethereum/go-ethereum/wiki/Gas-Price-Oracle <- This is completely out of sync with the codebase :( gpoblocks and gpopercentile are the only flags actually available

Losing state block cache

Gochain is not storing the block State cache in Disk, so after restart is losing all blocks and need to resync with other nodes

WARN [02-25|14:13:38|core/blockchain.go:224] Head state missing, repairing chain number=134 hash=d2b178…a0723f
INFO [02-25|14:13:38|core/blockchain.go:440] Rewound blockchain to past state number=7 hash=7b0d7e…177336
INFO [02-25|14:13:38|core/blockchain.go:254] Loaded most recent local header number=134 hash=d2b178…a0723f td=269
INFO [02-25|14:13:38|core/blockchain.go:255] Loaded most recent local full block number=7 hash=7b0d7e…177336 td=15
INFO [02-25|14:13:38|core/blockchain.go:256] Loaded most recent local fast block number=134 hash=d2b178…a0723f td=269

Validate TxPool configuration

It is possible to configure the TxPool to have pool limits of 0, which results in full pool errors. We should validate the TxPool configuration and reject bad configurations.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.