In this course, we will study the Solidity programming language to be able to create digital assets in the Internet of Value. This requires a fluent knowledge of Solidity in its entire spectrum: syntax, testing, design principles, contract updates, publishing and verification scripts, intercommunication, most common vulnerabilities, etc.
However, Solidity's mastery is not enough to harness the full potential of Blockchain. We also require an understanding of the different existing digital standards and the ecosystem of tools that extend the power of smart contracts.
In this course we will study a series of digital standards and their variants. We will learn at the code level how to create fungible money, using the ERC20, as well as create unique digital assets, using the ERC721. The union of the previous two was called ERC1155 and is widely used in blockchain games. We will study other variations that help solve other use cases: ERC20Permit, ERC721x, ERC721Enumerable, ERC777, ERC223, etc. We will see how to use the Uniswap V2 AMM to create a liquidity pool from an ERC20 digital asset pair.
There is a set of complementary tools to the Blockchain that allow us to extend the power of smart contracts. In this course we will learn tools created by leading companies in the industry. Among these we have Chainlink (semi-decentralized oracles, Open Zeppelin Defender (lambda function on demand triggered by contracts), The Graph (the largest indexer of Blockchain information), Hardhat (continuous deployment), Foundry (testing, continuous deployment), among others.
What you are going to learn the following topics:
- The constituent parts of the Blockchain and how it works internally
- The Solidity programming language in depth
- The most common digital standards (programmable money) and their variants
- Smart contract testing with 100% coverage
- Automation of contract publication and verification
- Cross-chain operations: you pay on one chain and mint the asset on another
- Most common attacks and vulnerabilities to smart contracts
- Decentralized finance to create liquidity pools on Uniswap V2
- Schedule contracts to auction, sell and buy digital assets
- Token Economy
- Using oracles to inject information into smart contracts
Finish the CryptoZombies Game. Finish the following topics:
- Solidity: Beginner to Intermediate Smart Contracts
- Advanced Solidity: Get In-depth Knowledge
This will help you to prepare for the course and put you up to speed.
Complete the following steps. You should obtain an address after completing step 8. With these steps you will able to publish and verify your first smart contract.
-
Repository and System
-
Node minimum version: 18.x. Use nvm to install other versions of
nodeJS -
Fork the class repository
-
Go to the terminal and run the following commands:
$ git clone https://github.com/Blockchain-Bites/blockchain-and-smart-contract-development.git $ cd blockchain-and-smart-contract-development $ npm install
-
-
Install Metamask
- Download here the extension
- Create an account and enable a wallet in Metamask
-
Add
Amoyto Metamask- Go to Chainlist
-
Click on
Add to Metamaskand follow the instructions -
Open Metamask wallet and verify that there is an
Aat the top left corner.
-
Get testing tokens
- Send
Maticto the wallet created using the wallet'saddress. - To request
Matic, go to Polygon Faucet or Alchemy Faucet. You will receive a balance inMaticthat you will need to make transactions
- Send
-
Create the file
.envfile by duplicating the.env-copyfile- Do in the terminal:
$ cp .env-copy .env
- Do in the terminal:
-
Fill the keys in the
.envfile:API_KEY_OKLINK: Go to OkLink. Click onSign Upand finish creating the an account. After creating the account, hover your icon at the top right corner. Search forAPI MANAGEMENT. Add 2FA. Then click onCreate API key. Copy theAPI Key Tokeninto the.envfile.
-
PRIVATE_KEY: Obtain theprivate keyof the wallet that was created in point2by following these steps and copy it to this variable in the.envfile. -
AMOY_TESTNET_URL: Create an account in Alchemy. Enter the dashboard and create an app+ CREATE APP. Choose anyNAMEandDESCRIPTION. ChooseENVIRONMENT=Development,CHAIN=PolygonandNETWORK=Amoy. Click onVIEW KEYand copy the value insideHTTPSinto the.envdocument for this environment variable. Skip the service payment step. -
This is what the
.envfile should look like:
-
Go to the file
contracts/MyFirstContract.sol:- Find the variable
nameAndLastNameon line 6 - Replace the value of that variable with your first and last name
- Find the variable
-
Publishing and verifying your first smart contract:
$ npx hardhat --network amoy run scripts/deploy.js- Wait 1 minute while the deployment is done
- If everything was executed correctly, you will see the following result:
====== Publishing your first contract (1 min)... ====== ====== Congrats! You did publish your first contract ====== Contract Address: 0x9F24e522017580028fd388554f119DEAbb3A6442 ====== Contract verification has started ====== Successfully submitted source code for contract contracts/MyFirstContract.sol:MyFirstContract at 0x9F24e522017580028fd388554f119DEAbb3A6442 for verification on the block explorer. Waiting for verification result... Successfully verified contract MyFirstContract on the block explorer. https://www.oklink.com/polygonAmoy/address/0x9F24e522017580028fd388554f119DEAbb3A6442#code ====== Congrats! You successfully verified your 1st contract ======
-
Reasons why the above command might fail
- The
.envfile does not have the correct keys - The Metamask wallet private key does not have enough funds
NodeJSis an old version



