跳转到主要内容
POST
/
v1
/
wallets
/
{walletId}
/
contracts
/
write
/
sign
Master Wallet Write Sign-Only
curl --request POST \
  --url https://api.blockradar.co/v1/wallets/{walletId}/contracts/write/sign \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <api-key>' \
  --data '
{
  "calls": [
    {
      "abi": [
        {
          "constant": false,
          "inputs": [
            {
              "name": "_to",
              "type": "address"
            },
            {
              "name": "_value",
              "type": "uint256"
            }
          ],
          "name": "transfer",
          "outputs": [],
          "payable": false,
          "stateMutability": "nonpayable",
          "type": "function"
        }
      ],
      "address": "0x337610d27c682E347C9cD60BD4b3b107C9d34dDd",
      "method": "transfer",
      "parameters": [
        "0x2455eC6700092991Ce0782365A89d5Cd89c8Fa22",
        "10000"
      ]
    },
    {
      "abi": [
        {
          "constant": false,
          "inputs": [
            {
              "name": "_to",
              "type": "address"
            },
            {
              "name": "_value",
              "type": "uint256"
            }
          ],
          "name": "transfer",
          "outputs": [],
          "payable": false,
          "stateMutability": "nonpayable",
          "type": "function"
        }
      ],
      "address": "0x337610d27c682E347C9cD60BD4b3b107C9d34dDd",
      "method": "transfer",
      "parameters": [
        "0x2455eC6700092991Ce0782365A89d5Cd89c8Fa22",
        "10000"
      ]
    }
  ]
}
'
import requests

url = "https://api.blockradar.co/v1/wallets/{walletId}/contracts/write/sign"

payload = { "calls": [
        {
            "abi": [
                {
                    "constant": False,
                    "inputs": [
                        {
                            "name": "_to",
                            "type": "address"
                        },
                        {
                            "name": "_value",
                            "type": "uint256"
                        }
                    ],
                    "name": "transfer",
                    "outputs": [],
                    "payable": False,
                    "stateMutability": "nonpayable",
                    "type": "function"
                }
            ],
            "address": "0x337610d27c682E347C9cD60BD4b3b107C9d34dDd",
            "method": "transfer",
            "parameters": ["0x2455eC6700092991Ce0782365A89d5Cd89c8Fa22", "10000"]
        },
        {
            "abi": [
                {
                    "constant": False,
                    "inputs": [
                        {
                            "name": "_to",
                            "type": "address"
                        },
                        {
                            "name": "_value",
                            "type": "uint256"
                        }
                    ],
                    "name": "transfer",
                    "outputs": [],
                    "payable": False,
                    "stateMutability": "nonpayable",
                    "type": "function"
                }
            ],
            "address": "0x337610d27c682E347C9cD60BD4b3b107C9d34dDd",
            "method": "transfer",
            "parameters": ["0x2455eC6700092991Ce0782365A89d5Cd89c8Fa22", "10000"]
        }
    ] }
headers = {
    "x-api-key": "<api-key>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
  method: 'POST',
  headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
  body: JSON.stringify({
    calls: [
      {
        abi: [
          {
            constant: false,
            inputs: [{name: '_to', type: 'address'}, {name: '_value', type: 'uint256'}],
            name: 'transfer',
            outputs: [],
            payable: false,
            stateMutability: 'nonpayable',
            type: 'function'
          }
        ],
        address: '0x337610d27c682E347C9cD60BD4b3b107C9d34dDd',
        method: 'transfer',
        parameters: ['0x2455eC6700092991Ce0782365A89d5Cd89c8Fa22', '10000']
      },
      {
        abi: [
          {
            constant: false,
            inputs: [{name: '_to', type: 'address'}, {name: '_value', type: 'uint256'}],
            name: 'transfer',
            outputs: [],
            payable: false,
            stateMutability: 'nonpayable',
            type: 'function'
          }
        ],
        address: '0x337610d27c682E347C9cD60BD4b3b107C9d34dDd',
        method: 'transfer',
        parameters: ['0x2455eC6700092991Ce0782365A89d5Cd89c8Fa22', '10000']
      }
    ]
  })
};

