slide 1: Deploy Your First Smart Contract on Loom Network
Using Remix | Yudiz Solutions Pvt. Ltd.
Introduction to Loom Network:
Loom Network is a platform to help the Ethereum scale. Loom Network provides a Layer 2 solution
that uses Ethereum as it’s the base layer. Using Ethereum as a base layer means base chain assets like
ERC20 ERC721 tokens can have security guarantees of the Ethereum.
The loom is the perfect solution for building scalable applications with almost no transaction cost and
very less amount of time for transaction confirmation.
If you don’t know more about the Loom Network and are curious to know then you can check
this handy guide where you can get more ideas about the Loom Network.
Without wasting time let’s go through the process of deploying smart contracts on the
Loom Basechain.
How to Deploy Smart Contract on Loom Chain:
It’s easy to deploy smart contracts on the loom.
Steps to deploy Smart Contract on Loom:
1. Integrate Remix with Loom
2. Writing your Smart Contract
3. Deploy Smart Contract on Loom from Remix IDE.
It’s that simple Isn’t it
slide 2: Step 1: Integrate Remix IDE with Loom
To integrate Remix with loom it requires services that proxies JSON RPC call to Loom. For that
Loom had built a small JSON RPC Proxy. So here we will install and configure it with the Remix
IDE to deploy our smart contract on Loom.
Prerequisites to install JSON RPC Proxy:
Node.js 10 or higherrecommended v10.15.3
Yarn
Git client
1. Clone the JSON RPC Proxy repository:
Open a terminal cd into your project directory and execute below command:
git clone https://github.com/loomnetwork/loom-provider-json-rpc-proxy
2. Install Dependencies and Build the Proxy:
For that run below command
cd loom-provider-json-rpc-proxy/ yarn install yarn build
3. Configure the Proxy:
You need to configure a proxy to connect to Loom Testnet or Loom Basechain. For that
you need to set the following environment variablesPORT: port on which proxy listens for
incoming requests. The default port is 8080.
CHAIN_ID: Network Id you want to connect to. default for Mainnet extdev-plasma-
us1 for Testnet. By default it will connect to Loom Mainnet.
CHAIN_ENDPOINT: the address of the endpoint. The default value
is wss://plasma.dappchains.com.Run below command to run proxy against Loom Testnet.
PORT8545 CHAIN_ENDPOINT"wss://extdev-plasma-us1.dappchains.com"
CHAIN_ID"extdev-plasma-us1" node .
Run below command to run proxy against Loom Basechain. Make sure deploying smart
contracts on Loom Mainnet isn’t free. To deploy a smart contract on Loom Mainnet you need
to whitelist your address which will cost you around 1400 Loom per year ATM.
node .
Step 2: Writing your Smart Contract
Here is our Smart Contract example. It is a very simple smart contract that stores string messages and
retrieve it from smart contracts. This is just for demo purposes. You can also use your smart contract
code.
pragma solidity 0.4.25
slide 3: contract HelloWorld
// Define variable message of type string
string message
// Write function to change the value of variable message
function postMessagestring value public
message value
// Read function to fetch variable message
function getMessage public view returns string
return message
Step 3: Deploy Smart Contract on Loom
First of all we need to configure Remix to use Loom JSON RPC Proxy. For that open Remix Editor.
Click on the Run menu and then select the Environment as Web3 Provider.
slide 4: Now you are good to deploy our solidity Smart Contract to Loom Network. Paste below smart
contract code into Remix. Select the appropriate compiler version and compile a smart contract by
clicking the Compile button.
After compiling a smart contract you can deploy your smart contract by just clicking
the Deploy button.
slide 5: Conclusion:
Cheers. You just deployed your first smart contract code on the Loom network. I hope from now
onwards you can deploy smart contracts on the Loom Network. If you have any confusion feel free to
comment below.
Stay tuned with Yudiz Solutions