1

How can I get the block_num_hint for calling eos.getTransaction(transactionID, blockNumHint) ?

Using eosjs or any other library/api. I tested it without, with only 1 above or below and received always bad request error.

2 Answers 2

1

In EOSIO, The block_num_hint argument is optional, and it represents the block number where the transaction should be. This can help find the transaction by fetching just one block when not all history is known.

How can I get the block_num_hint

In most cases you won't know the block in which the transaction is, but if you happen to know or have an idea where it may be, you can make some requests with block_num_hint

Using cleos, without a blok_num_hint, it works fine for me; example:

$ cleos -u https://api.eosnewyork.io get transaction af69829823a4807fa18e4e2ee044552922add451e692ce53c3961f258

returns a transaction

1
  • Interesting! Thanks. In eosjs I need the block_num_hint. I'll ask the guys in the Github repo if it's intended or a bug
    – Marcel
    Commented Aug 5, 2018 at 13:52
0

Without using block number hint, the transaction details can be fetched only by searching from whole blockchain. This is possible only with nodes with history plugin enabled. It's hard to find such an API with full history enabled because it is expensive to maintain such a node. So its better to use block_hint if possible

cleos get transaction <txn_id> -b <block_number>

example:

cleos -u  https://api.jungle.alohaeos.com:443 get transaction 4c37c4252440f841b26d044c9fe8ccec850329e046cd09d0e972bafc34da6b44 -b 16667265

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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