Transactions – How to Check If Transaction Is Interacting with Smart Contract or Deploying It

deployed-bytecodetransactions

I'm currently working with go-ethereum,

And unable to use etherscan for this case,

No ABI for me here.

How to check whether if the transaction interacts with/calls a smart contract or deploying the smart contract itself?

And if it deploys the smart contract how can I know the smart contract address deployed?

Best Answer

Well what you can do is in the geth console you can use the web3.eth.getTransactionReceipt(<TX_HASH>) method to get the transaction receipt. Let's take Chainlink contract creation transaction for example:

enter image description here

As you can see the to value is null and the contractAddress value is the value of Chainlink contract. So whenever we have empty to value and contractAddress is not empty then we're speaking of contract creation.

Contract method requests can be caught with the transaction hash by using method web3.eth.getTransaction(<TX_HASH>). In the response of this method if the to value is the contract address and data value is not empty ( it has to be valid encoded ABI of the particular method ) then we're definitely speaking for contract method request.

Related Topic