i'm playing around a bit with serverless execution using AWS, and have so far managed to route 'basic' RPC functions just using standard POST functionality.

I'm currently trying to work out how to do this for transactions. Right now my react app just uses the standard solana web3 framework, so does something like:

let signature = await wallet.sendTransaction(
                    new Transaction().add(instruction),

which works just fine. I feel like there must be a way to do this with one or two POST requests. Alchemy/Quicknode etc at least has a sendTransaction end point, which just requires me to have a signed transaction as a string:

    curl RPC_ADDRESS \
  -X POST \
  -H "Content-Type: application/json" \
  --data '{"method":"sendTransaction","params":["ENTER_ENCODED_TRANSACTION_ID"],"id":1,"jsonrpc":"2.0"}'

But i'm unclear how to actually do the signing using a wallet. Using Phantom as an example they seem to quote an end point (https://phantom.app/ul/v1/signTransaction) but don't have any explanation I can follow that explains how one might use this, and this would then presumably require code per wallet type.

Does the wallet even need to have a connection to the outside world? There is a web3 function wallet.signTransaction, but it isn't obvious to me if that requires a connection to be established somewhere.

Thanks for any tips!

2 Answers 2


You don't need an external wallet like Phantom to sign and send transactions to the network. You can simply use Keypairs if you are in a server environment. For example, you can do:

const {
} = require("@solana/web3.js");

let fromKeypair = Keypair.generate();
let toKeypair = Keypair.generate();
let transaction = new Transaction();

    fromPubkey: fromKeypair.publicKey,
    toPubkey: toKeypair.publicKey,
    lamports: LAMPORTS_PER_SOL,
let connection = new Connection(clusterApiUrl("testnet"));
sendAndConfirmTransaction(connection, transaction, [fromKeypair]);

To sign transactions, you don't need any connection to the outside world, but to send transactions, you must be able to send to a node.

Copied from the docs https://docs.solana.com/developing/clients/javascript-api#creating-and-sending-transactions


You don't need phantom or any other wallet provider to sign a transaction, you can simply import your Pk/Mnemonic into your logic => sign a transaction and send it using JSON RPC API.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.