Quickstart

Installation

This is the quickstart guide for Trinity. It teaches us how to run a Trinity node as a user.

To develop on top of Trinity or to contribute to the project, check out the Contributing Guide that explains how to set everything up for development.

Installing on Ubuntu

Trinity requires Python 3.7 as well as some tools to compile its dependencies. On Ubuntu, the python3.7-dev package contains everything we need. Run the following command to install it.

apt-get install python3.6-dev

Trinity is installed through the pip package manager, if pip isn’t available on the system already, we need to install the python3-pip package through the following command.

apt-get install python3-pip

Note

Optional: Often, the best way to guarantee a clean Python 3 environment is with virtualenv. If we don’t have virtualenv installed already, we first need to install it via pip.

pip install virtualenv

Then, we can initialize a new virtual environment venv, like:

virtualenv -p python3 venv

This creates a new directory venv where packages are installed isolated from any other global packages.

To activate the virtual directory we have to source it

. venv/bin/activate

Trinity uses Snappy Compression and hence needs the Snappy Library to be pre-installed on the system. It can be installed through the following command.

apt-get install libsnappy-dev libgmp3-dev

Finally, we can install the trinity package via pip.

pip3 install -U trinity

Installing on macOS

First, install LevelDB and the latest Python 3 with brew:

brew install python3 leveldb

Note

Optional: Often, the best way to guarantee a clean Python 3 environment is with virtualenv. If we don’t have virtualenv installed already, we first need to install it via pip.

pip install virtualenv

Then, we can initialize a new virtual environment venv, like:

virtualenv -p python3 venv

This creates a new directory venv where packages are installed isolated from any other global packages.

To activate the virtual directory we have to source it

. venv/bin/activate

Now, install Snappy Library with brew as follows:

brew install snappy

Finally, install the trinity package via pip:

pip3 install -U trinity

Installing through Docker

Trinity can also be installed using Docker which can be a lightweight alternative where no changes need to be made to the host system apart from having Docker itself installed.

Note

While we don’t officially support Windows just yet, running Trinity through Docker is a great way to bypass this current limitation as Trinity can run on any system that runs Docker with support for linux containers.

Using Docker we have two different options to choose from.

1. Run an existing official image

This is the default way of running Trinity through Docker. If all we care about is running a Trinity node, using one of the latest released versions, this method is perfect.

Run:

docker run -it ethereum/trinity

Alternatively, we can run a specific image version, following the usual docker version schema.

docker run -it ethereum/trinity:0.1.0-alpha.13

2. Building an image from the source

Alternatively, we may want to try out a specific (unreleased) version. In that case, we can create our very own image directly from the source code.

make create-docker-image version=my-own-version

After the image has been successfully created, we can run it by invoking:

docker run -it ethereum/trinity:my-own-version

Installing on DappNode

Trinity is available as a DappNode package. Just search for trinity.public.dappnode.eth, install the package and it will immediately start syncing. Head over to the Running Trinity on DappNode for more tips and tricks.

Running Trinity

Note

Execution of the following comand will cause downloading of a considerable amount of data. We need to make sure to have enough disk space available as well as a data plan that allows such traffic.

After Trinity is installed we should have the trinity command available to start it.

trinity

While it may take a couple of minutes before Trinity can start syncing against the Ethereum mainnet, it should print out some valuable information right away which should look something like this. If it doesn’t please file an issue to help us getting that bug fixed.

    INFO  05-29 01:57:02        main
  ______     _       _ __
/_  __/____(_)___  (_) /___  __
  / / / ___/ / __ \/ / __/ / / /
/ / / /  / / / / / / /_/ /_/ /
/_/ /_/  /_/_/ /_/_/\__/\__, /
                      /____/
    INFO  05-29 01:57:02        main  Trinity/0.1.0a4/linux/cpython3.6.5
    INFO  05-29 01:57:02        main  network: 1
    INFO  05-29 01:57:02         ipc  IPC started at: /root/.local/share/trinity/mainnet/jsonrpc.ipc
    INFO  05-29 01:57:02      server  Running server...
    INFO  05-29 01:57:07      server  enode://09d34ecb0de1806ab0e68cb2d822b967292dc021df06aab9a55aa4d2e1b2e04ae73560137407a48073286026e12dd60d265a1b1ae0505e44e60d55cea9c7b100@0.0.0.0:30303
    INFO  05-29 01:57:07      server  network: 1
    INFO  05-29 01:57:07        peer  Running PeerPool...
    INFO  05-29 01:57:07        sync  Starting beam-sync; current head: #0

Once Trinity successfully connected to other peers we should see it starting to sync the chain.

INFO  05-29 02:23:13       chain  Starting sync with ETHPeer <Node(0xaff0@90.114.124.196)>
INFO  05-29 02:23:14       chain  Imported chain segment in 0 seconds, new head: #191 (739b)
INFO  05-29 02:23:15       chain  Imported chain segment in 0 seconds, new head: #383 (789c)
INFO  05-29 02:23:16       chain  Imported chain segment in 0 seconds, new head: #575 (a1d0)
INFO  05-29 02:23:17       chain  Imported chain segment in 0 seconds, new head: #767 (aeb6)

What’s next?

Now that we’ve got things running, there’s a lot ahead to learn. Check out the existing guides on Trinity’s general Architecture, Writing Components or scan the Cookbook for short recipes to learn how to:

Warning

Trinity is currently in public alpha. Keep in mind:

  • It is expected to have bugs and is not meant to be used in production
  • Things may be ridiculously slow or not work at all
  • Only a subset of JSON-RPC API calls are currently supported