Deploy Smart Contracts with 0 ETH: LOOM


Yes, you heard it right. This is no clickbait article, I will tell you how to deploy your smart contracts from scratch with 0 ETH fees.

Before, going ahead first try to understand what is LOOM?

Source — LOOM

“Loom Network is a production-ready, multichain interop platform for serious dapp developers. It provides the tools and knowledge developers need to launch high-performance dapps that require a fast and seamless UX across multiple chains. With integrations to Bitcoin, Ethereum, Binance Chain, and all major blockchains, deploying once to Loom lets you future-proof your dapp by reaching the largest possible user base today.”
loom blockchain

This article mostly focuses on technical aspects and how to deploy the contract on Loom from scratch, to learn more in theory you can always visit Loom documentation.

Without wasting much time, let’s start.

  1. Download the LOOM Binary.
curl | sh
# set LOOM_BIN to reference the downloaded loom binary,
# makes it easy to invoke it from anywhere
export LOOM_BIN=`pwd`/loom

2. Generate Private and Public Key for LOOM.

$LOOM_BIN genkey -k extdev_private_key -a extdev_public_key

3. Install and Setup Truffle.

We will be using Truffle to set up our structure.

$ npm install -g truffle

Now we will initialise the truffle

$ truffle init
Setting up...
Unbox successful. Sweet!
  Compile:        truffle compile
Migrate: truffle migrate
Test contracts: truffle test

Till now we have created a raw structure of Loom and Truffle, now all we need to do is write a simple smart contract and choose a network to deploy. As it is meant for testing purpose, so here we are deploying on extdev-plasma-us1.

4. Write a simple smart contract-

Here I am just showing you a demo, you can write your smart contract with n complexity.

I have written a simple smart contract for Counter.

pragma solidity ^0.5.8;
contract Counter {
uint counter;
constructor() public {
counter = 0; // Initialise the counter to 0
function increment() public {
function getCounter() public view returns (uint) {
return counter;

This you have to save on /contracts/counter.sol

I am providing you Github repo link for this project, for further reference you can view that.

And we also need to modify the migrations file.

5. Install require dependencies.

We need to install Loom support for Truffle HD wallet, so we can connect with it.

$ npm install truffle-hdwallet-provider loom-truffle-provider dotenv --save-dev

6. Setup truffle_config.js file.

Now we are almost done and we need to do the most crucial part, we need to set up the truffle config file and define all the configuration that will be needed to deploy it on Loom.

const LoomTruffleProvider = require('loom-truffle-provider');
const HDWalletProvider = require('truffle-hdwallet-provider');
module.exports = {
networks: {
extdev: {
provider: function() {
const privateKey = process.env.PRIVATE_KEY;
const chainId = 'extdev-plasma-us1';
const writeUrl = '';
const readUrl = '';;
return new LoomTruffleProvider(chainId, writeUrl, readUrl, privateKey)
network_id: '9545242630824'

Here you can notice that we have used chainId as extdev-plasma-us1 because we are deploying it on testnet you can change it if you need to deploy it on production.

Also, if you remember we have generated a private and public key for the loom. We are using that here, you can make an .env file and define the PRIVATE_KEY so that it can access by this.

Voila !! Now we are all set up and now we can compile and migrate it.

Open a terminal in the current directory.

and RUN

truffle compile
truffle migrate --network extdev

You will see something like this on the terminal.

Compiling your contracts...
> Everything is up to date, there is nothing to compile.
Starting migrations...
> Network name: 'extdev'
> Network id: 9545242630824
> Block gas limit: 0x0
   Deploying 'Migrations'
> transaction hash: 0xbfc8761ec98ee6940773cfb9c04c84dc1069fb20e66e8bf7c5dbc6a3c1198fd7
> Blocks: 0 Seconds: 0
> contract address: 0xEeb7A3C57DA6DdBa60F0a053Dbf4Cf1467313487
> block number: 8084445
> block timestamp: 1567489492
> account: 0xEF6E82E8099Db14bB0a7cD426aE18ca0169Ee767
> balance: 0
> gas used: 0
> gas price: 0 gwei
> value sent: 0 ETH
> total cost: 0 ETH
   > Saving migration to chain.
> Saving artifacts
> Total cost: 0 ETH
   Deploying 'Counter'
> transaction hash: 0x0d67c1eee590940e6fe72bcfce494bc562c6d5152630fda27c45b09aaab1bfa8
> Blocks: 0 Seconds: 0
> contract address: 0xcB5B46FA01Ce20a69AE972AE6A983205d896be1b
> block number: 8084452
> block timestamp: 1567489505
> account: 0xEF6E82E8099Db14bB0a7cD426aE18ca0169Ee767
> balance: 0
> gas used: 0
> gas price: 0 gwei
> value sent: 0 ETH
> total cost: 0 ETH
   > Saving migration to chain.
> Saving artifacts
> Total cost: 0 ETH
> Total deployments: 2
> Final cost: 0 ETH

Congratulations !!! You have successfully deployed a smart contract with 0 ETH and that you can see in Final cost.

And now you can send those save ETH to me *wink*.

S0, that’s all from my side. You can find Github link below for this and also do let me know any queries or feedback down below.

Thank you

Happy Blockchaining.




Deploy Smart Contracts with 0 ETH: LOOM was originally published in Coinmonks on Medium, where people are continuing the conversation by highlighting and responding to this story.