Skip to content
forked from ethereum/trin

An Ethereum portal client: a json-rpc server with nearly instant sync, and low CPU & storage usage

Notifications You must be signed in to change notification settings

tenthplanet-x/trin

 
 

Repository files navigation

Trin

Trin is an Ethereum "portal": a json-rpc server with nearly instant sync, and low CPU & storage usage.

Trin does this by making these tradeoffs:

  • Trusts miners to include valid state transitions, to skip sync
  • Shards state across a (new) p2p network, to reduce local storage needs

This should sound similar to a light client. It is, but with a peer-to-peer philosophy rather than the LES client/server model, which has introduced challenges in an altruistic environment.

Repository Structure

The portal protocol is a collection of networks. Trin needs to connect to all of them.

The repository is structured as follows:

  • trin/: The main entry point to run a holistic Ethereum portal client
  • trin-history/: The chain history network
  • trin-state/: The state network

Ready for production?

LOL, not even a little bit. At the last readme update, this was simply a proxy to Infura for all inbound requests, and doesn't validate any answers against state roots.

Trin will proxy at least some requests to Infura for quite a while, but the plan is to incrementally reduce the reliance on Infura, as more trin functionality becomes available.

How to use Trin

Checkout out the Getting Started guide to quickly get up and running with Trin.

CLI Options

trin 0.0.1
carver
Run an eth portal client

USAGE:
    trin [OPTIONS]

FLAGS:
        --enable-metrics    Enable prometheus metrics reporting (requires --metrics-url)
    -h, --help              Prints help information
        --internal-ip       (For testing purposes) Use local ip address rather than external via STUN.
    -V, --version           Prints version information

OPTIONS:
        --bootnodes <bootnodes>               One or more comma-delimited base64-encoded ENR's or multiaddr strings of
                                              peers to initially add to the local routing table [default: ]
        --discovery-port <discovery_port>     The UDP port to listen on. [default: 9000]
        --external-address <external_addr>    The public IP address and port under which this node is accessible
        --kb <kb>                             Maximum number of kilobytes of total data to store in the DB
                                              [default: 100000]
        --metrics-url <metrics-url>           URL for prometheus server
        --networks <networks>...              Comma-separated list of which portal subnetworks to activate
                                              [default: history,state]
        --pool-size <pool_size>               max size of threadpool [default: 2]
        --unsafe-private-key <private_key>    Hex encoded 32 byte private key (considered unsafe to pass in pk as cli
                                              arg, as it's stored in terminal history - keyfile support coming soon)
        --web3-http-address <web3-http-address>    address to accept json-rpc http connections [default: 127.0.0.1:8545]
        --web3-ipc-path <web3_ipc_path>       path to json-rpc endpoint over IPC [default: /tmp/trin-jsonrpc.ipc]
        --web3-transport <web3_transport>     select transport protocol to serve json-rpc endpoint [default: ipc]
                                              [possible values: http, ipc]

Want to help?

Want to file a bug, contribute some code, or improve documentation? Excellent! Read up on our guidelines for contributing, then check out issues that are labeled Good First Issue.

Gotchas

  • There is a limit on concurrent connections given by the threadpool. At last doc update, that number was 2, but will surely change. If you leave connections open, then new connections will block.

About

An Ethereum portal client: a json-rpc server with nearly instant sync, and low CPU & storage usage

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Rust 99.4%
  • Other 0.6%