How to sign messages and send transactions on Solana
If you’re not using React, use the @account-kit/signer
package to create smart wallets on Solana, sign messages, sign transactions, and sponsor transaction fees.
If you’re using React, get started with Solana wallets here.
Create a Solana signer
Once you’ve authenticated users, convert the AlchemyWebSigner
to a Solana compatible signer using either of these methods:
Sign Message
To sign either a string or byte array with your Solana wallet use the signMessage
method. The method accepts a UInt8Array
as input:
Sign Transaction
To sign a prepared transaction with your Solana wallet use the addSignature
method. The following example demonstrates signing a transfer transaction:
signing-transaction-solana-signer.tsx
Sponsor transaction fees
To sponsor transaction fees on Solana:
- Set up your sponsorship policy in the dashboard to retrieve a policy ID
- Add sponsorship to the preparred transaction before signing and sending
sponsored-solana-transaction-signer.tsx