Skip to content

SethuRamanOmanakuttan/lottery-contract-cronos-hardhat

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Labs

Chainstack is the leading suite of services connecting developers with Web3 infrastructure

         

Supported protocolsChainstack blogChainstack docsBlockchain API referenceStart for free

Lottery smart contract on Cronos blockchain

In this tutorial, you will learn how to build a lottery smart contract using Solidity, and how to deploy and verify smart contracts on the Cronos blockchain using Hardhat. This repo serves as the codebase for you to be able to follow along comfortably with the written tutorial on Chainstack's blog:

Project details

Cronos is an EVM-compatible layer 1 blockchain, equipped with the unique Inter Blockchain Communications (IBC) protocol powered by the Cosmos SDK. This gives Cronos interoperability between Cosmos and EVM ecosystems.

In this project you will be create, test, deploy and verify a Lottery smart contract on the Cronos Testnet straight from Hardhat's command line.

Quick Start

Clone this repository.

Install project-level dependencies:

npm install

Setting up dotenv file

Run this command at the root of oyur terminal to create a dotenv file:

touch .env

Configure it along the following lines:

RPC_URL=CHAINSTACK_CRONOS_NODE_URL
PRIVATE_KEY=YOUR_PRIVATE_KEY
API_KEY=CRONOSCAN_API_KEY(to verify the smart contract)

Save the dotenv file and run this command in your terminal:

source .env

Compile smart contract

npx hardhat compile

Testing in Hardhat

Run this command to start a local Hardhat node in your terminal:

npx hardhat node

Run the tests on your local node with:

npx hardhat test --network localhost

Deploy and verify

You already have the deploy script setup in scripts/DeployDutch.js. To dpeloy on Cronos testnet, simply run:

npx hardhat run --network Cronos_testnet scripts/DeployDutch.js

To verify:

npx hardhat verify --network Cronos_testnet {Contract Address}

Conclusion

You now have a deployed and verified smart contract on the Cronos Testnet. Feel free to create your own project from scratch by following along with our blog, linked above.

About

Learn how to develop and deploy a lottery smart contract on Cronos using Chainstack and Hardhat.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 70.3%
  • Solidity 29.7%