Prerequisites
- Successful smart contract deployment.
- The ABI and contract address from the previous deployment are recorded. Generated after compilation and deployment.
- Funded wallet connected to the appropriate network (peaq/agung).
Instructions
Remix
1. Access the Deployed Contract
- In Remix, navigate to the Deployed Contracts section in the Deploy & Run Transactions sidebar.
- You’ll see your deployed contract listed, with an interactive UI displaying the contract’s functions.
2. Perform Write Operations
- In the Deployed Contracts interface, locate the set function.
- Enter an integer as an input field (e.g.
10
) and click the set button. - A MetaMask popup will be triggered to confirm the transaction. Confirm the transaction and wait for it to be appended on-chain.
- After completion the new value will be stored on the blockchain.
3. Perform Read Operations
- Locate the get function in the Deployed Contracts drop down in the Deploy & Run Transactions tab.
- Click the get button to fetch the current value stored in the contract.
- The result will appear below the function, showing the updated value (e.g.,
10
).
JavaScript
1. Create an Interaction Script
- Inside the
scripts/
directory of your project, create a new file namedinteract.js
- Add the following script to interact with your deployed contract:
2. Execute the Interaction Script
- In the root directory of your program run the cmd to execute the code written above. The code will deploy the contract on the agung network as defined in the
hardhat.config.js
file.
Python
1. Install Dependencies
web3
- Allows the interaction with EVM deployed contracts in Python.python-dotenv
- Provides basic protection for secret variables.
2. Create Python File
- Inside the
scripts/
directory of your project, create a new file namedinteract.py
- Add the following script to interact with your deployed contract:
3. Execute the Interaction Script
- To execute the code above you can use the following script: