AI 资讯
What Your Multisig Threshold Actually Protects
I've been digging into multisig configurations for bridge and protocol security reviews. The threshold gets all the attention — 3-of-5, 4-of-7, whatever. But after checking a few dozen Safes on mainnet, the threshold is rarely the weakest link. There are five other things that determine whether a Gnosis Safe actually protects funds, and most people only check the first one. This post walks through all of them, with cast commands you can run yourself. What the threshold does The threshold sets the minimum number of owner signatures required to execute a transaction through execTransaction() . If threshold is 3 and you have 2 signatures, the call reverts. Simple. # check threshold and owners cast call <SAFE> "getThreshold()(uint256)" cast call <SAFE> "getOwners()(address[])" This is the part everyone understlse. What the threshold does NOT protect 1. Modules This is the biggest blind spot in multisig security. Safe modules are contracts authorFromModule()`. A module can execute*any transaction from the safe without a single owner signature*. The threshold is irrelevant. The module has its own authority. `bash if this returns anything other than an empty array, investigate cast call "getModulesPagin[],address)" \ 0x0000000000000000000000000000000000000001 10 ` Modules are legitimate — timelockation. But a malicious or compromisedmodule is a full bypass of every threshold. Your 7-of-10 means nothing if a module can move funds independently. 2. Guard A guard contract implements checerExecution() . It adds validation on top of the threshold — restricting destinations, limiting values, blocking certain operations. The guard address lives at a specific storage slot. If it's 0x00 , there's no guard. No additional checks beyond threshold + signatu `bash guard storage slot (keccak256("guard_manager.guard.address")) cast storage \ 0x4a204f620c8c5ccdca3fd54d003badd85ba500436a431f0cbda4f558c93c34c8 0x000...000 = no guard installe ` A guard can enforce things like "no transfers ab
AI 资讯
MetaMask launches its agent wallet, Glamsterdam Testnet goes public, a lattice-crypto attack draws doubt, NEAR Intents unifies liquidity
Welcome to our weekly digest, where we unpack the latest in account and chain abstraction and the broader infrastructure shaping Ethereum. This week: MetaMask launches a self-custodial wallet built for AI agents; Ethereum core devs send Glamsterdam to a public testnet while Frame Transactions pick up client support for Hegota; a new quantum attack on lattice-based cryptography draws quick skepticism; and NEAR Intents grows into a single cross-chain liquidity layer. MetaMask Launches Its Agent Wallet Glamsterdam Testnet Goes Public as Hegota Advances A Lattice-Crypto Attack Draws Doubt NEAR Intents Becomes a Unified Liquidity Layer Please fasten your belts! MetaMask Launches Its Agent Wallet MetaMask launched its Agent Wallet , a self-custodial wallet built for AI agents to execute onchain actions inside rules the user sets. It lets traders and builders connect an agent framework, then define spend limits, allowlisted protocols, and a risk profile before the agent acts. The pitch is that safety is the product. Agent Wallet is not blind delegation, so supported transactions pass through MetaMask’s security pipeline, including transaction simulation, Blockaid-powered threat scanning, and MEV protection, and anything outside policy pauses for two-factor approval. Users pick between two modes. Guard Mode, the default, enforces daily spend limits, allowlists, and human approval for out-of-policy actions, while opt-in Beast Mode reduces approval interruptions but still runs security checks and still stops flagged transactions. On capabilities, agents can connect frameworks like Claude Code, Codex, and Cursor and execute across HyperLiquid and EVM chains such as Robinhood and Monad. They can run ERC-7821 batch swaps, and they never need a chain’s native gas token, since MetaMask settles the fee in the token being moved. This is account abstraction in a very practical form. Spend limits, allowlists, gasless execution, and batching are exactly the programmable account feature
AI 资讯
Web3 funding is fundamentally broken.
Finding grants means digging through 50 scattered Discords, blogs, websites, and Notion pages. So I built a fix. Meet Web3 Accelerator GrantHub (W3AGH). What is GrantHub? GrantHub is a web app that helps Web3 founders discover funding opportunities without digging through dozens of scattered websites. Grants are listed across ecosystems like Solana, Ethereum, Polygon, BNB Chain, Arbitrum, Base, and more. The idea is simple: instead of spending hours searching for funding opportunities, you should be able to find relevant grants in one place. GrantHub also has AI tools that sit on top of the grant database. You can describe your project once and instantly see which grants fit best. Why GrantHub? Funding is the lifeblood of Web3 startups, but finding grants today is painful. Scattered listings Every ecosystem publishes its own programs on its own website, blog, Discord, or other channels. There is no single source of truth. Stale information Grants expire, close, or change their requirements, while the listings founders rely on can remain outdated. Manual matching A founder has to read through each grant's requirements and figure out whether their project qualifies. With dozens of grants available, that can quickly turn into hours of work. No personal workflow There is no single place to save interesting grants, track applications, or ask questions about a specific program. GrantHub is built around solving these problems. It combines three things: One central catalog of grants stored in a real database. Personal tools: accounts, favorites, and a personal dashboard. AI assistance: a grant ranking engine, an AI assistant, a smart-contract auditor, and context-aware chat on every grant page. Who is this for? Solo builders and startups: looking for funding or ecosystem support. Beginners who don't yet know which ecosystems and grants are right for them. Anyone who would rather spend their time building than hunting for funding. The goal isn't to create another directory o
AI 资讯
Redbelly Network Troubleshooting Guide: 22 Common Developer Errors and Their Fixes
description: "Fixes for the 22 errors developers hit most often on Redbelly Network — RPC and chain ID conflicts, MetaMask setup, USD-pegged gas, permissioned-network reverts, Hardhat deployment, Routescan verification, and the Eligibility SDK." tags: blockchain, web3, ethereum, solidity canonical_url: https://dev.to/isaac_atunbi_c2ed2489e89c/redbelly-network-troubleshooting-guide-22-common-developer-errors-and-their-fixes-1g26/edit cover_image: published: true Redbelly Network Troubleshooting Guide 22 common developer errors, with the exact command that fixes each one. Redbelly Network is an EVM-compatible L1 built for compliant asset tokenisation. "EVM compatible" gets you most of the way, but three things about Redbelly are genuinely different from every other EVM chain, and they account for most of the time developers lose here: It is a permissioned network. An address that has not claimed a network access credential cannot write to the chain. Transactions from it fail in a way that looks like an ordinary revert. Gas is priced in US dollars, not gwei. eth_gasPrice returns roughly 165,000 gwei . That is about four orders of magnitude above Ethereum, it is correct, and it breaks any tool with a hardcoded fee cap or a "that can't be right" sanity check. The two official documentation sites disagree with each other , including on the mainnet chain ID. One of them is stale. Every entry below follows the same shape — Symptom → Root Cause → Solution → Prevention — and every command is copy-pasteable. Every chain ID, URL, contract address and package name was read from a live source on the date in the footer, not from memory. Sources read: 8 August 2026. Every chain ID, URL, contract address and package name below was read from a live source on that date and is traced in sources.md . Execution status: the fixes here are derived from those sources and from the documented behaviour of the tooling; they have not yet been executed end-to-end against Redbelly Testnet . A ver
AI 资讯
Your DEX tool is probably overstating Uniswap v3 TVL by 25x
I shipped a bug into a paid API and it took me a while to see it, because nothing errored. Every response was a clean HTTP 200 with a confident number in it. The number was wrong by 25x . Here is the finding, the arithmetic, and how to check your own code in about thirty seconds. The measurement Uniswap v3, WETH/USDC on Base. Left column is what my API reported as TVL. Right column is what the pool contract actually holds — a plain balanceOf on each token, at the pool address. pool reported actually held overstated uniswapV3 0.01% $2,070,000 $215,646 9.6x uniswapV3 0.05% $73,600,000 $10,069,584 7.3x uniswapV3 0.30% $2,840,000,000 $111,513,855 25.5x uniswapV3 1.00% $14,800,000 $846,661 17.4x $2.84 billion in one pool on Base. Base's entire ecosystem TVL is a few billion dollars. That is what finally made me look — not a failing test, just a number too large to be true. Why it happens A v2 pool holds two piles of tokens and the price is the ratio between them. getReserves() returns the actual piles. Easy. A v3 pool concentrates liquidity into price ranges. It does not have "reserves" in the v2 sense. What it has is a liquidity value L at the current price P , and the standard way to make v3 math reusable is to compute the virtual reserves — the amounts a v2-style pool would need to behave identically right here: x_virtual = L / √P y_virtual = L × √P These are enormously useful. Feed them into the ordinary constant-product formula and you get correct swap outputs and correct price impact, which is why essentially every v3 integration computes them. They are also not tokens anyone owns . They describe the shape of the curve at the current price, not custody. Concentration is exactly the point of v3: a position spanning a narrow band behaves like a much larger v2 pool while holding far less capital. The 25x above is that leverage, showing up as a number I then mislabelled. My code did this: tvlUsd = 2 * reserveA * priceA // fine for v2, nonsense for v3 That line is corre
AI 资讯
Shipping a Solidity contract to mainnet? Do this 20-minute self-check first
You built something. Tests pass. You're days from mainnet. Before you either skip security entirely (please don't) or spend weeks lining up a full audit, here's a self-check you can run in 20 minutes that catches the mistakes I see most often in first-time deployments. I run security reviews for small and new protocols, and the same handful of issues come up again and again. None of these need a tool — just your eyes and this list. 1. Who can call what? Open every external / public function that moves funds, mints, pauses, or upgrades. For each, ask: should a random address be able to call this? If not — is there an onlyOwner / onlyRole / require(msg.sender == ...) guarding it, in the function itself or in every internal function it calls? The classic bug isn't a missing modifier. It's a function that looks unguarded but delegates to a guarded internal one (fine), or one that looks guarded but the guard is in a branch a caller can skip (not fine). Trace the call, don't trust the signature. 2. The first-depositor trap (if you have a vault) If you mint shares from deposits (ERC-4626 or anything share-based), the first depositor can sometimes donate assets directly to the contract to inflate the share price, so the second depositor rounds down to zero shares and loses funds. Fix: virtual shares, a dead-shares mint at deploy, or a minimum-liquidity lock. OpenZeppelin's ERC-4626 handles this out of the box — a hand-rolled vault usually doesn't. 3. Reentrancy — but only the real kind Not every external call is reentrancy. It's a bug when an attacker-controlled call can re-enter and corrupt shared storage before you've updated it. Quick checks: Do you update state before the external transfer (checks-effects-interactions)? Is there a nonReentrant on functions that move value? Is the call target a trusted, immutable contract, or an arbitrary address the attacker supplies? A call to a protocol-owned contract, or a memory /local variable written after the call, is usually not
AI 资讯
The Archive Multiplier: Why eth_call at a Historical Block
TL;DR: Passing a historical blockNumber to eth_call , eth_getBalance or eth_getLogs silently routes your request to the archive tier of hosted RPC providers. In our production metrics, archive calls cost on average 26.7x more compute units than the same call at latest . This post explains why, shows the exact client code pattern that triggers it, and gives you three Prometheus queries to measure your own archive exposure in under a minute. Full cross provider measurements are published in the OpenChainBench RPC benchmarks . Last week our RPC cost dashboard flagged an overage projection above four thousand dollars for a single billing cycle on a single provider. On paper, our services were doing normal eth_call operations. In practice, one small pattern buried in three separate indexers had multiplied our compute unit consumption by more than an order of magnitude, and nothing in the code review process had surfaced it. This post breaks down what an archive multiplier is, why it silently inflates blockchain RPC bills across every major hosted provider, and how to detect it in your own Prometheus stack before the next overage alert lands in Slack. What does "archive" mean at the Ethereum node level? Every request that reads the state of a smart contract, whether through eth_call , eth_getBalance , eth_getStorageAt , eth_getCode , or a batch of these, requires the RPC node to reconstruct the world state at a specific block height. Ethereum clients handle this in two modes. Full node mode. The state trie is kept in memory or on fast SSD for the tip of the chain plus a rolling window of recent blocks. On Geth default settings that window is 128 blocks deep. Any query targeting latest , pending , or a block within that window resolves in a few milliseconds against the current state. Archive node mode. The client preserves every intermediate state trie since genesis. Answering a query at a block from months or years ago requires reading historical trie data off disk and re
AI 资讯
Taiko RPC: The L2 With No Sequencer
Every OP Stack chain we've covered — Base, Unichain, Zora — has a sequencer: one privileged party that orders transactions, and the thing you're implicitly trusting for liveness and fair ordering. Taiko doesn't have one. It's a based rollup : Ethereum's own validators propose Taiko's blocks as part of normal L1 block production. That single architectural choice cascades into everything a developer cares about — liveness, finality, MEV, and reliability. And because Taiko is also a Type-1 zkEVM , your Ethereum tooling works with zero changes. Here's the map for chain ID 167000 . The essentials Taiko mainnet ( Alethia ) is chain ID 167000 , an EVM Layer 2 with: ETH as the gas token (18 decimals) — no separate gas token to source. ~12-second blocks , aligned with Ethereum's slot times — because block proposing rides on L1, the cadence follows L1. Type-1 zkEVM equivalence — the most Ethereum-equivalent zkEVM design. Contracts deploy bit-identically; opcode behavior is exact. Connecting is completely standard EVM: import { createPublicClient , http } from " viem " ; import { taiko } from " viem/chains " ; // chain ID 167000 const client = createPublicClient ({ chain : taiko , transport : http ( " https://rpc.swiftnodes.io/rpc/taiko?key=YOUR_API_KEY " ), }); await client . getBlockNumber (); // just works What "based" changes: no sequencer to trust — or to fail On a typical rollup, a sequencer receives your transactions, orders them, and produces L2 blocks ( what a sequencer does ). It's efficient, but it's also a single point of trust and a single point of failure — sequencer outages have taken major L2s offline for hours. A "based" rollup removes it entirely: Block proposing happens on Ethereum L1. Taiko blocks are proposed via L1 transactions, so Ethereum's proposers include them as part of normal block production. There is no separate Taiko sequencer. Liveness = Ethereum's liveness. As long as Ethereum is producing blocks, Taiko is producing blocks. There is no "the se
AI 资讯
Robinhood Chain Goes Live, Agentic Payments Take Shape, Updated Lean Ethereum Roadmap
Welcome to our weekly digest, where we unpack the latest in account and chain abstraction and the broader infrastructure shaping Ethereum. This week: Robinhood takes its own chain and agentic trading live; WalletConnect and MetaMask make the case that account abstraction is what will keep AI agent payments safe; a new essay argues Ethereum should fund its founding period like a young nation-state; and Vitalik shares the updated Lean Ethereum roadmap that makes privacy and quantum resistance first-class. Robinhood Chain Goes Live With Agentic Trading WalletConnect and MetaMask on Agentic Payments The Case for Founding-Period Ethereum Funding Vitalik Shares the Updated Lean Ethereum Roadmap Please fasten your belts! Robinhood Chain Goes Live With Agentic Trading Robinhood has launched the public mainnet of Robinhood Chain , its biggest move yet into onchain finance. Built on Arbitrum, the Layer 2 is designed for tokenized real-world assets and DeFi, and it went live at a London keynote with day-one partners including Uniswap. With the mainnet, Robinhood’s Stock Tokens are now fully live in more than 120 countries, though availability varies by jurisdiction. Users can trade tokenized equities around the clock and put them to work across DeFi, including in lending pools and as trading collateral. The company also rolled out Robinhood Earn , a decentralized lending product that pays an estimated 7% on its dollar-backed USDG stablecoin through a self-custody wallet, powered by the Morpho protocol. Perpetual futures and maker fees as low as 0% round out the trading updates. The most relevant piece for our readers is Agentic Accounts for crypto. Through a Trading MCP, eligible users can connect their AI model of choice to Robinhood’s data and tools, while keeping control by setting how much capital to allocate and which safety guardrails apply. This is account abstraction territory in all but name. Letting an agent trade from a self-custody wallet within human-defined limit
AI 资讯
Ethlabs Launch, the EF Restructures, Starknet Brings Private USDC, Crypto Neobanks Go Mainstream
Welcome to our weekly digest, where we unpack the latest in account and chain abstraction and the broader infrastructure shaping Ethereum. This week: Ethlabs launches as an independent EF-origin R&D lab backed by Bitmine, Sharplink, and Joe Lubin; the Ethereum Foundation reorganizes into five focused clusters and parts ways with a fifth of its staff; Starknet brings confidential USDC payments to DeFi through its STRK20 framework; and a new industry report charts how crypto-native neobanks went mainstream and why account abstraction matters more because of it. Ethlabs Launches as an Independent R&D Lab The Ethereum Foundation Restructures Into Five Clusters Starknet Brings Private USDC to DeFi Crypto Neobanks Cross From Experiment to Infrastructure Please fasten your belts! Ethlabs Launches as an Independent R&D Lab A coordinated group of Ethereum contributors has launched Ethlabs , an independent nonprofit research and development lab built to ready the network for its next wave of institutional and agentic adoption. The funding effort is led by Bitmine, Sharplink, and Ethereum co-founder Joe Lubin, with support from Anchorage, Octant, and SNZ. Ethlabs is cofounded by five former senior Ethereum Foundation researchers — Ansgar Dietrichs, Barnabé Monnot, Caspar Schwarz-Schilling, Josh Rudolf, and Julian Ma — who between them shaped finality, scaling, data availability, and protocol economics over the past decade. Dietrichs serves as Executive Director. The lab’s early work centers on what institutions need to move onchain at scale: faster settlement, native issuance, cross-chain movement, and more mainnet capacity, alongside research into ETH’s monetary properties. The team frames the moment as Ethereum’s shift from infrastructure buildout to an age of adoption, where the architecture that settles global activity is being decided now rather than in ten years. To preserve neutrality, funding flows through an independent grants administrator that handles screening and
AI 资讯
Layer 2: A Engenharia Secreta Que Destrava a Velocidade do Ethereum [PT-BR]
Quando comecei a trabalhar com aplicações descentralizadas há mais de uma década, lembro bem da frustração de pagar US$ 50 em taxas de transação para mover alguns tokens na rede Ethereum durante um pico de congestionamento. Era um problema técnico que ameaçava inviabilizar todo o ecossistema. Hoje, observo com entusiasmo profissional como as soluções de Layer 2 transformaram radicalmente esse cenário, abrindo portas para casos de uso que antes eram economicamente impraticáveis — especialmente aqui no Brasil, onde a tokenização de ativos e os pagamentos em stablecoins crescem em ritmo acelerado. O problema fundamental: o trilema da escalabilidade Para entender por que as soluções de segunda camada são tão importantes, precisamos compreender o trilema da blockchain proposto por Vitalik Buterin. Uma rede precisa equilibrar três pilares: descentralização, segurança e escalabilidade. O Ethereum, em sua arquitetura original, priorizou os dois primeiros, processando apenas cerca de 15 a 30 transações por segundo (TPS) na camada base. Para se ter dimensão, redes de pagamento tradicionais como a Visa processam milhares de transações por segundo. Quando o DeFi explodiu em 2020 e 2021, e novamente com o boom dos NFTs, a rede simplesmente não dava conta da demanda. As taxas de gas dispararam, e usuários comuns foram literalmente expulsos pelo custo. Em meus projetos de consultoria, atendi empresas brasileiras que desistiram de iniciativas Web3 justamente porque os custos operacionais inviabilizavam o modelo de negócio. A pergunta que sempre me faziam era: "Como cobrar R$ 5 de um cliente se a taxa da transação custa R$ 30?". A resposta estava — e está — nas camadas de segunda geração. Como funcionam as soluções de Layer 2 O conceito central das soluções de Layer 2 é elegante: em vez de processar todas as transações diretamente na blockchain principal (Layer 1), executamos a maior parte do processamento "fora da cadeia" e depois enviamos apenas uma prova compacta de volta para o
AI 资讯
New Dimensions of Onchain Threats, Accelerated by AI.
Sometime in 2024 I had a Coinbase wallet on my laptop. I had created the wallet some months back, backed up and all, and just sent very little amount of $ETH to the wallet. Then in 2024 I was paid $100 for a gig which I sent to this wallet, I also sent another $650 worth of cryto as "savings". The next morning I decided to check my "savings", wallet was empty. At first I didn't believe that I was hacked, because I had some $1.50 or so worth of $ETH in the wallet for months and it was safe, so what happened? I traced the transaction history and there was the full detail of how someone sent some $ETH to the wallet, then moved out my "savings" and afterwards also took back the remaining $ETH from the one they had sent in for the attack. I checked on Twitter and saw many other posts of people who had experienced the same exploit, exactly the same pattern... and some of the people who lost their funds were experienced blockchain developers and crypto guys. I made a post about it, told my friends to avoid the wallet and tried to forget about the experience. Blockchain hit instant PMF for many, especially people in parts of the world where there are crazy high fees and bank charges. The moment people tried sending crypto and for a few cents in gas fees, there was no going back for them. The only issue has always been how to secure users' funds, desperate people will always find a way no matter how complex the UX was. After losing my savings I stopped using self custodial wallets and only used Centralized Exchanges for a while. I thought, even though that was a non-custodial wallet, the builders still should have ensured strong security and secure backups, so users don't lose funds unnecessarily. This happened to me when AI and LLMs were still at their early development stages. You can only imagine how sophiscated the attacks have gotten, now that AI and LLMs are very advanced and more capable. To put things in perspective, more than $640 million was lost to deFi hacks and
AI 资讯
The contract is clean - for now: catching crypto scams that survive launch-time checks
Most token scam detectors, including the one I work on, share one implicit assumption: the contract you analyze at launch is the contract people will trade. Read the source, simulate a buy and a sell, cluster the deployer, score it, done. That is a snapshot. And a snapshot is exactly what a patient scammer plays against. Two token designs pass every launch-time check and then turn hostile later. This is how they work, and the two on-chain techniques we shipped this week to catch them. Design 1: the delayed honeypot A honeypot is a token you can buy but cannot sell. The classic version is non-sellable from block one, so a buy-then-sell simulation catches it instantly. The patient version is sellable at launch. Early buyers sell fine, the chart looks healthy, the token earns a clean verdict from every checker that judged it at T0. Then, days later, the operator flips a switch: a timed blacklist that rejects transfers after a block height or timestamp, a setTrading(false) / pause() kill switch pulled once liquidity has accumulated, a fee setter cranked to 100% on sells. From that moment it is a honeypot. But the only verdict on record is the clean one from launch day. The detection ran once, at the worst possible time to run it. Fix: re-simulate at J7 We keep post-launch snapshots of every token at J0, J7 and J30 (originally to catch slow rugs: volume collapse, late LP burns). The new piece re-runs the full buy/sell honeypot simulation at J7, but only for tokens that were genuinely sellable at J0. A clean-to-honeypot flip is the signal: // Only for tokens sellable + tradable at J0 - a clean->honeypot flip is the point. // Bounded per run because it is RPC-heavy. const eligible = ! j0 . risk_flags . some (( f ) => J0_SKIP_RESIM_FLAGS . has ( f )); if ( rpc && eligible && resims < resimLimit ) { const isNowHoneypot = await detectLateHoneypot ( rpc , tokenAddress ); if ( isNowHoneypot ) flags . push ( " late_honeypot " ); // +40 risk at J7 } One rule we hold to: an RPC hi
AI 资讯
Base Azul multiproofs, ERC-8211 smart batching, LI.FI Intents, Vitalik's Sci-Fi pivot
Welcome to our weekly digest, where we unpack the latest in account and chain abstraction and the broader infrastructure shaping Ethereum. This week: Base ships its first independent upgrade with a TEE+ZK multiproof system and confirms native AA is next; Biconomy turns the ERC-8211 smart batching standard into a TypeScript SDK; LI.FI launches an enterprise intents engine for stablecoin and RWA flows; and Vitalik steps back from technical essays to write fiction. Base Launches Azul, Bringing Multiproofs to Coinbase's L2 Biconomy Ships Smart Batching SDK for ERC-8211 LI.FI Launches Intents Engine for Enterprise Cross-Chain Flows Vitalik Pivots to Fiction and Floats a "Trust Dependency" Framework Please fasten your belts! Base Launches Azul, Bringing Multiproofs to Coinbase’s L2 Base activated Azul on mainnet on May 28, its first network upgrade built entirely on its own stack. The headline feature is a multiproof system that pairs Trusted Execution Environment (TEE) proofs with Zero-Knowledge (ZK) proofs, advancing the Coinbase-incubated L2 toward Stage 2 decentralization. Either proof type can finalize a withdrawal independently, but when both agree, finality drops to as little as one day, far faster than the typical multi-day optimistic rollup wait. Crucially, permissionless ZK proofs can override permissioned TEE proofs if the two conflict, a design Base says meaningfully improves censorship resistance. The upgrade also makes base reth the sole execution client and introduces a new consensus client, phasing out older software. Node operators must migrate to the new stack to stay in sync. For AA and chain abstraction builders, the more important signal is what comes next: Base confirmed its end-of-June upgrade will include native account abstraction, an enshrined token standard and Flashblock Access Lists. The largest L2 by activity moving toward native AA is a meaningful pull on the whole ecosystem. Biconomy Ships Smart Batching SDK for ERC-8211 Biconomy released t
AI 资讯
A .NET Dinosaur in Web3. Day 18 - Automated Market Maker
🏦 Day 6 of 7: Building a Mini Uniswap in 80 Lines of Solidity Imagine a vending machine. It has 1,000 coffee beans and 1,000 coins. No menu, no cashier — just one iron rule: the product of the two numbers inside must never decrease. That's it! This is how Uniswap works — and this is what I built on Day 6, coming from .NET. Here's how, why it's elegant, and where you can step on a rake. Why an Order Book Doesn't Work on a Blockchain Traditional exchanges — Binance, NYSE, any CEX — run on an order book . Market makers post bids and asks. A matching engine pairs them. Millions of updates per second, all in a centralised database. In a blockchain, this is impossible. Transactions take 12 seconds. Every state change costs gas. Storing millions of constantly changing orders would eat all the profit before a single trade completes. Uniswap's solution: replace the order book with a liquidity pool — a smart contract holding two tokens — and replace the matching engine with pure math. Just a formula — below. x · y = k — The Formula That Broke Finance The Constant Product Invariant : x · y = k Where x is the reserve of Token0, y is the reserve of Token1, and k is a constant that must never decrease during swaps. When a trader sells Token0 into the pool, x increases. To keep k constant, y must decrease — the contract sends out Token1. The price is determined automatically by the ratio of reserves. Live example with numbers: Pool: 1,000 Token0, 1,000 Token1. k = 1,000,000. Trader sells 100 Token0: amountOut = (reserveOut × amountIn) / (reserveIn + amountIn) amountOut = (1000 × 100) / (1000 + 100) amountOut = 100,000 / 1,100 amountOut ≈ 90.9 Token1 The trader gets ~90.9, not 100. That gap is slippage — and it's not a bug. It's the formula protecting the pool. The more you buy relative to pool size, the worse your price gets. Naturally. Mathematically. After the swap: pool has 1,100 Token0 and ~909.1 Token1. k ≈ 1,000,000. Invariant holds. The Contract: SimpleAMM Three functions.
AI 资讯
Gas Optimization Part 4: Solidity Tips for Cheaper Contracts
Every line of your smart contract costs something. Some lines cost more than others. In this part of our gas saving series, we’ll explore how to write smarter Solidity code that keeps your contract lean and efficient. Here are six simple and practical ways to reduce gas costs while writing Solidity smart contracts. 1. Use payable Only When Needed, But Know It Saves Gas In Solidity, a function marked payable can actually use slightly less gas than a non-payable one. Even if you're not sending ETH, the EVM skips some internal checks when the function is marked payable. See this example: function hello() external payable {} // 21,137 gas function hello2() external {} // 21,161 gas That tiny difference may not seem like much, but across thousands of calls, it adds up. Only use payable when your function is actually meant to accept ETH 2. Use unchecked for Safe Arithmetic When You’re Sure Since Solidity 0.8.0, all arithmetic operations automatically check for overflows and underflows. While this makes contracts safer, it also uses extra gas. When you're certain that overflow won't occur, you can use the unchecked keyword to skip these safety checks. uint256 public myNumber = 0; function increment() external { unchecked { myNumber++; } } Gas used: 24,347 (much cheaper than using safe math) Warning: Use unchecked carefully. Only when you're confident there's no risk of overflow. 3. Turn On the Solidity Optimizer The Solidity Optimizer is like a smart helper that cleans up and tightens your compiled bytecode. It does not change how your contract works, but it removes waste and makes it cheaper to run. If you’re using tools like Hardhat or Remix, always enable the Optimizer before deploying to mainnet. 4. Use uint256 Instead of Smaller Integers (Most of the Time) Smaller types like uint8 or uint16 might look more efficient, but they can cost more gas during execution. That’s because the EVM automatically converts them to uint256 behind the scenes. So, if you're not tightly p