| Crates.io | chain-signatures-solana-program |
| lib.rs | chain-signatures-solana-program |
| version | 0.4.2 |
| created_at | 2025-12-12 06:15:56.104552+00 |
| updated_at | 2025-12-12 06:21:29.292029+00 |
| description | Chain signatures program for cross-chain signing on Solana |
| homepage | |
| repository | https://github.com/sig-net/signet-solana-program |
| max_upload_size | |
| id | 1981050 |
| size | 103,555 |
Solana program for cross-chain signature requests with verified response callbacks.
This program enables users to request ECDSA signatures from the Signet MPC network, supporting both simple signing and bidirectional cross-chain transactions.
These are the primary instructions for building applications:
| Instruction | Description |
|---|---|
sign |
Request signature on a 32-byte payload |
sign_bidirectional |
Cross-chain tx with execution result callback |
get_signature_deposit |
Query the current deposit amount (view function) |
The bidirectional flow enables cross-chain transaction execution with verified response callbacks:
User Solana (Source) MPC Network Destination Chain
│ │ │ │
│ sign_bidirectional() │ │ │
├───────────────────────►│ │ │
│ │ SignBidirectionalEvent │ │
│ ├────────────────────────►│ │
│ │◄──── respond() ─────────┤ │
│ │ │ │
│ Poll SignatureRespondedEvent │ │
│◄───────────────────────┤ │ │
│ │ │ │
│ Broadcast signed tx ───┼─────────────────────────┼───────────────────►│
│ │ │◄── Light client ───┤
│ │◄─ respond_bidirectional() │
│ │ │ │
│ Poll RespondBidirectionalEvent │ │
│◄───────────────────────┤ │ │
sign_bidirectional with serialized unsigned transactionSignBidirectionalEventrespond, emitting SignatureRespondedEventSignatureRespondedEvent to get signatureoutput_deserialization_schemarespond_serialization_schemakeccak256(request_id || serialized_output)respond_bidirectionalRespondBidirectionalEvent for user to pollEach request has a unique ID for tracking:
// For sign_bidirectional (packed encoding):
request_id = keccak256(
sender || serialized_tx || caip2_id || key_version ||
path || algo || dest || params
)
Cross-chain data encoding uses two schemas:
| Schema | Direction | Purpose |
|---|---|---|
output_deserialization_schema |
Destination → MPC | Parse execution result from destination chain |
respond_serialization_schema |
MPC → Source | Serialize response for source chain consumption |
See destination chain guides (e.g., EVM) for format details and examples.
Failed destination chain transactions are indicated with magic prefix:
const MAGIC_ERROR_PREFIX: [u8; 4] = [0xde, 0xad, 0xbe, 0xef];
// Check if response indicates failure:
fn is_error(output: &[u8]) -> bool {
output.starts_with(&[0xde, 0xad, 0xbe, 0xef])
}
Each user gets a unique destination chain address derived from:
epsilon = derive_epsilon(sender_pubkey, derivation_path)
user_pubkey = derive_key(mpc_root_pubkey, epsilon)
// Address format is chain-specific (see destination chain guides)
The respond_bidirectional response is signed using a special derivation path:
const RESPONSE_DERIVATION_PATH: &str = "solana response key";
// Response epsilon derivation:
epsilon = derive_epsilon(key_version, sender_pubkey, "solana response key")
response_pubkey = derive_key(mpc_root_pubkey, epsilon)
The signature is computed over:
message_hash = keccak256(request_id || serialized_output)
To verify the response signature, clients must:
secp256k1_recover"solana response key" pathRequest ID Uniqueness: Each request has a unique ID computed from
keccak256(sender || tx || chain_id || ...) preventing replay attacks
Response Authenticity: Responses are signed over
keccak256(request_id || serialized_output) using MPC threshold signatures
Output Verification: The output_deserialization_schema and
respond_serialization_schema ensure consistent data encoding across chains
Key Isolation: Each user has isolated keys through unique derivation paths
(epsilon = derive_epsilon(predecessor, path))
Light Client Security: The MPC light client validates destination chain consensus without trusting an RPC provider
For detailed integration guides with real code examples, see:
MIT