Distributed computers – Threefold

ThreeFold.io project

Many different crypto project are running decentralized computing as it’s a good piece to complete the distributed storage or messaging I previously documented. The principle is to be able to deploy a workload on someone else computed to serve a reliable web service. This layer is a IaaS layer like we can find on Azure, Aws, GCP, Ovh… This layer is an important piece of a decentralized cloud in construction in the web3.

I already written review of project like Flux, Golem, Akash previously and explain how to contribute to them and how use the one that seems the more reliable. This new blog post is about an other solution named Threefold

ThreeFold network

The network has about 2747 nodes with 463TB ram, this is an infrastructure equivalent to 600 servers. It makes it bigger than FLUX by a factor close of two.

The Token is distributed to the hardware provider based on Proof of Capacity, meaning more you propose hardware to the network and more you get rewarded. As an example a 2Vcpu, 4GB ram, 50Gb storage is rewarded 30 TFT a month. But you can also propose storage, network or public IP and get rewarded just for this part. The TFT value is currently ($0,032). The revenue simulator is a good way to have a better idea of the potential rewards.

When a user consume some cloud capacities, he is charged on hourly basis, 35% of this will be burn (kind of burn & mint equilibrium), 50% goes to the resource provider, 5% for the validator and 10% to the TF Foundation.

So many different wallets and accounts

To start accessing the dashboard, you need to install the polkadot extension, create a wallet and a Twin address. You get 0.1TFT to get started for the first transaction required at setup.

Associated to this wallet you will have a TFChain address (corresponding to the wallet created and your polkadot account), but also a Stellar address, this one is different and visible when you go in swap tab in your account menu in the dashboard. You also need to install the ThreFoldConnect mobile application to get a second stellar address with a trusted link to use the bridge to connect with Binance exchange. The application is also used as a two factors authentication for certain tools.

If you want to easily buy TFT, you will also need a BNB address usable on Metamask Binance Smart Chain to swap tokens.

Get some tokens

You can buy TFT from different source, you can buy with fiat (I did not succeed and you have a minimum of $100) or you can buy some with Metamask on the Binance Smart Chain (contract 0x8f0FB159380176D324542b3a7933F0C2Fd0c2bbf ). The Metamask is good to swap TFT but then you need to send them to the right chain Stellar using a bridge … so it starts to be really complex ! But the documentation exists and in fact the bridge is easy to do…

So once your have the TFT token in your BSC wallet on Metamask, you can use the bridge to transfer your TFT to a trusted stellar wallet (the one you have created with the mobile application – do not use one you imported in the application, it won’t be trusted).

Once your TFT are on your mobile app wallet, you can transfer them to your dashboard wallet, the address will be found in the Swap sub menu and the deposit QR code will help to make the transfer simple.

As soon as you master these operation, it’s quite easy…

Provide resources

From the dashboard, at first you need to create a farm, once done, you need to associate your stellar address. The farm ID will be use ti get the iso file to get started.

Run on QEMU

I don’t want to run it on a physical machine as I don’t want to dedicate a hardware but use my spare capacity. So on Ubuntu I used Qemu to run it.

# install kvm
[root ~] apt -y install bridge-utils cpu-checker libvirt-clients libvirt-daemon qemu qemu-kvm libvirt-daemon-system virtinst
[root ~] systemctl enable --now libvirtd

# download the boot image, replace XXXX by your farm ID
[root ~] wget https://v3.bootstrap.grid.tf/iso/prod/XXXX

# create a virtual disk
[root ~] qemu-img create ./tft.img 384G

# go for screen
[root ~] screen -S tft

# Start Threefold (need enough space in ramfs here 16G, 4core)
[screen session] qemu-system-x86_64 -curses  -cdrom ./XXXX -drive format=raw,file=tft.img,index=0,media=disk,if=virtio -enable-kvm -m 16384 -cpu host,vmx=on -smp 4

# terminal can be closed

Once running the dashboard look like this on the server and on the web

To recall the terminal on the server later…

[root ~] screen -r tft
# close the screen session with [ctrl]+a [ctrl]+d
# to kill the screen session
[root ~] screen -X -S tft kill

Use ThreeFold grid

When you want to use ThreeFold grid, you have different way to do this. The simpler one is to use the web interface but you can also go with terraform approach.

Before starting, you also need to consider the cost of running a workload on ThreeFold. Basiclaly there is a single price of any of the technical components. The price for a VM with 2VCPU, 4GB Ram and 50GB storage is about $0,03 / h ($22/month). All the price are listed in this page. You don’t pay in $ but with TFT and the cost is calculated in mTFT, to make sure the price will be stable over the time, the technical unit price is based on $ and the amount of mTFT consumed per hour is calculated with the token oracle price.

You can get a better price for your resources thanks to the stacking system. Basically, it you have in your wallet the equivalent of 3 years of your current consumption rate, you will have a rebate of 60% on the price above. Lower stacking gives lower rebate. You can simulate your cost with the ThreeFold price claculator.

Create a first VM

Connecting to the ThreeFold web portal, you can create a VM, a K8S cluster or a software instance of different components like Owncloud, Mattermost …

ThreeFold web portal to create VMs and much more

Once you have connected your wallet, you can start commissioning a VM on a node. You need to select the Farm and node you want to deploy on. Here is a tricky point: you need to select a farm, a country and some options like the network configuration. So you won’t always have a node responding to the option you selected and if you do not use the explorer this requires different failed and retry steps. Finally the easiest way has been for me to find a Node with explorer and manually enter id ID.

VM deployment on ThreeFold

The VM is going to be created and you can connect ot it with ssh using the key you provided during your profile setup. Your VM can access all the planetary network, so you can have a part of your servers public and a part inside the planetary network (not visible from Internet). This is not a private network, your VMs on planetary network are exposed to all others.

1 thought on “Distributed computers – Threefold

  1. If zos fails to boot with this error:

    thread ‘main’ panicked at ‘Could not determine the UTC offset on this system.

    try to add this to the qemu command line (worked for me):

    -rtc base=localtime,clock=host

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.