This is a quick hands-on guide/reference for developers interested in VeChain platform.

For overall understanding of VeChain please refer to their documentation.

I ll be using the latest API built by VeChain for DApp development: Connex.

Reasons to use VeChain from a developmnet point of view:

  1. Large overlap with Ethereum platform (the industry standard for DApp development).
    • Your Ethereum dev skills are transferable to VeChain: Solidity, Truffle Suit, Remix, etc…
  2. Cheaper than Ethereum to deploy and execute smart contracts

Create Smart Contract

  • Create project
  • Write Solidity smart contract under contracts folder
  • Compile it

Outcome is under build folder.

Deploy Smart Contract

At the time of writing it seems the easiest way to deploy is using Inspector dapp that can be accessed via Sync v1 browser (Sync v2 is the recommended). The source code for Inspector is here.

  1. Install Sync v1 browser and run Sync
  2. Open Inspector App. Make sure you select the right nework: MainNet or TestNet before
  3. Create or import account.
  4. Copy byte code from truffle project under build/contracts/Greet.json
  5. Click Send button – Sync will prompt you to accept transaction

You can validate contract from Inspector app by copy pasting the abi (from build/contracts/Greet.json)

Create Wallet

  1. Go to Sync2: You can either use Sync2 Desktop or Browser version and create a wallet
  2. Backup wallet (Must store mnemonic words)
  3. Get tokens to spend: https://faucet.vecha.in

Interact with Smart Contract: Frontend

In this section will show how to use Connex API from a web application e.g. Vanilla JS or SPA framework (React, Vue, etc…). The key point here is that the user will be prompted by Sync to accept/reject spending VTHO to complete the transaction. Sync2 manages private keys and signs transactions.

Interact with Smart Contract: Backend

  1. Make sure you have your wallet’s mnemonic in hand
  2. I will extract private key using thor-devkit
  3. Write to similar blockchain smart contract using a signed transaction
  4. Read result back

Transfer Money

You can use below code with either Frontend or Backend example.

Source Code

raedabusanad/vechain-developer-guide (github.com)