Trustline is a basic entity of the GEO Protocol’s transaction topology. A trustline connects two nodes and all its data is stored only on these two nodes. The data on both of these nodes is symmetrical (will be explained below in the example).

It is worth to mention that one trustline between the two nodes can be opened in a single asset equivalent only. If the very same nodes want to open a trustline in another equivalent, that will be another trustline with the corresponding data set.

The data with which a trustline operates is represented by three numbers:

Incoming Trust Amount (ITA)

Outgoing Trust Amount (OTA)

Current Balance (CB)

For a better understanding of how a trustline works, let’s consider a simple example.

If the node A opens a trustline to the node B for the amount of 100 BTC. And the node B opens a trustline to the node A for the amount of 200 BTC. In this case on the side of the node A this trustline will be represented by the following numbers:

Incoming Trust Amount: 200 BTC

Outgoing Trust Amount: 100 BTC

Current Balance: 0 BTC

As for the node B the numbers will look like this:

Incoming Trust Amount: 100 BTC

Outgoing Trust Amount: 200 BTC

Current Balance: 0 BTC

After payment of, let’s say, 40 BTC is performed from the node A to the node B the trustline info will be changed to the following.

For the node A:

Incoming Trust Amount: 200 BTC

Outgoing Trust Amount: 100 BTC

Current Balance: -40 BTC

For the node B:

Incoming Trust Amount: 100 BTC

Outgoing Trust Amount: 200 BTC

Current Balance: 40 BTC

All these numbers and transactions are backed by cryptography, but this mechanics will be considered in another article.

Also, further we will use the terms like Incoming Payment Flow (IPF) and Outgoing Payment Flow (OPF) of a trustline.

IPF is the maximum amount that one node can receive from another with a particular trustline. It is calculated by the following formula:

IPF = OTA — CB

OPF is the maximum amount that one node can transfer to another with a particular trustline. It is calculated by the following formula:

OPF = ITA + CB

In our case:

IPF (a→b) = OTA (a→b) — CB (a→b) = 100 BTC — (-40 BTC) = 140 BTC

OPF(a→b) = ITA(a→b) + CB (a→b) = 200 BTC + (-40 BTC) = 160 BTC

IPF (b→a) = OTA (b→a) — CB (b→a) = 200 BTC — 40 BTC = 160 BTC

OPF (b→a) = ITA (b→a) + CB (b→a) = 100 BTC + 40 BTC = 140 BTC

As you can see from this example, IPF and OPF are symmetrical:

IPF (a→b) = OPF (b→a)

OPF(a→b) = IPF (b→a)

This example describes the simplest case of a transaction that involves only two nodes with a direct trustline connection between them. But in GEO Protocol you can use the trustline mechanics to perform multi-hop transactions. That means that it is possible to make a payment between two nodes that don’t share a common direct trustline connection.

In this case, GEO will automatically find possible indirect paths between the two nodes. We will describe this in more detail in one of our next articles dedicted to the GEO Protocol path building algorithm.

How the actual multi-hop payment is performed will be described in an article about the Payment Algorithm.

And the next article will describe the Trustlines Mechanics in detail.

You can watch the video explainer version of this article on GEO Protocol YouTube channel here: