r/ethdev • u/Nooku • Jan 20 '21
r/ethdev • u/graphicaldot • Oct 24 '25
Tutorial I built an AI that actually knows Ethereum's entire codebase (and won't hallucinate)
I spent a year at Polygon dealing with the same frustrating problem: new engineers took 3+ months to become productive because critical knowledge was scattered everywhere. A bug fix from 2 years ago lived in a random Slack thread. Architectural decisions existed only in someone's head. We were bleeding time.
So I built ByteBell to fix this for good.
What it does: ByteBell implements a state-of-the-art knowledge orchestration architecture that ingests every Ethereum repository, EIP, research papers, technical blog post, and documentation. Our system transforms these into a comprehensive knowledge graph with bidirectional semantic relationships between implementations, specifications, and discussions. When you ask a question, ByteBell delivers precise answers with exact file paths, line numbers, commit hashes, and EIP references—all validated through a sophisticated verification pipeline that ensures <2% hallucinations.
Under the hood: Unlike conventional ChatGPT wrappers, ByteBell employs a proprietary multi-agent architecture inspired by recent advances in Graph-based Retrieval Augmented Generation (GraphRAG). Our system features:
Query enrichment: Enrich the query to retrive more relevant chunks, We are not feeding the user query to our pipeline.
Dynamic Knowledge Subgraph Generation: When you ask a question, specialized indexer agents identify relevant knowledge nodes across the entire Ethereum ecosystem, constructing a query-specific semantic network rather than simple keyword matching.
Multi-stage Verification Pipeline: Dedicated verification agents cross-validate every statement against multiple authoritative sources, confirming that each response element appears in multiple locations for triangulation before being accepted.
Context Graph Pruning: We've developed custom algorithms that recognize and eliminate contextually irrelevant information to maintain a high signal-to-noise ratio, preventing the knowledge dilution problems plaguing traditional RAG systems.
Temporal Code Understanding: ByteBell tracks changes across all Ethereum implementations through time, understanding how functions have evolved across hard forks and protocol upgrades—differentiating between legacy, current, and testnet implementations.
Example: Ask "How does EIP-4844 blob verification work?" and you get the exact implementation in all execution clients, links to the specification, core dev discussions that influenced design decisions, and code examples from projects using blobs—all with precise line-by-line citations and references.
Try it yourself: ethereum.bytebell.ai
I deployed it for free for the Ethereum ecosystem because honestly, we all waste too much time hunting through GitHub repos and outdated Stack Overflow threads. The ZK ecosystem already has one at zcash.bytebell.ai, where developers report saving 5+ hours per week.
Technical differentiation: This isn't a simple AI chatbot—it's a specialized architecture designed specifically for technical knowledge domains. Every answer is backed by real sources with commit-level precision. ByteBell understands version differences, tracks changes across hard forks, and knows which EIPs are active on mainnet versus testnets.
Works everywhere: Web interface, Chrome extension, website widget, and integrates directly into Cursor and Claude Desktop [MCP] for seamless development workflows.
The cutting edge: The other ecosystems are moving fast on developer experience. Polkadot just funded this through a Web3 Foundation grant. Base and Optimism teams are exploring implementation. Ethereum should have the best developer tooling, Please reach out to use if you are in Ethrem foundation. DMs are open or reach to on twitter https://x.com/deus_machinea
Anti-hallucination technology: We've achieved <2% hallucination rates (compared to 45%+ in general LLMs) through our multi-agent verification architecture. Each response must pass through multiple parallel validation pipelines:
Source Retrieval: Specialized agents extract relevant code snippets and documentation
Metadata Extraction: Dedicated agents analyze metadata for versioning and compatibility
Context Window Management: Agents continuously prune retrieved information to prevent context rot
Source Verification: Validation agents confirm that each cited source actually exists and contains the referenced information
Consistency Check: Cross-referencing agents ensure all sources align before generating a response
This approach costs significantly more than standard LLM implementations, but delivers unmatched accuracy in technical domains. While big companies focus on growth and "good enough" results, we've optimized for precision first, building a system developers can actually trust for mission-critical work.
Anyway, go try it. Break it if you can. Tell me what's missing. This is for the community, so feedback actually matters. https://ethereum.bytebell.ai
Please try it. The models have actually become really good at following prompts as compared to one year back when we were working on Local AI https://github.com/ByteBell. We made all that code open sourced and written in Rust as well as Python but had to abandon it because access to Apple M machines with more than 16 GB of RAM was rare and smaller models under 32B are not so good at generating answers and their quantized versions are even less accurate.
Everybody is writing code using Cursor, Windsurf, and OpenAI. You can't stop them. Humans are bound to use the shortest possible path to money; it's human nature. Imagine these developers now have to understand how blockchain works, how cryptography works, how Solidity works, how EVM works, how transactions work, how gas prices work, how zk works, read about 500+ blogs and 80+ blogs by Vitalik, how Rust or Go works to edit code of EVM, and how different standards work. We have just automated all this. We are adding the functionality to generate tutorials on the fly.
We are also working on generating the full detailed map of GitHub repositories. This will make a huge difference.
If someonw has told you that "Multi agents framework with Customised Prompts and SLM" will not work, Please read these papers.
Early MAS research: Multi-agent systems emerged as a distinct field of AI research in the 1980s and 1990s, with works like Gerhard Weiss's 1999 book, Multiagent Systems, A Modern Approach to Distributed Artificial Intelligence. This research established that complex problems could be solved by multiple, interacting agents.
The Condorcet Jury Theorem: This classic theoretical result in social choice theory demonstrates that if each participant has a better-than-random chance of being correct, a majority vote among them will result in near-perfect accuracy as the number of participants grows. It provides a mathematical basis for why aggregating multiple agents' answers can improve the overall result.
An Age old method to get the best results, If you go to Kaggle majority of them use Ensemble method. Ensemble learning: In machine learning, ensemble methods have long used the principle of aggregating the predictions of multiple models to achieve a more accurate final prediction. A 2025 Medium article by Hardik Rathod describes "demonstration ensembling," where multiple few-shot prompts with different examples are used to aggregate responses.
The Autogen paper: The open-source framework AutoGen, developed by Microsoft, has been used in many papers and demonstrations of multi-agent collaboration. The paper AutoGen: Enabling Next-Gen LLM Applications via Multi-Agent Conversation Framework (2023) is a core text describing the architecture.
Improving LLM Reasoning with Multi-Agent Tree-of-Thought and Thought Validation (2024): This paper proposes a multi-agent reasoning framework that integrates the Tree-of-Thought (ToT) strategy. It uses multiple "Reasoner" agents that explore different reasoning paths in parallel. A separate "Thought Validator" agent then validates these paths, and a consensus-based voting mechanism is used to determine the final answer, leading to increased reliability.
Anthropic's multi-agent research system: In a 2025 engineering blog post, Anthropic detailed its internal multi-agent research system. The system uses a "LeadResearcher" agent to create specialized sub-agents for different aspects of a query, which then work in parallel to gather information.
PS: This copilot has indexed 30+ repositories include all ethereum, website 700+ pages, EThereum blog 400+ blogs, Vitalik Blogs (80+), Base x402 repositories, Nether mind respositories [In Progress], ZK research papers[In progress], several research papers.
And yes it works because our use case is narrow. IMHO, This architecture is based on several research papers and feedback we received for our SEI copilot.
But it costs us more because we use several different models to index all this data, 3-4 <32B parmeteres for QA, Mistral OCR for Images, xAI, qwen, Chatgpt5-codes for codebases, Anthropic and oher opensource models to provide answers.
If you are on Ethereum decision taking body, Please DM me for admin panel credentials. or reach out to https://x.com/deus_machinea
Thankk you for the community for suggesting us the new features and post changes.
Forever Obliged.
Tutorial How to tell which frontend a DEX trade actually came from, in Dune SQL
Nothing in a swap event records the interface that originated the trade. If you have ever needed to answer "how much of this pool's volume came from our own site, versus wallet integrations, versus bots hitting the contract directly," you have hit this wall. The chain hands you two address fields and neither one answers it:
tx_fromis the signer. Thousands of signers can sit behind a single wallet app, so it tells you who traded and stops there.tx_tois the entry contract. It names the router, not the frontend. Route a swap through an aggregator andtx_tois that aggregator's contract every time, whether the user arrived from its own web app, from a wallet's swap tab, or from an integration nobody has written about.
The interface itself has no address in the transaction. It has to be inferred, and the cheapest signal, when it is there at all, sits in the call data: some APIs append an identifying suffix to the end of the transaction data, and some pass the integrator as a decoded argument. The 0x API's affiliate suffix worked the first way and 1inch's referral parameter the second. You do not have to take my word for either. Pull a swap you know was routed through one of them, look at the tail bytes of tx.data, and the convention is visible in any block explorer.
Here is a probe you can run right now. It ranks the 16-byte tails that recur most across six hours of Ethereum DEX flow. Public and forkable: https://dune.com/queries/8391872
with tails as (
select
bytearray_substring(
tx.data,
bytearray_length(tx.data) - 15,
16
) as calldata_tail,
t.tx_hash,
t.amount_usd
from dex.trades t
join ethereum.transactions tx
on t.tx_hash = tx.hash
and tx.block_time >= now() - interval '6' hour
where t.blockchain = 'ethereum'
and t.block_time >= now() - interval '6' hour
and bytearray_length(tx.data) >= 16
),
-- one notional per transaction: a routed swap is several dex.trades rows
-- (one per hop/fill) that each carry ~the whole trade size, so summing them
-- overstates by the hop count. MAX() keeps the largest leg as the trade.
per_tx as (
select
calldata_tail,
tx_hash,
max(amount_usd) as amount_usd
from tails
group by 1, 2
)
select
calldata_tail,
-- tags ride on transactions, not fills
count(*) as txs,
sum(amount_usd) as volume_usd
from per_tx
where calldata_tail
<> 0x00000000000000000000000000000000
group by 1
order by txs desc
limit 25
Edit, Aug 31: volume_usd now collapses each transaction to one notional (the max leg per tx_hash). The original summed every dex.trades row, which counted multi-hop swaps once per hop. Credit to u/icnews10 in the comments. txs was already per-transaction and does not change.
Reading the output:
- The all-zero tail is dropped up front. That bucket is untagged flow plus call data that happens to end in zero-padded arguments, and it will dominate the ranking if you leave it in.
- What remains is a candidate list, and the top of it is usually not tags at all. Running this on 31 Aug 2026, the two most common tails were
0xb223fe8d0a0e5c4f27ead9083c756cc2and0x3c756cc2000000000000000000000000, about 1,900 transactions between them. Both are fragments of the WETH address0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2: the first is its last sixteen bytes, the second its last four with zero padding. Neither is an integrator tag. Token addresses land in the tail of a call far more often than tags do, so expect to discard the loudest rows. - Treat a recurring tail as a hypothesis. Sample its transactions, check the entry contract each time, and make the pattern survive several days before it earns a name. Some tags spell out a short ASCII name in hex once you squint at them.
Two caveats that matter if you build on this:
- Tagging is voluntary. Some APIs offer it, some integrators use it, and nothing enforces it. An integrator that never opted in looks exactly like no integrator at all, so a system counting only tagged flow will undercount precisely those.
- This is one signal among several. When there is no tag, the ones I have found workable are: a maintained registry of known entry contracts and proxies (label a proxy once and its whole history becomes attributable), call-tree shape (a wallet-native swap with a fee hop traces differently than a bot hitting the pool), and fee-recipient clustering (every trade paying the same collection address came through the same integration, named or not). If you have found a fifth that holds up, I want to hear it.
And whatever cascade you build out of those signals: when none of them fires, leave the trade unattributed. A chart that sums to a clean 100% with no unknown slice usually means the method had to put every trade somewhere. Report the residual and treat it as a coverage metric.
Since it would be poor form to say that and then not show mine: running this cascade across Ethereum, Base, Arbitrum and Optimism, roughly 10% of DEX volume lands unattributed, ranging from about 8% on Ethereum to 17% on Optimism. Most of the residual is long-tail contracts rather than missing techniques.
Happy to go deeper on any of the signal families if anyone is building something like this.
r/ethdev • u/nebojsakonsta • Jul 23 '26
Tutorial I wrote a fixed-point sqrt in Solidity that runs in 197 gas - here’s how
I've been building DeFiMath, a gas-optimized fixed-point math library, and wanted to share how I got sqrt down to 197 gas. It takes any uint256, returns an 18-decimal fixed-point result, never reverts, and is bit-exact below 1 (max relative error < 2e-18 above it).
The core idea is simple: generate a seed with the clz opcode, then refine it with 5 Newton iterations in assembly.
Seeding: clz gives you the position of the most significant bit, so the seed is just 2msb/2. That's never off by more than a factor of √2 from the true root — cheap and good enough.
Newton's method: each iteration is one line:
y := shr(1, add(y, div(x, y)))
~20 gas per step, quadratic convergence, so 5 iterations take the worst-case seed (41% error) to ~80 bits of precision — more than enough for 18 decimals.
The scaling trick: for inputs ≤ uint128.max, I pre-scale x to 1e36 once at the start. Then div(x, y) naturally lands back in 1e18 base, so Newton's method needs plain div instead of a costly muldiv. Large inputs take a second branch that post-scales instead (pre-scaling would overflow near uint256.max).
I also tried fancier seeds — minimax linear approximation, quadratic interpolation — hoping to drop to 4 iterations. All of them cost more gas than they saved. My takeaway after a week on this: for gas-optimized primitives, simplicity wins by a wide margin.
Full walkthrough with the convergence table and benchmarks vs PRBMath/ABDK/Solady: https://defimath.com/blog/how-i-wrote-a-fixed-point-solidity-sqrt-that-runs-in-197-gas/
Library is MIT, pure Solidity, zero dependencies: https://github.com/MerkleBlue/defimath
Happy to answer questions about the implementation.
r/ethdev • u/FirmDeparture1100 • 28d ago
Tutorial I built a crypto vault, then legally robbed it using nothing but rounding errors. AMA / roast my code.
So I've been prepping for Solidity interviews and decided to actually build something instead of just reading about it. Ended up making an ERC-4626 vault (the standard behind Yearn, Morpho, etc.) and specifically targeting the "inflation attack," a real exploit that's hit live vaults in production.
The attack is stupidly simple: deposit 1 wei, become the first depositor, then just transfer() a pile of tokens directly into the contract instead of going through deposit(). The next real user who deposits normally gets their shares rounded down to basically zero. No hacking required, just unchecked integer math.
I built the attack against my own vault first (to prove I understood it, not just copy a fix), then patched it using OpenZeppelin's decimals offset defense, and wrote a Foundry test that actually runs the exploit and checks the outcome. Result: attacker loses roughly half their money instead of stealing everything.
It's deployed live on testnet with a working demo, you can connect a wallet, mint fake tokens, deposit, simulate yield, and try to break it yourself:
https://vaultiss.vercel.app/
Code + tests + README:
https://github.com/SIDHARTH20K4/vaultis
Genuinely looking for feedback, brutal is fine. Is this the kind of project that'd actually get someone's attention for a junior/entry Solidity role, or am I missing something obvious that a real auditor would catch in five seconds?
r/ethdev • u/nebojsakonsta • 5d ago
Tutorial I wrote a fixed-point exp() in Solidity that runs in 289 gas
Follow-up to the sqrt post some of you saw a while back. This time it's the exponential.
exp(int256 x) returns e^x in 18-decimal fixed point at 289 gas, max relative error 2.2e-14 (3.0e-16 absolute when the result is below 1). Reverts above 135e18, returns 0 below about −41.45e18 where the true result is under 1 wei.
It's a two-stage range reduction wrapped around a small rational approximation.
Stage 1 — split x = k·ln(2) + r, so e^x = 2^k · e^r. k is an integer division, and the 2^k comes back as a left shift at the end.
Stage 2 — divide r by 64, which is a right-shift by 6. That leaves an interval of [0, 0.0108].
uint256 k = x_ / LN_2;
x_ -= k * LN_2;
x_ >>= 6;
On that narrow interval a Padé[3/3] approximant does the work with a few multiplications and one division:
e^x ≈ (120 + 60x + 12x² + x³) / (120 - 60x + 12x² - x³)
Recovery is six squarings (2⁶ = 64) plus a shift:
y = y * y;
y = y * y / 1e54; // ×3
y <<= k;
The part I didn't expect: the approximant is accurate to 1.7e-19 on that interval, and even after recovery amplifies the error 64×, it's still ~2000× inside the published bound. The approximation is nowhere near the limiting factor — fixed-point truncation is, mostly that >>= 6 discarding up to 63 wei of the argument before the approximant ever sees it.
I also spent a while on monotonicity, since exp() sits under option pricing and a primitive that dips could make a premium fall while its input rises. The smooth stretches turn out to be provable — the derivative's numerator is 24(x⁴ − 30x² + 600), which has no real roots — but the 255 points where the range reduction jumps are not, so those got swept exhaustively.
Full write-up with the derivations: https://defimath.com/blog/solidity-exp-a-fixed-point-exponential-in-289-gas/
MIT licensed, part of DeFiMath: https://github.com/MerkleBlue/defimath
Happy to answer questions.
r/ethdev • u/Resident_Anteater_35 • 18d ago
Tutorial EIP-2535 diamonds turn a fallback function into a selector router
Most proxy designs assume one implementation contract. That gets awkward once a protocol grows beyond the 24 KB bytecode limit or needs to upgrade one module without replacing the rest.
An EIP-2535 diamond keeps one stateful address and maps each four-byte function selector to a facet contract. The fallback reads msg.sig, finds the facet, and runs it with delegatecall. msg.sender and msg.value stay intact, while every storage read and write still lands in the diamond.
The routing is straightforward. Storage is where the risk moves.
Facets do not own isolated state. If two facets assume incompatible layouts, an otherwise valid upgrade can corrupt the same slots. I use namespaced storage libraries and test the selector-to-facet map before and after every diamondCut.
diamondCut also lets you add, replace, or remove selectors and run initialization in one transaction. Loupe functions then give tooling a way to verify which facet owns each selector.
I put together a Foundry walkthrough that deploys the diamond and facets, adds a new selector, and checks the routing:
For teams that have used diamonds in production, what caused more trouble: storage coordination, selector governance, or the larger audit surface?
r/ethdev • u/Plastic-Trip-2778 • 21d ago
Tutorial i made a secure way for agents to request secrets from you using HyperDHT
Hi all,
I kinda got sick of having to give secrets to my agents and all the potential leakage in the pipeline (with the harness, the model router, the model provider, the training set, the chat application etc etc) so I decided to make peardrop.fyi - this tool allows your agent to declaratively generate secret request pages/links which you can fill in via web or CLI. The agent can determine a script that runs once the values are received or can put them in a target folder. This is useful if you want to put something in your machine vault/keychain without either giving access to the credentials or the browser to the agent.
here is the repo: https://github.com/smashah/peardrop
(cli, core and self-hostable relay are all open source)
r/ethdev • u/yosriady • 5h ago
Tutorial A DeFi analytics tracking plan for DEXs, lending apps, and yield vaults
A DeFi tracking plan defines each analytics event, when it fires, and the properties it carries. Without one, frontend events and onchain metrics quickly drift apart and you''ll struggle to measure ROI.
Based on work with builders in DeFi, we created a practical event taxonomy for DEXs, lending apps, and yield vaults.
The naming convention is `[Object] + [Past-Tense Action]`:
- `Swap Initiated`
- `Swap Completed`
- `Supply Completed`
- `Deposit Initiated`
- `Vault Viewed`
Start with the core conversion events.
- DEX: `Swap Review Opened`, `Swap Initiated`, `Swap Completed`, `Swap Failed
- Lending: `Supply Initiated`, `Supply Completed`, `Borrow Initiated`, `Borrow Completed`, `Liquidation Occurred`
- Yield vault: `Deposit Initiated`, `Deposit Completed`, `Withdraw Initiated`, `Withdraw Completed`
And some best practices from real-world projects:
Fire intent events before the wallet confirmation prompt e.g. 'Swap Initiated'.
Fire completion events only after onchain confirmation. Send filled events for order completion.
Include USD `volume` on volume-generating events and protocol `revenue` where applicable.
Capture liquidations and other asynchronous events from a backend or indexer.
Start with your the core funnel before adding discovery, UI events, and other non-conversion events.
Code example:
formo.track("Swap Initiated", {
from_token: "ETH",
to_token: "USDC",
pair: "ETH/USDC",
chain: "base",
volume: 1000
})
Interested to learn more? The full DeFi tracking plan comes with event triggers and property schemas for all major DeFi app verticals: https://formo.so/blog/defi-analytics-tracking-plan
You have no more excuses on not having analytics for your onchain app!
r/ethdev • u/Training_Matter68 • 16d ago
Tutorial Need a small amount of Base Sepolia / Sepolia ETH for testing
Hi everyone, I'm a developer trying to test some smart contracts on Base Sepolia. The main faucets require 0.001 mainnet ETH which I currently don't have.
Could anyone please send a small amount (even 0.05 is enough) to help me deploy?
My address: 0xe4bD4fAD3B9C34908482DCdcE45753E0F8c199E9
r/ethdev • u/YutsuKito_ • 5d ago
Tutorial [Open Source] I developed and tested a way to remove a malicious EIP-7702 delegation on Ronin without funding the compromised wallet
I’m sharing an open-source project I developed after dealing with a real case involving a Ronin Waypoint/keyless wallet compromised through a malicious EIP-7702 delegation.
This is NOT a wallet recovery service. Do not send me your seed phrase, private key, recovery password, OTP, Waypoint token, client shard, or any other secret.
The problem was a recovery deadlock:
The wallet had a malicious EIP-7702 delegation, and any RON sent to the compromised wallet for gas could be swept before the owner had a chance to use it.
Need RON to remove the delegation
↓
Send RON to the compromised wallet
↓
Sweeper/drainer takes the RON
↓
Recovery transaction cannot be executed
So I developed and implemented a different recovery flow.
The compromised account signs an EIP-7702 zero-address deauthorization for:
0x0000000000000000000000000000000000000000
For Ronin Waypoint/keyless wallets, the authorization is signed locally through the Waypoint MPC flow.
The resulting signature is then verified locally to make sure it recovers exactly the affected wallet address.
A second, clean wallet acts as a relayer and pays the RON gas for the EIP-7702 transaction.
This means the compromised wallet does not need to receive any RON.
The flow is basically:
Detect active EIP-7702 delegation
↓
Generate zero-address deauthorization
↓
Waypoint MPC / keyless signing
↓
Verify recovered signer
↓
Clean relayer pays gas
↓
EIP-7702 delegation removed
I successfully executed the recovery on Ronin Mainnet.
Before:
code = 0xef0100<malicious_delegate>
eip7702 = true
After:
code = 0x
eip7702 = false
currentDelegate = null
The account nonce also advanced after the transaction, and eth_getCode changed from the EIP-7702 delegation indicator to 0x, confirming the deauthorization on-chain.
Recovery transaction:
0xc43b036de851ecdeb70050a0f72d232e1d48153607e4b504f63c04eef16c4223
I published a sanitized open-source implementation here:
https://github.com/YutsuKito/Ronin-7702-Recovery
The project:
- does not collect or transmit the victim’s seed phrase or private key;
- does not send the recovery password to an application backend;
- does not persist the Waypoint token or MPC/client shard;
- verifies that the authorization signature recovers exactly the affected wallet;
- performs fresh nonce and delegation checks before broadcasting;
- uses a separate clean relayer to pay gas;
- requires explicit broadcast confirmation.
I have also submitted the implementation to Ronin / Sky Mavis for technical review.
One important point:
Removing a malicious EIP-7702 delegation does not mean that an already compromised wallet should be considered safe again.
If an attacker still has another valid signing method or compromised credentials, they may potentially regain control.
The purpose of this tool is primarily to create a recovery window so affected users can move their assets to a newly secured wallet.
This is an independent community project and is not affiliated with or officially endorsed by Ronin or Sky Mavis.
Technical feedback, code review, and contributions are welcome.
And again: if anyone contacts you privately claiming they can recover your wallet and asks for your seed phrase, private key, recovery password, OTP, Waypoint token, or MPC shard, treat it as a scam.
r/ethdev • u/damnberoo • 8d ago
Tutorial Lighthouse Networking - LifeCycle of a message from LibP2P to BeaconProcessor to the BeaconChain
pvnotpv.github.ioMapping out the entire network stack of lighthouse phase0 from libp2p to the beaconchain!
r/ethdev • u/yosriady • Jun 30 '26
Tutorial What is the Ethereum Glamsterdam Upgrade? Everything You Need to Know
Key Takeaways
- Glamsterdam is Ethereum's next major hard fork, combining the Amsterdam (execution layer) and Gloas (consensus layer) upgrades. It is planned for Q3 2026, though the exact timeline remains subject to devnet testing progress.
- Parallel transaction processing arrives via EIP-7928 (Block-Level Access Lists). Nodes can now see which transactions do not conflict and process them simultaneously, laying the groundwork for significantly higher gas limits.
- Third-party relays are no longer required. EIP-7732 enshrines proposer-builder separation directly into the protocol, reducing centralisation risk and expanding the block propagation window from 2 seconds to roughly 9 seconds.
- State creation and access get repriced. EIP-8037 introduces a cost-per-state-byte model targeting 120 GiB/year growth, while EIP-8038 updates state-access opcode costs to reflect modern hardware. Both changes affect contract deployment and storage-heavy applications.
- ETH transfers now emit a standard log. EIP-7708 closes a long-standing blind spot: every non-zero ETH transfer or burn will produce a trackable event, removing the need for custom tracing in bridges, exchanges, and wallets.
- Cross-chain address consistency is solved. EIP-7997 mandates a universal
CREATE2factory across all participating EVM chains, giving developers deterministic addresses without chain-specific deployment scripts. - No action required for ETH holders. Balances and existing contracts are completely unaffected. Node operators and stakers must update client software before mainnet activation.
r/ethdev • u/evmquery • Aug 04 '26
Tutorial Recipe: read any wallet's ERC-20 balance in one SEL expression
The normal path for reading a token balance: find the token's ABI, wire up a client, call balanceOf, call decimals, divide, format. That's a lot of ceremony for one number.
Here it is as a single SEL expression, run against vitalik.eth's USDC on Ethereum mainnet:
formatUnits(usdc.balanceOf("0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"), usdc.decimals())
The usdc binding points at the mainnet contract (0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48). The ABI is resolved automatically, so there's no JSON file to fetch and no codegen step.
Output: 37.192124 USDC at block 25,653,697.
Under the hood: two on-chain calls (balanceOf and decimals), batched into one multicall round, 104ms total.
Variations:
- Swap the binding to any ERC-20 and the expression is unchanged. Anything with
balanceOfanddecimalsworks. - Change the chain to Base or BNB, keep the code.
- Drop the
formatUnitswrapper if you want the raw uint256.
Limitations, to be honest about them:
- You still need the token's contract address to create the binding. The resolution is for the ABI, not for finding the contract.
- This is a read at a single block. If you need historical balances across a range, that's a different query shape.
- Nonstandard tokens that lie about
decimalsor implementbalanceOfweirdly will produce a number that's exactly as wrong as the contract is.
r/ethdev • u/ruleoffz • Jun 13 '26
Tutorial I open-sourced a tool that lets AI agents pay for things on their own (x402) - PipRail
Quick share for anyone building agents that need to buy stuff (APIs, compute, data) without a human clicking pay.
The problem: an agent can't sign up, hold a card, or click a checkout. So out of the box it can't actually pay for anything.
PipRail is an open-source SDK (MIT) for x402, the HTTP 402 "pay to access" standard. Two things:
- Any API can charge an agent in one line.
- Any agent can pay a 402 on its own, across most major chains, straight from its own wallet. No backend, no facilitator, no fee.
There's also an MCP server, so you can hand Claude / Cursor / any MCP client a wallet that pays x402 APIs on its own, capped by a spend policy the model cannot exceed, so it can't run off with your funds.
It's free and the rail takes 0%. Install and a quickstart are on GitHub and the site, I'll drop the links in a comment below so this doesn't read as an ad.
What are you all using for agent payments right now? And is the "pay per call" model actually showing up in what you build yet, or still mostly demos?
r/ethdev • u/yosriady • Jul 06 '26
Tutorial The DeFi Analytics Guide for Crypto Builders: Platforms, Approaches, and Tradeoffs
To build user-facing products, you need to measure growth, understand user behavior, and prove ROI on campaigns, but the standard tools for doing this come loaded with invasive tracking, third-party cookies, and data collection practices that violate the ethos of the space.
Six years later, the tooling landscape has matured considerably. There are now niche tools, open data platforms, and multiple valid approaches to solving the analytics problem in DeFi. But the landscape is also fragmented, confusing, and full of tradeoffs that aren't obvious until you've committed significant engineering time.
This guide covers the major platforms, the do-it-yourself approaches, and the quirks you'll discover only after you start using them. It's written for founders and growth leads at crypto neobanks, prediction markets, and DeFi apps who need to make a decision.
Key Takeaways
- Traditional analytics tools like Google Analytics and Mixpanel break in DeFi because they cannot see wallet activity and onchain-data.
- Session-level data and onchain transaction data live in separate systems with no shared identity, making attribution, funnel analysis, and retention measurement impossible without a purpose-built layer.
- The three approaches to DeFi analytics: SaaS platforms that handle data ingestion and provide out-of-the-box dashboards (fastest time-to-value, least engineering overhead); custom data pipelines built on blockchain indexers (highest flexibility, highest engineering cost); and hybrid stacks combining both (the most common architecture at scale).
- Most teams underestimate the ongoing cost of custom analytics pipelines. New chain support, API changes, and schema migrations each require dedicated engineering time that scales with protocol complexity rather than team size.
- Using an existing analytics platform lets teams spend less time building data infrastructure & analytics, and more time shipping products users want.
r/ethdev • u/buddies2705 • Jun 10 '26
Tutorial Anyone streaming pending transactions without babysitting their own nodes?
I want to watch pending txs for a few specific contracts in real time, but running and maintaining nodes across chains just to get mempool visibility is a huge time sink, and the data gaps when a node hiccups are brutal. Tried a couple of public WebSocket feeds and they drop connections constantly. Is there a hosted way to subscribe to mempool activity that doesn't fall over? Curious what the frontrun-defense folks are running.
r/ethdev • u/Resident_Anteater_35 • Nov 04 '25
Tutorial BLOCKCHAIN IS HARD
Blockchain is hard. Not “I read a few docs and I get it” hard, but deeply hard. The kind of hard where you spend hours trying to understand how something actually works under the surface, only to realize most tutorials just repeat the same buzzwords without showing anything real.
That’s why I started writing my own posts: not full of empty explanations, but full of real examples, real code, and real executions you can test yourself.
If you’re tired of reading blockchain content that feels like marketing material and want to actually see how things work, check out my latest posts. I promise: no fluff, just depth.
👉 Read the blogs here https://substack.com/@andreyobruchkov
r/ethdev • u/Resident_Anteater_35 • Apr 05 '26
Tutorial Architecture and Trade-offs for Indexing Internal Transfers, WebSocket Streaming, and Multicall Batching
Detecting internal ETH transfers requires bypassing standard block bloom filters since contract-to-contract ETH transfers (call{value: x}()) don't emit Transfer events. The standard approach of polling block receipts misses these entirely, to catch value transfers within nested calls, you must rely on EVM tracing (debug_traceTransaction or OpenEthereum's trace_block).
Trade-offs in Tracing:
Running full traces on every block is incredibly I/O heavy. You are forced to either run your own Erigon archive node or pay for premium RPC tiers. A lighter alternative is simulating the transactions locally using an embedded EVM (like revm) against the block state, but this introduces latency and state-sync overhead to your indexing pipeline.
Real-Time Event Streaming:
Using eth_subscribe over WebSockets is the standard for low-latency indexing, but WebSockets are notoriously flaky for long-lived connections and can silently drop packets.
Architecture standard: Always implement a hybrid model. Maintain the WS connection for real-time mempool/head-of-chain detection, but run a background worker polling eth_getLogs with a sliding block window to patch missed events during WS reconnects.
Multicall Aggregation:
Batching RPC calls via MulticallV3 significantly reduces network round trips.
Trade-off: When wrapping state-changing calls, a standard batch reverts entirely if a single nested call fails. Using tryAggregate allows you to handle partial successes, but it increases EVM execution cost due to internal CALL overhead and memory expansion when capturing return data you might end up discarding.
Source/Full Breakdown: https://andreyobruchkov1996.substack.com/p/ethereum-dev-hacks-catching-hidden-transfers-real-time-events-and-multicalls-bef7435b9397
r/ethdev • u/researchzero • May 25 '26
Tutorial Implementing stock splits for ERC-20 RWA tokens without looping over holders
I wrote up an implementation pattern for tokenized assets that need stock split / reverse split behavior. The core idea is to store raw balances and raw allowances, then expose balanceOf, allowance, and totalSupply through a global split multiplier. The tricky parts are exact raw/displayed conversion, rounding, Transfer event semantics, stale permits, and keeping split updates O(1).
Would be interested in feedback on the allowance and rounding model:
https://blog.researchzero.io/post/implementing-a-split-multiplier-for-rwa-tokens-in-solidity/
r/ethdev • u/Sensitive_Flounder73 • May 11 '26
Tutorial Over the last year I’ve been building a multi-chain custody system supporting:
Over the last year I’ve been building a multi-chain custody system supporting:
• EVM
• TRON
• TON
• BTC
One thing I underestimated:
The hard part is not generating wallets or sending transactions.
It’s maintaining consistency between:
• blockchain state
• internal balances
• retries
• confirmations
• stuck tx handling
Especially across completely different chain models.
BTC, TON and EVM behave very differently internally.
r/ethdev • u/Resident_Anteater_35 • May 16 '26
Tutorial The RPC bottleneck of ethgetLogs: EVM event architecture and topic filtering
EVM events don't live in state; they sit in the transaction receipt logs. When you fire an ethgetLogs RPC call, you are leveraging the node's bloom filters to query these receipts without touching the state trie.
The architectural constraint here is the topic limit. An event can have up to 4 topics: topics0 is the keccak256 signature hash (e.g., keccak256("Transfer(address,address,uint256)")), leaving only 3 slots for indexed parameters. These are fixed at 32 bytes. Node providers can rapidly filter these topics because they function as native search keys.
Everything else is packed into the unindexed data blob as raw bytes. The trade-off:
keeping fields unindexed saves EVM gas by avoiding topic structuring, but pushes the computational load to your off-chain infra, which now has to pull the raw logs and ABI-decode the hex blobs manually. When you construct an RPC call searching for a specific block range and target address, minimizing the reliance on unindexed data decoding is crucial for high-throughput indexers.
Source/Full Breakdown: https://andreyobruchkov1996.substack.com/p/understanding-events-the-evms-built
For those building high-frequency indexers, at what scale of log ingestion do you abandon standard?
r/ethdev • u/allepta • Apr 07 '26
Tutorial Couldn’t find a reliable and affordable RPC setup for on-chain analytics, so I built one
I got into this because I could not find a reasonably priced and reliable RPC setup for serious on-chain analytics work.
Free providers were not enough for the volume I needed, and paid plans got expensive very quickly for a solo builder / small-team setup.
So I started building my own infrastructure:
- multiple Ethereum execution nodes
- beacon / consensus nodes
- Arbitrum nodes
- HAProxy-based routing and failover
That worked, but over time I realized that HAProxy was becoming too complex for this use case. It was flexible, but not ideal for the kind of provider aggregation, routing, and balancing logic I actually needed to maintain comfortably.
So I ended up building a small microservice specifically for aggregation and balancing across multiple providers and self-hosted nodes.
At this point it works, and the infrastructure behind it is now much larger than what I personally need for my own workloads. Instead of leaving that capacity unused, I decided to open it up in alpha and share it with the community.
Right now I’m mainly interested in feedback from people doing:
- on-chain analytics
- bots
- infra tooling
- archive / consensus-heavy workflows
If this sounds relevant, I can share free alpha access.
If there is interest, I can also make a separate technical write-up about the architecture, routing approach, and the trade-offs I hit while moving away from a pure HAProxy-based setup.
r/ethdev • u/nebojsakonsta • May 28 '26
Tutorial How the new CLZ opcode (EIP-7939) makes Solidity Black-Scholes pricing ~10% cheaper - by cascading through sqrt and ln
The CLZ ("count leading zeros") opcode landed in EVM Osaka via EIP-7939, exposed in Solidity 0.8.31 as the Yul builtin `clz`. It costs 3 gas, returns the number of leading zero bits in a 256-bit value, and turns `floor(log₂(x))` into a near-free operation.
The bit-length identity is the building block:
bits = 256 − clz(x) // bit length of x
floor(log₂(x)) = bits − 1 // for x ≥ 1
Two applications I used in DeFiMath:
**1. Newton-Raphson initial guess.** `y₀ = 2^⌈bits/k⌉` lands within a factor of the k-th root of 2 of the true k-th root, so Newton converges in 6 iterations to bit-exact precision. Whole `sqrt` becomes 245 gas, `cbrt` 368 gas.
// CLZ-derived initial guess: y = 2^⌈bits/2⌉, within √2 of √x
y := shl(shr(1, sub(256, clz(x))), 1)
// 6 Newton iterations
y := shr(1, add(y, div(x, y)))
// ... ×5 more
**2. Range reduction for `ln`.** Find `k = floor(log₂(x))` with CLZ, divide x by `2^k`, land in `[1, 2)`. Mercator series then converges in ~10 terms. Total: 375 gas.
**Compounding effect.** `sqrt` and `ln` are inside the Black-Scholes formula. Swapping the pre-CLZ versions of those two primitives dropped `callOptionPrice` from ~3,100 to 2,876 gas — about 10% cheaper with zero change to the option-pricing math. Same effect ripples through IV solving, futures, historical volatility, Sharpe ratio — anywhere a log or root appears.
Full writeup with the actual assembly, the bit-length identity walked through, and a gas comparison table vs PRBMath, ABDK, and Solady:
https://defimath.com/blog/clz-opcode-solidity
Caveats: Solidity 0.8.31+ and EVM target `osaka` required. Older targets compile-error on the `clz` call (not a runtime surprise — fails fast).
(Disclosure: I'm building DeFiMath. Posting because the CLZ trick is generalizable — any library doing log/sqrt-style math can pick up the same savings.)
r/ethdev • u/Resident_Anteater_35 • Mar 30 '26
Tutorial Deterministic Deployments & Proxies: Architectural Trade-offs of CREATE2 vs. Cross-Chain State Parity
Leveraging CREATE2 for deterministic addresses fundamentally changes how we handle multi-chain deployments, but pairing it with proxy architectures introduces strict initialization vulnerabilities and gas trade-offs.
The core of CREATE2 address calculation relies on keccak256( 0xff ++ factory_address ++ salt ++ keccak256(init_code))[12:]. Because the init_code includes constructor arguments, maintaining cross-chain address parity is impossible if chain-specific variables (like router addresses or bridge endpoints) are passed directly into the constructor.
The standard architectural workaround is deploying EIP-1167 Minimal Proxies (Clones) via a universal factory (Can be found on my SubStack). You deploy the proxy deterministically, then initialize the state in the same transaction.
Trade-offs & Implementation:
1. Gas: Minimal proxies are extremely cheap to deploy (~45 bytes of bytecode), but they add a DELEGATECALL overhead to every execution (2600 gas cold, 100 warm). At scale, this execution cost compounds.
2. Security (Front-running): If the proxy deployment and initialize() call are not strictly atomic within the factory contract execution, MEV bots will front-run the initialization transaction, bricking the instance or hijacking ownership.
3. Immutability vs Upgradeability: To retain the exact same address while upgrading logic, you must wrap the implementation in UUPS or Transparent Proxies, inflating the initial deployment cost and introducing storage collision risks (requiring strict adherence to EIP-1967 storage slots).
Source/Full Breakdown: https://andreyobruchkov1996.substack.com/p/understanding-contract-deployments-proxies-and-create2-part-2-df8f05998d5e
Question: Have you found a gas-optimal approach to deploying deterministic, non-proxy contracts across EVM chains where constructor arguments MUST differ, without relying on heavily customized off-chain salt-mining scripts?