multiSign

用于多重签名

用法

tronWeb.trx.multiSign(transaction, privateKey, permissionId)

参数

Parameter

Description

Data Type

transaction

交易对象

JSON

privateKey

签名者的私钥

String

permissionId

指定要使用的权限。 默认值为0,这是owner权限。

Integer32

Owner id=0, Witness id=1, Active id 从2开始递增分配。在执行合约时, 通过该id来指定使用哪个权限,如使用owner权限,即将id设置为0。有关javatron的多重签名详细信息,请参阅多重签名

📘

注意:

由于权限ID与原始交易ID进行了哈希处理,因此交易ID在签名期间每次都会更改。

示例

const tradeobj = await tronWeb.transactionBuilder.freezeBalance(tronWeb.toSun(100), 3, "ENERGY",  "415d73f56d93a9380a100d2a340dd30dc3df6e0746", 0);
const signedtxn = await tronWeb.trx.multiSign(tradeobj, privateKey,0);
console.log(signedtxn)
>{
  "txID": "0502452a4d60e10624168e4dfbd30f549619c1a4231a5f1b23b2fdee7271122f",
  "raw_data": {
    "contract": [
      {
        "parameter": {
          "value": {
            "frozen_duration": 3,
            "frozen_balance": 100000000,
            "owner_address": "415d73f56d93a9380a100d2a340dd30dc3df6e0746"
          },
          "type_url": "type.googleapis.com/protocol.FreezeBalanceContract"
        },
        "type": "FreezeBalanceContract",
        "Permission_id": 0
      }
    ],
    "ref_block_bytes": "0029",
    "ref_block_hash": "085b2efaf56ed4ab",
    "expiration": 1555112526000,
    "timestamp": 1555112466675
  },
  "raw_data_hex": "0a0200292208085b2efaf56ed4ab40b081b89fa12d5a58080b12540a32747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e467265657a6542616c616e6365436f6e7472616374121e0a15415d73f56d93a9380a100d2a340dd30dc3df6e07461080c2d72f180370f3b1b49fa12d",
  "signature": [
    "91d1b6d562b7aec2dc7ab52d82841ebb92d2288b01e04bd0075e0499559353ade4e74246d9ea002dec12e3246f7ae05714a1787b8c3670446cc6891a1cb9b56600",
    "4ca79b721e4965189335a9d8324a207297bbf52f90cdd5be778716817db13b2a678eacdb83b1ad38d6823606bf51b41a9810da4a8618361e2251205382b357eb00",
    "672920c0e277aa84225e9441468cd425c85748599968842c7a39a0b7ddb6bc14e9dde4eb6d00464d0e411dd24be7ac7cdfbfcd21ca72bfbf7021bcfe4080e47800"
  ]
}