Build a Rust-based HTTP server exposing Solana-related endpoints. The server provides functionality to generate keypairs, handle SPL tokens, sign/verify messages, and construct valid on-chain instructions.
https://your-url
All endpoints return JSON responses in the following format:
{
"success": true,
"data": { /* endpoint-specific result */ }
}
{
"success": false,
"error": "Description of error"
}
Generate a new Solana keypair.
Endpoint: POST /keypair
Response:
{
"success": true,
"data": {
"pubkey": "base58-encoded-public-key",
"secret": "base58-encoded-secret-key"
}
}
Create a new SPL token initialise mint instruction.
Endpoint: POST /token/create
Request:
{
"mintAuthority": "base58-encoded-public-key",
"mint": "base58-encoded-public-key"
"decimals": 6
}
Response:
{
"success": true,
"data": {
"program_id": "string",
"accounts": [{
pubkey: "pubkey",
is_signer: boolean,
is_writable: boolean
}...],
"instruction_data": "base64-encoded-data"
}
}
Create a mint-to instruction for SPL tokens.
Endpoint: POST /token/mint
Request:
{
"mint": "mint-address",
"destination": "destination-user-address",
"authority": "authority-address",
"amount": 1000000,
}
Response:
{
"success": true,
"data": {
"program_id": "string",
"accounts": [
{
"pubkey": "pubkey",
"is_signer": false,
"is_writable": true
}...,
],
"instruction_data": "base64-encoded-data"
}
}
Sign a message using a private key.
Endpoint: POST /message/sign
Request:
{
"message": "Hello, Solana!",
"secret": "base58-encoded-secret-key"
}
Response:
{
"success": true,
"data": {
"signature": "base64-encoded-signature",
"public_key": "base58-encoded-public-key",
"message": "Hello, Solana!"
}
}
Error Response (Missing Fields):
{
"success": false,
"error": "Missing required fields"
}
Verify a signed message.
Endpoint: POST /message/verify
Request:
{
"message": "Hello, Solana!",
"signature": "base64-encoded-signature",
"pubkey": "base58-encoded-public-key"
}
Response:
{
"success": true,
"data": {
"valid": true,
"message": "Hello, Solana!",
"pubkey": "base58-encoded-public-key"
}
}
Create a SOL transfer instruction. Should only process valid inputs, figure out what we mean when we say valid inputs
Endpoint: POST /send/sol
Request:
{
"from": "sender-address",
"to": "recipient-address",
"lamports": 100000,
}
Response:
{
"success": true,
"data": {
"program_id": "respective program id",
"accounts": [
"address of first account",
"address of second account"
],
"instruction_data": "instruction_data"
}
}
Create an SPL token transfer instruction.
Endpoint: POST /send/token
Request:
{
"destination": "destination-user-address",
"mint": "mint-address",
"owner": "owner-address",
"amount": 100000,
}
Response:
{
"success": true,
"data": {
"program_id": "respective program id",
"accounts": [
{
pubkey: "pubkey",
isSigner: boolean,
}
],
"instruction_data": "instruction_data"
}
}
- Uses Ed25519 for signing/verification
- Base58 encoding for public/private keys
- Base64 encoding for signatures
- Detailed error messages in response
- Proper validation of all input fields
- Consistent error message format
- No private keys stored on server
- All cryptographic operations use standard libraries
- Input validation for all endpoints
- Proper error handling to avoid information leakage