First API Call
Now that your Signchain Vault is set up, you’re ready to make your first API call. In this guide, we’ll walk you through creating a wallet within your vault, verifying your vault’s setup, and demonstrating the core structure of Signchain API requests.
Prerequisites
To make an API call, you’ll need:
- Vault ID and API Key: Available on the Signchain Dashboard.
- Curl or a REST Client (e.g., Postman, Insomnia) installed, or a preferred programming language with HTTP request support.
1. Verify Vault Connection
Before creating a wallet, it’s a good idea to confirm that your vault is reachable and that your API Key and Vault ID are correctly configured.
Check Vault Status
Run this command to check the status of your vault:
curl -X GET https://signchain.net/api/v1/vaults/<vault-id>/status \
-H "Authorization: Bearer <your-api-key>"
Test Endpoint
A successful response confirms that your vault is running and accessible. If you receive any errors, double-check your Vault ID and API Key.
2. Create Your First Wallet
Creating a wallet within your vault is a key operation, as it enables your Signchain Vault to securely manage blockchain accounts.
Make the Request
To create a wallet, use the following request structure:
curl -X POST https://signchain.net/api/v1/vaults/<vault-id>/wallets \
-H "Authorization: Bearer <your-api-key>" \
-H "Content-Type: application/json" \
-d '{
"name": "My First Wallet"
}'
- Vault ID: Replace
<vault-id>
with your actual Vault ID. - API Key: Ensure that you have replaced
<your-api-key>
with the correct API Key. - Wallet Name: Customize the
"name"
field to identify your wallet.
Test Endpoint
Expected Response
On success, you’ll receive a JSON response with details about the created wallet, including a unique wallet ID and address:
{
"success": true,
"data": {
"id": "wallet-id",
"account": "account-id",
"vault": "vault-id",
"name": "My First Wallet",
"address": "0x...",
"created": "2024-10-26T12:00:00Z",
"updated": "2024-10-26T12:00:00Z"
}
}
The address
field shows the wallet’s public Ethereum address, which you’ll use to perform transactions.
3. Explore More API Endpoints
Once your first wallet is created, you can experiment with other API operations, including listing wallets, updating wallet details, and performing secure transaction signing.
-
List Wallets: Retrieve a list of all wallets in your vault.
curl -X GET https://signchain.net/api/v1/vaults/<vault-id>/wallets \ -H "Authorization: Bearer <your-api-key>"
Test Endpoint
-
Sign a Transaction: Test transaction signing using your new wallet.
curl -X POST https://signchain.net/api/v1/vaults/<vault-id>/sign \ -H "Authorization: Bearer <your-api-key>" \ -H "Content-Type: application/json" \ -d '{ "contract": "<contract-address>", "chain": "ethereum", "sender": "<wallet-address>", "abi": { "name": "transferSigned", "inputs": [ {"name": "to", "type": "address"}, {"name": "value", "type": "uint256"} ], "outputs": [] }, "args": ["<recipient-address>", "<amount>"] }'
Test Endpoint
4. Common Troubleshooting Tips
- Unauthorized Access Error: Ensure that your API Key and Vault ID are correct and have sufficient permissions.
- Timeout or Connection Errors: Verify that your firewall or network configurations allow access to Signchain’s API endpoints.
By making your first API call, you’ve completed a key milestone in using Signchain! Now you’re ready to dive deeper and explore more capabilities with the API Reference and Developer Guides.