Skip to content

Commit

Permalink
using debug_traceTransaction
Browse files Browse the repository at this point in the history
  • Loading branch information
JukLee0ira committed Aug 31, 2024
1 parent 5208332 commit 26bcf7f
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/opCodeFinder.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,18 @@ async function findContracts(startBlockNumber, endBlockNumber) {
);
let block = await web3.eth.getBlock(i);
if (block != null) {
if (block.transactions != null && block.transactions.length != 0) {
if (block.transactions != null) {
let blockFinishedCount = block.transactions.length;
//srarch for contract address in each transaction
//search for type of "CREATE" in each transaction
for (let txHash of block.transactions) {
let receipt = await web3.eth.getTransactionReceipt(txHash);
if (receipt && receipt.contractAddress) {
let traceObject = await web3.eth.currentProvider.sendAsync({
method: "debug_traceTransaction",
params: [`${txHash}`, { tracer: "callTracer" }],
jsonrpc: "2.0",
id: "1",
});
if (traceObject.result.type === "CREATE") {
let receipt = await web3.eth.getTransactionReceipt(txHash);
getContractBytecode(receipt.contractAddress);
contractCount++;
}
Expand Down

0 comments on commit 26bcf7f

Please sign in to comment.