▶️Write and compile the smart contract

For the scope of this tutorial, we will publish a simple "Hello Swisstronik" smart contract with only 2 functions -one for writing to the blockchain and one for reading from the blockchain- with 1 state variable.

  1. Go to the contracts folder and open the .sol file (smart contract).

We renamed it to Hello_swtr.sol

  1. Paste the smart contract into your Hello_swtr.sol file.

  1. Compile the contract

To compile the smart contract, run npx hardhat compile in your terminal (if you are using VSCode, you can open a new terminal with Ctrl + Shift + ` )

After successful compilation:

  1. You should get the message Compiled 1 Solidity file successfully in your terminal

  2. A new artifacts folder should be created

Now you are ready to deploy this contract on Swisstronik! 🚀

Last updated

Was this helpful?