Interact with the Contract (Backend)

Please ensure that all necessary development environments and dependencies are properly installed and configured.

Once your program is deployed on the SOON Devnet, the next step is to interact with it from a client-side application. This interaction is facilitated using the Solana web3.js library, which allows you to communicate with the Solana blockchain.

This section will guide you through interacting with your deployed smart contract from the backend in our own example.

First, clone the hello-world example repository to your local machine. If you have already cloned, skip this and cd to the project directory.

git clone https://github.com/soonlabs/hello-world

Change into the project directory:

cd hello-world/backend
pnpm i
pnpm start

After confirmation, you can check the transaction on SOON Devnet Explorer:

explorer.devnet.soo.network

To proceed with this, the backend developer needs to export their secret key and replace the placeholder in the sample code with their actual private key. While in most real-world scenarios, secret keys should be securely managed and stored in environment variables (to ensure security and avoid hardcoding sensitive information), for the sake of this example, we have included a private key in the code as a reference.

Last updated