5. Interact with the contract - Transaction

  1. Within the scripts folder, create a file called setMessage.js

  1. Let's write our setMessage.js script

  • Import hardhat and swisstronikJS functions

  • Let's use sendShieldedTransaction to send a call/query to the blockchain

  • Write the main script to use sendShieldedTransaction function

  • Add this by hardhat default

  1. Execute the following command in your terminal to run the script using the Swisstronik network

    npx hardhat run scripts/setMessage.js --network swisstronik

  2. Upon successful execution, your terminal should display Transaction Receipt: TransactionResponse {...} , now it's time to retrieve this message🎉

Last updated