2

If you use

cleos get block blocknum

you can only get the transaction data, but not the transaction receipt.

And in the transactions, there're some inline actions which we can't get through the blocks.

So, is it only possible to use history plugin to listen the specific actions?

I see that the history plugin can listen any inline actions you specified.

2

From eosjs module

You can use eosjs node module to get tx status

 var txDetail = await eos.getTransaction(req.params.txid);
 console.log(txDetail.trx.receipt.status)

From command line using cleos

You can use cleos to get transaction details, and then use trx.receipt.status to check the status of your transaction

cleos get transaction txHash
  • 1
    but there is no transaction if you don't add the history plugin – Jimmy Guo Aug 9 '18 at 9:43
  • Yes You need to start nodeos with --plugin eosio::history_api_plugin – Prashant Prabhakar Singh Aug 9 '18 at 9:54
  • not just history_api_plugin, but also history_plugin, and you must filter-on many actions – Jimmy Guo Aug 9 '18 at 10:01
1

I tried to find get receipt too but can't find anything related. but int the path libraries/testing we can see a simple test.

 void base_tester::open() {
  control.reset( new controller(cfg) );
  control->startup();
  chain_transactions.clear();
  control->accepted_block.connect([this]( const block_state_ptr& block_state ){
    FC_ASSERT( block_state->block );
      for( const auto& receipt : block_state->block->transactions ) {
          if( receipt.trx.contains<packed_transaction>() ) {
              auto &pt = receipt.trx.get<packed_transaction>();
              chain_transactions[pt.get_transaction().id()] = receipt;
          } else {
              auto& id = receipt.trx.get<transaction_id_type>();
              chain_transactions[id] = receipt;
          }
      }
  })

we can get the receipt by id in chain_transaction.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.