Solana
Code example can be found here
The general flow of the Collateral transfer_team flow is described as follows:
- Admin: Is the admin of the Collateral account that wants to transfer it to either a new admin or group of admins.
- Admin Signer: is the Solana account set as admin into the Collateral account that you must have access to sign both transactions and Buffers of information. It can be a custodial wallet like Phantom Wallet, a non-custodial like Privy, a smart account or a multi-sign account.
- Message Generator: Is a utility included in this example at the file
messageGenerator.tsthat helps to generate the message that must be signed by your Admin Signer to authorize the transference of your Collateral. - Solana RPC: A Solana node connected to the network on either Mainnet, Devnet or Localnet.
- Collateral: Is the Collateral account stored in the Solana network that you want to transfer.
- Collateral Admin Signatures: Is a support account that will helps to temporary store the autorization given by you Admin Signer to transfer the Collateral account.
index.ts using a Keypair of the Admin Signer to sign the authorization message and send the transaction to the chain. If you want to go deep into the example jump to the What This Script Does section. Otherwise, continue reading the How to Create Your Own Integration section.
🔧 How to Create Your Own Integration
This section provides a step-by-step guide for creating your own integration to transfer collateral team ownership. It is assumed that you have your own way to load the signer in your environment.Step 1: Generate the Request
First, import the types and create aTransferCollateralTeamRequest with the new information for the collateral account:
Step 2: Generate and Sign the Message
Import the message generator and create aTransferCollateralTeamMessage to generate the message that needs to be signed:
Step 3: Upload the Signatures
Create a transaction with two instructions to upload the signatures:3.1: Ed25519 Instruction
For collateral accounts with a single admin, use the standardEd25519Program:
3.2: Submit Signatures Instruction
Create the submit signatures instruction using the Rain program:Step 4: Send the Transfer Team Transaction
Finally, invoke thetransfer_collateral_team transaction using the Anchor program:
Important Notes
- Signer Implementation: You must implement your own way to load and use the signer in your environment
- Transaction Size Limits: Solana has a 1232-byte transaction size limit, so keep the number of admins reasonable (recommended max: 5)
- Nonce Management: Always use the current adminDataNonce from the collateral account to prevent replay attacks
- Error Handling: Implement proper error handling for network issues, insufficient funds, and invalid signatures
- Testing: Always test on devnet before deploying to mainnet
🏗️ Design Considerations
Why This Two-Step Flow?
Authorization Mechanism: The authorization is provided by admins signing a message that includes the operation arguments (new name, list of admins, and threshold value). This signature is submitted to the chain for verification and stored in an account that holds the authorization until consumed during transfer execution. Verification occurs by:- Checking that the signature generated using the Ed25519 curve belongs to a current admin of the collateral
- Verifying that the signed message matches the expected one corresponding to the transfer invocation arguments