VeChain CustomNetwork — The BFC Story, Part 1
VeChain recently released Version 1.0.7 of their VeChain Thor Blockchain client. With this update it is now possible to run a seperate version of the VeChain Thor mainnet. This includes private Authority Nodes and private Thor Node server. But this also means that the custom chain is not connected to the main- nor the testnet. This is awesome for testing the limits of VeChain.
So I did exactly that: I tested the technical limits of the VeChain Thor network. Of course I was not able to rebuild the exact mainnet structure and that was not my goal. I will run you through all steps I have done, to give you an easy start if you want to try it yourself. I also had to tweak some settings of the VeChain Thor client — compared to the mainnet — to get results faster. And those results are awesome! It’s a BFC — Big Fu*king Chain.
Why testing in a private network?
VeChain already has two very smooth running blockchains: The mainnet and the testnet. Obviously, testing in mainnet is pricy, because you actually need to buy VTHOR. Testing in testnet is a valid option but the testnet currently has a 16 Million GAS limit per block. And we want to go beyond that. FAR beyond!
Tweaking the client!
As mentioned above, I did some changes in the source code to enable me to test faster. You can look through my GIT repo and clone it yourself but I will also walk you through the changes.
- TX Pool Size: I change the maximum size of transactions in the TX-Pool from 64KB to 256KB. This is to be able to send bigger transactions.
- BodyRequest Size: I changed the maximum site of the Requestbody from 200KB to 1MB. Also to send bigger transactions….
- TX Pool Amount and duration: On the normal mainnet, a unique sender could “only” have 16 transactions in the TX Pool. This is plenty for real users, even for big players. But I needed more, so I increased that amount from 16 to 64 and the maximal age of a transaction from 20 to 80 minutes.
Thats it. Although there are more changes in the GIT Repo, they are not related to the features of the chain.
How to setup a custom network?
To be able to run a custom VeChain network, you need to set up at least two (software) nodes and start the Thor client with some special settings. VeChain already described the process here: CustomNets
So let’s start with the server: We need at least two server running the Thor client and at least one of them has to sign blocks. So I set up two “Debian 9” VPS at my favorite hoster Vultr. The VPS are from the 10$ plan with 1 CPU, 2GB RAM and 25GB SSD. Keep those numbers in mind!
Now we need to install the Vechain Thor Client. You can do this by following this script (tested with Debian 9). The last line in the script will pull the config file for my custom network. This config sets the GAS Limit to 500 million and the relation of gas to VTHOR from 1.000 to 10.000, so a transaction only costs 2,1 VTHOR instead of 21. This can do some BIG blocks. This also sets the Authority Nodes to adresses wich private keys I own. To be able to sign blocks, at least one Node needs to have a private key put in /home/thor-node/.org.vechain.thor/master.key.
WARNING: This script will install a modified Vechain Client, not appoved by VeChain. Only use the for testing!
Also: This network and the coins in it are not worth any money.
When done installing the two machines, you can fire up your own VeChain network by starting the client like this.
/home/thor-node/go/src/VeChain/thor/bin/thor — network /home/thor-node/go/src/VeChain/thor/genesis/MiRei.json — api-addr 0.0.0.0:8669
Now some VeChain magic happens and after a few minutes the clients should be able to see each other and start syncing and signing blocks.
Connect to the CustomNetwork
Now that I have my own network running, I need to connect and interact with it; and I want other people to be able to connect (and interact) with it, too. So I set up a nice hostname: https://bfc.veblocks.net
The play API is of course not very fancy to use but VeChain has already released Sync and I can add CustomNetworks to Sync! All I need to do is to click on the green “Main”, say “Add Node” and enter the settings as shown below. You can do that too ;)
Browsing the CustomNetwork
Sync is already a BlockExplorer that is almost as powerful as Veforge and it is an absolute charm to use it on my own network. As you can see below, my very own genesis block on a VeChain CustomNetwork!
The BFC Stuff!
So, a private Chain with nothing in it. Boring!!!! I need to change that; and change it really good! So I wrote myself a litte something. As you can see on the Genesis Config File, there are six addresses in total containing VET and VTHOR. We will focus on the last five (yea, I used some GPU power to get these addresses :D ):
To be able to have more sender/recipients, I wrote a basic “Wallet Management and Distribution System” and added 20.000 Adresses to it. And with a maximum GAS Limit of 500.000.000 per Block I can distribute VET/VTHO to those addresses really quick.
In the video below I send 800.000 VET and 20.000 VTHOR to 20.000 addresses each in a total of 40 transactions. And I did that again for VTHOR from another wallet, so every address has 800.000 VET and at least 40.000 VTHOR.
As you can see in the video, I have
- created transactions containing 1000 clauses each.
- created blocks consuming 96M gas and including 6 transactions with a total of 6000 clauses
- distributed a total of 16 Billion VET to 20.000 addresses in four blocks and that took 40 seconds
- done all this with two VPS with 1 CPU and 2 GB of RAM.
- NOT changed any mechanic of the chain to work any different than the mainnet. The VeChain Thor mainnet can do that!
Let that sink in…
Now I have 20.000 Addresses to send and revieve… that will be fun.
Thats it for part 1. But there will be more.
Part 2 is now online.