I am using infura.io as my node and trying to get the internal transactions (i.e. transfers initiated by smart contract) for a specific transaction (or its parent block). I have two attempts (both erroring out). It feels like I am missing something basic here.
Some setup code:
const Web3 = require("web3");
const VM = require('ethereumjs-vm');
const Tx = require('ethereumjs-tx');
const blockFromRpc = require('ethereumjs-block/from-rpc');
const web3 = new Web3(new Web3.providers.HttpProvider('https://mainnet.infura.io/' + process.env.INFURA_API_KEY));
const vm = new VM();
When I try this:
web3.eth.getTransaction('0x6b871b7db60454cf97fe7b5d0bb1192f23984e35990dfeeb8df5b9295d0eaaf5')
.then(tx => {
web3.eth.getBlock(6189875)
.then(block => {
try {
vm.runTx({
tx: new Tx({
...tx,
data: tx.input
}),
block: blockFromRpc(block)
}, function(err, results){
console.log('returned: ' + results.logs);
});
}
catch(e) {
const i = e;
}
});
});
I get an error:
The sender does not have enough ether to send this tx
and when I try this:
web3.eth.getBlock(6189875)
.then(block => {
try {
vm.runBlock({
block: blockFromRpc(block),
//block
}, function(err, results){
console.log('returned: ' + results.logs);
});
}
catch(e) {
const i = e;
}
});
I get an error:
base free exceeds gas limit
Whats going on? I just want to replay the transaction or block so that I can see the internal transactions.
Thanks in advance.
approvalsandtransfersin separate tables. Historic balances of the token accounts and other cool stuff. The code is in development right now , but If interested, leave your contract data and I will send it to you. – Nulik Aug 23 '18 at 17:45GetModifiedAccountsByNumberfloating around. Do you know of any way I could access that on a public node? – istrau2 Aug 23 '18 at 18:36callTracerhttps://blog.ethereum.org/2018/02/14/geth-1-8-iceberg%C2%B9/ , it will give you internal transaction in an easy JSON array .GetModifiedAccountsByNumberis also part of thedebugmodule which requies to be enabled by node administrator – Nulik Aug 23 '18 at 18:56