-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Closed
Labels
topic:apirpc/http related issuerpc/http related issue
Description
Please answer these questions before submitting your issue. Thanks!
- What did you do?
I test transaction in shasata testnet, can not get fee from walletapi
the program step is below
#1 create new account
#2 fund 1TRX to it
#3 send 20 times from funding account in order to exhaust default 5000 bandwidth and make it to use account's TRX as fee
from #1 to #17 we have free bandwidth, so according to https://developers.tron.network/docs/bandwith#section-normal-transaction
we consume the free bandwidth, from #18
we go to Consume the transaction initiator's TRX, calculated as the number of bytes in the transaction * 10 SUN.
because in #18 we only have 248 bandwidth, the tx need 264 bandwidth, so the transaction fee is deducted from account TRX, this is ok,
but I can not get transaction fee.
I do not freeze any TRX, so only 5000 free bandwidth can use.
async function test(){
//#1 create account
const account = await generateNewAddress();
const address = account.address.base58;
const hex = account.address.hex;
//#2 fund 1 trx to it
await fund(address, 1000000);
await sleep(5000);
//#3 send 1 sun from new funding account to other account
for (let i=0; i<20; i++) {
console.log('#',i)
const acc1 = await getAccount(address)
const bandwidth1 = await getBandwidth(address)
console.log('address=',address,'balance=',acc1.balance,'bandwith=',bandwidth1)
const tx = await send(account.privateKey, 'TRZ76hR2JmAqfQTsZSM2GApmM6WHK4QSWj', 1)
await sleep(5000);
const txID = tx.transaction.txID;
//console.log(txID)
const txInfo = await getTransactionById(txID);
const amount = txInfo.raw_data.contract[0].parameter.value.amount;
const acc2 = await getAccount(address)
const bandwidth2 = await getBandwidth(address)
console.log('address=',address,'balance=',acc2.balance,'bandwith=',bandwidth2,'bandwithdiff',bandwidth1-bandwidth2,'amount=',amount,'txId=',txID);
console.log('\n');
}
}
test();
- What did you expect to see?
need return really calculated transaction fee in fee outout.
hash: ef770927ccf87f460d552e16a5fb34d7cf866c2a00a0b9b21ec3ef42c9dae73f
txid: b6c82e74f6d16af655ac44b9211cbe04a2a43dd5fa398fbe24f93486852415d8
raw_data: {
ref_block_bytes: e8f2
ref_block_hash: ca16eaf99f8bd403
contract: {
contract 0 :::
[
contract_type: TransferContract
owner_address: TMBBmFdQepZpRzYTyoSHCSwssKNvYU9fuM
to_address: TRZ76hR2JmAqfQTsZSM2GApmM6WHK4QSWj
amount: 1
]
}
timestamp: Thu Jul 11 17:32:11 JST 2019
fee_limit: 0
}
signature: {
signature 0 :0618bb60fd84053b061a4fb132b89c29d41ac59d3bc8f36aee9a4e3d37b64eec94a7a9d9117e2ab5a2b7f4eeaf5afc8ec3237c091455a63e1bcf6614c7dcceb901
}
ret: {
result: 0 :::
[
code ::: SUCESS
fee ::: xxxx
ContractRet ::: DEFAULT
]
}
- What did you see instead?
the fee always is zero even the account's TRX is burn.
hash: ef770927ccf87f460d552e16a5fb34d7cf866c2a00a0b9b21ec3ef42c9dae73f
txid: b6c82e74f6d16af655ac44b9211cbe04a2a43dd5fa398fbe24f93486852415d8
raw_data: {
ref_block_bytes: e8f2
ref_block_hash: ca16eaf99f8bd403
contract: {
contract 0 :::
[
contract_type: TransferContract
owner_address: TMBBmFdQepZpRzYTyoSHCSwssKNvYU9fuM
to_address: TRZ76hR2JmAqfQTsZSM2GApmM6WHK4QSWj
amount: 1
]
}
timestamp: Thu Jul 11 17:32:11 JST 2019
fee_limit: 0
}
signature: {
signature 0 :0618bb60fd84053b061a4fb132b89c29d41ac59d3bc8f36aee9a4e3d37b64eec94a7a9d9117e2ab5a2b7f4eeaf5afc8ec3237c091455a63e1bcf6614c7dcceb901
}
ret: {
result: 0 :::
[
code ::: SUCESS
fee ::: 0
ContractRet ::: DEFAULT
]
}
Metadata
Metadata
Assignees
Labels
topic:apirpc/http related issuerpc/http related issue