ORTELIUS: Avalanche Transaction Indexer

Murat Celiktepe
BCISTCenter
Published in
5 min readOct 31, 2020

After launching the Avalanche mainnet, tracking transactions has become one of the most important requirements for developers and interested parties to follow transactions on the network. In order to satisfy this demand, Avalanche transaction indexer called ORTELIUS was launched.

Avalanche Explorer uses this indexer and provides users with the information of every transaction processed on the Avalanche mainnet and testnet. Avalanche Explorer is currently searching transactions by ID, account details and token’s info. ORTELIUS provides flexible facilities for users who wish to use these transactions. (filtering, listing, sorting, etc.).

ORTELIUS can be integrated with a local node. This means that we need a node running on the network and ORTELIUS will both run a node and implement indexer upon it. The services of this product can be listed as follows:

  • keeps the records of events and decisions made on the network
  • indexes all transactions on X-Chain and P-Chain for both the mainnet and the testnet(Fuji) network
  • provides an API (Application Programming Interface) to be explored for all the transactions

Because this service can be used with docker and docker-compose, we need to install them on our machine. Two modes of ORTELIUS can be operated. Standalone mode is the fastest and the easiest way to run it. However, it is not recommended for large-scale projects. Since we will use it for testing and discovering, we will start with standalone mode. Before starting the installation process, docker and docker-compose should be installed.

Docker has well-prepared how to install and how to run guides. From this installation page, docker can be downloaded and installed. For example, for Ubuntu users, this link shows how to install docker to the machine.

Likewise docker, docker-compose may be installed via this guide.

$ docker-compose --version
Docker version 19.03.13, build 4484c46d9d
$ docker --version
docker-compose version 1.27.4, build 1110ad01

You can check whether these exist and which versions are installed through the two commands above. The versions are not too important, you may have different versions of docker or docker-compose. If everything is installed, it is time to work with ORTELIUS.

First of all open a terminal and paste this command, this will clone the GitHub repository to our local machine and set $GOPATH to ORTELIUS. If you have trouble with $GOPATH, there is a lot of documents about how to set it.

git clone https://github.com/ava-labs/ortelius.git $GOPATH/github.com/ava-labs/ortelius

Currently, the service has been set to work with the Avalanche fuji testnet. These 3 commands below should be enough to run your node and ORTELIUS service that implemented to the node.

cd $GOPATH/github.com/ava-labs/ortelius
make dev_env_start
make standalone_run

To be sure about connecting testnet or in case of having problems with source code, we should check some lines of the codes. Firstly, open the source code (cloned from GitHub) via a code editor. Source code should be in this path: “go/github.com/ava-labs/ortelius”

ORTELIUS SOURCE CODE

Then find the file in the picture above. The file path is docker/standalone/docker-compose.yml

You have to be sure that it is the same with your file and these 2 things are also the same;

  • network-id = 5
  • “-ipcs-chain-ids=11111111111111111111111111111111LpoYY,2JVSBoinj9C2J33VntvzYtVJNZdN2NKiwwKjcumHUWEb5DbBrm”,

Then come to the config.json file. The path is docker/config.json

ORTELIUS SOURCE CODE

Here, please be sure that these lines and their values match with each other.

"networkID": 5,"chains": {
"2JVSBoinj9C2J33VntvzYtVJNZdN2NKiwwKjcumHUWEb5DbBrm": {
"id": "2JVSBoinj9C2J33VntvzYtVJNZdN2NKiwwKjcumHUWEb5DbBrm",
"alias": "X",
"vmType": "avm"
}
}

That’s all we need to do. Please make sure that these two files match with the ones above. Now it is time to run the node and ORTELIUS on the testnet. Enter these 3 commands to the terminal again.

cd $GOPATH/github.com/ava-labs/ortelius
make dev_env_start
make standalone_run

If everything goes well, both services should start to run on the machine. Please give a couple of minutes to run ORTELIUS and node concurrently. Now, we have a node that runs on the testnet and an indexer that watching these networks.

To check whether the indexer is working properly, just go to the browser and paste this address;

→ http://localhost:8080/

ORTELIUS

Now you should be able to see the network ID and chains that ORTELIUS is tracing. Let’s see the transactions on the testnet.

ORTELIUS

Of course, it takes time to sync all the transactions but you should see a list of them. As you see, 158 transactions are synced and it keeps increasing.

You can also check ORTELIUS API GUIDE to see what you can do with this service.

These operations currently exist and you can call them either from a browser or from your code. Of course, these will be diversified and developed in course of time. You can find examples of how to use and interact with them in these GitHub documents.

The last example shows how we can interact with ORTELIUS via terminal. In order to do that, you have “Curl” to be installed on your machine.

curl http://localhost:8080/X/transactions

When you run this command on the terminal, you should see the list of transactions in JSON format.

As the last example, let’s look at the tokens that created on the testnet;

curl http://localhost:8080/X/assets

See you in the next article…

Murat CELIKTEPE

LinkedIn → celiktepemurat

Twitter → muratctp

--

--