A Rust-based HTTP server that provides Solana blockchain operations including keypair generation, token operations, message signing/verification, and SOL/token transfers.
- Generate Solana keypairs
- Create and mint SPL tokens
- Sign and verify messages using Ed25519
- Send SOL and SPL token transfers
- Input validation and error handling
- CORS enabled for web applications
src/main.rs – Currently contains the application entry point, server startup, and all other logic that should be moved into separate modules.
- Rust (latest stable version)
- Cargo package manager
- Clone the repository:
git clone <your-repo-url>
cd solana-http-server- Build the project:
cargo build --release- Run the server:
cargo run --releaseThe server will start on http://localhost:3000
- GET
/- Check if server is running
- POST
/keypair- Generate a new Solana keypair
- POST
/token/create- Create a new SPL token mint instruction - POST
/token/mint- Create a mint-to instruction for SPL tokens
- POST
/message/sign- Sign a message using a private key - POST
/message/verify- Verify a signed message
- POST
/send/sol- Create a SOL transfer instruction - POST
/send/token- Create an SPL token transfer instruction
curl -X POST http://localhost:3000/keypaircurl -X POST http://localhost:3000/message/sign \
-H "Content-Type: application/json" \
-d '{
"message": "Hello, Solana!",
"secret": "your-base58-encoded-secret-key"
}'curl -X POST http://localhost:3000/token/create \
-H "Content-Type: application/json" \
-d '{
"mint_authority": "your-mint-authority-pubkey",
"mint": "your-mint-pubkey",
"decimals": 6
}'# Download ngrok
wget https://bin.equinox.io/c/bNyj1mQVY4c/ngrok-v3-stable-linux-amd64.tgz
tar xvzf ngrok-v3-stable-linux-amd64.tgz
# Or use snap
sudo snap install ngrokcargo run --releasengrok http 3000ngrok will provide you with a public URL like https://abc123.ngrok.io that you can use to access your server from anywhere.
All endpoints return JSON responses in the following format:
{
"success": true,
"data": { /* endpoint-specific result */ }
}{
"success": false,
"error": "Description of error"
}- No private keys are stored on the server
- All cryptographic operations use standard libraries
- Input validation for all endpoints
- Proper error handling to avoid information leakage
- CORS is enabled for web application integration
cargo runcargo test./test_server.shcargo build --release-
axum - Web framework
-
tokio - Async runtime
-
solana-sdk - Solana SDK for blockchain operations
-
spl-token - SPL token program integration
-
serde - Serialization/deserialization
-
tower-http - HTTP middleware (CORS)
MIT License