fetch('https://api.blockradar.co/v1/wallets/{walletId}/contracts/write/sign', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api.blockradar.co/v1/wallets/{walletId}/contracts/write/sign",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => json_encode([
    'calls' => [
        [
                'abi' => [
                                [
                                                                'constant' => false,
                                                                'inputs' => [
                                                                                                                                [
                                                                                                                                                                                                                                                                'name' => '_to',
                                                                                                                                                                                                                                                                'type' => 'address'
                                                                                                                                ],
                                                                                                                                [
                                                                                                                                                                                                                                                                'name' => '_value',
                                                                                                                                                                                                                                                                'type' => 'uint256'
                                                                                                                                ]
                                                                ],
                                                                'name' => 'transfer',
                                                                'outputs' => [
                                                                                                                                
                                                                ],
                                                                'payable' => false,
                                                                'stateMutability' => 'nonpayable',
                                                                'type' => 'function'
                                ]
                ],
                'address' => '0x337610d27c682E347C9cD60BD4b3b107C9d34dDd',
                'method' => 'transfer',
                'parameters' => [
                                '0x2455eC6700092991Ce0782365A89d5Cd89c8Fa22',
                                '10000'
                ]
        ],
        [
                'abi' => [
                                [
                                                                'constant' => false,
                                                                'inputs' => [
                                                                                                                                [
                                                                                                                                                                                                                                                                'name' => '_to',
                                                                                                                                                                                                                                                                'type' => 'address'
                                                                                                                                ],
                                                                                                                                [
                                                                                                                                                                                                                                                                'name' => '_value',
                                                                                                                                                                                                                                                                'type' => 'uint256'
                                                                                                                                ]
                                                                ],
                                                                'name' => 'transfer',
                                                                'outputs' => [
                                                                                                                                
                                                                ],
                                                                'payable' => false,
                                                                'stateMutability' => 'nonpayable',
                                                                'type' => 'function'
                                ]
                ],
                'address' => '0x337610d27c682E347C9cD60BD4b3b107C9d34dDd',
                'method' => 'transfer',
                'parameters' => [
                                '0x2455eC6700092991Ce0782365A89d5Cd89c8Fa22',
                                '10000'
                ]
        ]
    ]
  ]),
  CURLOPT_HTTPHEADER => [
    "Content-Type: application/json",
    "x-api-key: <api-key>"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.blockradar.co/v1/wallets/{walletId}/contracts/write/sign"

	payload := strings.NewReader("{\n  \"calls\": [\n    {\n      \"abi\": [\n        {\n          \"constant\": false,\n          \"inputs\": [\n            {\n              \"name\": \"_to\",\n              \"type\": \"address\"\n            },\n            {\n              \"name\": \"_value\",\n              \"type\": \"uint256\"\n            }\n          ],\n          \"name\": \"transfer\",\n          \"outputs\": [],\n          \"payable\": false,\n          \"stateMutability\": \"nonpayable\",\n          \"type\": \"function\"\n        }\n      ],\n      \"address\": \"0x337610d27c682E347C9cD60BD4b3b107C9d34dDd\",\n      \"method\": \"transfer\",\n      \"parameters\": [\n        \"0x2455eC6700092991Ce0782365A89d5Cd89c8Fa22\",\n        \"10000\"\n      ]\n    },\n    {\n      \"abi\": [\n        {\n          \"constant\": false,\n          \"inputs\": [\n            {\n              \"name\": \"_to\",\n              \"type\": \"address\"\n            },\n            {\n              \"name\": \"_value\",\n              \"type\": \"uint256\"\n            }\n          ],\n          \"name\": \"transfer\",\n          \"outputs\": [],\n          \"payable\": false,\n          \"stateMutability\": \"nonpayable\",\n          \"type\": \"function\"\n        }\n      ],\n      \"address\": \"0x337610d27c682E347C9cD60BD4b3b107C9d34dDd\",\n      \"method\": \"transfer\",\n      \"parameters\": [\n        \"0x2455eC6700092991Ce0782365A89d5Cd89c8Fa22\",\n        \"10000\"\n      ]\n    }\n  ]\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("x-api-key", "<api-key>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://api.blockradar.co/v1/wallets/{walletId}/contracts/write/sign")
  .header("x-api-key", "<api-key>")
  .header("Content-Type", "application/json")
  .body("{\n  \"calls\": [\n    {\n      \"abi\": [\n        {\n          \"constant\": false,\n          \"inputs\": [\n            {\n              \"name\": \"_to\",\n              \"type\": \"address\"\n            },\n            {\n              \"name\": \"_value\",\n              \"type\": \"uint256\"\n            }\n          ],\n          \"name\": \"transfer\",\n          \"outputs\": [],\n          \"payable\": false,\n          \"stateMutability\": \"nonpayable\",\n          \"type\": \"function\"\n        }\n      ],\n      \"address\": \"0x337610d27c682E347C9cD60BD4b3b107C9d34dDd\",\n      \"method\": \"transfer\",\n      \"parameters\": [\n        \"0x2455eC6700092991Ce0782365A89d5Cd89c8Fa22\",\n        \"10000\"\n      ]\n    },\n    {\n      \"abi\": [\n        {\n          \"constant\": false,\n          \"inputs\": [\n            {\n              \"name\": \"_to\",\n              \"type\": \"address\"\n            },\n            {\n              \"name\": \"_value\",\n              \"type\": \"uint256\"\n            }\n          ],\n          \"name\": \"transfer\",\n          \"outputs\": [],\n          \"payable\": false,\n          \"stateMutability\": \"nonpayable\",\n          \"type\": \"function\"\n        }\n      ],\n      \"address\": \"0x337610d27c682E347C9cD60BD4b3b107C9d34dDd\",\n      \"method\": \"transfer\",\n      \"parameters\": [\n        \"0x2455eC6700092991Ce0782365A89d5Cd89c8Fa22\",\n        \"10000\"\n      ]\n    }\n  ]\n}")
  .asString();
require 'uri'
require 'net/http'

url = URI("https://api.blockradar.co/v1/wallets/{walletId}/contracts/write/sign")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"calls\": [\n    {\n      \"abi\": [\n        {\n          \"constant\": false,\n          \"inputs\": [\n            {\n              \"name\": \"_to\",\n              \"type\": \"address\"\n            },\n            {\n              \"name\": \"_value\",\n              \"type\": \"uint256\"\n            }\n          ],\n          \"name\": \"transfer\",\n          \"outputs\": [],\n          \"payable\": false,\n          \"stateMutability\": \"nonpayable\",\n          \"type\": \"function\"\n        }\n      ],\n      \"address\": \"0x337610d27c682E347C9cD60BD4b3b107C9d34dDd\",\n      \"method\": \"transfer\",\n      \"parameters\": [\n        \"0x2455eC6700092991Ce0782365A89d5Cd89c8Fa22\",\n        \"10000\"\n      ]\n    },\n    {\n      \"abi\": [\n        {\n          \"constant\": false,\n          \"inputs\": [\n            {\n              \"name\": \"_to\",\n              \"type\": \"address\"\n            },\n            {\n              \"name\": \"_value\",\n              \"type\": \"uint256\"\n            }\n          ],\n          \"name\": \"transfer\",\n          \"outputs\": [],\n          \"payable\": false,\n          \"stateMutability\": \"nonpayable\",\n          \"type\": \"function\"\n        }\n      ],\n      \"address\": \"0x337610d27c682E347C9cD60BD4b3b107C9d34dDd\",\n      \"method\": \"transfer\",\n      \"parameters\": [\n        \"0x2455eC6700092991Ce0782365A89d5Cd89c8Fa22\",\n        \"10000\"\n      ]\n    }\n  ]\n}"

response = http.request(request)
puts response.read_body
{ "data": { "amlScreening": {}, "amount": null, "amountPaid": null, "amountUSD": "0.00", "asset": null, "assetSwept": null, "assetSweptAmount": null, "assetSweptAt": null, "assetSweptGasFee": null, "assetSweptHash": null, "assetSweptRecipientAddress": null, "assetSweptSenderAddress": null, "blockHash": null, "blockNumber": null, "blockchain": { "createdAt": "2024-05-27T14:31:14.966Z", "derivationPath": "m/44'/60'/0'/0", "id": "74733889-4ecd-403e-9840-94e87c043f24", "isActive": true, "isEvmCompatible": true, "isL2": true, "name": "base", "slug": "base", "symbol": "eth", "tokenStandard": null, "updatedAt": "2024-11-26T20:04:13.945Z" }, "chainId": null, "confirmations": null, "confirmed": true, "createdAt": "2025-08-11T22:21:56.077Z", "currency": "USD", "fee": null, "feeHash": null, "gasFee": null, "gasPrice": null, "gasUsed": null, "hash": "0x229d811ef34a9f12454e89f12e06945dfc8122538a0af6369ec3f2a2f9aa8cbb", "id": "fe2d8c39-a6ba-41cb-99e7-05c4dcee6c94", "metadata": null, "network": "testnet", "note": null, "rate": null, "rateUSD": "0.00", "reason": "{\"method\":\"transfer\",\"parameters\":[\"0x451dEFC27B45808078e875556AF06bCFdC697BA4\",\"10000\"],\"abi\":{\"constant\":false,\"inputs\":[{\"name\":\"_to\",\"type\":\"address\"},{\"name\":\"_value\",\"type\":\"uint256\"}],\"name\":\"transfer\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"}}", "recipientAddress": "0x036CbD53842c5426634e7929541eC2318f3dCF7e", "reference": "xvLz7CIFoD", "senderAddress": "0x947514e4B803e312C312da0F1B41fEDdbe15ae7a", "signedTransaction": "0xf8ab3e83124fc08301623d94036cbd53842c5426634e7929541ec2318f3dcf7e80b844a9059cbb000000000000000000000000451defc27b45808078e875556af06bcfdc697ba400000000000000000000000000000000000000000000000000000000000027108302948ca0c86783ba50374a959907d9174c2a0b5cd3a87d55336e6c9a6420fde0dd07303ea019a93dad742a9bed4c6d1f514f7fe26777e8f17fe090967a9719afddaa281d64", "status": "SUCCESS", "toAmount": null, "toCurrency": null, "tokenAddress": "0x036CbD53842c5426634e7929541eC2318f3dCF7e", "type": "SIGNED", "updatedAt": "2025-08-11T22:21:56.077Z", "wallet": { "address": "0x947514e4B803e312C312da0F1B41fEDdbe15ae7a", "configurations": null, "createdAt": "2024-08-22T16:05:46.167Z", "derivationPath": "m/44'/60'/0'/0/0", "description": "This is Base wallet", "id": "e17dea25-6c01-4b3a-a4ae-51f411bf69cd", "isActive": true, "name": "Base Wallet", "network": "testnet", "status": "ACTIVE", "updatedAt": "2024-08-22T16:05:46.167Z" } }, "message": "Contract write signed successfully", "statusCode": 200 }

Batch Operations

This endpoint supports batch operations, allowing you to sign multiple contract write operations without broadcasting them. This is useful for offline signing or preparing transactions for later submission.

Batch Request Format

To sign multiple transactions, use the calls array:
{
  "calls": [
    {
      "address": "0xTokenContract...",
      "method": "approve",
      "parameters": ["0xSpender...", "1000000000000000000"],
      "abi": [...],
      "reference": "approve-tx"
    },
    {
      "address": "0xProtocolContract...",
      "method": "deposit",
      "parameters": ["1000000000000000000"],
      "abi": [...],
      "reference": "deposit-tx"
    }
  ],
  "code": "123456"
}

Batch Response Format

Returns signed transactions without broadcasting:
{
  "message": "Batch contract write signed successfully",
  "statusCode": 200,
  "data": {
    "success": [
      { "index": 0, "method": "approve", "signedTransaction": "0x..." },
      { "index": 1, "method": "deposit", "signedTransaction": "0x..." }
    ],
    "errors": []
  }
}

Validation Rules

RuleValue
Max batch size20 operations
Min batch size1 operation
2FA requiredYes

Use Cases

  • Offline signing: Sign transactions for later broadcast
  • Transaction preparation: Prepare multiple transactions in advance
  • Multi-signature workflows: Generate signed payloads for multi-sig wallets

授权

x-api-key
string
header
必填

路径参数

walletId
string
必填
示例:

"YOUR_WALLET_ID"

请求体

application/json
calls
object[]
示例:
[
  {
    "abi": [
      {
        "constant": false,
        "inputs": [
          { "name": "_to", "type": "address" },
          { "name": "_value", "type": "uint256" }
        ],
        "name": "transfer",
        "outputs": [],
        "payable": false,
        "stateMutability": "nonpayable",
        "type": "function"
      }
    ],
    "address": "0x337610d27c682E347C9cD60BD4b3b107C9d34dDd",
    "method": "transfer",
    "parameters": [
      "0x2455eC6700092991Ce0782365A89d5Cd89c8Fa22",
      "10000"
    ]
  },
  {
    "abi": [
      {
        "constant": false,
        "inputs": [
          { "name": "_to", "type": "address" },
          { "name": "_value", "type": "uint256" }
        ],
        "name": "transfer",
        "outputs": [],
        "payable": false,
        "stateMutability": "nonpayable",
        "type": "function"
      }
    ],
    "address": "0x337610d27c682E347C9cD60BD4b3b107C9d34dDd",
    "method": "transfer",
    "parameters": [
      "0x2455eC6700092991Ce0782365A89d5Cd89c8Fa22",
      "10000"
    ]
  }
]

响应

200 - application/json

Ethereum / Tron / Ethereum (Batch) / Tron (Batch)

data
object
message
string
示例:

"Contract write signed successfully"

statusCode
number
示例:

200