Deploying a smart contract

Deploying a contract is done as follows:

Verifying the compiled binary in your workspace

This simply means verifying that the binary file you have compiled with static linking in the step which is specific for your language exists in your current workspace folder. After you have successfully executed the compilation, the resulting binary should be in your workspace already under the name contract. To verify just execute this command:

ls -al contract

If everything went well you should see similar output:

-rwxr-xr-x 1 user group 1204224 Jul 25 02:14 contract

Run the deploy command of qvmctl using docker

docker run --rm -v $(pwd):/ws qanplatform/qvmctl deploy --privkey privkey.txt contract

What happens under the hood?

Upload

  • Deployment fees are estimated based on your contract size

  • Balance check is performed whether your wallet address has enough funds to cover the fee

  • Your contract binary is pinned to IPFS

  • A checksum of the binary's integrity is generated

  • The above checksum is signed with your private key

  • A call is made to the QVM Repository contract with your IPFS CID + the signature

  • Fees are either paid during this call or the whole call fails

Download

  • The QVM Repository contract emits a Deployment event upon successful deployment

  • QVM Executor nodes will download the binary based on the IPFS CID

  • They will cryptographically prove to the QVM Repository that the contract has been downloaded indeed

  • The QVM Repository contract verifies the submitted cryptographic proof to ensure Executors have the binary

  • If above verification verification was successful then the contract is Registered and is now callable

Last updated