Native Framework (solana-program)
Pre-Alpha Disclaimer: This is an early pre-alpha release for exploring the SDK and starting development only. There is no real MPC signing — all signatures are generated by a single mock signer, not a distributed network. Do not submit any real transactions for signing or rely on any security guarantees. The dWallet keys, trust model, and signing protocol are not final; do not rely on any key material until mainnet. All interfaces, APIs, and data formats are subject to change without notice. The Solana program and all on-chain data will be wiped periodically and everything will be deleted when we transition to Ika Alpha 1. This software is provided “as is” without warranty of any kind; use is entirely at your own risk and dWallet Labs assumes no liability for any damages arising from its use.
The ika-dwallet-native crate provides a CPI SDK using Solana’s standard solana-program crate. No framework lock-in — just raw AccountInfo and invoke_signed.
Dependencies
[dependencies]
ika-dwallet-native = { git = "https://github.com/dwallet-labs/ika-pre-alpha" }
solana-program = "2.2"
solana-system-interface = "1"
[lib]
crate-type = ["cdylib", "lib"]
DWalletContext
#![allow(unused)]
fn main() {
use ika_dwallet_native::DWalletContext;
let ctx = DWalletContext {
dwallet_program: &accounts.dwallet_program,
cpi_authority: &accounts.cpi_authority,
caller_program: &accounts.program,
cpi_authority_bump: bump,
};
}
| Field | Type | Description |
|---|---|---|
dwallet_program | &AccountInfo<'info> | The dWallet program account |
cpi_authority | &AccountInfo<'info> | Your program’s CPI authority PDA |
caller_program | &AccountInfo<'info> | Your program’s account (must be executable) |
cpi_authority_bump | u8 | Bump seed for the CPI authority PDA |
CPI Authority PDA
#![allow(unused)]
fn main() {
use ika_dwallet_native::CPI_AUTHORITY_SEED;
use solana_program::pubkey::Pubkey;
let (cpi_authority, bump) = Pubkey::find_program_address(
&[CPI_AUTHORITY_SEED],
&your_program_id,
);
}
Methods
approve_message
#![allow(unused)]
fn main() {
ctx.approve_message(
&message_approval, // &AccountInfo — PDA to create
&dwallet, // &AccountInfo — the dWallet
&payer, // &AccountInfo — pays rent
&system_program, // &AccountInfo
message_hash, // [u8; 32]
user_pubkey, // [u8; 32]
signature_scheme, // u8
bump, // u8 — MessageApproval PDA bump
)?;
}
transfer_dwallet
#![allow(unused)]
fn main() {
ctx.transfer_dwallet(&dwallet, &new_authority)?;
}
transfer_future_sign
#![allow(unused)]
fn main() {
ctx.transfer_future_sign(&partial_user_sig, &new_authority)?;
}
Example: Voting dWallet
Source: chains/solana/examples/voting/native/
#![allow(unused)]
fn main() {
use solana_program::{
account_info::{next_account_info, AccountInfo},
entrypoint,
entrypoint::ProgramResult,
program::invoke_signed,
program_error::ProgramError,
pubkey::Pubkey,
rent::Rent,
sysvar::Sysvar,
};
use ika_dwallet_native::DWalletContext;
entrypoint!(process_instruction);
fn process_instruction(
program_id: &Pubkey,
accounts: &[AccountInfo],
instruction_data: &[u8],
) -> ProgramResult {
match instruction_data[0] {
0 => create_proposal(program_id, accounts, &instruction_data[1..]),
1 => cast_vote(program_id, accounts, &instruction_data[1..]),
_ => Err(ProgramError::InvalidInstructionData),
}
}
}
Uses next_account_info() for account iteration, Rent::get()?.minimum_balance() for rent, and system_instruction::create_account + invoke_signed for PDA creation.
When quorum is reached, the program constructs a DWalletContext and calls approve_message.
When to Use Native
| Consideration | Pinocchio | Native | Anchor |
|---|---|---|---|
| CU efficiency | Best | Good | Good |
| std library | No (no_std) | Yes | Yes |
| Framework dependency | pinocchio | solana-program | anchor-lang |
| Account validation | Manual | Manual | Declarative |
| Migration from existing | Rewrite | Minimal | Rewrite |
Choose Native when you have an existing solana-program codebase, want std library access, or prefer no framework lock-in beyond Solana’s standard SDK.
Differences from Pinocchio
| Pinocchio | Native | |
|---|---|---|
| Account type | &AccountView | &AccountInfo<'info> |
| Entrypoint | pinocchio::entrypoint!() | solana_program::entrypoint!() |
| CPI | pinocchio::cpi::invoke_signed | solana_program::program::invoke_signed |
| PDA creation | pinocchio_system::CreateAccount | system_instruction::create_account + invoke_signed |
| Rent | minimum_balance() helper | Rent::get()?.minimum_balance() |
| std | #![no_std] | Full std |
| Account iteration | Array indexing | next_account_info() |
Both SDKs use the same CPI authority seed, instruction discriminators, and account layouts. Programs built with either are fully interoperable.