Learn how to deploy a simple smart contract on the SNFT testnet.
Before deploying a smart contract, make sure you have:
Let's create a simple "Hello World" smart contract that stores a greeting message.
Go to Remix IDE in your browser.
Click on the "File explorers" icon, then click the "+" icon to create a new file. Name it "HelloWorld.sol".
Copy and paste the following code into your file:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract HelloWorld {
string private greeting;
constructor(string memory _greeting) {
greeting = _greeting;
}
function setGreeting(string memory _greeting) public {
greeting = _greeting;
}
function getGreeting() public view returns (string memory) {
return greeting;
}
}
Click on the "Solidity compiler" icon in the left sidebar, then click "Compile HelloWorld.sol".
Click on the "Deploy & run transactions" icon in the left sidebar. In the "ENVIRONMENT" dropdown, select "Injected Provider - MetaMask". This will connect Remix to your MetaMask wallet.
Make sure your MetaMask is connected to SNFT testnet. In the "CONTRACT" dropdown, select "HelloWorld". In the "DEPLOY" section, enter an initial greeting (e.g., "Hello, SNFT!"), then click "Deploy".
MetaMask will prompt you to confirm the transaction. Click "Confirm" to deploy your contract.
After deployment, you'll get a contract address. You can verify your contract on the SNFT testnet block explorer:
Once deployed, you can interact with your contract through: