Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Audits/participated.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ https://codehawks.cyfrin.io/c/2025-04-rock-paper-scissors - Rock paper scissors
https://codehawks.cyfrin.io/c/2025-05-hawk-high - school project ( first flight )


---------------------------------------------------------------------------------------------------


forge install https://github.com/foundry-rs/forge-std --no-commit && forge install https://github.com/OpenZeppelin/openzeppelin-contracts --no-commit

// revise
Expand Down
31 changes: 25 additions & 6 deletions Ethereum/DEFI/AMM.txt → Ethereum/DEFI/AMMOrUniswap.txt
Original file line number Diff line number Diff line change
@@ -1,30 +1,49 @@

----------------------------------- Uniswap v2 -----------------------------------------
-> the bigger the curve , the better price you will get when we do a trade ( more liquidity)
-> Three main contracts - Factory , Router and pair contracts
- Factory is used to deploy the pair contract
- Router is the intermediate contract between the user and the pair contract
- users can still directly interact with the pair contract but suggested to use the router contract so it will automate some functionalities and checks
-> swap fee was charged on the incoming token into the pool
-> swapExactTokensForTokens - I want to spend exactly X tokens, give me at least Y tokens out
-> swapTokensForExactTokens - I want to receive exactly Y tokens, and I'm willing to spend up to X tokens to get it
-> Uniswap uses TWAP - Time weighted average price
-> Uniswap provides flash swaps using the pair contracts just like the flash loans




-------------------------------- Constant Product AMM -----------------------------------
-> AMM - x * y = k ( x = Asset A , y = Asset B , k = Constant value )
-> price of Asset x = x / y
-> price of Asset y = y / x
From the above equations we can get the below two equations
-> reserve of x**2 = K / price of x
-> reserve of y**2 = K * price of y
-> Our share in the liquidity is = liquidity of ours / current total liquidity
-> Our share in the liquidity is = liquidity of ours / current total liquidity ( LP tokens )
-> When liquidity is added, K changes because the total pool size has increased—but each liquidity provider's share is then calculated as a fraction of the new total liquidity
-> x*y = (x + deltax) * (y - deltay)
-> At a price of 4000 USDT/ETH: ( invested 1 eth at 2000 price )
Pool Reserves: Approximately 0.7071 ETH and 2828.43 USDT.

Below Example was from LP token holder perspective
-> At a price of 4000 USDT/ETH: ( added 1 eth at 2000 price into the pool ( 1 eth , 2000 usdt ) )
Pool Reserves: Approximately 0.7071 ETH and 2828.43 USDT. ( x * y = ~2000)
Total Value upon Removal: ~5656.86 USDT.
Impermanent Loss: ~343.14 USDT compared to simply holding.

At a price of 5000 USDT/ETH:
Pool Reserves: Approximately 0.6325 ETH and 3162.28 USDT.
Pool Reserves: Approximately 0.6325 ETH and 3162.28 USDT. ( x * y = ~2000)
Total Value upon Removal: ~6324.78 USDT.
Impermanent Loss: ~675.22 USDT compared to holding.

At 1000 USDT/ETH:
Pool Reserves: ≈ 1.4142 ETH and ≈ 1414.21 USDT
Pool Reserves: ≈ 1.4142 ETH and ≈ 1414.21 USDT ( x * y = ~2000)
Total Value: ≈ 2828.42 USDT
If Held: 3000 USDT
Impermanent Loss: ≈ 171.58 USDT

At 500 USDT/ETH:
Pool Reserves: 2 ETH and 1000 USDT
Pool Reserves: 2 ETH and 1000 USDT ( x * y = ~2000)
Total Value: 2000 USDT
If Held: 2500 USDT
Impermanent Loss: 500 USDT
Expand Down
6 changes: 5 additions & 1 deletion Ethereum/EIPorERC.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
-> ERC - 7715 Grant permissions for Wallets

-> erc-1155 - what are semi fungible token
- A single ERC-1155 contract can manage multiple token types, including fungible, non-fungible, and semi-fungible tokens
- ERC-1155 can represent semi-fungible tokens, which are essentially fungible tokens that can be converted into non-fungible tokens under certain conditions

-> EIP-3529: Reduction in refunds

Expand All @@ -56,6 +58,8 @@

-> EIP-7863 proposes block-level warming

-> EIP-2930 : Pre-warming with Access Lists
-> EIP-2930 : Pre-warming with Access Lists ( cold and warm access)
- An Ethereum access list transaction enables saving gas on cross-contract calls by declaring in advance which contract and storage slots will be accessed. Up to 100 gas can be saved per accessed storage slot
- Making a cross contract call normally incurs an additional 2600 gas, but using an access list transaction costs 2400 and prewarms the contract access so that it only charges 100 gas, meaning the net cost goes from 2600 to 2500.

