Im using getblock by hash with included internal transactions. On some blocks, the internal transactions just dont work. For example 17020104 and 17020037 on eth. Internal transactions are just an empty array on every tx. Is this a bug?
Edit: Reran the blocks and the internal transactions are there. Could it be something with running getblock when a block is so new?
Hey @edv124,
Thanks for reaching out to us.
Can you let me know how does your code looks like or what API do you use and the parameters that you have specifically so I can test it out on my end
It could be a delay maybe if the block was a new block
This is what we use
let response = await Moralis.EvmApi.block.getBlock({
"chain": "0x1",
"include": "internal_transactions",
"blockNumberOrHash": block
})
Hereโs a block which has this error currently - 17028465
A lot of mints on it which dont have internal transactions, but also 0x467753d15d8ca1e2dcf1604128b20c9b8eabf0a53097522d838049a2ac2352a2 which does and isnt shown on getBlock
Hey @edv124,
I tested out what you have here, and looks like I was able to get the internal_transactions
of that specific block and transaction hash with the following code:
const Moralis = require("moralis").default;
const runApp = async () => {
try {
await Moralis.start({
apiKey: "YOUR_API_KEY",
});
let response = await Moralis.EvmApi.block.getBlock({
chain: "0x1",
include: "internal_transactions",
blockNumberOrHash: 17028465,
});
const findTxIndex = response
.toJSON()
.transactions.findIndex(
(val) =>
val.hash ===
"0x467753d15d8ca1e2dcf1604128b20c9b8eabf0a53097522d838049a2ac2352a2"
);
console.log(response.toJSON().transactions?.[findTxIndex]);
} catch (e) {
console.error(e);
}
};
runApp();
and I got this internal transactions
internal_transactions: [
{
transaction_hash: '0x467753d15d8ca1e2dcf1604128b20c9b8eabf0a53097522d838049a2ac2352a2',
block_number: 17028465,
block_hash: '0x7af6d51aec177b9358e4a098cfc708c8e33c86581857386d8117a4bb468c65ff',
from: '0x6b7a87899490ece95443e979ca9485cbe7e71522',
to: '0x22648c12acd87912ea1710357b1302c6a4154ebc',
value: '0',
gas: '166950',
gas_used: '32019',
input: '0x40c10f19000000000000000000000000e04d779b643df2e4015450db71e77a1cbfff68170000000000000000000000000000000000000000000000000000000006415052',
output: '0x0000000000000000000000000000000000000000000000000000000000000001'
},
{
transaction_hash: '0x467753d15d8ca1e2dcf1604128b20c9b8eabf0a53097522d838049a2ac2352a2',
block_number: 17028465,
block_hash: '0x7af6d51aec177b9358e4a098cfc708c8e33c86581857386d8117a4bb468c65ff',
from: '0x6b7a87899490ece95443e979ca9485cbe7e71522',
to: '0x22648c12acd87912ea1710357b1302c6a4154ebc',
value: '0',
gas: '132104',
gas_used: '327',
input: '0x6f307dc3',
output: '0x000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec7'
},
{
transaction_hash: '0x467753d15d8ca1e2dcf1604128b20c9b8eabf0a53097522d838049a2ac2352a2',
block_number: 17028465,
block_hash: '0x7af6d51aec177b9358e4a098cfc708c8e33c86581857386d8117a4bb468c65ff',
from: '0x6b7a87899490ece95443e979ca9485cbe7e71522',
to: '0xdac17f958d2ee523a2206206994597c13d831ec7',
value: '0',
gas: '128650',
gas_used: '5031',
input: '0x70a0823100000000000000000000000022648c12acd87912ea1710357b1302c6a4154ebc',
output: '0x0000000000000000000000000000000000000000000000000000001d91ed212d'
},
{
transaction_hash: '0x467753d15d8ca1e2dcf1604128b20c9b8eabf0a53097522d838049a2ac2352a2',
block_number: 17028465,
block_hash: '0x7af6d51aec177b9358e4a098cfc708c8e33c86581857386d8117a4bb468c65ff',
from: '0x6b7a87899490ece95443e979ca9485cbe7e71522',
to: '0x22648c12acd87912ea1710357b1302c6a4154ebc',
value: '0',
gas: '123075',
gas_used: '46324',
input: '0x0039d6ec000000000000000000000000e04d779b643df2e4015450db71e77a1cbfff68170000000000000000000000000000000000000000000000000000000006415052000000000000000000000000e04d779b643df2e4015450db71e77a1cbfff6817',
output: '0x0000000000000000000000000000000000000000000000000000000006415052'
},
{
transaction_hash: '0x467753d15d8ca1e2dcf1604128b20c9b8eabf0a53097522d838049a2ac2352a2',
block_number: 17028465,
block_hash: '0x7af6d51aec177b9358e4a098cfc708c8e33c86581857386d8117a4bb468c65ff',
from: '0x22648c12acd87912ea1710357b1302c6a4154ebc',
to: '0xdac17f958d2ee523a2206206994597c13d831ec7',
value: '0',
gas: '112777',
gas_used: '37601',
input: '0xa9059cbb000000000000000000000000e04d779b643df2e4015450db71e77a1cbfff68170000000000000000000000000000000000000000000000000000000006415052',
output: ''
}
]
Based on your timing and the fact that this transaction is the very recent, itโs likely that when you are fetching it the internal transactions have not been fully indexed yet
So I think likely that this is not a bug, but I can see that there could be a delay on querying with the internal transactions
For this, I can provide the suggestion to our product team to investigate further~
Sure, thatd be fine. I tested the same block again and now internal transactions show. Wasnt for the first 30 mins or so after block happened
It is much quicker then 30 minutes actually
When I tested, it was like around15-20 mins after the tx has been added to the block, not exactly sure how long it takes for the internal transactions are added, but I understand that if this frustrates you since it is still a significant amount of time.
Also have forwarded this to the product team, theyโll be working on investigating and improving this
This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.