Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.heysage.me/llms.txt

Use this file to discover all available pages before exploring further.

Sage builds entirely on Squads Protocol V4, the audited multisig program for Solana. Sage adds no custom on-chain program of its own — it composes the Squads instructions and supplies the second signer.

Program

ItemValue
ProgramSquads Protocol V4
Program IDSQDS4ep65T869zMMBKyuUq6aD6EgTu8psMjkvj52pCf
SDK@sqds/multisig
NetworksSolana Mainnet-beta, Devnet (RPC_URL / SOLANA_RPC_URL)
Commitmentconfirmed

Multisig Layout

Each user gets one Squads multisig with two members and a threshold of 1:
MemberPermissionsRole
User (Privy embedded wallet)Initiate, Vote, Execute (Permissions.all())Proposes and votes
Sage (server keypair)Execute onlyCo-signs and broadcasts approved transfers
The server is added as a member at creation but holds only Execute — it can never initiate a transfer, only push through what the user has proposed and what passed screening.

Deterministic Vaults

The vault address is derived deterministically per user, so a login from any device resolves the same vault:
// createKey is HMAC-SHA256(sponsorSecret, "sage_multisig_v1:" + userPubkey)
const createKey = deriveCreateKey(userPubkey);
const [multisigPda] = multisig.getMultisigPda({ createKey: createKey.publicKey });
const [vaultPda]    = multisig.getVaultPda({ multisigPda, index: 0 });
If the multisig already exists on-chain, /sponsor/create returns the existing PDAs instead of re-creating.

PDAs

PDADerived fromPurpose
MultisigcreateKeyThe multisig config account
VaultmultisigPda, indexThe treasury that holds and sends funds
TransactionmultisigPda, transactionIndexA proposed vaultTransaction
ProposalmultisigPda, transactionIndexVote-tracking account for a transaction
Program configResolves the Squads treasury (rent destination)
Sage is the fee payer and rent collector for the full lifecycle. The user never needs SOL.
StepInstructionSigners / payer
Create vaultmultisigCreateV2Server (fee payer) + createKey
ProposevaultTransactionCreate + proposalCreate + proposalApproveUser signs as member; server pays via /sponsor/send
ExecutevaultTransactionExecuteServer signs as executing member and fee payer
Reclaim rentvaultTransactionAccountsCloseServer (permissionless; rent → rentCollector)
The multisig is created with rentCollector = server, so rent from completed proposals returns to the sponsor.

SDK Wrappers

The src/ package wraps the Squads SDK for tests and reuse:
FunctionWhat it does
createMultisig(params)Creates a multisig with members and threshold
getMultisigState(connection, multisigPda)Fetches on-chain multisig state
getProposalState(connection, multisigPda, transactionIndex)Fetches a proposal account
deriveVaultPda(multisigPda, index)Derives the vault PDA
The canonical end-to-end agentic co-signer flow is covered in tests/reference/transfer-flow.test.ts.
Always verify the Squads program ID against the official Squads documentation before deploying to mainnet.