The tutorial was tested on a Mac. You should be able to run the Android version of the app on Linux or Windows, but some things might be different.
The Trustline app relies on a Relay server for its communication with the Trustlines blockchain (TLBC). Especially at the beginning, when you just want to get started, it is a daunting task to set up everything. In this tutorial we'll take a shortcut. Instead of setting up a Relay server that will communicate with the TLBC chain or with the Laika test chain, we'll use a utility that the maintainers of the Trustlines Protocol use for e2e tests.
The tool in the end2end repository relies on Docker and sets the followings:
- A development OpenEthereum node that automatically mines a block when it receives a transaction
- A relay server
- A py-eth-index instance to index events for the relay
- A Postgres database
- A contracts docker image that will deploy test currency networks, exchanges, and identity contracts
By using the end2end utility you won't be sending transactions to the TLBC or Laika chains, but instead to a local dev chain. This way you don't have to pay for transactions when you get started. At a later stage when you move to production you'll have to properly configure your relay server to communicate with the TLBC chain.
First, clone the end2end repository
Now go inside the created end2end repo
You could already try to run the
run-e2e.sh script, but chances are that this will fail. The tool in the end2end
repo isn't versioned and running always from the HEAD of the master branch wouldn't always succeed. At the time of
writing this tutorial one couldn't successfully launch the relay server, so let us checkout a version of the end2end
library that we know works:
Now start the relay with the following command
We are starting the e2e script with the
-b flag - this tells the script to start everything except for the e2e tests.
Also, note that we've set the
TL_RELAY_IMAGE to a combination of versions we know are working at
the time of writing this.
Once the script is ready you should see output similar to this:
Let's spend a few seconds to look over the output (you can click on the image to view it in full size). The most important lines are:
Identity proxy factory and
Identity implementations addresses. You'll need them later for the .env config
of the app. The output also tells you that 3 currency networks were deployed
Work Hours and
currency networks will be later available in the app once it is connected to the relay server.
Now let's configure the Trustlines App to use this backend.
Let's clone the Trustlines app
enter the trustlines app directory:
Before you can install the developer dependencies you'll need to create a Firebase Project in the firebase console Once ready you should see a screen similar to this one:
Click on the cog wheel to enter the project settings and create iOS and Android Apps there
To make your experimentation easy when asked for iOS bundleID enter:
beercoin.io.mobileapp.develop and for android
package name enter:
network.trustlines.mobileapp.develop.debug. You won't be able to distribute the app you build
through the App/Play store with those ids, but that's not the goal here anyway. Once you experiment with the
Trustlines app and you are ready to distribute it through the App/play store you can create new apps in Firebase with the
correct bundle ID and package name.
When creating the iOS app Firebase will offer the
GoogleService-Info.plist file for download. Download it and store it
in the firebase/ios/** folders.
When creating the Android app Firebase will offer the
google-services.json file for download. Download it and store it
in the firebase/android/** folders.
You might wonder: "Why do I need to store the firebase files in develop, staging and production folders?". The answer is simple. By default the Trustlines App is configured to work in 3 modes - develop, staging and production. You can specify different configurations for each of those modes. For simplicity, in this tutorial we'll reuse the same config everywhere.
Now that you've placed the firebase files in the correct folders, you can continue by initializing the dependencies. In the terminal run:
Once this is complete, if you plan to run the iOS version of the App you need to execute the following command:
This command will navigate to the ios folder, inside of it, it will call pod install and once the cocoapods installation is complete, it will go back to the main mobileapp folder.
Now you need to modify some
.env variables. In the mobileapp folder you should see an
file, copy it and rename it to
.env.develop. Now open the
.env.develop file and you should see something like this:
.env.dist connects the app to the Laika test chain. We need to change this. Change the
Remember the identity factory address that was output when you started the e2e script? Set it for
Now you should be ready to Rock & Roll!
If using npm run:
if using Yarn run:
If using npm run:
if using Yarn run:
If when you build the iOS app you get a
The following build commands failed: CopyPlistFile .../mobileapp-fmklahskitxufpgbffpdozahumyf/Build/Products/Release-iphonesimulator/mobileapp-develop.app/GoogleService-Info.plist .../mobileapp/ios/mobileapp/GoogleService-Info.plist
error, just restart the build, and it should be fine.