Giter Site home page Giter Site logo

status-im / go-ethereum Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ethereum/go-ethereum

16.0 22.0 9.0 204.2 MB

Official golang implementation of the Ethereum protocol

Home Page: http://ethereum.github.io/go-ethereum/

License: GNU Lesser General Public License v3.0

Makefile 0.10% Go 89.00% Shell 0.11% C 5.38% JavaScript 3.50% Ruby 0.01% M4 0.21% Java 0.24% Python 0.05% NSIS 0.19% Assembly 0.76% HTML 0.09% Solidity 0.12% Dockerfile 0.01% Sage 0.24%

go-ethereum's Introduction

Go Ethereum

Official Golang implementation of the Ethereum protocol.

API Reference Go Report Card Travis Discord

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.

Building geth requires both a Go (version 1.14 or later) 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 page for command line options.
clef Stand-alone signing tool, which can be used as a backend signer for geth.
devp2p Utilities to interact with nodes on the networking layer, without running a full blockchain.
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 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 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.
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 run).
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).
puppeth a CLI wizard that aids in creating a new Ethereum network.

Running geth

Going through all the possible command line flags is out of scope here (please consult our CLI Wiki page), 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 console

This command will:

  • Start geth 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 Ethereum network, which is very CPU intensive.
  • Start up geth's built-in interactive JavaScript console, (via the trailing console subcommand) through which you can interact using web3 methods (note: the web3 version bundled within geth is very old, and not up to date with official docs), as well as geth's own management APIs. This tool is optional and if you leave it out you can always attach to an already running geth instance with geth attach.

A Full node on the Görli 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 --goerli console

The console subcommand has 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 here.

Specifying the --goerli flag, however, will reconfigure your geth instance a bit:

  • Instead of connecting the main Ethereum network, the client will connect to the Görli test network, which uses different P2P bootnodes, different network IDs and genesis states.
  • Instead of using the default data directory (~/.ethereum on Linux for example), geth will nest itself one level deeper into a goerli subfolder (~/.ethereum/goerli 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 geth attach will try to attach to a production node endpoint by default, e.g., geth attach <datadir>/goerli/geth.ipc. Windows users are not affected by this.

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, geth will by default correctly separate the two networks and will not make any accounts available between them.

Full node on the Rinkeby test network

Go Ethereum also supports connecting to the older proof-of-authority based test network called Rinkeby which is operated by members of the community.

$ geth --rinkeby console

Full node on the Ropsten test network

In addition to Görli and Rinkeby, Geth also supports the ancient Ropsten testnet. The Ropsten test network is based on the Ethash proof-of-work consensus algorithm. As such, it has certain extra overhead and is more susceptible to reorganization attacks due to the network's low difficulty/security.

$ geth --ropsten console

Note: Older Geth configurations store the Ropsten database in the testnet subdirectory.

Configuration

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

$ geth --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:

$ geth --your-favourite-flags dumpconfig

Note: This works only with geth v1.6.0 and above.

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

This will start geth 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. There is also an alpine tag available for a slim version of the image.

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

Programmatically 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 and geth 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 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:

  • --http Enable the HTTP-RPC server
  • --http.addr HTTP-RPC server listening interface (default: localhost)
  • --http.port HTTP-RPC server listening port (default: 8545)
  • --http.api API's offered over the HTTP-RPC interface (default: eth,net,web3)
  • --http.corsdomain Comma separated list of domains from which to accept cross origin requests (browser enforced)
  • --ws Enable the WS-RPC server
  • --ws.addr WS-RPC server listening interface (default: localhost)
  • --ws.port WS-RPC server listening port (default: 8546)
  • --ws.api API's offered over the WS-RPC interface (default: eth,net,web3)
  • --ws.origins 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 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 web servers, so malicious web pages 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):

