智能合约WASM之同时调用多合约和多签交易
同时调用多个合约,并上链
调用多个合约 genunsignedtxraw+submitwasmcontractcalltx
Parameters
genunsignedtxraw submitwasmcontractcalltx '{ "sender", "fee" "height" "transactions"}'
Arguments:
sender
(string, required), 在这个钱包中发起合约的address
fee
: (string, required), 总的手续费用
height
: (string, required), 最新的块高度(250个块高度的容错)
transactions
:
contract: 合约生成的regid
action: 调用的合约的ACTION
data: ACTION:需要的参数
auth: 签名者地址(选填)
Result
txhash
(string) 调用合约交易的哈希
unsigned_txraw
(string) 调用合约的签名
Examples
// Request
root@8b8db19c4e32:/opt/wicc# coind genunsignedtxraw submitwasmcontractcalltx '{"sender":"0-1","fee":"WICC:10000000:sawi","height":3947,"transactions":[{"contract":"0-800","action":"transfer", "data":["0-2","0-3","0.10000000 WICC", "xxx"],"auth":"0-2"}, {"contract":"2047-2","action":"hi", "data":["0-4"], "auth":"0-4"}]}'
// Response
{
"txid" : "b66f6cd4650206cdfe364dadfde8244cb305edff1800f469dfd308db41c04f1c",
"unsigned_txraw" : "64019d6b020001045749434383e1ac0002852080cce5ce84d4b6feff00010280e0d7c8e980a692a9702402000000000000000300000000000000809698000000000008574943430000000378787886febeff02eabefefefefefeff00010480e0d7c8e980a692a970080400000000000000020200040000"
}
签名signtxraw
Parameters
signtxraw "str" "addr"
签名交易
Arguments:
str
: (string, required) 哈希数据。不超过65K。生成的签名raw
signer_address
: (array, required) 签名者的地址,或者account
[
"address" (string) WICC address
...,
]
Examples
// Request
root@8b8db19c4e32:/opt/wicc#coind signtxraw "64019d6b020001045749434383e1ac0002852080cce5ce84d4b6feff00010280e0d7c8e980a692a9702402000000000000000300000000000000809698000000000008574943430000000378787886febeff02eabefefefefefeff00010480e0d7c8e980a692a970080400000000000000020200040000" '["0-1","0-2","0-4"]'
// Respond
{
"rawtx" : "64019d6b020001045749434383e1ac0002852080cce5ce84d4b6feff00010280e0d7c8e980a692a9702402000000000000000300000000000000809698000000000008574943430000000378787886febeff02eabefefefefefeff00010480e0d7c8e980a692a970080400000000000000020246304402202aabe9e5916f057801df194b715555a416b2b31e602e81ee4d6c3f41715ad94a02207ea5d730eae4a21d0781fcbc9588861055c08f1f84315153dd13737a4dbbe1f40446304402206a15a3eb69ed06683a6f24fd0da02dd74faf64c2c90d098dbe6ab6006dde3ab902203b41f990259436fe21c929b7b153f280f278a1f43988381d0562f4303bb052e74630440220552464021a7a6607dc0f9e4c52997f426b3da3df29c09c0338e48177b436719102200ea46a19b7fd2d17793a68fcf000c651c0d818e112157e3f71aa2fda6c4c09c5",
"signed_count" : 3,
"signed_list" : [
{
"addr" : "wLKf2NqwtHk3BfzK5wMDfbKYN1SC3weyR4",
"regid" : "0-1",
"signature" : "30440220552464021a7a6607dc0f9e4c52997f426b3da3df29c09c0338e48177b436719102200ea46a19b7fd2d17793a68fcf000c651c0d818e112157e3f71aa2fda6c4c09c5"
},
{
"addr" : "wNDue1jHcgRSioSDL4o1AzXz3D72gCMkP6",
"regid" : "0-2",
"signature" : "304402202aabe9e5916f057801df194b715555a416b2b31e602e81ee4d6c3f41715ad94a02207ea5d730eae4a21d0781fcbc9588861055c08f1f84315153dd13737a4dbbe1f4"
},
{
"addr" : "wP64X59EoRmeq2M5GrJ23UVttE9uxnuoFa",
"regid" : "0-4",
"signature" : "304402206a15a3eb69ed06683a6f24fd0da02dd74faf64c2c90d098dbe6ab6006dde3ab902203b41f990259436fe21c929b7b153f280f278a1f43988381d0562f4303bb052e7"
}
]
}
上链 submittxraw
Parameters
submittxraw "rawtx" ["signatures"]
submit raw transaction (hex format)
Arguments:
rawtx
(string, required), 调用合约的签名
signatures
: (array, optional), 签名信息的json数组,一般是通过离线签名时或者多签时需要填写
[
{
"addr": "address" (string, required) 签名的地址
"signature": "hex str" (string, required)签名的signature
}
,...
]
Examples
// Request
root@8b8db19c4e32:/opt/wicc# coind submittxraw "64019d6b020001045749434383e1ac0002852080cce5ce84d4b6feff00010280e0d7c8e980a692a9702402000000000000000300000000000000809698000000000008574943430000000378787886febeff02eabefefefefefeff00010480e0d7c8e980a692a970080400000000000000020246304402202aabe9e5916f057801df194b715555a416b2b31e602e81ee4d6c3f41715ad94a02207ea5d730eae4a21d0781fcbc9588861055c08f1f84315153dd13737a4dbbe1f40446304402206a15a3eb69ed06683a6f24fd0da02dd74faf64c2c90d098dbe6ab6006dde3ab902203b41f990259436fe21c929b7b153f280f278a1f43988381d0562f4303bb052e74630440220552464021a7a6607dc0f9e4c52997f426b3da3df29c09c0338e48177b436719102200ea46a19b7fd2d17793a68fcf000c651c0d818e112157e3f71aa2fda6c4c09c5" '[{"addr":"wLKf2NqwtHk3BfzK5wMDfbKYN1SC3weyR4","signature":"30440220552464021a7a6607dc0f9e4c52997f426b3da3df29c09c0338e48177b436719102200ea46a19b7fd2d17793a68fcf000c651c0d818e112157e3f71aa2fda6c4c09c5"},{"addr":"wNDue1jHcgRSioSDL4o1AzXz3D72gCMkP6","signature":"304402202aabe9e5916f057801df194b715555a416b2b31e602e81ee4d6c3f41715ad94a02207ea5d730eae4a21d0781fcbc9588861055c08f1f84315153dd13737a4dbbe1f4"},{"addr":"wP64X59EoRmeq2M5GrJ23UVttE9uxnuoFa","signature":"304402206a15a3eb69ed06683a6f24fd0da02dd74faf64c2c90d098dbe6ab6006dde3ab902203b41f990259436fe21c929b7b153f280f278a1f43988381d0562f4303bb052e7"}]'
// Response
{
"txid" : "b66f6cd4650206cdfe364dadfde8244cb305edff1800f469dfd308db41c04f1c",
"tx_trace" : {
"trx_id" : "b66f6cd4650206cdfe364dadfde8244cb305edff1800f469dfd308db41c04f1c",
"elapsed" : 2382,
"burned_fuel" : 43890,
"fuel_rate" : 1,
"minimum_fee" : 100000,
"traces" : [
{
"trx_id" : "b66f6cd4650206cdfe364dadfde8244cb305edff1800f469dfd308db41c04f1c",
"receiver" : "0-800",
"trx" : {
"contract" : "0-800",
"action" : "transfer",
"authorization" : [
{
"account" : "0-2",
"permission" : "wasmio_owner"
}
],
"data" : {
"from" : "0-2",
"to" : "0-3",
"quantity" : "0.10000000 WICC",
"memo" : "xxx"
}
},
"inline_traces" : [
{
"trx_id" : "b66f6cd4650206cdfe364dadfde8244cb305edff1800f469dfd308db41c04f1c",
"receiver" : "0-2",
"trx" : {
"contract" : "0-800",
"action" : "transfer",
"authorization" : [
{
"account" : "0-2",
"permission" : "wasmio_owner"
}
],
"data" : {
"from" : "0-2",
"to" : "0-3",
"quantity" : "0.10000000 WICC",
"memo" : "xxx"
}
}
},
{
"trx_id" : "b66f6cd4650206cdfe364dadfde8244cb305edff1800f469dfd308db41c04f1c",
"receiver" : "0-3",
"trx" : {
"contract" : "0-800",
"action" : "transfer",
"authorization" : [
{
"account" : "0-2",
"permission" : "wasmio_owner"
}
],
"data" : {
"from" : "0-2",
"to" : "0-3",
"quantity" : "0.10000000 WICC",
"memo" : "xxx"
}
}
}
]
},
{
"trx_id" : "b66f6cd4650206cdfe364dadfde8244cb305edff1800f469dfd308db41c04f1c",
"receiver" : "2047-2",
"trx" : {
"contract" : "2047-2",
"action" : "hi",
"authorization" : [
{
"account" : "0-4",
"permission" : "wasmio_owner"
}
],
"data" : {
"issuer" : "0-4"
}
}
}
]
}
}