Wallet Management

Get or Create Wallet

Get or create a wallet for the given chain and return its public address. If a wallet doesn’t exist for the user and chain combination, one will be created automatically.
cURL
curl -X POST 'https://tee.express.magiclabs.com/v1/wallet' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IjNhYVl5dGR3d2UwMzJzMXIzVElyOSJ9...' \
  -H 'X-Magic-API-Key: your-magic-api-key' \
  -H 'X-OIDC-Provider-ID: your-oidc-provider-id' \
  -H 'X-Magic-Chain: ETH' 
Response:
{
  "public_address": "0x6b422EefBFBc47a6900A1fc5454Ef4b940B7e36e"
}

Request Parameters

X-Magic-Chain
string
required
Header
The blockchain to create the wallet for. Available values: ETH, SOL

Response Fields

public_address
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

Sign Data

Sign a hash of arbitrary data using the wallet’s private key. This is useful for signing transaction data, typed data, or any structured information.
cURL
curl -X POST 'https://tee.express.magiclabs.com/v1/wallet/sign/data' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IjNhYVl5dGR3d2UwMzJzMXIzVElyOSJ9...' \
  -H 'X-Magic-API-Key: your-magic-api-key' \
  -H 'X-OIDC-Provider-ID: your-oidc-provider-id' \
  -H 'X-Magic-Chain: ETH' \
  -d '{
    "raw_data_hash": "0xabc123def4567890abc123def4567890abc123def4567890abc123def4567890"
  }'
Response:
{
  "message_hash": "0xabc123def4567890abc123def4567890abc123def4567890abc123def4567890",
  "signature": "0x8e7d6c5b4a3928172635445566778899aabbccddeeff00112233445566778899",
  "r": "0x3d4e5f678901234567890abcdef1234567890abcdef1234567890abcdef1234",
  "s": "0x4e5f678901234567890abcdef1234567890abcdef1234567890abcdef123456",
  "v": "27"
}

Request Parameters

X-Magic-Chain
string
required
Header
The blockchain to sign for. Available values: ETH, SOL
raw_data_hash
string
required
Body
The keccak256 hash of the data to sign (hex string with 0x postfix).

Response Fields

message_hash
string
The hash that was signed.
signature
string
The complete signature in hex format.
r
string
The r component of the ECDSA signature.
s
string
The s component of the ECDSA signature.
v
string
The recovery parameter of the ECDSA signature.

Sign Message

Sign an arbitrary message using the wallet’s private key. Useful for authentication, off-chain verification, and personal signatures.
cURL
curl -X POST 'https://tee.express.magiclabs.com/v1/wallet/sign/message' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IjNhYVl5dGR3d2UwMzJzMXIzVElyOSJ9...' \
  -H 'X-Magic-API-Key: your-magic-api-key' \
  -H 'X-OIDC-Provider-ID: your-oidc-provider-id' \
  -H 'X-Magic-Chain: ETH' \
  -d '{
    "message_base64": "bm9uZQ=="
  }'
Response:
{
  "signature": "0x0cebb670d8375ac74122b46c44def7e1ce593e80434a3e6557108ae124f8b44f3c5068fc104279fe7f51918cbe4c249d707bc1c0ce2fdee8d",
  "r": "0x0cebb670d8375ac74122b46c44def7e1ce593e80434a3e6557108ae124f8b44f",
  "s": "0x3c5068fc104279fe7f51918cbe4c249d707bc1c0ce2fdee8d",
  "v": "27"
}

Request Parameters

X-Magic-Chain
string
required
Header
The blockchain to sign for. Available values: ETH, SOL
message_base64
string
required
Body
The message to sign, encoded as base64.

Response Fields

signature
string
The complete signature in hex format.
r
string
The r component of the ECDSA signature.
s
string
The s component of the ECDSA signature.
v
string
The recovery parameter of the ECDSA signature.