1. Install TrueBlocks

TrueBlocks runs on Linux and Mac. There is no official Windows support. Some users have had success using WSL─you're on your own!

These instructions assume you can navigate directories with the command line and edit configuration files. If you need help with a step, see the installation’s troubleshooting section.

Quick Install

  1. Install dependencies

    • Install the latest version of Go.
    • ☑ Install the other dependencies with your command line: build-essential git cmake python python-dev libcurl3-dev clang-format jq.

  2. Compile from the codebase

    git clone -b develop https://github.com/trueblocks/trueblocks-core
    cd trueblocks-core
    mkdir build && cd build
    cmake ../src
    make
    

    (You may use make -j nproc to parallelize the build.)

  3. Add trueblocks-core/bin to your shell PATH.

  4. Find your TrueBlocks configuration directory. It should be in one of these places:

    • On linux at ~/.local/share/trueblocks
    • On mac at ~/Library/Application Support/TrueBlocks
    • If you’ve configured it, wherever the location of $XDG_DATA_HOME is

  5. In the configuration directory, edit trueblocks.toml to add your RPC and API keys. It should look something like this:

    [settings]
    rpcProvider = "<url-to-rpc-endpoint>"
    
  6. Test a command!

    chifra blocks 12345
    

Optional steps

  1. To make deep data queries, get the index
  2. To explore the data visually, install the explorer application.

Troubleshooting

Here are some problems users have run into at each step. If you’re still having trouble, create an issue, or ask us on discord.

Dependencies

How do I check my Go version?

Run this command

go version

TrueBlocks needs version 1.12.x or later.

How do I install packages on the command line?

  • For Linux

    sudo apt install build-essential git cmake python python-dev libcurl3-dev clang-format jq
    
  • For Mac:

    For best results, we recommend running MacOS Big Sur or later.

    brew install cmake
    brew install git
    brew install clang-format
    brew install jq
    

Compiling

How many cores can I use to make TrueBlocks?

When you run make, you can speed up the build by parallelizing with

make -j <ncores>

Where <ncores> represents the number of cores to devote to the job. How many cores can you use? That depends on many factors. A handy tool is nproc, which identifies the machine’s number of available processing units.

If you have nproc installed, you can safely parallelize the build with this command

make -j `nproc`

How do I know if compilation was successful?

From the trueblocks-core directory, test your install with this command:

../bin/chifra --version

You should get a version string similar to this:

trueBlocks GHC-TrueBlocks//0.9.0-alpha-409aa9388-20210503

If nothing outputs, the build has failed. Try repeating the instructions. If it still fails, make an issue.

How do I export to PATH?

chifra only works if its underlying tools are found in your $PATH. To find the full path, run this from the top of the trueblocks-core directory.

cd bin && pwd && cd -

Add the result of that command to your shell’s $PATH.

How you do that depends on your system. In Bash, you’re probably going to put something like this in your .bashrc:

export PATH=${PATH}:</path/to/trueblocks-core/directory>/bin

If you are confused, a Google search may be in order…

Configuring RPCs

How do I add my local RPC?

By default, TrueBlocks checks for an RPC on http://localhost:8545/. If you are running a local node on a different port, simply change the port.

How do I add external RPCs and etherscan?

If you are using an external RPC, you to need add its endpoint. Similarly, for deep exploration of ABI data, some tool interfaces have an --articulate option. The articulate option requires an EtherScan API key. We are working on removing this centralized dependency.

In your config file, the specific RPC path will differ depending on the service.

Here’s an example for Infura and EtherScan, with <key_value> being replaced by a hash string.

[settings]
rpcProvider = "https://mainnet.infura.io/v3/<key_value>"
etherscan_key = "<key_value>"

Why should I get an index?

When you query basic transaction data, you don’t need an index. However, most people want to explore entire histories of addresses, calls, and traces. Doing that requires an index.

There are multiple options, which the How Can I Get the Index? article covers in more detail.

No matter what method, getting the index will take somewhere between 10 minutes and a few days. So you might want to play around with some chifra blockchain commands first.

What if my node doesn’t have tracing or archiving?

If you don’t have a node with tracing or archiving, you might get an error when you run some chifra commands. Something like

--accounting requires historical balances. The RPC server does not have them. Quitting...

TrueBlocks lets you disable these checks.

To disable, make a file in your TrueBlocks config directory called blockScrape.toml. Add the following settings:

[requires]
tracing = false
archive = false

Edit this page on GitHub