How to Send Transaction of Your Generated API Endpoints on Kalp Studio
Asjad Ahmed Khan
Posted on October 10, 2024
Introduction
In the previous tutorial, we saw how Kalp Studio eases generating the API Endpoints of our desired smart contracts with the help of Kalp API Gateway. Now that we have the API Endpoints generated, it’s time to test and play with our API Endpoints and send the transactions on Kalp Studio.
Prerequisites
Before diving further into the tutorial, you must ensure the following are set up.
- A Kalp Studio Account. Create your account on Kalp Studio here.
- A Custodial Wallet: Before proceeding further, you must connect Kalp Studio’s Custodial Wallet. For this tutorial, we are connecting our wallet to the Ethereum Blockchain and Holesky Network. If you haven’t connected your wallet yet, please go through our first tutorial of this series here: Creating your Custodial Ethereum Wallet on Holsekey Network, using Kalp Studio.
- A Deployed Solidity Smart Contract: To generate API Endpoints, we must first deploy our desired smart contract on Kalp Studio using the Kalp Instant Deployer. To ensure you deploy your smart contract on Kalp Studio, look at the second tutorial of this series: Create Your First Smart Contract in Solidity and Upload it to Kalp Instant Deployer.
- Generated API Endpoints using Kalp API Gateway: To ensure that we can send transactions to Kalp Studio, you must have generated the API Endpoints of your deployed smart contract via Kalp API Gateway. Refer to the previous tutorial for generating the endpoints: Generating the API Endpoints of Your Smart Contract using the Kalp API Gateway.
- Basic understanding of how Postman API Services work.
Once all the requirements are set, we can test the Endpoints on Postman.
Creating the Requests on Postman
To create the requests from the endpoints on Postman, you must create an account and install Postman, once you have it ready, follow the steps below.
- After generating the API Endpoints of your smart contract, in the API Gateway section, you can see the list of all your smart contracts whose endpoints have been generated or need to be generated.
- Click on the ID of the desired smart contract, for this tutorial, we will be clicking on the ID
SC00000570
. Once you click on it, you can see the smart contract details, including the Method, Function, Routes and Action.
- Copy the Route URL (in this case, the get function’s URL), and go to your Postman Workspace.
- In your workspace, create a new POST Request and paste the URL “Enter URL or paste text” section.
- Next, click on the Headers section. Type
x-api-key
in the Key column and in the Value column, enter yourAPI Auth Key
. To know more about API Auth Key and how to generate one, refer to the docs here.
- Next, head over to the Body, and copy the body section by clicking on the Check Params button.
- On your Postman, once you have clicked on the Body section, choose
raw
from the radio buttons and select the format toJSON
from the dropdown, and paste your Routes Detail.
- Once you have all the details filled in, click the Send button to send the transaction to the Ethereum Holesky Blockhain.
The above picture shows that the evaluation of the get function has been done successfully. To check the transaction details, let’s head over to our Kalp Studio Dashbaord.
Examining the Transaction Details on Kalp Studio Dashboard
- In the dashboard's sidebar, click on the Transaction section, and you’ll see the list of all the deployed smart contracts.
- Click on the smart contract whose API Endpoints you used on Postman.
- Once you click on it, you can see the entire transaction history of your smart contract, such as Transaction ID, Blockchain, TxHash, Created on, and the Status of your transactions. You can also see a graphical representation of the stats in the top right corner.
You can repeat the same steps with the other functions of your deployed smart contracts to measure the details of the transactions.
Conclusion
You can easily send transactions on Kalp Studio using their API Gateway following these steps. The gateway simplifies the interaction between your applications and smart contracts, enabling secure and efficient transaction management. Whether you're sending tokens, executing smart contract functions, or interacting with decentralised applications (dApps), Kalp’s API Gateway provides the tools to make blockchain integration smoother.
Stay tuned for more advanced tutorials on using Kalp Studio to enhance your blockchain projects!
Check out our official documentation here to continue exploring what more Kalp Studio can do. If you have any queries, join our Discord server and let’s continue the discussion there.
Posted on October 10, 2024
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.