This post is intended for friends at Matic . Both ThreeFold and Matic share common values and there is an enormous potential that can be exploited together, especially when it comes to leveraging ThreeFold’s peer to peer cloud network.
We will quickly demonstrate how to setup a Matic node on the ThreeFold Grid . The purpose here is to get people started. The configuration can be tweaked to perfection with other experts in the community.
What we will do ?
- Setup your 3bot and install the 3sdk
- Log in and create your Network
- Get your wallet loaded , don’t worry, we have FreeTFTs
- Deploy your Matic container
- Access your Matic container
- Verify your Matic deployment
Before you start, we have 2 networks publicly available
Our Recommendation : *Start deploying on testnet as ThreeFold gives free nodes to deploy and play around with. Mainnet is production and paid for. Therefore, from settings in the 3sdk menu, switch to TESTNET *
Step 1 - Setup the 3sdk
The 3sdk is a tool that allows you to setup your 3bot and give you access to the ThreeFold Grid for your deployments (containers, virtual machines, S3 storage and so on). The wiki provides detailed instructions on how to set up the 3sdk .
If this part is done, rest should be extremely easy as management is done via web interface.
To access the 3sdk admin interface, in your browser use the following link,
7000 is the http port and 4000 is the https port
If you installed locally on your machine, you can use
Step 2 - Log in and Create your Network for Deployment
From the previous step,
Log in here with your 3bot. Make sure you open the 3bot connect app first!
Once you log in, Go to Solutions and then go to Network . The interface is user-friendly and it should be easy. Few things to note,
- Use IPv4 network unless you are sure you have IPv6. You can test IPv6 connectivity here
- It is better to have the chat bot configure the network for you unless you have specific requirements
- Ideally start with FreeTFT as your network currency
Note : The wizard will ask you to download your Wireguard configuration. This is important as you won’t be able to access your network without it. This serves as an entry point to your private network.
Step 3 : Get your wallet loaded - Get some FreeTFTs
First things first, create a wallet from the Wallet Manager. It is pretty easy actually,
The next step is to get your wallet funded, there are 2 ways,
To get FreeTFTs for testnet, use this link => https://getfreetft.testnet.threefold.io
Login with your 3botID which you created in the 1st step and provide the wallet address. You get 1000 FreeTFTs per wallet. This should be adequate ! The stellar address is the simply the wallet address. Our transaction layer is on stellar.
To get FreeTFTs for Mainnet, use this request form => https://www.getfreetft.threefold.io
Step 4 - Create your Matic Container - Time to Rock’n Roll
Under Solutions , go to Generic flists , the wizard will guide you accordingly.
- Select the network name which you created . Your container is going to be deployed in this network.
- Enter the container name, size in terms of CPU and memory . Ideally start with 2 CPUs and 2048 MB memory.
- The flist link you have to use is => https://hub.grid.tf/arehman/v2-matic-0-3.flist
- Would you like access to your container through the web browser (coreX)? Select NO . You may want to use this for troubleshooting.
- Set the IP address from the drop down list you want to assign to your container.
- The container entry_point should be set to
- Under environment variables , use pub_key=your_public_key_here . This would allow to SSH into the container once it is deployed. The rest of the environment variables need to be passed also.
Now you get a list of farms to deploy on, let the freefarm be there
If all goes well, the wizard will give you a final screen before proceeding with the deployment,
The last screen is the payment screen which can be done with “FreeTFTs” in your wallet. Payment can be either via the 3bot App or the wallet you created. Just choose the wallet you funded in Step 3
That should be it ! You will be given a reservation ID of your deployment that you can use for future references.
Step 5 - Access your Matic Container
To access the container,
For Linux , wg-quick up path_to_wireguard_conf_file. For example,
wg-quick up /my-wg/net-1.conf
For windows , Import the downloaded wireguard configuration from Step 2,
Once the wireguard tunnel is up, you can test connectivity by doing a ping test for your container IP address. Access the container with ssh using your private key.
ssh -i path_to_your_privatekey root@container_ip_address, For example
ssh -i /opt/mysshkey firstname.lastname@example.org
The SSH public key should be provisioned during the container deployment.
Step 6 - Verify your Matic node Deployment
From the left side navigation panel, go to Deployed Solutions . You should see the name of your container
You can click the container name here to see details, Here is a view of it,
Inside the container, do a
ps aux , you should see the matic daemon / bor running,
root@matic:~# ps aux USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND root 1 0.0 0.0 15848 864 ? Ss 13:32 0:00 /usr/sbin/sshd -D root 206 92.2 1.8 6588800 2489508 ? Sl 13:52 51:19 /go/src/github.com/maticnetwork/bor/build/bin/bor --datadir /matic-data --port 30303 --rpc --rpcaddr 0.0.0.0 --rpcvhosts * - root 2000 0.1 0.0 12312 2492 ? Rs 14:02 0:03 tmux new -s bor root 2001 0.0 0.0 5752 500 pts/1 Ss 14:02 0:00 -bash root 2006 0.0 0.0 5752 508 pts/2 Ss 14:03 0:00 -bash root 2012 0.0 0.0 4076 100 pts/1 S+ 14:03 0:01 tail -f logs/bor.log root 2015 0.0 0.0 16780 3140 ?
root@matic:~# netstat -lntpe Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State User Inode PID/Program name tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 0 1885335 1/sshd tcp 0 1 10.87.2.20:45086 184.108.40.206:* SYN_SENT 0 2302801 206/bor tcp6 0 0 :::30303 :::* LISTEN 0 1975428 206/bor tcp6 0 0 :::8545 :::* LISTEN 0 1975431 206/bor tcp6 0 0 :::8546 :::* LISTEN 0 1975432 206/bor
The data directory is /matic-data. If you attach a persistent volume to the container, this should serve as the mount point to it. This is important as by default, the root filesystem of the container <= 250 MB.
root@matic:/matic-data# tree -dh . ├── [ 110] bor │ ├── [7.5K] chaindata │ │ └── [ 288] ancient │ ├── [ 78] lightchaindata │ └── [ 98] nodes ├── [ 0] keystore └── [ 14] logs
If you do,
tail -f /matic-data/logs/bor.log, you will logs for data sync,
That should be pretty much ! . We have a matic node running. Once the node syncs, you can update keys / wallets as per your requirements. This should get you started !