Multisig
Native threshold wallets with EOA and passkey owners0x00000000000000000000000000000000000000AC~10,000+ gas to create
// Sign an operation off chain (EIP-712) and execute it with the signatures
import { createPublicClient, createWalletClient, custom, http, parseAbi, parseEther } from 'viem';
const MULTISIG = '0x00000000000000000000000000000000000000AC';
const abi = parseAbi([
'function info(address wallet) view returns (address[] owners, uint256[] passkeyX, uint256[] passkeyY, uint256 threshold, uint256 nonce)',
'function execute(address wallet, address[] to, uint256[] value, bytes[] data, bytes[] signatures) returns (bytes[] results)',
]);
const publicClient = createPublicClient({ transport: http('https://rpc.vitruveo.ai') });
const walletClient = createWalletClient({ transport: custom(window.ethereum) });
const [account] = await walletClient.getAddresses();
const wallet = '0xYourMultisigWallet';
const calls = [{ to: '0xRecipient', value: parseEther('1'), data: '0x' }];
const [, , , , nonce] = await publicClient.readContract({ address: MULTISIG, abi, functionName: 'info', args: [wallet] });
// Each EOA owner signs the operation (eth_signTypedData_v4)
const signature = await walletClient.signTypedData({
account,
domain: { name: 'Vitruveo Multisig', version: '1', chainId: 1490, verifyingContract: wallet },
types: {
Execute: [{ name: 'calls', type: 'Call[]' }, { name: 'nonce', type: 'uint256' }],
Call: [{ name: 'to', type: 'address' }, { name: 'value', type: 'uint256' }, { name: 'data', type: 'bytes' }],
},
primaryType: 'Execute',
message: { calls, nonce },
});
// EOA signature format: 0x01 | r | s | v
const eoaSig = '0x01' + signature.slice(2);
// Anyone can submit; msg.sender also counts as an approval if it is an owner
await walletClient.writeContract({
account, chain: null, address: MULTISIG, abi, functionName: 'execute',
args: [wallet, calls.map(c => c.to), calls.map(c => c.value), calls.map(c => c.data), [eoaSig /*, more signatures */]],
});Why It Matters
A multisig without deploying a wallet contract. Wallets are keyless addresses derived from the creator and a salt, controlled by a threshold of owners. Owners can be addresses (EOAs or contracts) or P-256 passkeys. A wallet holds VTRU, tokens and NFTs like any address and executes batches of calls all-or-nothing, including calls into other contracts.
How It Works
create(owners, passkeyX, passkeyY, threshold, salt)creates the wallet atwalletAddress(msg.sender, salt). Up to 32 owners in total.execute(wallet, to[], value[], data[], signatures[])runs up to 64 calls as the wallet. Approvals are counted from distinct owners:- EOA signature:
0x01 | r | s | vover the operation hash (EIP-712) - Passkey signature:
0x02 | abi.encode(x, y, authenticatorData, clientDataJSON, r, s), where the WebAuthn challenge is the operation hash (base64url) - Prior on-chain
approve(wallet, opHash)calls by address owners (works for contract owners) msg.senderofexecute(), if it is an address owner
- EOA signature:
- EIP-712 (
eth_signTypedData_v4): domain{ name: "Vitruveo Multisig", version: "1", chainId, verifyingContract: wallet }, typesExecute(Call[] calls,uint256 nonce)andCall(address to,uint256 value,bytes data).operationHash()returns it. - Owner and threshold changes (
addOwner,addPasskey,removeOwner,setThreshold) are calls from the wallet to this precompile insideexecute(), so they need the same approvals. - Owner ids: address owner =
bytes32(uint256(uint160(owner))); passkey =keccak256(abi.encode(x, y)). - Send VTRU to the wallet address directly, not with a call to this precompile.
- State-changing functions revert inside STATICCALL.
Gas
Every call 500 + 1/byte of input Create wallet 10000 + 2000/owner Owner read 100/owner approve / admin update 2000 Execute 2000 + forwarded call gas EOA signature 3000 Passkey signature 3500
Interface
interface IMultisig {
event WalletCreated(address indexed wallet, address indexed creator);
event Approved(address indexed wallet, bytes32 indexed opHash, bytes32 ownerId);
event Executed(address indexed wallet, bytes32 indexed opHash, uint256 nonce);
event OwnerAdded(address indexed wallet, bytes32 indexed ownerId);
event OwnerRemoved(address indexed wallet, bytes32 indexed ownerId);
event ThresholdChanged(address indexed wallet, uint256 indexed threshold);
function walletAddress(address creator, bytes32 salt) external view returns (address wallet);
function create(address[] calldata owners, uint256[] calldata passkeyX, uint256[] calldata passkeyY,
uint256 threshold, bytes32 salt) external returns (address wallet);
function operationHash(address wallet, address[] calldata to, uint256[] calldata value,
bytes[] calldata data, uint256 nonce) external view returns (bytes32);
function execute(address wallet, address[] calldata to, uint256[] calldata value,
bytes[] calldata data, bytes[] calldata signatures) external returns (bytes[] memory results);
function approve(address wallet, bytes32 opHash) external returns (bool);
function info(address wallet) external view returns (address[] memory owners, uint256[] memory passkeyX,
uint256[] memory passkeyY, uint256 threshold, uint256 nonce);
function approvedBy(address wallet, bytes32 opHash) external view returns (bytes32[] memory ownerIds);
// Callable only by the wallet itself (as a call inside execute)
function addOwner(address owner) external returns (bool);
function addPasskey(uint256 x, uint256 y) external returns (bool);
function removeOwner(bytes32 ownerId) external returns (bool);
function setThreshold(uint256 threshold) external returns (bool);
}Source: contracts/multisig/IMultisig.sol in the Vitruveo protocol repository.