colored-coins-sdk
colored-coins-sdk copied to clipboard
`financeChangeAddress` is ignored when transferring the entire asset amount
Before process send asset between addresses token that hold valid amounts:
send json:
var send = {
from: [cc.hdwallet.getAddress(0, 0), fromAddress],
to: transferToAddresse,
fee: 1000,
financeChangeAddress: cc.hdwallet.getAddress(0, 0)
};
###There are something not right here.
- Json Argu properties:
- cc.hdwallet.getAddress(0, 0) hold some cc amount (1,000,000).
- fromAddress amount is 100.
- transferToAddresse is hold 100
- amount to send is 110, (I am intentionally put it more than the fromAddress hold)
After I did the send asset:
- cc.hdwallet.getAddress(0, 0) :
{ address: [ ‘moNXJM8PytYgL3AWo7quuebnMbmyRoQKFD’ ],
utxos:
[ { index: 2,
txid: ‘25f3f5a5eb4127e733282b206bcf86d673c82422372708b8c44073dea85507fa’,
blocktime: 1497589000206,
blockheight: -1,
value: 64942400,
used: false,
scriptPubKey: [Object],
assets: [] } ] }
Its assets (cc.hdwallet.getAddress(0, 0)) become empty.
- fromAddress amount is become 999,990
[
{
“assetId”: “Ua9XJuWCkUs1K8d6H8UtFtDu5ij8NRNaoY4pBK”,
“amount”: 100,
“issueTxid”: “7fa2c9a6c084b5f1c3b2b95341490b54ea0476f5dc970ceb25a512e8e01ad783”,
“divisibility”: 2,
“lockStatus”: false,
“aggregationPolicy”: “aggregatable”
}
],
[
{
“assetId”: “Ua9XJuWCkUs1K8d6H8UtFtDu5ij8NRNaoY4pBK”,
“amount”: 999890,
“issueTxid”: “ef62a80b878c6987ffb1747279b548ca3ffb786ddb620563fc7fc26ed54373c8",
“divisibility”: 2,
“lockStatus”: false,
“aggregationPolicy”: “aggregatable”
}
]
- transferToAddresse is hold 210 as expected.
[
{
“assetId”: “Ua9XJuWCkUs1K8d6H8UtFtDu5ij8NRNaoY4pBK”,
“amount”: 100,
“issueTxid”: “8719ea7d187bfb00698087917d5300956094d432c1df981ecdc8eab9feb3f655”,
“divisibility”: 2,
“lockStatus”: false,
“aggregationPolicy”: “aggregatable”
}
],
[
{
“assetId”: “Ua9XJuWCkUs1K8d6H8UtFtDu5ij8NRNaoY4pBK”,
“amount”: 110,
“issueTxid”: “ef62a80b878c6987ffb1747279b548ca3ffb786ddb620563fc7fc26ed54373c8",
“divisibility”: 2,
“lockStatus”: false,
“aggregationPolicy”: “aggregatable”
}
]
Note:
from: [cc.hdwallet.getAddress(0, 0), fromAddress] I did use 2 address since the fromAddress did not have enough satoshi tBTC as u can see I set the financeChangeAddress: cc.hdwallet.getAddress(0, 0) to the same tBTC address every time therefore sending asset will spend only the small dust/tx fee.
Every thing work fine if the cc.hdwallet.getAddress(0, 0) hold zero amount in cc and I can use its tBTC value to help finance the tx in cc sdk for another address in cc(addresses with the same assetId).
And it happen the same to the BurnAsset!
Hi, it's hard to understand from your issue, what exactly happened that did not match your expectations. Please update your comment.
Alright let me explain more detail about my case:
First I issue main asset I got assetId and an address token which is cc.hdwallet.getAddress(0, 0).
Then I try to get another address from cc.hdwallet.getaddress() (let call it Address-A) -> I got new address which is hold no amount in cc node, But during sending as u mention I can setting
financeChangeAddress: cc.hdwallet.getAddress(0, 0) Then I re-issue the main asset amount of 100 to cc.hdwallet.getAddress(0, 0) and transfer amount of 100 to Address-A,
var asset = {
amount: 100,
divisibility: 2,
fee: 1000,
reissueable: true,
issueAddress: cc.hdwallet.getAddress(0, 0),
transfer: [{
address: Address-A,
assetId: assetId,
amount: 100
}],
financeChangeAddress: cc.hdwallet.getAddress(0, 0)
};
Therefore the Address-A will be hold amount of 100, but here the tBTC of Address-A is 0.000006 tBTC or considered as very small amount.
Then I do the same to Address-B. Then I trying to send asset between Address-A and Address-B But it is always alert error not enough satoshi to cover the transaction.
Hi @oleiba Any idea. I think I am stuck right here.
Got the bug, editing the title to:
financeChangeAdress
is ignored when transferring entire asset amount.