1

I'm using web3py and web3js to send transactions on the Harmony EVM chain using sendRawTransaction, and i noticed that once my transaction is sent, the transactionIndex value will always be between 0 and 3. Why is that? And is there a way to set a specific index for my transactions?

JayK23
  • 85
  • 2
  • 7

1 Answers1

2

transactionIndex will be set by miner. each block has many transactions which are ordered to mine. your transaction's index is 0 when the block goes to mine the transaction was first tx in that block. maybe you are using local dev node because in real networks a user cant get his/her tx all the time at first place in a block

Saman H. Pasha
  • 327
  • 1
  • 7
  • 1
    It's not always 0, but it's always a low number between 0 and 3. Here is an example https://explorer.harmony.one/tx/0x1852ba3fac03d7e02529fc7d4da53301610410ae3d96740beefe47f3c2063b17 – JayK23 Nov 25 '21 at 11:18
  • 2
    it's about gas price, miners will mine those txs with higher gas price first, at your block, your gas price was 0.00000405 then you reached 2 index, 0 index had more gas price: 0.0000054 and 4 index has lower than gas price as you : 0.00000002 – Saman H. Pasha Nov 25 '21 at 11:28
  • Damn i didn't notice that. Thank you a lot! – JayK23 Nov 25 '21 at 11:58