Remix for Theta Deploy Contract Interact With Dapp Builder Help Examples Broadcast TXN Donate




Help is divided into 4 sections compile, deploy, interact and Dapp builder.

1. How to compile a smart contract in Remix.
2. How to deploy a smart contract on the Theta Blockchain.
3. How to interact with a smart contract on the Theta Blockchain.
4. How to build a Dapp that works on the Theta Blockchain.
(All interactions on the Theta Blockchain require the MetaMask extension. Click Here for detailed directions to setup MetaMask.)

Download this section as a PDF file.



1. Compiling a smart contract with Remix.

1.1 Click on "Remix for Theta" from the left menu.
1.2 Click on create new file.
1.3 Name the file you just created (example: helloWorld.sol)
1.4 You can use one of our examples (Click here) or type in your contract. Copy and paste (ctrl + v) your contract here.
1.5 After your contract is entered click the solidity compile button to show the compiler.




1.6 Click the compile button to build your ABI and Bytecode. After it compiles, you will see it directly below this button.



You will need both sets of code to deploy your contract in the next section.
1.7 Click on ABI to copy your ABI code to the clipboard.
1.8 Click on Bytecode to copy your Bytecode code to the clipboard.


If you would like to learn more about Remix feel free to click here to watch an in depth video explaining how to use it.



2. Deploying a smart contract.

2.1 Click on "Deploy Contract" from the left menu.

2.2 Copy and paste your ABI interface into the text box. You will use the code you copied from step 7 and 8 in the "Compiling a smart contract with Remix" section.
2.3 Copy and paste your Bytecode code into the text boxes.
2.4 Click Next



2.5 Click on Connect in the upper right corner.
(If you are already connected your address and tFuel balance will be display.)
2.6 If you have no variables in your constructor the gas price will auto calculate. If you have variables enter them then you can estimate the gas needed to deploy the contract. (You do not have to use this button)
2.7 Click Deploy to send you contract to the Theta Network.


2.8 Metamask will open. This is your last chance to reject the transaction. If you are ready to send it to the blockchain click Confirm.

2.9 The hash will appear quickly. But it can take up to 15 seconds for the contract address to display. Once it displays click copy to copy it to your clipboard.
(Save the contract address in a safe place you will need it in sections 3 and 4.)




*Thetascan.io will never ask for your private key. All interactions with the blockchain in the Smart Contract HQ use the Metamask Wallet to interact with the blockchain.


3. Interacting with a smart contract.

3.1 Click on "Interact With" from the left menu.
3.2 Copy and paste the contract address. (From deploy step 2.9)
3.3 Copy and paste the contract's ABI interface to interact with a contract. (From Remix step 1.7)
3.4 Click Next to interact with a contract.


3.5 Click on Connect in the upper right corner.
(If you are already connected your address and tFuel balance will be display.)
3.6 Select the function you would like to use with the contract.
3.7 The interface will appear.
3.8 Click interact to read or write to the contract. If the function is a read function click interact and the results will display, no more action is needed. If the function is a write function enter the inputs if needed and click interact.


3.9 Only if it is not a read function. Metamask will open. This is your last chance to reject the transaction. If you are ready to send it to the blockchain click Confirm.


3.10 If it is a write function the transaction hash will appear below the interact button. If it is a call function no hash will display. (You can click View on Thetascan.io to see the transaction hash details on the block explorer in a new window.)




*Thetascan.io will never ask for your private key. All interactions with the blockchain in the Smart Contract HQ use the Metamask Wallet to interact with the blockchain.


4. Building a Dapp on the Theta Blockchain.

4.1 Click on "Dapp Builder" from the left menu.
4.2 Copy and paste in the contract address (From deploy step 2.9)
4.3 Copy and paste in the contract ABI. (From Remix step 1.7)
4.4 Click Next.


4.5 Choose how you want the connect button to appear. It can display just the user's address or the address with tFuel balance.
4.6 Choose a function you want in your Dapp. You can select just one function or one by one you can add them all. (After you select a function the "Add" button will appear.)
4.7 Click "Add" Some functions will require additional information such as how much tFuel do you want this button to send to the contract when clicked. (If you added a function you do not want in your Dapp refresh the page to start over.)
4.8 Click "Build and Download" to save your Dapp as an HTML file.


4.9 Copy and paste or upload the file into your web server. (It must be ran from a web server such as Apache or NGINX.)
4.10 Edit the HTML file to match your website by changing the CSS, adding images, etc...



*Thetascan.io will never ask for your private key. All interactions with the blockchain in the Smart Contract HQ use the Metamask Wallet to interact with the blockchain.


© 2022 Thetascan.io