Examples
Using Adamik API with StarkNet
This guide demonstrates how to create, sign, and broadcast a transaction using the Adamik API with StarkNet. This tutorial is perfect for developers who want to leverage Adamik to power their StarkNet workflow, ensuring secure and efficient transaction management.
Prerequisites
- Node.js and npm installed
- Basic understanding of StarkNet blockchain and transaction workflows
- Familiarity with StarkNet libraries
Step-by-Step Guide
1. Setting Up the Environment
Install the required dependencies:
2. Writing the Script
Below is the script that handles StarkNet transactions, including wallet deployment and transfers:
3. Explanation
- Key Generation: The script uses the StarkNet curve to generate a public key from your private key.
- Address Encoding: Before making a transfer, we need to get our wallet address using the Adamik API’s address encode endpoint.
- Transaction Encoding: The transaction details are passed to the Adamik API, which encodes the transaction specifically for StarkNet.
- Signing: The encoded transaction is signed using StarkNet’s signature scheme.
- Broadcasting: The signed transaction is broadcast to the StarkNet network via the Adamik API.
4. Deploying a Wallet
If you need to deploy a new wallet, here’s how:
5. Troubleshooting
- Invalid Signature: Ensure you’re using the correct private key and StarkNet curve for signing.
- Gas Fees: Make sure your wallet has enough funds to cover gas fees.
6. Get in Touch
Connect with us through our Discord Server or directly through GitHub.
Was this page helpful?