Blockchain _ Solidity _ Web3.0
Blockchain _ Solidity _ Web3.0
Índice
Índice
Link al repo
Blockchain Demo
Definiciones
Anotaciones Interesantes
Seguridad
Blockchain Explanation
Gas Fees and Cost per Transaction
Link al repo
https://github.com/smartcontractkit/full-blockchain-solidity-course-js/blob/main/README.md
Blockchain Demo
https://andersbrownworth.com/blockchain/block
Definiciones
● web1: permissionless open sourced web with static content
● web2: permissioned web, with dynamic content. Where companies run your
agreements on their servers.
● Blockchain Oracle: Any device that interacts with the off-chain world to provide
external data computation to smart contracts.
● Oracle problem: The blockchain oracle problem refers to the inherent inability of
blockchains to access external data (blockchain is immutable). It is immutable
because we have thousands and thousands of nodes that form the blockchain, so we
would need to have an infinite compute power to do this. Instead, in normal contracts
we have only one node in which the information is stored, so we just need to change
the information in this node.
● GAS: Gas refers to the unit that measures the amount of computational effort
required to execute specific operations on the Ethereum network.
● Block Time: How much time it takes between blocks being published.
- Sybil resistance mechanism: Which of all the nodes was the author of a
mining operation, so all the other nodes can verify this is accurate. this
mechanism is a way to avoid the malicious users that create a large number
of pseudo anonymous identities to gain a disproportionately advantageous
influence over the set system.
● Sharding: is a solution to the scalability problem of the blockchain (as more people
use the blockchain, the more transactions are going to cost). The plan is to have a
Main Chain that is going to coordinate everything amongst several chains that hook
into his main chain. That means that there are more chains for people to make
transactions.
● Layer 1: Base layer of a blockchain implementation (BTC, Etherium, etc)
● Layer 2: Any application built on the Layer 1
Anotaciones Interesantes
● Bitcoin actually has smart contracts, but they are “turned off”. The developers saw it
as just a store of value.
● Robinhood and uniswap are decentralized exchanges, they can not stop the
operation of one specific asset.
● We have different networks in our Metamask, the Ethereum Mainnet is the main
network of Ethereum, where the real money is traded. For developing and testing we
will have other networks (test networks), in these networks we will test our smart
contracts.
● The way to put fake money into our wallet in the ethereum test network is going to
Testnet Faucets, linking our account, and sending a transaction.
● The more people use the Chain, the more expensive it is to send transactions.
● We need a real testnet to work with oracles, for example when we want to get the
actual price of a Eth (not the JSVM).
● We can import code directly from github, for example the AggregatorV3Interface to
connect to api with eth price.
Seguridad
● Metamask:
- Mnemonic: can access to all the accounts in your Metamask
- Private key: can access to 1 account in your Metamask (one pk for each
account)
- Public Address: its public and can not access to nothing
Blockchain Explanation
explanation video: https://youtu.be/_160oMzblY8
it always has the same length, no matter what. This is called a digital fingerprint of
this data.
(if the Hash starts with four zeros, then we say the block is signed)
So, when we change some information in the block. and the block is signed, we know
that the Hash is going to change, and the probability of getting a new generated
Hash with four zeros is pretty low, so this modified block will not be signed. To set
our modified block as signed, we will have to set a new arbitrarily Nonce, so a new
Hash is generated and it starts with four zeros.
● Blockchain: So a blockchain is just a set of all these blocks put together. Each of
them has to be signed to be valid in the chain.
The problem with the blockchain is that if we change one block, this gets invalid, and
the rest of the following blocks are going to get invalid too. This happens because the
block next to the block with problems uses the invalid hash as its previous hash, this
affects its own hash (because this change generates a new one), making it invalid
too, this repeats with each of the following blocks. To fix this, we will have to mine all
the broken blocks.
● Distributed: we will have a lot of Peers, each peer will have a copy of all the
blockchain, so for example, if we have three Peers, actually we will have three copies
of the same blockchain.
If we change the blockchain of one Peer, we will have then a Peer with one
blockchain and other two Peers with another blockchain, it can be noticed that the
one different Peer has a problem, we know that because we have a relation 1:2.
● Tokens: We have a blockchain copy in each Peer, and each block have some data,
this data actually can be, for example, a list of transactions.
● Gas Fees: this costs Ether; however, the amount is so minimal that it is measured in
Gwei. It has a minimum price in Ether (Base), and a maximum price (Max).
● Gas limit: the maximum amount of GAS that we are willing to pay in this transaction.
● Usage by Txn: how much GAS was actually used in the transaction.
● Burnt: (Gas Fee) x (Gas limit and usage by Txn) = Burnt Ether. The Burnt Ether is
removed forever from circulation, it comes from our wallet when we make the
transaction.
● Transaction Fee: it comes from our wallet too, but is not burnt, it goes to the miners
that made the transaction possible.
EVM Overview
Contracts transaction fields
the data providers get the data from the different exchanges, then, the info collected by the
data providers goes thru the uncentralized chainlink nodes, then we get the information for
out contracts
Chainlink VRF (Verifiable Random Function)
Blockchains are deterministic structures by default that means by concept that we can not
set randomness to these environments, a way to secure some randomness is the use of
chainlink VRF.
Chainlink Keepers
Decentralized event driver execution. It turns our smart contracts into hybrid contracts, given
them access to the real world data and services while maintaining the security and reliability
guarantee inherent in the blockchain technology.