Explorer Tools for DApp Development

Explorer Smart Contract Tools

The Theta explorer provides a set of tools similar to Etherscan for users to interact with and inspect smart contracts deployed on-chain.

Verify Contract Source Code and Interact with Contracts

After a smart contract is deployed, the Theta explorer allows users to upload and verify the source code of the smart contract. To do this, after a smart contract is deployed on chain, navigate to the explorer page for the contract address. Then simply scroll down the page. After the "Transactions" section, you should see a text box for uploading the contract source code. Simply copy and past your contract source code, and select the Compiler Version and Optimization option (need to be identical to your settings when you compiled the contract). Next hit "Verify and Publish".

Below is an example showing how to publish the source code of the SquareCalculator contract to the explorer.

2230

After the contract is verified, you should see the verified source code as shown in the screenshot below.

1782

In addition, by clicking on the "Read Contract" tab, the explorer will extract and display all the readable attributes of the smart contract as shown below.

1798

To see the above SquareCalculator example contract on-chain, please click here.

Inspect the Smart Contract Event Logs

Similar to Etherscan, the Theta Explorer can display the event logs emitted by smart contract execution for the DApp developers to inspect the internal state of the smart contracts. First, navigate to a transaction which executes a smart contract function. The example below shows the detail page for a transaction that calls the setValue() function of the above SquareCalculator contract. The "Overview" tab displays some general information including the Gas Used and the Gas Price.

1688

To see the logs emitted by the setValue() function, simply click on the "Logs" tab. In our example, it shows the event SetValue which sets the value data member of the contract to 99.

1692

To see the above smart contract transaction on-chain, please click here.