Wallet Management
Get or Create Wallet
Get or create a wallet for the authenticated user and return its public address. If a wallet doesn’t exist for the user, one is created automatically and cryptographically bound to the user’s JWT identity.cURL
Request Parameters
string
required
Header
The blockchain to create the wallet for. Available values:
ETH, SOL, BTCResponse Fields
string
The wallet’s public address on the specified blockchain.
Each user can have one wallet per blockchain. Calling this endpoint multiple times with the same user and chain will return the same wallet address.
Signing Operations
All signing operations use theAuthorization: Bearer JWT as the operation JWT (op_jwt). The Nitro Enclave verifies this JWT offline against JWKS baked into the enclave image and confirms the caller’s identity matches the wallet’s owner before authorizing the operation.
Sign Data
Sign a hash with the wallet’s private key. Send the hash together withtransaction_data, the content it was computed from. Magic recomputes the hash from that content and signs only when they match.
cURL
Request Parameters
string
required
Header
The blockchain to sign for. Only
ETH is supported: other chains have no transaction_data to check the hash against, so their requests are rejected. For Solana, use Sign Message with the serialized transaction message.string
required
Body
The hash to sign (hex string with 0x prefix), computed from
transaction_data as described below.object
required
Body
What you’re signing. Required for
ETH. Set method and the fields for it:See EVM data preparation for code that builds each one. Transactions with an access list, blobs or an authorization list are not supported here.
Response Fields
string
The hash that was signed.
string
The complete signature in hex format.
string
The r component of the ECDSA signature.
string
The s component of the ECDSA signature.
string
The recovery parameter of the ECDSA signature.
Sign EIP-7702 Authorization
Sign an EIP-7702 authorization that delegates an EOA to a smart contract implementation. This is used to temporarily upgrade an EOA into a smart wallet for a transaction bundle, enabling features like batched calls and gas sponsorship.cURL
Request Parameters
string
required
Header
The blockchain to sign for. Available values:
ETH, SOL, BTCnumber
required
Body
The chain ID for the authorization (e.g.,
84532 for Base Sepolia).string
required
Body
The smart contract address to delegate to (20-byte hex string).
number
required
Body
The authorization nonce.
Response Fields
string
The r component of the ECDSA signature (decimal string).
string
The s component of the ECDSA signature (decimal string).
number
The y-parity bit (
0 or 1) used for EIP-7702 signature recovery.Sign Message
Sign an arbitrary message using the wallet’s private key. Useful for authentication, off-chain verification, and personal signatures.cURL
Request Parameters
string
required
Header
The blockchain to sign for. Available values:
ETH, SOL, BTCstring
required
Body
The message to sign, encoded as base64.
Response Fields
string
The complete signature in hex format.
string
The r component of the ECDSA signature.
string
The s component of the ECDSA signature.
string
The recovery parameter of the ECDSA signature.