HowTo VeChain Blockchain — Part 1

MiRei
5 min readJul 18, 2020

Create a wallet on the VeChain Blockchain

(Links to all parts at the bottom)

Some weeks ago the python-based VeChain DevKit was released and I thought this would be a good chance to get to know python and the mechanics behind transactions a little better. So I started to play around with it and I learned a lot about python and how transactions on the VeChain Thor Mainnet work. So this will be a little walk-through to my future self and all you people who are interested to get to know the inner mechanics of the VeChain blockchain. This little series will explain everything thats important to create transactions and interact with the blockchain. The provided codesamples are simple and (maybe) inefficient on purpose to make it more easy to understand for Newbies and (for the most part) because I am a python Newbie myself. :)

In this first part, I want to get the the python environment up and running, create a VeChain wallet with it, import it in Sync and get some VET/VTHO from the VeChain Testnet Faucet.

Setting up the python environment

To get started, we really only need two things:

In Linux, its really straight forward. Just install python and then install:

pip3 install thor-devkit -U

In Windows, you need to install python as well but before you can install the devkit, you also need to install the Visual Studio Build Tools from Mircosoft and from choose “Workloads” and then the “Desktop development with C++” (compare the checks with the symbol in the picture below).

C++-Buildtools installed from Visual Studio Build Tools

After that, open a commad shell and do the same installation:

pip3 install thor-devkit -U

That’s it.

Create a wallet with the thor-devkit

The thor-devkit has some example usage on the github page. Based on this, the script to create a new wallet is really simple (Link to script here):

from thor_devkit import cry
from thor_devkit.cry import mnemonic
from thor_devkit.cry import hdnode
# Generate random mnemonic words
words = mnemonic.generate()
# Construct HD node from words.
hd_node = cry.HDNode.from_mnemonic(words)
# Get address and privatekey from words
for i in range(0, 1):
address='0x'+hd_node.derive(i).address().hex()
privkey=hd_node.derive(i).private_key().hex()
# Print out everything
print('')
print('Your mnemonic words are: ' + str(words))
print('Your wallet private key is: ' + str(privkey))
print('Your wallet address is: ' + str(address))
print('')

Copy this code into a text-file and save it as 1_create_wallet.py. Then run it as followed

python .\1_create_wallet.py

The result should look like the picture below. I will use this wallet in this demo. You can use this wallet to but NERVER use it in mainnet, only in testnet.

Create new vechain wallet with mnemonic words, private key and public address.
Your mnemonic words are: twenty, jelly, around, appear, approve, version, general, bright, crumble, all, master, sail]Your wallet private key is: 61faba91ef7516969e885d197f59feeb2007ea2c6057908d1696d6f056ca69d4Your wallet address is:
0xbc1497fc775f5cbf42dfeca44d97efaba79462b7

Import wallet into VeChain Sync

Sync is the desktop wallet for VeChain. It can be used to interact with the blockchain. After installation, it needs to be set to the testnet networks, simply by clicking on the green “main” text and the choose the “TEST” network.

After Sync is in testnet, we need to import the newly created wallet into Sync. This can be done by either importing the mnemonic words or by importing the private key.

VeChain Sync in Testnet
Import private key into Vechain Sync
Set name and Password for wallet in VeChain Sync

After the wallet is now availible in Sync, it is absolut crutial to compare the addresses generated by the script and shown in Sync. If these are not the same, something went wrong!

Imported wallet address in VeChain Sync

Get testnet VET/VTHO from VeChain faucet

To be able to use the VeChain testnet, VET/VTHO is needed. To get some, open https://faucet.vecha.in/ inside Sync and click on “Claim Tokens”.

VeChain Testnet faucet opened in Sync.

After clicking on “Clain Tokens”, you have to sign a certificate to identify yourself to the faucet. (This is a part of the VIP192 protocol.)

Sign a certification request in VeChain Sync

This will result in a transaction with 500 VET and 5000 VTHO send to the address ‘0xbc1497fc775f5cbf42dfeca44d97efaba79462b7’. (See transaction)

This is all for part 1. Stay tuned for the next part.

--

--