Invoking Lottery Smart Contract on KleverChain using KleverScan

Hey there, fellow developers! Ready to dive into the world of Smart Contracts on KleverChain? Let’s get you started with a quick and easy tutorial on how to invoke the Lottery Smart Contract using KleverScan.

Step 1: Ensure Klever Extension is Installed and Connected
First things first, make sure you have the Klever Extension installed and connected to KleverScan. Click on the ‘Connected Wallet’ button to access your linked account.

Step 2: Request Test KLV
To ensure you have a balance (available only on the testnet environment), click on the ‘Request Test KLV’ button.

Step 3: Create a Transaction
Now, let’s create a transaction. Click on the ‘Create Transaction’ option to proceed.

Step 4: Choose ‘Smart Contract’
On the transaction options page, select the ‘Smart Contract’ option.

Step 5: Select ‘Invoke’ Operation
Under the ‘Operation’ list, choose the ‘Invoke’ option.

Note: The ‘Deploy’ option will be available in Phase 02

Step 6: Add Contract Address
In the ‘Contract Address’ field, paste the following address:

klv1qqqqqqqqqqqqqpgqlg5l6y5mx2zyysgwh37qjzv3e6ywwd5cxgds82pc09

This is the address where the Lottery Smart Contract was deployed

Step 7: Upload Contract ABI
Upload the lottery-kda.abi file into the ‘Contract ABI’ field. You can download this ABI file here.

Step 8: Choose a Function to Invoke
Under the ‘Function’ list, select the function you want to invoke. Here’s the function flow:

  • start/createLotteryPoll
  • buy_ticket
  • determine_winner

Each function has a set of parameters to feed.

For this demonstration, we are utilizing ‘TestNetSCLottery’ as the lottery_name field

Step 9: Create Transaction
Once you’ve set everything up, click on the ‘Create Transaction’ button.

A Klever Extension window will pop up, asking you to sign the transaction. Verify all the details, ensure everything looks good, then click on the ‘Sign’ button.

Congratulations!
Woohoo! You’ve successfully invoked a Smart Contract on the KleverChain Virtual Machine using KleverScan. :tada: To check out the transaction details, simply click on the hash link provided.

You can easily find this and all transactions made by Klever Smart Contracts on the transactions page on KleverScan filtering by Smart Contract.

And there you have it! A straightforward guide to Invoke Smart Contracts on KleverChain by KleverScan. Have fun exploring the possibilities and stay tuned for more exciting developments!

Happy coding, and remember always #BeKlever! :muscle:

Feel free to reach out if you have any suggestions or need further assistance. Let’s build the future of blockchain together!

5 Likes