Transaction Signing

Sign transaction payloads for different blockchain networks. The payload format varies by network type.

EVM Transaction Signing

Sign Ethereum and EVM-compatible chain transactions.
cURL
curl -X POST 'https://tee.magiclabs.com/v1/api/wallet/sign_transaction' \
  -H 'Content-Type: application/json' \
  -H 'x-magic-secret-key: sk_live_XXXXXXXX' \
  -d '{
    "payload": {
      "type": 2,
      "chainId": 888888,
      "nonce": 1,
      "value": "0x616263646566",
      "gas": 100000,
      "maxFeePerGas": 2000000000,
      "maxPriorityFeePerGas": 2000000000,
      "to": "0x0aA818d7952c0B6a56ee97581708866C154f63AD"
    },
    "encryption_context": "hashed_passcode",
    "access_key": "key_shard",
    "wallet_id": "wallet_id"
  }'

Solana Transaction Signing

Sign Solana blockchain transactions.
cURL
curl -X POST 'https://tee.magiclabs.com/v1/api/wallet/sign_transaction' \
  -H 'Content-Type: application/json' \
  -H 'x-magic-secret-key: sk_live_XXXXXXXX' \
  -d '{
    "payload": "transaction_base64",
    "encryption_context": "hashed_passcode",
    "access_key": "key_shard",
    "wallet_id": "wallet_id"
  }'

Bitcoin Transaction Signing

Sign Bitcoin blockchain transactions.
cURL
curl -X POST 'https://tee.magiclabs.com/v1/api/wallet/sign_transaction' \
  -H 'Content-Type: application/json' \
  -H 'x-magic-secret-key: sk_live_XXXXXXXX' \
  -d '{
    "payload": {
      "inputs": [
        {
          "address": "bc1q59ehj6mza09gk8v5558dqpy8m4c...",
          "value": 5,
          "txid": "d12beb629cebe086149c9c7b558f09531f8...",
          "tx_num": 0
        }
      ],
      "outputs": [
        {
          "address": "bc1q59ehj6mza09gk8v5558dqpy8m4c...",
          "value": 5
        }
      ]
    },
    "encryption_context": "hashed_passcode",
    "access_key": "key_shard",
    "wallet_id": "wallet_id"
  }'
Transaction Signing Response:
{
  "data": {
    "signed_transaction": "0xabc...",
    "transaction_hash": "0xabc..."
  }
}

Request Parameters

payload
object
required
Body
Transaction payload to be signed. Format varies by network:
  • EVM: Standard Ethereum transaction object
  • Solana: Base64-encoded transaction string
  • Bitcoin: Object with inputs and outputs arrays
encryption_context
string
required
Body
The context used to decrypt key shards. Should match the context used during wallet creation.
access_key
string
required
Body
The access key shard for this wallet.
wallet_id
string
required
Body
The UUID of the wallet to sign with.

Response Fields

data.signed_transaction
string
The signed transaction ready for broadcast to the blockchain.
data.transaction_hash
string
The transaction hash that will be generated when the transaction is submitted to the network.

Message Signing

Sign Data

Sign arbitrary data using keccak256 hash.
cURL
curl -X POST 'https://tee.magiclabs.com/v1/api/wallet/sign_data' \
  -H 'Content-Type: application/json' \
  -H 'x-magic-secret-key: sk_live_XXXXXXXX' \
  -d '{
    "raw_data_hash": "keccak256_string_hash",
    "encryption_context": "hashed_passcode",
    "access_key": "key_shard",
    "wallet_id": "wallet_id"
  }'
Data Signing Response:
{
  "data": {
    "messageHash": "0xabc...",
    "signature": "0xabc...",
    "r": "",
    "s": "",
    "v": ""
  }
}

Request Parameters

raw_data_hash
string
required
Body
The keccak256 hash of the data to sign
encryption_context
string
required
Body
The context used to decrypt key shards. Should match the context used during wallet creation.
access_key
string
required
Body
The access key shard for this wallet.
wallet_id
string
required
Body
The UUID of the wallet to sign with.

Response Fields

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

Sign Message (Solana)

Sign an arbitrary message using a Solana wallet.
cURL
curl -X POST 'https://tee.magiclabs.com/v1/api/wallet/svm/sign_message' \
  -H 'Content-Type: application/json' \
  -H 'x-magic-secret-key: sk_live_XXXXXXXX' \
  -d '{
    "message_base64": "base64_string_hash",
    "encryption_context": "hashed_passcode",
    "access_key": "key_shard",
    "wallet_id": "wallet_id"
  }'
Solana Message Signing Response:
{
  "data": {
    "signature": "base64_encoded"
  }
}

Request Parameters

message_base64
string
required
Body
The message to be signed, encoded in base64
encryption_context
string
required
Body
The context used to decrypt key shards. Should match the context used during wallet creation.
access_key
string
required
Body
The access key shard for this wallet.
wallet_id
string
required
Body
The UUID of the wallet to sign with.

Response Fields

data.signature
string
The signature in base64 format