Hello World
In this section, we will deploy and interact with a Hello World
smart contract onto the Zilliqa testnet using Neo-Savant web IDE and ZilPay wallet.
Create Testnet Wallet using ZilPay
ZilPay is an open source browser add-on that manages a user’s Zilliqa wallet and can be used on Chrome, Firefox and Opera browsers. It does not store any user's private keys on the server. Instead, they are password protected and stored on browser storage. It is a non-custodial wallet, meaning, only the user has full access and responsibility for their private key.
To create a ZilPay wallet:
- Visit ZilPay's website and download the extension for your respective browser.
- Open the extension, create a new wallet by verifying your 12 words recovery phrase and selecting a password for your wallet.
note
Please store your 12 words recovery phrase securely
- Click on the
network change
button (shown below) and select thenetwork
as testnet.

Voila! You have now successfully set up a testnet ZilPay wallet.
Request Testnet $ZIL from Faucet
Deploying a contract to zilliqa's testnet will consume gas. As such you will need testnet $ZIL in your ZilPay account to pay for the gas.
To request for testnet $ZIL from the faucet,
- Visit Nucleus wallet testnet faucet
- Enter and submit your ZilPay address to the faucet, you will receive 300 testnet $ZIL shortly. This will take about 30s to 1 min, as the transactions will need to be confirmed on the blockchain.

Deploying Contract on Testnet
To deploy the Hello World
contract on the Zilliqa testnet, we will use the Scilla web IDE, Neo-Savant IDE.
- Change the
network
to testnet and import your wallet by connecting with Zilpay.

- Select the
Hello World
contract under the files tab and click onCheck
button to use the typechecker to check for any syntax errors in your contract.

- Once the typechecker result is passed, click on
Deploy
button to deploy the contract to testnet. Use your wallet address (Base16 format) for the "owner" initialisation parameter.

Yay! Your contract is now deployed on the testnet and can be accessed under the "Contracts" tab on the left side of the IDE.
tip
To convert from Bech32
address format into base16 address format, you can use the address converter in the IDE. Click on Tools > Address converter
.
Understanding the Hello World Contract
The Hello World contract written in the scilla smart contract programming language essentially consists of two transitions. The transitions of a scilla contract define the public interface for the contract and are a way to define how the state of the contract may change.
The two transitions in the Hello World are:
setHello()
-setHello
transition updates the value of the mutable variable - 'welcomeMsg' to the value of the transition parameter.
getHello()
-getHello
transition fetches the value of the mutable variable - 'welcomeMsg' and emits it as an entry of an emitted event.
Front-End Contract Interaction Using zilliqa-js
Let's interact with the Hello World
contract using a simple front-end.
Clone the following repository and follow the installation steps: Hello World Front-End.
The above repository builds on the create-react-app starter kit. If you don't have experience working with React, this guide would still be useful for you as the zilliqa-js part of the code is VanillaJS and you can use that as it is in the framework of your choice.
Change Contract State Using ZilPay
After following the installation steps, you need to run the code locally by using the command
npm start
On successfully running the web application locally on your system, enter the address of your Hello World contract deployed on the testnet and connect your ZilPay wallet with the front-end by clicking on the Connect button.
To call the transitions from the front-end using ZilPay:
setHello()
- Upon clicking the Set Hello button and approving the transaction via ZilPay, thesetHello()
transition will be called and the value of thewelcomeMsg
mutable variable in the contract code will be updated with the new message.
The following code snippet achieves this functionality:
getHello()
- Upon clicking the 'Get Hello' button and approving the transaction via ZilPay, thegetHello()
transition will be called and the value of thewelcomeMsg
mutable variable is emitted as part of a contract event.
We will use the Zilliqa WebSocket Server (ZWS) to subscribe to all new event logs generated for our Hello World contract. This allows us to update the Welcome Msg on the web application as soon as the getHello()
transaction gets confirmed and an event is emitted.
The following code snippet achieves this functionality:
View Receipt on ViewBlock Explorer
ViewBlock explorer is a block explorer that supports both Zilliqa mainnet and testnet. It allows you to look at the status of your transaction, current status of the Zilliqa network, contract source code etc.
For example, this is the ViewBlock's transaction link for a getHello() transition transaction.