Deploy using Quickstart Repository
Deploy a smart contract to Validium using the Quickstart Repository in under 5 minutes
This tutorial shows you how to deploy and interact with a smart contract on Validium in less than 5 minutes. It will help you get familiar with the Validium smart contract development and deployment process using different tools.
In this section you will learn how to:
Build a smart contract named Counter.
Deploy the smart contract to the Validium Testnet.
Interact with the contract using scripts.
Prerequisites
Before you start, make sure that youโve configured the Validium Testnet in your wallet.
Have at least 0.5 Validium Testnet VLDM. If you need more, use one of the faucets.
Quickstart Repository
Clone and Setup
Clone this repo to get started with a pre-configured template quickly:
git clone https://github.com/Validium-Chain/Deploy-on-Validium.gitMove to just the cloned folder and install dependencies:
cd Deploy-on-Validium
npm installcreate a
.envfile and add these environment variables:
Add your account wallet private key here using which you want to deploy and interact with your contract. Also, you will need the Infura API key with the Holesky network enabled (the Underlying Ethereum network).
Review the Smart Contract
Review the contract inside contracts folder:
The Solidity smart contract contains three functions:
incrementincreases the value of the count state by 1 and emits theCountUpdatedevent.decrementdecreases the value of the count state by 1 and emits theCountUpdatedevent.getCountreturns the current value of the count state.
Validium is EVM compatible. You can write smart contracts with Solidity or Vyper and use existing popular libraries like OpenZeppelin, just like on Ethereum.
Compile and Deploy the Smart Contract
Use this command to compile the smart contract:
It will compile and generate an artifacts folder named artifacts-zk .
Logs:
Go to
deploy.tsfile insidedeployfolder:
Update the following:
contractArtifactName(check generatedartifacts-zkfolder, usually the same as the contract file name)constructorArguments(if providing any arguments to the constructor)
Deploy to Validium Testnet:
This will deploy the compiled contract to the Validium Testnet.
Logs:
Piece of cake right? ๐
Check the Contract in Validium Block Explorer
Use the contract address from the deployment logs to see the deployed contract on the Validium Block Explorer or use the link from the logs directly.

You can also move to the Events tab and see the Greet event emitted through the constructor as a result of deployment:

Interact with the Deployed Contract
Go to
interact.tsfile insidedeployfolder:
Update the following:
CONTRACT_ADDRESS(copy the contract address from the deployment logs and paste it here)CONTRACT_NAME(contract artifact name fromafticats-zkfolder)
Run the interact script:
The interact script above triggers three transactions (two increment and one decrement) and one fetch (getCount) to the deployed contract. It also listens to the CountUpdated event when emitted.
Logs:
Check the transactions in Validium Block Explorer as well:

Takeaways
EVM-compatibility: Validium is EVM-compatible and you can write smart contracts in Solidity or Vyper as in Ethereum.
Custom compilers: smart contracts deployed to Validium must be compiled with the customs compilers:
zksolcfor Solidity andzkvyperfor Vyper.
Next steps
Follow the same above steps to deploy your contract, changes can be made to
interact.tsfile and use your methods from the contract.Continue learning by deploying an ERC20 token to Validium.
Last updated