How to Deploy a Smart Contract on VeChain with Bare Hands.

A Byte Ahead
4 min readJan 6, 2020

Hello! Welcome to this part of the universe that we lazy engineers try to deploy a smart contract on VeChain without any special tools.

Tell your fellow engineers about these tricks and let’s build on VeChain right now!

Old Days of Deployment

In the good old days, developers on the blockchain face several critical components to deploy and fine-tune their smart contracts:

  1. A piece of source code of Solidity.
  2. A compiler to turn source code into byte code.
  3. A small utility program to deploy the byte code onto test-net.
  4. Another small utility program to interact with the deployed contract.

Although briefly described above, the whole process is not an easy-to-go process since we lack tools to help us and the setup cost of those tools are high, just to mention a few:

  1. Install solc the compiler on the computer.
  2. Prepare an account and write a small Javascript program in web3 to deploy the contract.
  3. Or plugin remix + web3 gear to deploy the contract.
  4. Setup a test-net connection, or spin up your own blockchain node to connect to.
  5. Write another small utility program to call the functions on the smart contract to observe the final result.

Enough, enough!

Deployments are not meant to be that tedious and can be done via a more graphics-oriented way. Just a few clicks and you are good to go!

A Shortcut: VeChain Inspector

The truth about fast deployment on VeChain is:

You don’t need to write a line of code for tools, all can be done in browsers!

The appeal is quite simple and straight-forward:

I am a developer and want to fast test out my precious “smart contract” as below, what should I do?

https://gist.github.com/laalaguer/5d7dd6889e70e8784f4448f529dc8976

Right. This hello.sol is our source code.

Compile

First, compile in the remix browser IDE, go to:

https://remix.ethereum.org/

and open the file editor and put in our hello.sol right away!

Copy the hello.sol into Remix

Then from the left panel, add a compiler, and hit the compile button!

Enable a compiler.
Compile the source code.

Simple and easy, so far so good.

Now we can retrieve the artifacts that we have compiled from the source code, the byte code (which is what we will deploy onto the test-net) and the ABI (the map of source code if we want to interact with the contract).

Deploy

Remember how painful it is to deploy by hand? How the tools fall apart when we connect them together? Remember how long it takes to sync before the test-net is useable?

All are gone and I introduce to you a swift sword for doing it: Inspectorapp in the Sync browser.

In case you haven’t downloaded the Sync browser, get it from here: https://env.vechain.org/

Sync browser is really useful as it already contains functions of: wallets, networks and lightweight utility programs developed by other developers.

Great, now we click open the Sync browser and find the Inspector app down below there. (Link: https://inspector.vecha.in/)

Click “view more” to find the Inspector app
Click to use the Inspector app.

Since we haven’t deployed the contract yet, we copy-paste the byte code and hit the deploy button!

Deploy the smart contract byte code.

Soon enough, the tool will do the job for you and show you where it is deployed (contract address).

For example, my smart contract is deployed on the address of:

0x6d48628bb5bf20e5B4e591c948e0394e0d5BB078

As for now, we haven’t programmed a line of code and yet we have deployed the smart contract successfully.

Interact/Debug

Now we use the ABI we copied earlier to establish a graphic interface to access it. Click the “+” button on the right and create a new smart contract interface.

Fill in the name you want to call it, fill in the ABI JSON and with a simple click of “add” you get an interface!

Great, now it is the time to interact with it. Click on the card, and you will be presented with all the “read” and “write” methods that can be called on the smart contract.

A smart contract interface.
Methods of the smart contract.

Conclusion

If you are new to VeChain development and simply want to test out an idea that you’ve written in Solidity, you can now use Inspector tool as the primary tool to simplify your life. The cost of the tool/network establishment is very low and can be done with just a few clicks!

--

--