[Mirrored from Slack] Can I use transferAsset API to create transaction voucher?

From suivew

Help: can I use transferAsset API to create transaction voucher? I tried following but failed:
sender publickey: 91d79431648e15b8d63dfg34653grferd5469ecc22a5e9e53a3d664b0634
recipient:ARDOR-AAAA-AAAA-AAAA-AAAAA
parameters:
requestType:transferAsset
chain: 2
recipient:ARDOR-AAAA-AAAA-AAAA-AAAAA
asset:12345678901234567890
quantityQNT:10
secretPhrase: ARDOR-AAAA’s passphrase
(sender’s) publicKey: 91d79431648e15b8d63dfg34653grferd5469ecc22a5e9e53a3d664b0634
recipientPublicKey: (blank)
feeNQT:-1
broadcast:false
voucher: ture
JSON Response did not match voucher created by wallet.

Hi. What do you mean “JSON Response did not match voucher created by wallet” ? Of course the generated voucher would not be always the same, there are fields that change, like timestamp, and that will also change the signature.

You got the API parameters right: you send the recipient’s secret instead of the sender’s, and put the sender public key.

this was what I got:

name=‘requestType’ value=‘transferAsset’
name=‘voucher’ value=;true’
name=‘secretPhrase’ value=‘recipient’s passphrase’
name=‘publicKey’ value=‘91d79431648e15b8d6359574e9170cada422d5469ecc22a5e9e53a3d664b0634’
name=‘recipientPublicKey’ value=null
JSON Response

{
“minimumFeeFQT”: “1000000”,
“signatureHash”: “ccbd9e83969860f0e367c0bea4df0e3e5c19c99e019cc32ec68634c7a3e48832”,
“transactionJSON”: {
“senderPublicKey”: “8c4c704ee5d320a521e6cc27265e2bc5cf3fce4392bc24b476e71bb0c78a3422”,
“chain”: 2,
“signature”: “1fbf00c95cf4b4a8fab80d23b5b8c77ba28b29a7e6e171e712f7818ffc48880f12e1c08bc447427d3b4111df6ac384747835d4ce35dd7d4d37c2018c4ac5e607”,
“feeNQT”: “2500000”,
“type”: 2,
“fullHash”: “0c180321ae7e8f0508c924ba382c2514d6461094afc8fd5689a396378f59ab97”,
“version”: 1,
“fxtTransaction”: “0”,
“phased”: false,
“ecBlockId”: “6995346416724439651”,
“signatureHash”: “ccbd9e83969860f0e367c0bea4df0e3e5c19c99e019cc32ec68634c7a3e48832”,
“attachment”: {
“version.AssetTransfer”: 1,
“quantityQNT”: “100”,
“version.Message”: 1,
“messageIsText”: true,
“asset”: “552220519268621185”,
“message”: “SDS20080801001”
},
“senderRS”: “ARDOR-MJEK-6QAF-Y9WQ-58678”,
“subtype”: 1,
“amountNQT”: “0”,
“sender”: “3680714291370639761”,
“recipientRS”: “ARDOR-MJEK-6QAF-Y9WQ-58678”,
“recipient”: “3680714291370639761”,
“ecBlockHeight”: 6103615,
“deadline”: 15,
“timestamp”: 91500529,
“height”: 2147483647
},
“unsignedTransactionBytes”: “02000000020101f12f74050f008c4c704ee5d320a521e6cc27265e2bc5cf3fce4392bc24b476e71bb0c78a342291c1d990258614330000000000000000a025260000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003f225d006372a9c9807614610100000001811bb0f0a2e1a907640000000000000001010e005344533230303830383031303031000000000000000000000000000000000000000000000000000000000000000000000000”,
“broadcasted”: false,
“requestProcessingTime”: 3,
“transactionBytes”: “02000000020101f12f74050f008c4c704ee5d320a521e6cc27265e2bc5cf3fce4392bc24b476e71bb0c78a342291c1d990258614330000000000000000a0252600000000001fbf00c95cf4b4a8fab80d23b5b8c77ba28b29a7e6e171e712f7818ffc48880f12e1c08bc447427d3b4111df6ac384747835d4ce35dd7d4d37c2018c4ac5e6073f225d006372a9c9807614610100000001811bb0f0a2e1a907640000000000000001010e005344533230303830383031303031000000000000000000000000000000000000000000000000000000000000000000000000”,
“fullHash”: “0c180321ae7e8f0508c924ba382c2514d6461094afc8fd5689a396378f59ab97”,
“bundlerRateNQTPerFXT”: “250000000”
}

