{"id":24809565,"url":"https://github.com/root-tanishq/web3-deep","last_synced_at":"2025-10-13T11:31:20.815Z","repository":{"id":274331364,"uuid":"922409717","full_name":"root-tanishq/web3-deep","owner":"root-tanishq","description":"WEB3 notes for smart contracts auditing and development","archived":false,"fork":false,"pushed_at":"2025-01-26T16:07:23.000Z","size":35,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-06T09:11:18.810Z","etag":null,"topics":["blockchain","ethereum","openzeppelin","smartcontracts","solidity","web3"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/root-tanishq.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":"RoadMap.md","authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-01-26T05:45:56.000Z","updated_at":"2025-01-28T05:25:22.000Z","dependencies_parsed_at":"2025-01-26T17:31:52.884Z","dependency_job_id":null,"html_url":"https://github.com/root-tanishq/web3-deep","commit_stats":null,"previous_names":["root-tanishq/web3-deep"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/root-tanishq/web3-deep","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/root-tanishq%2Fweb3-deep","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/root-tanishq%2Fweb3-deep/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/root-tanishq%2Fweb3-deep/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/root-tanishq%2Fweb3-deep/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/root-tanishq","download_url":"https://codeload.github.com/root-tanishq/web3-deep/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/root-tanishq%2Fweb3-deep/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279014793,"owners_count":26085594,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-13T02:00:06.723Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["blockchain","ethereum","openzeppelin","smartcontracts","solidity","web3"],"created_at":"2025-01-30T11:14:37.475Z","updated_at":"2025-10-13T11:31:20.342Z","avatar_url":"https://github.com/root-tanishq.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# README\n- Good website to learn smart contract security - https://scsfg.io/hackers/signature-attacks/\n---\n# Blockchain\n- A distributed ledger operated on via a decentralized network of nodes\n- Some properties\n\t- Immutable\n\t- Untamperable\n\t- Used to make cryptocurrency, computing machines\n\n## Bitcoin Cryptocurrency\n- Satoshi Nakamoto and his bitcoin whitepaper\n- Laid the foundation of cryptocurrency\n- What crypto is:\n\t- A system of economic exchange not controlled by a centralized entity (banks)\n\t- Instead managed by thousands of decentralized nodes on a peer-to-peer decentralized basis\n- Bitcoin is essentially a digital currency payment network\n\n## Etherum\n- Idealized in 2014 and its inception in 2015\n- A decentralized computing infrastructure witha built in Turing Complete programming language (Solidity)\n- Programs called \"Smart Contracts\"\n- The \"blocks\" in blockchains store all changes performed in the computing infrastructure\n- Foundation of Decentralized Applications\n\n## The core components of blockchain\n### Decentralized Network\n- A blockchain implementation always involves decentralized network of nodes\n- Two types:\n\t- Permissioned (Requirement of permission for participation)\n\t- Permissionless (Anyone can participate)\n- All of the nodes have a copy of the blockchain\n- When a new block is attached, the change is communicated across all these nodes.\n\n### Cryptography\n- One of the core ideas used by blockchain \n- Used for encryption, keys, hashing and so on\n\t- Digital signature are used for signing transactions, identity verification, to maintain integrity\n\t- Hashing is used to create the immutable chain of blocks.\n\n### Immutable Ledger\n- The database of blockchain \n- What it stores\n\t- Transactions made by the users on the network\n- In case of bitcoin (Any change in the balance of the involved users is recoreded)\n- In case of ethereum (Much more complex changes in the state of the blockchain are recorded)\n\n### Consensus\n- What let's users be able to do transactions between themselves without any intermediary controlling parties involved\n- A set of rules and processess which the senders and receivers in the network, agree upon, to complete a certain transaction\n- The transaction is attached to the block, and updated to all nodes on the decentralized network\n\n### Smart Contracts\n- Web3, divided into\n\t- Client (Frontend)\n\t- Smart Contract (Backend)\n\t- Blockchain\n\n- Smart Contracts can\n\t- Read data on the blockchain\n\t- Write new data to the blockchain\n---\n## Practical Demo \n- https://andersbrownworth.com/blockchain/hash\n\t- Key Learning:-\n\t- Nonce and data need to be changed multiple times to achieve the hash in a block.\n\t- the prev hash of the previous block is linked and the current hash is used as a pervios hash in the next block making a chain that's why its called blockchain. \n\t- Due to of this blockchain is considered tamper proof because if any data is changed the current hash will be changed which results in breaking the on-going blockchain. \n---\n# Ethereum\n- To understand ethereum better, we can divide it into parts.\n\t- The Blockchain\n\t\t- An integral part of ethereum, the same as any other blockchain\n\t\t- A General purpose programmable blockchain that runs a virtual machine capable of executing code\n\t- The nodes and the miners\n\t\t- `Nodes` \n\t\t\t- Nodes hold a copy of the blockchain\n\t\t\t- When a new block is attached to the chain, it gets updated across all the nodes in the network.\n\t\t- `Miners`\n\t\t\t- Miners run ethereum nodes that validate, execute and combine transactions into blocks, that go onto the blockchain\n\t\t\t- Validation, a process involving miners spending computational power\n\t\t\t- 'Proof of Work'\n\t\t\t- Miners are rewarded for blocks attached\n\t- The smart contracts\n\t\t- What holds executable code on the blockchain\n\t\t- Can execute specific pieces of said code\n\t\t- Some properties\n\t\t\t- Smary contracts have their own balance of ether and storage to keep track of variables.\n\t\t\t- Enable developers to build amazing Decentralized Applications\n\t\t\t- Once deployed, is immutable, that is, the code can never be changed\n\n---\n# Smart Contracts\n- Pieces of code written in solidity and other language (Rust, Go, Python etc...), programs that are stored on the blockchain and executed by EOAs or other smart contracts.\n- Just as Javascript executes in a web browser, Solidity code is always executed on the Ethereum blockchain.\n\n## Important Terms: Address\n- Address\n\t- Last 20 bytes of the hash of a given public key\n\t- How accounts and smart contracts are represented on the blockchain\n- Two Types of addresses\n\t- Externally Owned Accounts (EOAs)\n\t- Contract Accounts\n\n## Important Terms: Bytecode\n- Object code that is converted into binary machine code, which can be read by a machine\n- Smart Contracts written in High Level Language, converted into bytecode that can be executed by the EVM\n![](../attachments/Pasted%20image%2020231221152341.png)\n\n## Important Terms: Gas Fees\n- Gas Fees\n\t- Unit that measures the amount of computation required to do any transaction on the blockchain (Write something to blockchain data) \n\t- Comensation for computation resources used for the transaction to be completed.\n\t- Paid in Ethereum's Native currency, Ether (ETH)\n\t- Gas denoted in `gwei` such that ---\u003e 1 gwei = 0.0000000001 ETH\n\n## Why gas fees?\n- Prevent someone trying to overload the network and try DOS Attacks.\n- Also compensation for computation resources, of all the miners that keep the network running.\n\n## Interacting with smart contracts\n- User initiates a transaction using a wallet\n- The transaction is verified and approved\n- It includes code that defines what type of transaction is to be executed\n- The transaction is added as a block  to the blockchain\n- Using \n\t- Web3 js Library\n\t- Ethers js\n\t- Web3 py\n\n## Metamask\n- Its an crypto wallet which is used to connect with web3 application\n- It stores crypto assets.\n- https://metamask.io\n- `Secret Recovery Phrase` -\u003e its an 12 word phrase which is linked to your wallet and is used to recover or import the wallet\n\n# Decentralized Application `Dapps`\n- Decentralized Applications are apps that are built on decentralized networks and are essentially a system that combines smart contracts (As Backend) and User Interface (As Frontend)\n\n## Dapp Examples\n- Decentralized Exchanges (Uniswap, Sushiswap)\n- Decentralized Finances\n- Games (CryptoKitties)\n- Marketplace (Opensea)\n\n## Decentralized Autonomous Organization `DAO`\n### What's a DAO?\n- Like any other organization, has participants, offers services\n- Traditional Organizations\n\t- Decision are made by higher authorities like a board of directors or Executives\n\t- Centralized Entity makes decision for all members\n- Decentralized Autonomous Organization\n\t- The members create the decision (Proposals) and other members vote on whether said decision should be taken or not\n\t- Members themselves are involved in decision making\n\n### Advantages of DAO\n- More power to the people (True Democracy)\n- Autonomy (Independent of any other orgs, Governments etc.)\n- Everyone is involved in running the organization\n\n## Decentralized Exchanges\n- Blockchain based applications\n- Enable large scale trading of crypto assets between users\n- Different types of Decentralized Exchanges\n\t- Order Book DEX\n\t- AMM  DEX\n\n### Order Book  DEX\n- The `traditional` assets trading method\n- Uses an Order Book that keeps track of `buy orders` and  `sell orders`\n- When a buyer uploads a buy order, the order book organizes suitable sell orders that match the buyers price.\n- On Chain and Off Chain Order Books\n\n### Automated Market Makers\n- AMM stands for `Automated Market Maker`\n- The goal : remove the middleman between crypto asset exchange\n- Achieved using smart contracts\n- Aggregates a pool of assets that is to be exchanged, eg ETH/SOL\n- Uses Algorithm to determine an exchange price based on the assets that are available in the liquidity pools\n\n## Exchanging Crpyto assets\n- User A has some ETH\n- They want to trade their ETH for some Token\n- User goes to the exchange\n- Exchange gives the user the amount of Token that can be exchanged according to the ETH/Token Pair's Liquidity Pool\n- User A accepts, signs a transaction to trade.\n- User A now has Token for the ETH he traded.\n\n---\n## Test network for dapps\n- You can use test networks to interact with smart contracts with no real money value present for this in metamask extension go to Advance =\u003e show test network\n- ropsten faucet \n- upon sending ether or making any transaction some gas fees is charged for the miners who are minning\n\n---\n# The core concept of mining in crypto transactions\n- so there any mutliple ledgers and minining means finding the perfect hash which matches the blockchain to continue\n- and then that hash is put on to the records of all the decentralized copies of the cryptonetwork\n- and the person who is minning actually gets paid with the gas fees of the transaction\n\n---\n# Etherscan\n## What's etherscan?\n- Blockchain is a public ledger\n- Anyone can view all transactions at any point of time\n- Using etherscan\n- It's a tool to view all the transactions on blockchain\n\n## Etherscan.io\n- A Block explorer and analysis tool\n- Lets you view any and all transactions on the blockchain\n- Available for both the mainnet and testnet =\u003e net means networks\n\n## Etherscan for testnet\n- ropsten.etherscan.io\n- rinkeby.etherscan.io\n- goerli.etherscan.io\n\n---\n# Remix IDE\n- remix.etherium.org\n\n---\n# Solidity programming language\n## How to start\n```\ncontract MyContract {\n\t// Your smart contract\n}\n```\n\n## Primitive Datatypes\n- int : integer (signed integer)\n- uint : unsigned integer =\u003e `it does not store any negative values`\n- bool : Boolean (True or False)\n- address : Ethereum address\n\n### Address\n```\ncontract MyContract {\n\t// 20 byte value that holds Ethereum Address\n\taddress public myAddress; // public keyword is a visibility modifier\n}\n```\n\n![](../attachments/Pasted%20image%2020231225131559.png)\n\n- Visibility Modifier\n\t- public `any contract can access the variable` , private `the contract itself is able to access variable` , internal `functions internally can access this variable` , external `the variable can only be accessed externally`\n\n### Variables\n- Three types of variables\n\t- `Local Variables`\n\t\t- Declared inside a function\n\t\t- Not stored on the blockchain\n\t- `State Variables`\n\t\t- Declared outside a function\n\t\t- Stored on the blockchain\n\t- `Global Variables`\n\t\t- Global variables provide information about the blockchain\n\t\t- Some examples of global variables\n\t\t\t- `msg.sender` : address of the called of the function\n\t\t\t- `msg.value` : Ether sent by the caller\n\t\t\t- `msg.data` : Any data sent in the call\n\t\t\t- `block.timestamp` : Current block timestamp\n\n\u003e Example\n```sol\nContract myContract {\n// Stored on the blockchain\nuint num;\nstring myString;\nfunction myFunction() public {\n\t// Not stored on the blockchain\n\tuint num2;\n\t}\n}\n```\n\n#### Playing with Global Variables\n```sol\n...\nfunction newFunction() public returns (address) {\n\taddress myAddress = msg.sender;\n\treturn myAddress;\n}\n...\n```\n\n## Read and Write Operation\n- Reading variables is for free without any fees\n- To write a state variable, you have to send transactions with gas fees\n\n```sol\ncontract Storage {\n\tuint256 number;\n\n\tfunction get() public view returns (uint256) {\n\t\treturn number;\n\t}\n\n\tfunction set(uint256 num) public {\n\t\tnumber = num;\n\t}\n}\n```\n\n## Functions\n- Functions are sets of reusable code that can be called anywhere in the program\n- Used to avoid writing the same code again and again\n- Syntax\n```sol\nfunction function-name(argument) scope returns(return-values) {\n\t//code\n}\n```\n\n### Example\n```sol\nfunction addNumber(uint a,uint b) public returns(uint) {\n\tuint c = a + b;\n\treturn c;\n}\n```\n---\n### Global Variables in Solidity\n```sol\npragma solidity ^0.6.0;\n\ncontract MyContract {\n\tuint public number1;\n\n\tfunction myFunction() public {\n\t\tuint num;\n\t}\n\n\tfunction newFunction() public returns (uint, address) {\n\t\tuint num1 = 12;\n\t\tuint num2 = 13;\n\t\tnumber1 = num1 + num2;\n\t\taddress myAddress = msg.sender;\n\t\treturns(number1,myAddress);\n\t}\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froot-tanishq%2Fweb3-deep","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Froot-tanishq%2Fweb3-deep","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froot-tanishq%2Fweb3-deep/lists"}