About | Features | Technologies | Requirements | Starting | License | Author
This repo contains all my learnings related to SOLIDITY..
✔️ Variables and types;
✔️ Ether and Wei;
✔️ GAS;
#####Local Declared inside a function and are not stored on blockchain #####State declared outside a function to maintain the state of the smart contract Stored on the blockchain #####Global Provide information about the blockchain. They are injected by the Ethereum Virtual Machine during runtime. Includes things like transaction sender, block timestamp, block hash, etc.
Transactions are paid with ether.
Similar to how one dollar is equal to 100 cent, one ether is equal to 10^18 wei.
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;
contract EtherUnits {
uint public oneWei = 1 wei;
// 1 wei is equal to 1
bool public isOneWei = 1 wei == 1;
uint public oneEther = 1 ether;
// 1 ether is equal to 10^18 wei
bool public isOneEther = 1 ether == 1e18;
}
#####How much ether do you need to pay for a transaction?
You pay gas spent
* gas price
amount of ether, where
gas
is a unit of computationgas spent
is the total amount ofgas
used in a transactiongas price
is how much ether you are willing to pay pergas
Transactions with higher gas price have higher priority to be included in a block.
Unspent gas will be refunded.
#####Gas Limit There are 2 upper bounds to the amount of gas you can spend
- gas limit (max amount of gas you're willing to use for your transaction, set by you)
- block gas limit (max amount of gas allowed in a block, set by the network)
This project is under license from MIT. For more details, see the LICENSE file.
Made with ❤️ by {{YOUR_NAME}}