qtum icon indicating copy to clipboard operation
qtum copied to clipboard

How can I read qrc20 transaction?

Open junha-ahn opened this issue 4 years ago • 1 comments

Is your feature request related to a problem? Please describe.

For qrc20 received transactions

if I use the command "getTransaction (hash)"

  • the wallet will throw a error.

if I use the commoand "getrawtransaction (hash)"

  • the wallet will throw "No such mempool transaction ...... use -txindex..."

If I start my wallet with the "-logevents" option and use the "getTransactionRecipt (hash)" command, I can get "gasUsed" information. (GasUsed only. There is no gasPrice, vin, or vout information.)

I want to read the fee information of the transaction, but now I can't read.

// only gasUsed.... 
recipet:  {
  blockHash: '6464a7fe73ff42fe52022b9f143b0dce28793e8d294fbe89477aa605cfe20870',
  blockNumber: 783120,
  transactionHash: '144c99e24dcf86be12f24d32900b8d1d623eaa79ff75d1952d89ba522f351468',
  transactionIndex: 2,
  outputIndex: 0,
  from: '876508a5e4d3000796b5fc07f46cbd20917d7bc9',
  to: '864dcc7ddfd15d7be538fd4e33dc93de9cb19527',
  cumulativeGasUsed: 36264,
  gasUsed: 36264,
  contractAddress: '864dcc7ddfd15d7be538fd4e33dc93de9cb19527',
  excepted: 'None',
  exceptedMessage: '',
  log: [
    {
      address: '864dcc7ddfd15d7be538fd4e33dc93de9cb19527',
      topics: [Array],
      data: '0000000000000000000000000000000000000000000000000000000000002710'
    }
  ]
}

Describe the solution you'd like

I want to read the fee information of the transaction.

  • I don't want to use the -txindex option, because I means save all transactions...

Is there a way?

How can the wallet process recognize and save (transactions receiving qrc20)?

Describe alternatives you've considered

Additional context

I would like to know (details.fee) among the information below.

tx :: {
  amount: 0,
  fee: -0.081296,
  confirmations: 106,
  blockhash: '6464a7fe73ff42fe52022b9f143b0dce28793e8d294fbe89477aa605cfe20870',
  blockheight: 783120,
  blockindex: 2,
  blocktime: 1613706304,
  txid: '144c99e24dcf86be12f24d32900b8d1d623eaa79ff75d1952d89ba522f351468',
  walletconflicts: [],
  time: 1613706207,
  timereceived: 1613706207,
  'bip125-replaceable': 'no',
  details: [
    {
      category: 'send',
      amount: 0,
      vout: 0,
      fee: -0.081296,
      abandoned: false
    },
    {
      address: 'qVuHQsuu1Nbj8L5x6GoLpungVcE3abyCTD',
      category: 'send',
      amount: -44.010308,
      label: '',
      vout: 1,
      fee: -0.081296,
      abandoned: false
    },
    {
      address: 'qVuHQsuu1Nbj8L5x6GoLpungVcE3abyCTD',
      category: 'receive',
      amount: 44.010308,
      label: '',
      vout: 1
    }
  ],
  hex: ''
}

junha-ahn avatar Feb 19 '21 09:02 junha-ahn

By default the wallet can only see its own transactions. The -txindex option allows the wallet to see other transactions on the blockchain. All the transactions are saved in blocks on the blockchain, not saved in the wallet.

You can also use the explorer to see details for a transaction, such as https://testnet.qtum.info/tx/144c99e24dcf86be12f24d32900b8d1d623eaa79ff75d1952d89ba522f351468

Also note you need to add a QRC20 token to the wallet to manage that token from the wallet.

JB395 avatar Apr 10 '21 11:04 JB395