-> EIP-1822 : Universal Upgradeable Proxy Standard (UUPS)
7 changes: 4 additions & 3 deletions Ethereum/Ethereum.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
Pruned nodes (like archive nodes vs. full nodes) may discard older logs to save space.
-> user case and problem : we have created a smart contract wallet with social recovery and we have initialized smart
contract account in both ethereum and zksync and you have lost your EOA which you used to initialize the smart contract accounts
and some one sent you mony on optimism and you can't initialize the smart contract account with same address in optimism because
and some one sent you money on optimism and you can't initialize the smart contract account with same address in optimism because
you have used create2 and lost EOA adddress to initialize and generate the address of smart contract account
-> Why Gas Exist in the first place : Ethereum is a Turing-complete system. Turing-complete systems face the challenge
of the halting problem i.e. given an arbitrary program and its input, it is not solvable to determine whether the
Expand All @@ -71,7 +71,7 @@
-> scurge
-> selfdestruct will let you kill the contract even if the conctract has arbitrary large numner of storage slots
- this means there is not upper bound on the amount of state within in that could change within in a single block
- if in contract has a million object and if we selfdestruct this contract then this million objects will go away ( handling this edge case is complex and for this we need to add large amount of extra code on the client developers)
- if a contract has a million object and if we selfdestruct this contract then this million objects will go away ( handling this edge case is complex and for this we need to add large amount of extra code on the client developers)
- hardlimit on number of the storage slots that can change within in a single block
-> Turing machine - https://grok.com/share/bGVnYWN5_c9eaca24-3cb6-4863-8577-ecded478336f
- A Turing machine can perform any computation that can be described by an algorithm, given enough time and resources
Expand All @@ -81,4 +81,5 @@
Balance: The amount of ETH the account holds.
Storage Hash: A Merkle root representing the account's storage.
Code Hash: A hash of the account's associated code (empty for EOAs).
-> shamir backup - social recovery wallet
-> shamir backup - social recovery wallet
-> An SRP ( Seed Recovery Phrase ) restores the entire wallet with all its derived accounts, while a Private Key only restores one specific account.
2 changes: 1 addition & 1 deletion Ethereum/Solidity.txt
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@
-> Function name match checking from the call data of the transaction
- Each selector == X comparison (and the associated branch, JUMPI) has a constant gas cost—approximately 22 gas for the comparison plus the jump logic
-> As you can imagine, this is because different op-codes are needed for each one of this different functions (which all achieve the exact same result)
- num += 1 ; (26429 gas) num = num +1 (26416 gas) num++ (26368 gas) ++num (26362 gas)
- num += 1 ; (26429 gas) , num = num +1 (26416 gas) , num++ (26368 gas) , ++num (26362 gas)
-> Memory expansion cost
- When a contract call needs to use more than 32 kilobytes of memory storage in a single transaction, the memory cost will enter into a quadratic section
- compare 1,000 , 10,000 and 20,000 arrays with sizes
Expand Down
17 changes: 16 additions & 1 deletion Ethereum/noir.txt
Original file line number Diff line number Diff line change
@@ -1 +1,16 @@
-> In Noir (just like in Rust), the presence or absence of a trailing semicolon turns an expression into either a value‑producing expression (no semicolon) or a statement that returns () (with a semicolon)
-> In Noir (just like in Rust), the presence or absence of a trailing semicolon turns an expression into either a value‑producing expression (no semicolon) or a statement that returns () (with a semicolon)
-> Field :: It is an integer type whose maximum value is determined by the field modulus of the underlying proving system.
-> How are test functions identified and utilized in the Noir programming language? - By using the `#[test]` attribute above a function definition, to verify circuit logic with specific inputs.
-> In cryptographic systems that utilize proofs of computation, what is the fundamental role of a 'verification key'? - It allows an entity to validate a submitted proof for a specific computation without needing access to the secret inputs or the full circuit.
-> Arrays must be statically sized, meaning their length is known at compile time.











