Before you begin
- Use your Solana Gun endpoint (see below). Replace the placeholders with your connection details.
- Have a funded Solana wallet and its local keypair JSON file. The example sends 0.0021 SOL (2,100,000 lamports) to an existing wallet, plus the network fee.
- Use a regular Solana RPC to fetch a recent blockhash. The example uses
https://solana-rpc.publicnode.com.
Endpoints
Choose a host close to your application and copy the endpoint.Send a transaction
1
Create a Rust project
2
Add dependencies
Replace the
[dependencies] section in Cargo.toml with:Cargo.toml
3
Write the code
Save the code as
src/main.rs and replace the hostname, port, token, keypair path, and recipient address:src/main.rs
4
Run
Submission response
The example prints the signature from your signed transaction. A successful send means the client wrote the transaction bytes.It does not guarantee server acceptance or confirmation on Solana.