Skip to content

vivekvt/solrustapi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Solana Rust HTTP API

A Rust-based HTTP server providing Solana-related endpoints for keypair generation, SPL token operations, message signing/verification, and transaction instruction creation.

Features

  • POST /keypair - Generate new Solana keypairs
  • POST /token/create - Create SPL token mint instructions
  • POST /token/mint - Create mint-to instructions
  • POST /message/sign - Sign messages with Ed25519
  • POST /message/verify - Verify signed messages
  • POST /send/sol - Create SOL transfer instructions
  • POST /send/token - Create SPL token transfer instructions

Local Development

Prerequisites

  • Rust 1.70+ installed
  • Cargo

Running Locally

# Build and run
cargo run

# The server will start on http://localhost:3000

Testing Endpoints

# Generate a keypair
curl -X POST http://localhost:3000/keypair

# Sign a message (use the secret from keypair generation)
curl -X POST http://localhost:3000/message/sign \
  -H "Content-Type: application/json" \
  -d '{"message": "Hello, Solana!", "secret": "YOUR_SECRET_KEY"}'

Heroku Deployment

Step 1: Install Heroku CLI

Download and install from https://devcenter.heroku.com/articles/heroku-cli

Step 2: Create Heroku App

heroku create your-app-name

Step 3: Add Rust Buildpack

heroku buildpacks:set emk/rust

Step 4: Deploy

git add .
git commit -m "Initial commit"
git push heroku main

Step 5: Scale the Web Process

heroku ps:scale web=1

Your API will be available at https://your-app-name.herokuapp.com

API Response Format

Success Response (200)

{
  "success": true,
  "data": {
    /* endpoint-specific data */
  }
}

Error Response (400)

{
  "success": false,
  "error": "Error description"
}

Environment Variables

  • PORT - Server port (defaults to 3000, automatically set by Heroku)

Tech Stack

  • axum - Modern async web framework
  • solana-sdk - Official Solana SDK
  • spl-token - SPL Token program utilities
  • ed25519-dalek - Ed25519 cryptographic operations
  • serde - JSON serialization/deserialization

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published