Homepage / Notes / Computer Science / Blockchain / Cryptocurrencies / Ethereum
Rollup?
https://ethereum.org/en/developers/tutorials/
Smart contracts are a type of Ethereum account. This means they have a balance and they can send transactions over the network. However they're not controlled by a user, instead they are deployed to the network and run as programmed. User accounts can then interact with a smart contract by submitting transactions that execute a function defined on the smart contract. Smart contracts can define rules, like a regular contract, and automatically enforce them via the code.
High gas costs? Should check how expensive…
Smart contracts alone cannot get information about "real-world" events because they can't send HTTP requests. This is by design as relying on external information could jeopardise consensus, which is important for security and decentralization.
https://ethereum.org/en/developers/docs/smart-contracts/languages/
more advanced: Yul, intermediate to the EVM cheatsheet Solidity vs Vyper: https://reference.auditless.com/cheatsheet/
https://ethereum.org/en/developers/docs/smart-contracts/anatomy/
Storage: permanently in the blockchain, expensive
Memory: only stored during the contract's execution, cheaper
Env var: block timestamp, msg.sender
…
Functions: internal
(only accessible internally) vs external
(can be called from other contracts and through transactions)
public
vs private
for both functions and values?
view functions: "getter" function not modifying state
constructor functions: to initiate the state, only ran at contract creation
built-in functions: address.send()
ERCs: set of standards
https://ethereum.org/en/developers/docs/security/
https://ethereum.org/en/developers/tutorials/ https://learnxinyminutes.com/docs/solidity/
https://cryptozombies.io/ https://ethernaut.openzeppelin.com/ https://vyper.fun/
https://infura.io/: Ethereum node; have account and keys https://dashboard.alchemyapi.io/: Ethereum node; have account
https://ethereum.org/en/developers/local-environment/ https://openzeppelin.com/sdk/ interacting with smart contracts in the CLI https://hardhat.org/ compile, deploy, test, and debug your Ethereum software https://www.trufflesuite.com/ tools for smart contracts https://www.trufflesuite.com/ganache local copy of an Ethereum blockchain https://framework.embarklabs.io/ all-in-one for dapps https://eth-brownie.readthedocs.io/en/stable/deploy.html Python-based, better than the rest? https://github.com/gakonst/foundry new (Dec 2021), very fast
https://onbjerg.github.io/foundry-book/index.html forge init {project}
to start a new project
https://github.com/tintinweb/smart-contract-sanctuary lists all smart contracts on Etherscan? https://twitter.com/zapper_fi/status/1327035284677128192?s=09 explain why "Approve DAI", "Enable USDC"
https://ethereum.org/en/developers/docs/accounts/#an-account-examined
Ethereum accounts have four fields:
nonce
– a counter that indicates the number of transactions sent from the account. This ensures transactions are only processed once. If a contract account, this number represents the number of contracts created by the accountbalance
– the number of Wei owned by this address. Wei is a denomination of ETH and there are 1e+18 Wei per ETH.codeHash
– All such code fragments are contained in the state database under their corresponding hashes for later retrieval. For contract accounts, this is the code that gets hashed and stored as the codeHash. For externally owned accounts, the codeHash field is the hash of the empty string.storageRoot
– A 256-bit hash of the root node of a Merkle Patricia tree that encodes the storage contents of the account (a mapping between 256-bit integer values), encoded into the trie as a mapping from the Keccak 256-bit hash of the 256-bit integer keys to the RLP-encoded 256-bit integer values. This tree encodes the hash of the storage contents of this account, and is empty by default.Your private key is what you use to sign transactions, so it grants you custody over the funds associated with your account. You never really hold cryptocurrency, you hold private keys – the funds are always on Ethereum's ledger.
https://ethereum.org/en/developers/docs/nodes-and-clients/#clients GETH: https://geth.ethereum.org/docs/ Go's Ethereum implementation OpenEthereum: https://github.com/openethereum/openethereum Rust Trinity: https://trinity.ethereum.org/ Python
https://ethereum.org/en/developers/docs/transactions/#whats-a-transaction
A submitted transaction includes the following information:
recipient
– the receiving address (if an externally-owned account, the transaction will transfer value. If a contract account, the transaction will execute the contract code)signature
– the identifier of the sender. This is generated when the sender's private key signs the transaction and confirms the sender has authorised this transactionvalue
– amount of ETH to transfer from sender to recipient (in WEI, a denomination of ETH)data
– optional field to include arbitrary datagasLimit
– the maximum amount of gas units that can be consumed by the transaction. Units of gas represent computational stepsgasPrice
– the fee the sender pays per unit of gashttps://ethereum.org/en/developers/docs/nodes-and-clients/#node-types
In fact, clients can run 3 different types of node - light, full and archive. There are also options of different sync strategies which enables faster synchronization time. Synchronization refers to how quickly it can get the most up-to-date information on Ethereum's state.
https://notes.ethereum.org/@vbuterin/proto_danksharding_faq
https://compound.finance https://app.aave.com
ERC20 <> ETH
ERC20 <> ERC20
Can add single assets as liquidity Will use a Layer-2
Concentraded liquidity
Will be possible to concentrade liquidity in a specific range
Non-fungible liquidity
LP tokens won't be ERC20 anymore but ERC721 Trading fees no longer automatically reinvested
Flexible fees
0.05% => Stablecoins pairs 0.3% => Standard pairs 1% => Exotic pairs
Oracle
TWAP past 9 days on-chain
Pricing LP positions
https://github.com/ccyanxyz/uniswap-arbitrage-analysis https://github.com/libevm/subway
https://mistx.io/ Gasless swaps, no frontrunners
AMM for stablecoins
Conic
Conic Finance is an easy-to-use platform built for liquidity providers to easily diversify their exposure to multiple Curve pools. Any user can provide liquidity into a Conic Omnipool which allocates funds across Curve in proportion to protocol controlled pool weights.
https://shells.exchange/ Another AMM for stablecoins
Everything is done on L2 No gas fees once coins are deposited on L2 From time to time, L2 is synced to L1
CLI Interface: https://github.com/liquiditygoblin/1inch-cli
Automated on-chain hedge fund https://yearn.finance
https://formation.fi/ Yield farming optimizer
DECENTRALIZED PERPS Trade global markets with low fees, deep liquidity, and up to 100× leverage.
On Arbitrum L2
https://app.alchemix.fi/ Deposit DAI, borrow up to 50% as alUSD Yield on DAI through YFI pays back the loan itself
https://sideshift.ai/btc/eth Not sure I understand the appeal?
https://pop.town/ High-yield staking for ETH and USDC
New algo stablecoin
<2021-04-07> update: looks like Fei failed miserably… https://rekt.news/fei-rekt/
https://www.apwine.fi/ The protocol allowing you to trade unrealised yield.
"Like Uniswap, but for lending & borrowing" https://app.timeswap.io/
https://fodl.finance/ Leveraged lending
https://www.euler.finance/#/ Permissionless crypto lending markets are almost here.
https://zapper.fi: portfolio management https://feed.chain.link: on-chain price reference data https://defirate.com & https://yieldfarming.info: yield rate comparison https://tornado.cash: anonymize ETH transactions
AAVE, dYdX, Uniswap… Kollateral: https://docs.kollateral.co aggregated pools from different sources Balancer V2: https://twitter.com/fcmartinelli/status/1461777136071716875
https://defiprime.com/flahloans-comparison https://money-legos.studydefi.com/#/dydx https://github.com/fifikobayashi this guy have some repos using flash loans
https://docs.makerdao.com/smart-contract-modules/flash-mint-module
Miner Extracted Value https://www.coindesk.com/ethereum-trading-bot-strategy-miner-extracted-value-research
One can look at the waiting transactions on the Ethereum blockchains and upbid "profitable" transactions so it executes faster.
https://noxx.substack.com/p/dex-arbitrage-mathematical-optimisations