A total of 46 currency networks are deployed on the Trustlines Blockchain and are now ready for use.

A trustline is a mutual credit line or credit facility established between two people who trust each other. Credit provided across a trustline may be in a denomination of any unit of account. The purpose of different currency networks is to let people choose their preferred denomination for recording transactions. Currency networks are shared platforms and are not controlled by a single party. While anyone could create their own, the Trustlines Foundation has deployed 46 initial currency networks for anyone to use.

While the word "currency" often refers to fiat currencies, the term is used in this context to indicate any unit of value. For example, denominations like "beers," "work hours," or "ETH" are as valid as "euros" or "dollars." Each standalone network uses a smart contract on the Trustlines Blockchain for tamper-proof accounting of the credit granted between users in a trustline.

How the currency networks work

A currency network smart contract handles all trustlines with the same denomination. It allows for transfers between the users of the network. The contracts have three identifiers to each of them: a name, a symbol, and an address. The address is always a unique one as it is created on-chain and cannot be changed.

Each network is defined by three primary parameters besides the identifiers. These parameters are an imbalance fee, an interest rate, and the denomination. The imbalance fee and interest rate are both set as a percentage. The denomination can be anything and is established by the name and symbol of the network.

A ripple effect is a situation where an effect from an initial state can be followed outwards incrementally.

Besides the parameters, multi-hop transfers, also called "rippling," are a vital part of the networks. These multi-hops happen whenever someone interacts with another person in the network without having a direct trustline with that person. This mechanism introduces mediators to the network that can enable the granting of credit in a much more extensive network. If you were constrained to only those whom you have a direct trustline with, you wouldn't be able to efficiently conduct transactions with a much larger community than those close to you.

Mediators are other people in the network that have trustlines created with others. If that person is in the path required to connect you to the person you wish to transact with, they act as mediators providing capacity to the network in the form of trustlines. All these trustlines increase the bandwidth of the network and make it possible to operate in a distributed fashion within a network.

The imbalance fee is used to balance out the trustlines in the network. When finding a path between two users who wish to transact, the relay server checks available paths and suggests one to the user. The path consists of the originator, recipient, and, when necessary, mediators. The ideal path is one that results in the least amount of imbalances possible.

An interest rate can be set as a network-wide parameter, and it then applies to all trustlines within that network. A network-wide interest rate can be positive or negative. Another option is to let people choose the interest rate at the time of the creation of a trustline itself. This selected interest rate is called a custom interest rate, and such custom interest can only be positive. The custom interest rate is always a suggested one, and the other person has to accept the creation of the trustline before such a proposed interest is applied.

The calculation of interest accrued always uses an approximation of the continuous compounding interest principle, be it network-wide or custom.

These parameters are set for each of the networks deployed by the Trustlines Foundation. Networks denominated in fiat currencies and cryptocurrencies have an imbalance fee of 0.1%, and they let the users define the interest rate per trustline. "Beer" is the only denomination with no interest rate and no imbalance fee.

A person would interact with a network for the first time when they would be creating a trustline with someone. At this point, they would need to choose the denomination to use. After viewing the available networks and information about them, the person selects one for a trustline. They then define the maximum amount of credit they would be willing to provide to the other person and the maximum amount of credit they are willing to be provided by the other person. A single network is used per trustline. But people can choose to create many trustlines with the same person with different denominations.

As mentioned before, these denominations can be pretty much anything. Among the now deployed networks, there are different fiat currencies, Ether, DAI, Bitcoin, beer, and time.

How the client library interacts with the currency networks

The client library is a JavaScript user interface, high-level API, which enables applications to interact with the smart contract system on the Trustlines Blockchain via the relay servers. It is part of the Trustlines Protocol stack, which developers can use to build their implementations.

For an easy introduction to getting started with the Trustlines Protocol stack, we offer a docker-compose solution which contains the files needed to start a Trustlines system. This setup will allow you to connect to a local trustlines node, use the trustlines node as a MetaMask backend, and connect to a relay server. These are the prerequisites you should have in place for interacting with the client library.

The client library can:

Create a user/wallet

Discover currency networks

Set up trustlines

Send transfers

Creating a user / wallet

To be able to interact with the Trustlines Protocol, a user, i.e., a wallet, is needed. So you first have to create an instance of a wallet and load it into the library. The wallet manages your key pair and is used for cryptographically signing transactions, thus enabling the establishment of trustlines and transfers. Depending on the initial configuration of the TLNetwork instance, you can create either a new instance of type ethers or type identity . The former type is based on the wallet object of the ethers.js library. In contrast, the second type uses an identity contract to enable meta-transactions.

The client library also provides interfaces for retrieving information on deployed networks. It can get

All currency networks the relay server knows about

Detailed information on a specific network

List of all addresses in a specific network

Overview of an address in a particular network

Setting up a trustline

To set up a trustline, you'll need to make sure that a user instance is loaded into the library.

Request for establishing a trustline

Trustlines consists of bi-directional credit facility agreements. That means that they have to be accepted by both parties. The first step to establishing a trustline is, thus, to create an initial request or proposal to a counterparty.

The initiator creates a request or a proposal where they state that they are willing to provide a credit facility of, for example, at most a 100 units of the currency network denomination to the user with the address counterpartyAddress in the currency network with the address networkAddress . Additionally, within the same request, the initiator states that they are willing to accept a credit facility with, for example, at most 100 units of the network denomination from the counterparty. The proposed interest rate is also included in the request, be it network-wide or custom, which the user also has to agree to.

Accepting a trustline request

In the next step, the counterparty has to accept the request/proposal.

The counterparty first fetches all trustline requests in the network. The prepareAccept function is then called where the attributes given and received have to be from the caller.

Transfers

The requirement for a successful trustline transfer is a path with enough capacity from the sender to the receiver in the network.

Your own currency network

The set of networks deployed now is quite large. But we also understand that there may be some other use cases or a denomination that you would like to see which wasn't included. Everything Trustlines related is open-source, and we even have a tool for anyone to deploy a network as well.

To deploy the Trustlines smart contracts, you need an Ethereum client, e.g., Geth or Parity. The client should be synced to the chain you wish to deploy to and use. Additionally, you will need enough funds to pay the gas fee for the contract deployment.

The command-line tool tl-deploy allows you to deploy the Trustlines contracts for creating a new currency network. You can find out more about the tool and smart contract development in the contracts repository.

More to come

Last year, the Trustlines Blockchain launched, and we started the TLN Merkle drop. The currency networks have been deployed, and we are getting ready to share more.

Soon there will be more for both users and developers to use and build with on Trustlines, so stay tuned!