5 changes: 3 additions & 2 deletions Ethereum/speedDev/speedDev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@
- HEAD~2 = two commits before, etc.
- git revert <commit to revert>
-> command + w - to close the current working file in vs code
-> ctrl + backtick(`) - to toggle the terminal in vscode
-> Ctrl+J = Jump down (to the bottom panel). - VS code terminal
-> Minimize Current Window - ⌘ Command + M
-> Maximize / Restore (Zoom) Current Window - Control + ⌘ Command + F
-> Install baxh-completion for many auto completion features in bash
-> clear local storage :: Bookmarklet (One-click outside DevTools) ::> javascript:localStorage.clear();console.log('✅ localStorage cleared');
- Use Bookmark Mnemonics for Speed - just hit Cmd + L, type cl, and press Enter
-> Cmd + L - to focus the address bar , then hit tab repeatedly to until it focus on the bookmarks
-> Cmd + tab - to shift to new opened apps
-> Cmd + tab - to shift to new opened apps
-> Capture Chrome Screenshot without other tabs , bookmarks and extentions :: In Chrome : cmd + opt + i and then cmd + shift + p and then search for capture screenshot
1 change: 1 addition & 0 deletions Ethereum/wagmi.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--> npx create-next-app@latest -e https://github.com/Seth-McKilla/nextjs-wagmi
1 change: 1 addition & 0 deletions Ethereum/web3_stack.txt → Ethereum/web3_fullstack.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Example projects
-------------------------------------- BACKEND -------------------------------------------------
-> Indexing
- rindexer ( uses postgress db) - building database, indexes, exposing GraphQL APIs - ( Alternatives , The graph protocol )
- Docker Compose is a tool for running and managing multi-container Docker applications using a simple YAML file (docker-compose.yml)
- graphql


Expand Down
6 changes: 4 additions & 2 deletions Ethereum/zksyncOrlayer2OrRollup.txt
Original file line number Diff line number Diff line change
Expand Up @@ -138,13 +138,15 @@
-> When an integer is defined in Noir without a specific type, it will default to Field.
The one exception is for loop indices which default to u32 since comparisons on Fields are not possible
-> nargo execute :: it will compile the circuit into ACIR and it will execute our compiled circuits using the provided inputs in the Prover.toml and then compute a witness and then we will use this witness to create proof
-> creating Proof :: nargo prove -b <compileCircuitLocation> -w <witnessLocation> -o <outputProofLocation>
-> creating Proof :: bb prove -b <compileCircuitLocation> -w <witnessLocation> -o <outputProofLocation>
-> Verification key :: is basically a cryptographic object that allows the verifier to check the validity of the proof without having to rerun the full computation
- if we change something in the circuit we again need to regenerate the proof and the verification key
- kind of digital finger print for the circuit
- bb write_vk -b <compileCircuitLocation> -o <verificationKeyLocation>
- verifier would be creating this verification key from the byte code and then using it to verify the proof
- bb verify -k <verificationKeyLocation> -p <proofLocation>
-> In the context of developing Zero-Knowledge proofs with Noir, what does a 'Witness' represent?
- A complete set of all intermediate values and assignments that satisfy the circuit's constraints for a specific input
-> In General signature is of 65 bytes - ( r is of 32 bytes , s is of 32 bytes , v is of 1 byte )
-> To execute a shell script first we need to convert it to executable - chmod +x script.sh ( change mode executable)
-> To generate VK for onchain :: bb write_vk --oracle_hash keccak -b <CompiledByteCodeOrACIR> -o <verificationKeyLocation>
Expand Down Expand Up @@ -227,7 +229,7 @@
-> Cartesian Merkle Tree (CMT) is an elegant synergy of three data structures: the binary search tree, the heap, and the Merkle tree
- The CMT nodes store three values: the key, the priority, and the merkleHash
- https://medium.com/distributed-lab/cartesian-merkle-tree-the-new-breed-a30b005ecf27
->
-> What is the primary purpose of a library (`"lib"`) crate in Noir? - To create reusable Noir code that can be shared across different projects.

------------------------------------------------------------------------------------------------------------------------------

Expand Down
7 changes: 6 additions & 1 deletion Foundry_fundamentals.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
--> (storing private key) cast wallet import one_anvil --interactive
--> cast wallet public-key --account one_anvil
--> cast wallet sign --no-hash <HashedMessage> --account one_anvil
--> cast keccak "hello"
--> cast send 0xDc64a140Aa3E981100a9becA4E685f962f0cF6C9 "store(uint256)" 345 --account one_anvilca
--> foundryup , foundryup-zksync
--> forge fmt
Expand Down Expand Up @@ -74,4 +75,8 @@
--> To see the logs in the js file when we run vm.ffi
bytes memory result = vm.ffi(cmds);
string memory output = string(result);
console.log("Script Output: %s", output);
console.log("Script Output: %s", output);
--> Foreign Function Interface (FFI) - To run arbitary cli scripts
--> So Chisel is just showing you for : abi.encode("name") - output will be ( pointer + length + actual data)
Memory layout (how EVM stores it)
Tuple encoding layout (how ABI would serialize it for function calls / logs)
1 change: 1 addition & 0 deletions Questions.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ Need to check when destructing from a direct struct and a function returning a s
-> what is eip 4844 proto dank sharding ?
-> How single slot finality works under the hood
-> what is two party computation , fully homomorphic encryption and proof of person hood protocols
-> How flashbots prevents the MEV like attacks


# https://www.vigilseek.com/
Expand Down
10 changes: 0 additions & 10 deletions Rust/rust.txt

This file was deleted.

Loading