{
  "config": {
    "chainId": <arbitrary positive integer>,
    "homesteadBlock": 0,
    "eip150Block": 0,
    "eip155Block": 0,
    "eip158Block": 0,
    "byzantiumBlock": 0,
    "constantinopleBlock": 0,
    "petersburgBlock": 0,
    "istanbulBlock": 0,
    "berlinBlock": 0
  },
  "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, create the accounts and populate the alloc field with their addresses.

"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 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 <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 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=<bootnode-enode-url-from-above>

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 and the ethminer 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 <usual-flags> --mine --miner.threads=1 --miner.etherbase=0x0000000000000000000000000000000000000000

Which will start mining blocks and transactions on a single CPU thread, crediting all proceedings to the account specified by --miner.etherbase. You can further tune the mining by changing the default gas limit blocks converge to (--miner.targetgaslimit) and the price transactions are accepted at (--miner.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 Discord Server 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 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. "eth, rpc: make trace configs optional"

Please see the 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, 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, also included in our repository in the COPYING file.

go-ethereum's People

Contributors

acud avatar arachnid avatar cjentzsch avatar cubedro avatar debris avatar fjl avatar frncmx avatar gavofyork avatar gballet avatar gluk256 avatar holiman avatar holisticode avatar janos avatar jpeletier avatar jsvisa avatar karalabe avatar ligi avatar mariusvanderwijden avatar matthalp-zz avatar meowsbits avatar nolash avatar nonsense avatar obscuren avatar renaynay avatar rjl493456442 avatar tgerring avatar ucwong avatar vbuterin avatar zelig avatar zsfelfoldi avatar

Stargazers

 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

go-ethereum's Issues

Clint connection to trusted node

Actors

  • LES server node
  • LES client node
  • ULC node

Problem

Every LES client node can connect to an LES server node that is trusted by other ULC nodes too. This way the LES client nodes may fill the trusted nodes connection pool of the server. ULC nodes trying to connect to these LES server nodes will be rejected with a too much peers error.

Implementation

  • Discuss if ULC nodes shall be handled prioritized
  • If prioritized handling
    • investigate if we could implement zero fee priority clients as a part of 095-les-service-model swarm
    • investigate for any other way of priority handling without letting the LES server node know/conclude that it is trusted

Acceptance Criteria

  • If decided for a priority handling
    • ULC nodes are priority clients and can connect to a filled LES server
    • LES server must not know that it's trusted for ULC node

Notes

Closely related to https://github.com/status-im/ideas/tree/master/ideas/095-les-service-model.
It should be fixed after implementation of paying model.

Get free from LES if using a remote node

Problem

As remote node support has been added to the latest release, we faced a problem that some RPC commands still need to be forwarded to the local node, for example, eth_accounts. To handle this and other calls, we need eth api. Unfortunately, it is a part of the les service. We instantiate it when one uses a local node but we wanted to avoid doing that when using a remote node because we don't want it to sync the blockchain.

Implementation

Create a brand new service that exposes a minimal set of APIs required to support a remote node. A good example how to create a service is actually the les service https://github.com/status-im/go-ethereum/blob/master/les/backend.go#L157-L181

Docker images

  • Dockerfile that uses status-im/go-ethereum implementation for a LES server with whisper enabled that is capable of syncing the full blockchain (enough diskspace)
  • we also need to create 2 bootstrap nodes

Note: ideally we can also specifity the initial peers so we can point to each other

Trusted nodes list investigation

Problem

We keep trusted nodes in a file, but it's not secured.
We need to understand is it a problem or not.

Acceptance Criteria

  • comment why it's not a problem/how we could solve this.

downloader N/M validation

Problem

N/M validation works for fetcher, but it doesn't work for downloader sync.
(les/fetcher.go:404)
In les/ulc_test.go you could find failing tests which cover the problem.

Implementation

Sync using downloader should validate blocks using N/M validation.

Acceptance Criteria

In les/ulc_test.go test should pass.

status-go integration

Actors

  • ULC client
  • status-go

Problem

  • We need to integrate ULC into status-go

Acceptance Criteria

  • ULC is integrated to status-go
  • status-go tests is passing

Return HD keys on `eth.accounts` call.

Objective

  • list HD keys for logged in account

Notes:

  • Third-party apps will need the way to get HD keys related to the current account.
  • This method returns results for an account that was login into last i.e. account key for which is currently present/injected as Whisper identity.
  • Return CKD#1 (main account) and all the children of CKD#2 (sub-accounts)

signTransaction queue

when transaction is signed the account needs to be unlocked first, so we need to prompt the user with the details of the transaction and ask for password in the gui of the application

This would mean informing react-native of the transactions require to be signed.

Later we will also want to do more sophisticated management, ie allowing the user to "remember password for similar transactions"

ULC: mechanism to remove and add trusted servers

At the moment we can't ban for a period of time any trusted server that sends incorrect or malicious blocks. We should have one.

And we should have a possibility to extend a list of trusted servers: explore new servers with good stats, validate them and add to the trusted list.

Both parts need some storage to store data related to trusted nodes stats and blacklist information.

Implementation steps:

  • Store trusted nodes list in the DB
  • Store stats: number of incorrect blocks since last epoch
  • Store blacklist data: when a blacklisted node should be removed from the list
  • Load trusted nodes data from the DB. If DB doesn't contain any data, we should use config data
  • Add config param, when we should add a node to the blacklist, how long should it be.
  • Remove nodes from the blacklist after given period of time
  • Adding new trusted nodes mechanism: for example if an untrusted server sends to a user correct blocks for an epoch, we can trust this node and add it to the list.
  • Add config param to disable adding new trusted nodes mechanism

ULC documentation

Actors

  • ULC

Problem

We don't have any ULC documentation

Implementation

  • Article about how ULC works in general
  • Describe ULC related flags

ULC simulation tests

Actors

  • LES server node
  • ULC node

Problem

There are no E2E tests for ULC.

Implementation

Implement E2E tests for:

  • Sync and receive announce with 3 trusted LES server nodes (only trusted nodes in simulation)
  • Sync and receive announce with 3 trusted, announce-only LES server nodes (only trusted nodes in simulation)
  • Sync and receive announce with trusted and untrusted LES server nodes; ULC node should accept blocks only from trusted LES server nodes

Using simulation framework (https://github.com/ethereum/go-ethereum/tree/master/p2p/simulations).

Acceptance Criteria

Test cases for the scenarios above are implemented and passing.

Notes

https://github.com/ethereum/go-ethereum/tree/master/p2p/simulations

Implement observer chain

Implement ObserverChain for general purpose event logging. Its simplest use case is collecting diagnostic/statistical data. In addition to diagnostic purposes some of this data may also be post-processed with chain filters to provide service quality/capacity/availability estimates for clients.

An observer chain is basically a personal blockchain that is generated by individual nodes and validated by a single signature. Each block contains an Ethereum trie structure that is used as a general purpose key/value store. Interpretation of its contents (called statements) is application-specific, there are no general rules applying to its contents. Application-specific state transition rules can be defined inside the trie itself (we call these voluntary rules promises).

Whether the statement tries of subsequent blocks are interpreted as independent key/value stores (each new statement recorded in one block only) or an evolving database where trie entries are inherited from the previous statement trie is up to the specific application. Separate key ranges can be handled differently too. It is also allowed to leave data in the trie forever and just forget entire subtries that are no longer relevant to anyone. Ensuring data availability is the responsibility of everyone who might want to prove the existence of a certain statement later.

// NewObserverChain inits structure, reads existing chain head from db if possible.
func NewObserverChain(db ethdb.Database) *ObserverChain

func (o *ObserverChain) GetHead() *ObserverBlock

func (o *ObserverChain) GetBlock(index uint64) *ObserverBlock

// LockAndGetTrie locks trie mutex and gets r/w access to the current observer trie.
func (o *ObserverChain) LockAndGetTrie() *trie.Trie

// UnlockTrie unlocks trie mutex.
func (o *ObserverChain) UnlockTrie()

// CreateBlock commits current trie and seals a new block; continues using the same
// trie (values are persistent, we will care about garbage collection later).
func (o *ObserverChain) CreateBlock() *ObserverBlock

// AutoCreateBlocks creates a new block periodically until chain is closed; non-blocking, 
// starts a goroutine.
func (o *ObserverChain) AutoCreateBlocks(period time.Duration)

func (o *ObserverChain) Close()

The observer blocks have the following fields:

PrevHash	common.Hash
Number	        uint64
UnixTime	uint64
TrieRoot	common.Hash // root hash of a trie.Trie structure that is updated for every new block
SignatureType	string	// "ECDSA"
Signature	[]byte	// 65-byte ECDSA signature

Note: Signature is based on the hash of the RLP encoding of the struct while the Signature field is set to nil.

For signing with ECDSA see example here: https://github.com/ethereum/go-ethereum/blob/master/les/protocol.go#L144

Observer chains have to follow these general rules:

  • numbers must be consecutive
  • each number must be used only once (rolling back and forking are forbidden)
  • timestamps must be monotonic

Implement event logger

Implement EventLogger with following exported functions:

func NewEventLogger(o *ObserverChain, keyPrefix []byte) *EventLogger

func (e *EventLogger) AddEvent(key []byte, event interface{})

// NewChildLogger returns a new logger with the same observer chain and the new
// key prefix appended to the existing one.
func (e *EventLogger) NewChildLogger(keyPrefix []byte) *EventLogger

Process of adding one event is:

  • get current unix nano time
  • rlp encode event
  • get trie from e.o
  • add new entry in trie: e.keyPrefix + key + BigEndian(time) -> eventRlp
  • unlock trie

ULC config refactoring

Problem

geth allows using toml config for all params in toml file(geth --config config.toml).
But we store ulc config only in custom json config.

Implementation

Change configuration of ulc which should use config by the generic way.

  • allow toml config for ulc
  • command line params for trusted nodes and minTrustedFraction

Acceptance Criteria

  • We can run geth --config config.toml with ulc params
  • We can run geth flags for trusted nodes and minTrustedFraction

Fix incorrect announce type

Problem

LES Client will throw an "Unexpected response" error here https://github.com/status-im/go-ethereum/blob/enhancement/48/ulc_mode_rebase/les/handler.go#L411 and disconnect the server each time it receives a new block announcement

Implementation

We need to change p.requestAnnounceType instead of p.announceType at https://github.com/status-im/go-ethereum/blob/enhancement/48/ulc_mode_rebase/les/peer.go#L426

Acceptance Criteria

  • Client doesn't throw an error.
  • New test which covers this case

introduce whisperEnabled flag into geth accounts

on creation of account, have an argument that adds a whisperEnabled flag to the geth account and add it to the whisper keystore

on unlock of account, if has whisperEnabled flag, add it to the whisper keystore

Whisper Message Notification & Geth Service

The idea is that we can be 'logged in' to Ethereum and receiving and diplsaying relevant whisper messages and display popup notification to Android notification (and iOS equievellent)

@adrian-tiberius We will need Geth to be moved into a service on Android (and similar for iOS)

and then this ticket will be for @dwhitena

'Login' Feature

We need a binding for login which accepts a password and returns true/false.

The password should be used to attempt to unlock an account, inject the key into whisper and lock the account again - returning true.

If the account fails to be decrypted it should return false

Fix LES test with --race flag

Actors

  • LES server node
  • ULC node

Problem

go test -v --race ./les/
...
--- FAIL: TestGetCHTProofsLes1 (8.04s)
handler_test.go:438: proofs mismatch: message size mismatch: got 4, want 518

Acceptance Criteria

LES tests passes with --race flag

Watch for shh messages with len(keys) > 0

It seems like whisper can receive messages, but upon shh.newIdentity() or injection of an unlocked geth account, whisper stops listening.

-if the len(keys) == 0 them it tries to open the message withouth decryption

-if len(keys)> 0 like we have after newIndentity it tries to decrypt and probably fails

Use relative time for Whisper TTL

If a device has skewed clock settings, then the whisper messages it sends are discarded by the TTL check.

From the upstream issue:

Instead of keeping the absolute timestamp of when the envelope was created, we can make TTL counter relative to now() of the current node.

To do that, we create an envelope with a creation time and a TTL (e.g. 50 seconds), we enqueue it.
Just before sending it to another peer via a socket, we subtract now() - creation_time from TTL, and write this value there.
On the receiving node, we update creation_time to now(). Again, just before sending, we subtract now() - creation_time from TTL.

That makes TTL to be smaller and smaller with each hop.

We can keep the logic of discarding messages as it is now.

Upstream issue: ethereum#16134
Status-go issue: status-im/status-go#687

Allow to use untrusted peers

Actors

  • ULC client

Problem

  • Client should use untrusted peers for sync too, but it doesn't
  • Downloader should be allowed to connect to untrusted peers

Acceptance Criteria

  • client allowed to sync using untrusted peers, but validated using trusted peers
  • downloader don't know about trusted nodes

Prioritize peers with white-listed sub-protocols

Objective:

  • make sure that connecting clients with white-listed sub-protocols are given priority

Notes:

  • if net.peerCount < maxAllowedPerCount, do not interfer into discovery/connection
  • however, whenever we hit the limit and receive incoming peer connection:
    • check if peer advertises support for white-listed protocols, abandon interference if not
    • if white-listed sub-protocols are supported, then we need to evict some previously added peer w/o such support, hence the prioritization
  • for flag consider --preferredprotocols=ssh,les

ULC: incapsulate consensus logic

We do have a frequency parameter that defines consensus. However, it's possible that we'll use a different consensus logic.

We should define an interface that encapsulates consensus logic.

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.