nelsongallardo / eth-smart-contracts-beginner-guide

Just a few links that were useful to begin with smart contracts in ethereum

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ethereum Smart Contracts

 

Just a few links I found useful to start with smart contracts in ethereum.

 

Basics

 

Tools needed

  • Alchemy: A development platform and API that allows to make requests to the Ethereum blockchain without having to run a node
  • Metamask: an ethereum wallet that is also a browser extension that let me use the Ethereum Mainnet to use dApps. This extension will inject a javascript library in every website which will allow a website (if it's a dapp) to connect to the Ethereum network. It also allows me to use other networks to test without spending real gas in the Mainnet.
  • Hardhat/Truffle: development environment to debug, compile, deploy, etc. (see IDEs section)
  • Editor: could be vsCode

 

IDEs (can choose one of the next list)

 

First Tutorial to understand the different pieces

 

Gas - How to calculate gas price to deploy a smart contract

Based on the documentation, we know that Gas is a measure of computational complexity. How do we pay for the required gas to execute a transaction? using ETH.
Gas is basically the fees we have to pay for executing a transaction in the Ethereum network. Given that Gas prices are low ETH numbers (not currently though), a smaller denomination is used, which is gwei. Gwei means giga wei, where wei is the smallest unit of ETH (1,000,000,000 wei == 1 gwei). Gwei or wei is to ETH, what satoshis are to bitcoin, or cents are to dollar.
Without going into too much details (see documentation), each block has a base fee and also a tip for the miners.

  • How to calculate gas price?: Amount of Gas units (limit) * (Base fee + Tip) = gas price in gwei.
    In this site we can see how much is currently the base fee and also the tip. With this data, and also knowing how many units of Gas our smart contract requires, we can estimate how much gwei (or ETH after converting) it will cost us to deploy the smart contract.
  • How do we know how many units of Gas are required to deploy our smart contract? - When we compile our smart contract using the remix ide, it will tell us the estimated transaction cost, this is the amount of Gas units required.

 

Tokens

This project has examples of smart contracts creating tokens using the standar ERC20. This standard allows developers to create tokens in the same way, following a pre defined list of functions, making it easier to treat different tokens in the same way within the network. To know more about this standard read:

Examples

  • This example contains an ERC20 token created from scratch. The smart contract also contains the interfaces defined in the ERC20 standard and the contract implementing those interfaces. Example
  • This example imports a library that contains the interfaces, making it easier to create the token without having to write the interfaces from scratch. Example - Also, heres's a guide of how to use the library: Create ERC20 token

Further reading

About

Just a few links that were useful to begin with smart contracts in ethereum