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.
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
cleos, without a
blok_num_hint, it works fine for me; example:
$ cleos -u https://api.eosnewyork.io get transaction af69829823a4807fa18e4e2ee044552922add451e692ce53c3961f258
returns a transaction
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>
cleos -u https://api.jungle.alohaeos.com:443 get transaction 4c37c4252440f841b26d044c9fe8ccec850329e046cd09d0e972bafc34da6b44 -b 16667265