Voucher data created by wallet:
{
“transactionJSON”: {
“senderPublicKey”: “91d79431648e15b8d6359574e9170cada422d5469ecc22a5e9e53a3d664b0634”,
“chain”: 2,
“feeNQT”: “2500000”,
“type”: 2,
“version”: 1,
“fxtTransaction”: “0”,
“phased”: false,
“ecBlockId”: “5657621390974142748”,
“attachment”: {
“version.AssetTransfer”: 1,
“quantityQNT”: “10000”,
“asset”: “552220519268621185”
},
“subtype”: 1,
“amountNQT”: “0”,
“sender”: “12881356309019739920”,
“recipient”: “3680714291370639761”,
“ecBlockHeight”: 3214500,
“deadline”: 15,
“timestamp”: 91500633
},
“unsignedTransactionBytes”: “02000000020101593074050f0091d79431648e15b8d6359574e9170cada422d5469ecc22a5e9e53a3d664b063491c1d990258614330000000000000000a02526000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a40c31001c49aa02aee8834e0000000001811bb0f0a2e1a9071027000000000000000000000000000000000000000000000000000000000000000000000000000000000000”,
“signature”: “890caf212a4c7469637b358278c71f98dc416cbb81bc49d304b643788a128506e09a6a918b5bea6328bb6f03097d28cfce9dffc39d78dbdb3ad82d7168afea50”,
“publicKey”: “8c4c704ee5d320a521e6cc27265e2bc5cf3fce4392bc24b476e71bb0c78a3422”,
“requestType”: “transferAsset”
}

So you say the JSON on your first message is from the API and the second one is using the wallet? Are you sure is not the other way around?

Also the parameters look quite different: different amounts, one has a message added to the assetTransfer itself.

Still, I don’t really understand what’s you problem here and what’s your specific question.

yes, first one is from API, second one from wallet.

from API I use recipient’s passpharse to sign the transaction, and use intend sender’ publick key in the ‘publicKey’ field, the result show senderRS same as recipientRS:

from API JSON responses:
“senderPublicKey”: “8c4c704ee5d320a521e6cc27265e2bc5cf3fce4392bc24b476e71bb0c78a3422”,
“senderRS”: “ARDOR-MJEK-6QAF-Y9WQ-58678”,
“subtype”: 1,
“amountNQT”: “0”,
“sender”: “3680714291370639761”,
“recipientRS”: “ARDOR-MJEK-6QAF-Y9WQ-58678”,
“recipient”: “3680714291370639761”,

From wallet it show the correct information:
“senderPublicKey”: “91d79431648e15b8d6359574e9170cada422d5469ecc22a5e9e53a3d664b0634”,
“sender”: “12881356309019739920”,
“recipient”: “3680714291370639761”,

I tried with identical transaction attachment still have same senderRS and recipientRS created by API.

Let’s see if I got this.

You want to create a voucher for an assetTransfer from ARDOR-RKSJ-C4A7-AL7V-D7YJ7 (sender) to ARDOR-MJEK-6QAF-Y9WQ-58678 (recipient).

Try this API parameters:

  • requestType=transferAsset
  • chain=2
  • recipient=3680714291370639761 (you can also use the RS notation)
  • secretPhrase=*** (secret phrase for ARDOR-MJEK-6QAF-Y9WQ-58678)
  • publicKey=91d79431648e15b8d6359574e9170cada422d5469ecc22a5e9e53a3d664b0634 (this is the sender public key)
  • voucher=true
  • asset=552220519268621185
  • quantityQNT=42

problem resolved. thank you!

2 Likes