BCT EXPERIMENT 4
AIM: To design and deploy a smart contract using Remix IDE and Metamask.
THEORY AND OUTPUT:
1. Write or Paste the Smart Contract
1. On the left-hand side of Remix, under File Explorers, click the + button and create a
new file named SimpleCryptoCurrency.sol.
2. Paste your smart contract code into this file:
2. Compile the Smart Contract
1. Click on the Solidity Compiler tab (left sidebar, second tab from the top).
2. Ensure the Solidity Compiler version matches the version specified in the contract
(^0.8.0).
3. Click Compile SimpleCryptoCurrency.sol. You should see a green checkmark when
it's successfully compiled.
3. Deploy the Contract Using MetaMask
1. Click on the Deploy & Run Transactions tab (third tab from the top).
2. Under Environment, select Injected Web3. This will connect Remix to MetaMask.
3. MetaMask will prompt you to connect Remix to your wallet. Approve the connection
4. Under the Deploy section, enter the required parameters for your constructor:
o _name: The name of your cryptocurrency (e.g., "MyToken").
o _symbol: The token ticker symbol (e.g., "MTK").
o _decimals: The number of decimal places (commonly 18).
o _initialSupply: The total initial supply of the token (e.g., 1000000 for 1 million
tokens).
5. Click Deploy. MetaMask will prompt you to approve the transaction.
6. Confirm the transaction in MetaMask, and the contract will be deployed.
4. Verify the Contract Deployment
Once deployed, you can view the transaction details in Remix’s Deployed Contracts
section.
You will see the contract address, and you can interact with the contract functions
(such as balanceOf and transfer) directly from Remix.
5. Interact with the Deployed Contract Using MetaMask
1. In the Deployed Contracts section, you will see options to interact with the smart
contract:
o Use the balanceOf function to check the token balance of any address.
o Use the transfer function to send tokens from one address to another.
2. Every time you interact with the contract, MetaMask will prompt you to sign and send
the transaction.
CONCLUSION: Hence, we have successfully designed and deployed a smart contract using
Remix IDE and Metamask.