Publish on RSK Testnet
Requirements
- Selected the RSK network selected the web wallet, Nifty or Metamask.
- Have tR-BTC in your wallet.
- On Remix, at Deploy and run transactions, under Environment, make sure you have selected the Injected Web3 option.
First of all, be sure that you selected the RSK network selected the web wallet, Nifty or Metamask...
Ensure that you have tR-BTC in your wallet, as this is needed to pay gas fees when deploying the smart contracts. To do so, please follow the instructions related to: RSK faucet.
Don't forget to select the Injected Web3 option in Environment, located at Deploy and run transactions on Remix.
Deploy a smart contract on RSK testnet
In Remix, on the left side, locate the fourth button: Deploy and run transactions.
For now we have only one smart contract, so it is automatically selected in the dropdown list.
Click the button Deploy.
It will open a popup window on the web wallet, to confirm the transaction set up by Remix to publish the smart contract.
Click confirm / submit.
At bottom right, we can check the message: creation of Name pending...
A block in the RSK network takes, on average, 30 seconds to be mined, so we must wait for this time. When the transaction is confirmed on the network, your web wallet will display a notification like this:
Once it is confirmed, we can check the transaction's details on Remix terminal:
Copy the transaction hash to verify it on the Blockchain explorer
In this example, the transaction hash is:
0x050e216d2008a896f2e7799fee349c582f3e19bb6017e59cd8b323647624f999
RSK Explorer
A block explorer is a blockchain search engine that allows you to search for a particular piece of information on the blockchain. It is an online tool to view all transactions that have taken place on the blockchain, the current network hash rate and transaction growth, and the activity on blockchain addresses, among other useful information. You can think of it as a window into the blockchain world, giving you the opportunity to observe whatβs happening on it. Source: coinmarketcap guides: blockexplorer
The RSK explorer is the block explorer for RSK transactions. We will use the Testnet explorer:
Past the transaction hash at search field, at the top of the screen
This is the result:
You can verify my example at:
0x050e216d2008a896f2e7799fee349c582f3e19bb6017e59cd8b323647624f999
Smart contract address
Copy the address of your smart contract and save it. It will be used at other times during the course.
There are a few ways to copy it:
- No Remix
After the smart contract is published using Remix, we can see your instance in the left panel, at the bottom of deploy and run transactions.
Go to the section deployed contracts, locate the smart contract and click the copy icon.
- No RSK explorer
Locate the Contract Address line, and click the copy icon.
This is the address of my smart contract name:
0x888be03Bbd234D88dBa228Ef04A53950A2006345
Interact with the smart contract
We have already interacted with the smart contract published in JavascriptVM, and we can also use Remix to interact with a smart contract published on any network.
The only change is the Environment, that is, the connected network, which is now Injected Web3.
In deployed contracts section, in the smart contract, click the symbol > to see the datails.
Click the buttons and check it out the results:
You can also see the details of the transactions in the Remix terminal:
Check that the owner is the account selected in your web wallet.
Transactions on web wallet
You can also check the transaction on the web wallet:
Final considerations
Congratulations!
Now you know how to publish a smart contract on a "real" Blockchain network, and interact with it.
In the next lesson you will learn how to interact with your previously published smart contract.