# Hella Labs URL: https://www.hellalabs.dev ## Hella Labs | Fintech & Blockchain Fractional Engineering URL: https://www.hellalabs.dev Hella Labs: Fintech + Blockchain native fractional engineering, DevRel, digital marketing and strategy. US expertise multiplied by the cost effectiveness of… ![Neon-tinted street at sunset with a person walking past a car, overlaid with blockchain network nodes and currency tickers](/_astro/home-hero-image.4hlmKqKP_ZbCzPf.jpg) # Hella Labs Specialized Fintech+Blockchain Fractional Engineering, DevRel & Consulting - Design - Build - Launch - Scale Creators of industry-standard Web3 test automation tools. We provide fractional engineering to accelerate your transition to a decentralized future. [Let's Go](/contact/)[DM](https://t.me/anataliocs) ## The Emerging Digital Asset Flywheel ![Pixel-art monitor showing a five-stage loop: RWA & Tokenization, Back-Office Rails, $33T Stablecoins, x402 AI Agents, and Yield & Liquidity, with arrows cycling back to the start](/_astro/new-blockchain-flywheel.BiYPP8hm_Zk0iF6.jpg) 1. ### 1RWA & Tokenization Institutions bring trillions in real-world assets (T-bills, credit, funds) on-chain as programmable collateral. 2. ### 2Back-Office Rails Custodians, clearinghouses, and corporate ERPs integrate directly with blockchains for automated, real-time settlement. 3. ### 3Stablecoin Volume Frictionless back-office plumbing scales stablecoins into the 24/7 global settlement layer for B2B and cross-border payments. 4. ### 4x402 AI Agents Autonomous agents leverage deep, instant stablecoin liquidity to pay for APIs, data, and compute per-request via HTTP 402. 5. ### 5Liquidity Demand Continuous machine-to-machine transaction volume drives massive demand for stablecoin reserves. 6. ### 6Idle Float The idle float backing stablecoin volume drives demand for tokenized T-bills incentivizing institutions to tokenize even more assets. Then back to stage 1, and the cycle repeats. Hella Labs accelerating towards the on-chain future * * * ## Deep US-based expertise multiplied by global workforce efficiency - ![Chris Anatalio](/_astro/chris-anatalio.CDZAjOM7_ZKyNV5.webp) - ![Anna Lopatina](/_astro/anna-lopatina.6tpREB2d_8NRNG.webp) - ![Illustrated Hella Labs global team engineer in front of the Manila skyline at dusk](/_astro/manila-office-engineer.DAaoxP-Q_2o7h32.webp) - ![Neon Manila Office sign under a glowing Philippine flag, above a laptop and the city skyline](/_astro/manila-office.D2iXB4Ch_1XGa3P.webp) - ![Hella Labs logo](/_astro/hella-logo-1.D_S5AS1g_ARhQy.webp) - ![Chris Anatalio](/_astro/chris-anatalio.CDZAjOM7_ZKyNV5.webp) - ![Anna Lopatina](/_astro/anna-lopatina.6tpREB2d_8NRNG.webp) - ![Illustrated Hella Labs global team engineer in front of the Manila skyline at dusk](/_astro/manila-office-engineer.DAaoxP-Q_2o7h32.webp) - ![Neon Manila Office sign under a glowing Philippine flag, above a laptop and the city skyline](/_astro/manila-office.D2iXB4Ch_1XGa3P.webp) - ![Hella Labs logo](/_astro/hella-logo-1.D_S5AS1g_ARhQy.webp) - ![Chris Anatalio](/_astro/chris-anatalio.CDZAjOM7_ZKyNV5.webp) - ![Anna Lopatina](/_astro/anna-lopatina.6tpREB2d_8NRNG.webp) - ![Illustrated Hella Labs global team engineer in front of the Manila skyline at dusk](/_astro/manila-office-engineer.DAaoxP-Q_2o7h32.webp) - ![Neon Manila Office sign under a glowing Philippine flag, above a laptop and the city skyline](/_astro/manila-office.D2iXB4Ch_1XGa3P.webp) - ![Hella Labs logo](/_astro/hella-logo-1.D_S5AS1g_ARhQy.webp) - ![Chris Anatalio](/_astro/chris-anatalio.CDZAjOM7_ZKyNV5.webp) - ![Anna Lopatina](/_astro/anna-lopatina.6tpREB2d_8NRNG.webp) - ![Illustrated Hella Labs global team engineer in front of the Manila skyline at dusk](/_astro/manila-office-engineer.DAaoxP-Q_2o7h32.webp) - ![Neon Manila Office sign under a glowing Philippine flag, above a laptop and the city skyline](/_astro/manila-office.D2iXB4Ch_1XGa3P.webp) - ![Hella Labs logo](/_astro/hella-logo-1.D_S5AS1g_ARhQy.webp) - ![](/_astro/chris-anatalio.CDZAjOM7_ZKyNV5.webp) - ![](/_astro/anna-lopatina.6tpREB2d_8NRNG.webp) - ![](/_astro/manila-office-engineer.DAaoxP-Q_2o7h32.webp) - ![](/_astro/manila-office.D2iXB4Ch_1XGa3P.webp) - ![](/_astro/hella-logo-1.D_S5AS1g_ARhQy.webp) - ![](/_astro/chris-anatalio.CDZAjOM7_ZKyNV5.webp) - ![](/_astro/anna-lopatina.6tpREB2d_8NRNG.webp) - ![](/_astro/manila-office-engineer.DAaoxP-Q_2o7h32.webp) - ![](/_astro/manila-office.D2iXB4Ch_1XGa3P.webp) - ![](/_astro/hella-logo-1.D_S5AS1g_ARhQy.webp) - ![](/_astro/chris-anatalio.CDZAjOM7_ZKyNV5.webp) - ![](/_astro/anna-lopatina.6tpREB2d_8NRNG.webp) - ![](/_astro/manila-office-engineer.DAaoxP-Q_2o7h32.webp) - ![](/_astro/manila-office.D2iXB4Ch_1XGa3P.webp) - ![](/_astro/hella-logo-1.D_S5AS1g_ARhQy.webp) - ![](/_astro/chris-anatalio.CDZAjOM7_ZKyNV5.webp) - ![](/_astro/anna-lopatina.6tpREB2d_8NRNG.webp) - ![](/_astro/manila-office-engineer.DAaoxP-Q_2o7h32.webp) - ![](/_astro/manila-office.D2iXB4Ch_1XGa3P.webp) - ![](/_astro/hella-logo-1.D_S5AS1g_ARhQy.webp) [Meet the Team](/team/) ## Topic Zero Blog [![](/_astro/onchain-data-3.DKgNIT4I_dzzeC.jpg)](/websocket-solana-kit-rxjs-nestjs-thinclient/) - [Nestjs](/tags/nestjs/) - [Solana](/tags/solana/) - [Solana Kit](/tags/solana-kit/) - [RxJS](/tags/rxjs/) - [WebSockets](/tags/websockets/) ### [On-Chain Solana Data via WebSockets with Solkit, RxJS and Nest.js](/websocket-solana-kit-rxjs-nestjs-thinclient/) Wrap Solana Kit (@solana/kit) in a reusable Nest.js module and stream finalized Solana blocks over WebSockets to an ultra-thin vanilla JS client with RxJS Observables, re-using the exact pattern from the Ethereum articles. 24 Nov, 2026 21 min read [![](/_astro/onchain-data-2.0cV1fDea_ZhrxY5.jpg)](/sse-graphql-ethereum-nestjs-thinclient/) - [Nestjs](/tags/nestjs/) - [Ethereum](/tags/ethereum/) - [EthersJS](/tags/ethersjs/) - [RxJS](/tags/rxjs/) - [Server-Sent Events](/tags/server-sent-events/) - [GraphQL](/tags/graphql/) ### [On-Chain Ethereum Data via Server-Sent Events and GraphQL with Ethers.js, RxJS and Nest.js](/sse-graphql-ethereum-nestjs-thinclient/) Re-use one Nest.js service layer to stream finalized Ethereum blocks over Server-Sent Events and serve block queries over GraphQL, with ultra-thin vanilla JS clients and RxJS Observables. 23 Nov, 2026 17 min read [![](/_astro/solidity-e2e-invariant-testing.C75b-0rk_Z14vja5.jpg)](/e2e-invariant-testing-solidity-anvil-wiremock/) - [Solidity](/tags/solidity/) - [Testing](/tags/testing/) - [Invariant Testing](/tags/invariant-testing/) - [Fuzzing](/tags/fuzzing/) - [Foundry](/tags/foundry/) - [Anvil](/tags/anvil/) - [WireMock](/tags/wiremock/) ### [End-to-End Invariant Testing for Solidity: Fuzz the Whole Stack with Foundry Anvil and WireMock Testcontainers](/e2e-invariant-testing-solidity-anvil-wiremock/) Forge invariant tests stop at the EVM boundary. Learn how to fuzz random sequences of real transactions, keeper runs, price-feed outages and RPC faults against a containerized Anvil node, and assert protocol invariants after every step. 21 Nov, 2026 27 min read [![](/_astro/chaos-engineering.DFkfE7jN_Z2mHjmN.jpg)](/on-chain-chaos-engineering-ethereum-wiremock-anvil/) - [Testing](/tags/testing/) - [Chaos Engineering](/tags/chaos-engineering/) - [Ethereum](/tags/ethereum/) - [Anvil](/tags/anvil/) - [WireMock](/tags/wiremock/) - [EthersJS](/tags/ethersjs/) - [Nestjs](/tags/nestjs/) ### [Survive the Outage and Stop Writing Fake JSON-RPC Mocks: Real Life On-Chain Chaos Engineering for Ethereum Apps](/on-chain-chaos-engineering-ethereum-wiremock-anvil/) Put WireMock in front of a real Foundry Anvil node with Testcontainers to inject 503s, dropped connections, latency and 429s into your Ethereum app, without hand-writing a single fake JSON-RPC response. 19 Nov, 2026 14 min read ## Featured videos [All videos](/videos/) ### Web3 Chaos Engineering with Anvil Foundry Testcontainers and a WireMock Proxy Simulate flaky RPC nodes and network faults in your integration tests by putting a WireMock proxy in front of a Foundry Anvil Testcontainer. ## Ready to build on-chain? Book a free 30-minute call. Tell us what you're building and we'll map out how fractional engineering, DevRel, or a custom integration can get you to launch faster. [Book a Free Call](/contact/) [Or explore our services](/web3-consultant-service-offerings/) --- ## Topic Zero Blog | Hella Labs URL: https://www.hellalabs.dev/blog Every Topic Zero article from Hella Labs: Web3 and Ethereum engineering, smart contract testing, reactive dApps, CSS craft and open-source tooling. ## 2026 7 ### November 5 - [![](/_astro/onchain-data-3.DKgNIT4I_f2glc.jpg)](/websocket-solana-kit-rxjs-nestjs-thinclient/) #### [On-Chain Solana Data via WebSockets with Solkit, RxJS and Nest.js](/websocket-solana-kit-rxjs-nestjs-thinclient/) 24 Nov, 2026·21 min read - [![](/_astro/onchain-data-2.0cV1fDea_ZfYQRv.jpg)](/sse-graphql-ethereum-nestjs-thinclient/) #### [On-Chain Ethereum Data via Server-Sent Events and GraphQL with Ethers.js, RxJS and Nest.js](/sse-graphql-ethereum-nestjs-thinclient/) 23 Nov, 2026·17 min read - [![](/_astro/solidity-e2e-invariant-testing.C75b-0rk_16QAvC.jpg)](/e2e-invariant-testing-solidity-anvil-wiremock/) #### [End-to-End Invariant Testing for Solidity: Fuzz the Whole Stack with Foundry Anvil and WireMock Testcontainers](/e2e-invariant-testing-solidity-anvil-wiremock/) 21 Nov, 2026·27 min read - [![](/_astro/chaos-engineering.DFkfE7jN_Z2fXvKV.jpg)](/on-chain-chaos-engineering-ethereum-wiremock-anvil/) #### [Survive the Outage and Stop Writing Fake JSON-RPC Mocks: Real Life On-Chain Chaos Engineering for Ethereum Apps](/on-chain-chaos-engineering-ethereum-wiremock-anvil/) 19 Nov, 2026·14 min read - [![](/_astro/solidity-lifecycle-testing.BZoDoi4p_Z2hz07v.jpg)](/solidity-lifecycle-testing-foundry-anvil/) #### [Mastering Solidity Lifecycle Testing with Foundry Anvil Testcontainers](/solidity-lifecycle-testing-foundry-anvil/) 18 Nov, 2026·16 min read ### May 1 - [![](/_astro/github-open-source.BpYF5ln9_Z1jXU7q.png)](/web3-ethereum-open-source/) #### [Open-Source Web3 Ethereum Projects at Hella Labs](/web3-ethereum-open-source/) 13 May, 2026·3 min read ### January 1 - [![](/_astro/onchain-data-1.DuOJwwRh_2bQOUF.jpg)](/websocket-sse-graphql-nestjs-thinclient/) #### [On-Chain Ethereum Data via WebSockets with Ethers.js, RxJS and Nest.js](/websocket-sse-graphql-nestjs-thinclient/) 16 Jan, 2026·14 min read ## 2025 1 ### August 1 - [![](/_astro/css-animations-2.DpBqQg1V_Z8IdL9.jpg)](/pure-css-animations/) #### [Pure CSS Animated Gradient Background and More!](/pure-css-animations/) 05 Aug, 2025·18 min read --- ## Blog Series | Hella Labs URL: https://www.hellalabs.dev/blog/series Multi-part article series from the Topic Zero Blog: follow a topic from first steps to production, one part at a time. 3 parts ## Real-Time On-chain Data with Nest.js Wrap a blockchain SDK in reusable Nest.js modules once, then serve live on-chain data over WebSockets, Server-Sent Events and GraphQL to ultra-thin clients with RxJS. 1. [![](/_astro/onchain-data-1.DuOJwwRh_2bQOUF.jpg)](/websocket-sse-graphql-nestjs-thinclient/) Part 1 ### [On-Chain Ethereum Data via WebSockets with Ethers.js, RxJS and Nest.js](/websocket-sse-graphql-nestjs-thinclient/) 16 Jan, 2026 – 14 min read 2. [![](/_astro/onchain-data-2.0cV1fDea_ZfYQRv.jpg)](/sse-graphql-ethereum-nestjs-thinclient/) Part 2 ### [On-Chain Ethereum Data via Server-Sent Events and GraphQL with Ethers.js, RxJS and Nest.js](/sse-graphql-ethereum-nestjs-thinclient/) 23 Nov, 2026 – 17 min read 3. [![](/_astro/onchain-data-3.DKgNIT4I_f2glc.jpg)](/websocket-solana-kit-rxjs-nestjs-thinclient/) Part 3 ### [On-Chain Solana Data via WebSockets with Solkit, RxJS and Nest.js](/websocket-solana-kit-rxjs-nestjs-thinclient/) 24 Nov, 2026 – 21 min read --- ## Brand Kit | Hella Labs URL: https://www.hellalabs.dev/brand-kit Download the official Hella Labs logos and social media covers, and find our brand colors and typefaces for press, partner and event use. Writing about us, co-hosting an event or listing us as a partner? Use these assets as they are: please don't recolor, stretch or rearrange the logo. For anything else, [get in touch](/contact/). ## Logos High-resolution 1008 × 1044 JPGs. - ![Hella Labs logo: a rock-on hand built from isometric cubes, in a pink-to-cyan neon gradient on navy](/_astro/hella-logo-3.B2nYbNwb_ZeFfSJ.jpg) ### Primary logo (dark) Default mark for dark backgrounds, avatars and app icons. [Download Primary logo (dark)](/_astro/hella-logo-3.B2nYbNwb.jpg) - ![Hella Labs logo: a rock-on hand built from isometric cubes, in a pink-to-cyan gradient on white](/_astro/hella-logo-4.CoOu9PwJ_ZRkANa.jpg) ### Primary logo (light) Use on white or light backgrounds and in print. [Download Primary logo (light)](/_astro/hella-logo-4.CoOu9PwJ.jpg) - ![Alternate Hella Labs mark: a cluster of geometric polyhedra in a neon gradient on navy](/_astro/hella-logo-1.D_S5AS1g_nE2wD.jpg) ### Geometric mark Alternate decorative mark for stickers, swag and event graphics. [Download Geometric mark](/_astro/hella-logo-1.D_S5AS1g.jpg) ## Social covers Profile banners sized for each network. - ![Hella Labs LinkedIn banner: Design, Build, Launch, Scale; specialized fintech and blockchain fractional engineering, DevRel and consulting](/_astro/linkedin-cover.DxDg5E4c_ZyMgjX.jpg) ### LinkedIn cover 2544 × 416 banner for LinkedIn company and personal pages. [Download LinkedIn cover](/_astro/linkedin-cover.DxDg5E4c.jpg) - ![Hella Labs X header: Design, Build, Launch, Scale; specialized fintech and blockchain fractional engineering, DevRel and consulting](/_astro/twitter-cover.BaqIoIbD_Z1S8qQr.jpg) ### X (Twitter) cover 1400 × 463 header image for X profiles. [Download X (Twitter) cover](/_astro/twitter-cover.BaqIoIbD.jpg) ## Colors Our signature neon gradient sets the tone across the site. - Hella Purple #ae00ee Primary accent, light theme - Hella Pink #f70077 Gradient start - Neon Magenta #d60067 Primary accent, dark theme - Deep Violet #8311c0 Gradient end, dark theme - Midnight Navy #0f172a Dark background - Ink #10141f Headings and body text, light theme ## Typography Both typefaces are free on Google Fonts. - Aa Hella Poppins Headings, navigation and buttons - Aa Hella Roboto Mono Body copy and code --- ## Careers | Hella Labs URL: https://www.hellalabs.dev/careers Careers at Hella Labs: there are no open roles right now, but we're always glad to hear from Web3 engineers, DevRel pros and community builders. ## Open Positions 💡 There are no open positions right now. Check back soon: new roles are posted here first. ## Working at Hella Labs We’re a distributed team of Web3 engineers, developer advocates and community builders working out of **NYC** and our **Manila office**. We ship production code for fintech and blockchain teams, maintain open-source testing tools, and teach what we learn through talks, courses and articles. ### Don't see a fit yet? We’re always happy to meet talented people. Send us a note with a little about yourself and what you’d like to work on, and we’ll reach out when a matching role opens up. [Introduce Yourself](/contact/) [Meet the team](/team/) --- ## Contact | Hella Labs URL: https://www.hellalabs.dev/contact Got a revolutionary idea? A groundbreaking technical concept? Let's transform it into reality. Whether it's blockchain infrastructure, fintech innovation, or… ![Woman gazing upward on a neon-lit city street, with holographic network diagrams floating beside her](/_astro/thinking-girl.B4YKVYgJ_T8Yhn.jpg) ![The same woman on the neon-lit street, now outlined in glowing light beside a holographic "Preparing for launch" display](/_astro/thinking-girl-after-send.C5ALlLHK_Z1yGLnK.jpg) Photo by [Pablo Stanley](https://www.lummi.ai/creator/pablostanley) / [Lummi](https://www.lummi.ai/) [Back to home](/) ## Connect with us - [](https://t.me/hella_web3) - [](https://x.com/Hella_Web3) - [](https://github.com/hella-labs) - [](https://www.linkedin.com/company/hella-labs) - [](https://www.youtube.com/@hella-labs) - [](https://dev.to/hella-labs) - [](/feed.xml) --- ## End-to-End Invariant Testing for Solidity: Fuzz the Whole Stack with Foundry Anvil and WireMock Testcontainers | Hella Labs URL: https://www.hellalabs.dev/e2e-invariant-testing-solidity-anvil-wiremock Forge invariant tests stop at the EVM boundary. Learn how to fuzz random sequences of real transactions, keeper runs, price-feed outages and RPC faults… ## Your Contract Is Correct. Your Protocol Isn’t. Invariant testing is one of the best tools a Solidity team has. Describe something that must **always** be true (e.g. the pool is solvent, debts add up, the oracle price is sane) and let a fuzzer throw random sequences of calls at the system until something breaks. If you haven’t written one yet, the [Solidity Testing Book chapter on invariant tests](https://www.soliditytestingbook.com/advanced/invariant-tests) is a good introduction to handlers, actors and bounded inputs in Foundry. Forge’s invariant fuzzer has one hard limit: **it runs inside the EVM.** It cannot run: - the TypeScript keeper that pushes prices on-chain every few minutes - the REST price API that keeper depends on - a RPC provider, with its `503`s, dropped sockets and slow responses - viem or ethers encoding, nonce handling, timeouts and retry logic That’s where many real incidents start. The contract executes as expected but the off-chain code told it something wrong. This article shows how to take the invariant-testing model **end to end**: random sequences of real transactions from multiple actors, real keeper runs, and injected network faults, all against a real Anvil node, with protocol invariants checked after every step. We’ll use two open-source Hella Labs modules: - [`@hellaweb3/foundryanvil-testcontainers-nodejs`](https://www.npmjs.com/package/@hellaweb3/foundryanvil-testcontainers-nodejs) ([GitHub](https://github.com/hella-labs/foundryanvil-testcontainers-nodejs)) runs Foundry Anvil in Docker with a typed viem test client, snapshots and cheats. - [`@hellaweb3/wiremock-testcontainers-nodejs`](https://www.npmjs.com/package/@hellaweb3/wiremock-testcontainers-nodejs) ([GitHub](https://github.com/hella-labs/wiremock-testcontainers-nodejs)) runs WireMock in Docker to fake the price API and inject faults into JSON-RPC traffic. 💡 This builds on two earlier guides: [Solidity lifecycle testing with Foundry Anvil Testcontainers](/solidity-lifecycle-testing-foundry-anvil/) and [on-chain chaos engineering with WireMock and Anvil](/on-chain-chaos-engineering-ethereum-wiremock-anvil/). You don’t need to have read them, but they cover the container setup in more depth. * * * ## Forge Invariants vs. End-to-End Invariants The two approaches answer different questions, and you want both. | | Forge invariant tests | End-to-end invariant tests | | --- | --- | --- | | Runs | In-process EVM | Real Anvil node in Docker, over JSON-RPC | | Fuzzes | Contract calls | Contract calls, keeper runs, API responses, RPC faults, time | | Speed | Thousands of calls per second | Tens of transactions per second | | Typical budget | 256 runs × 500 calls | 32 runs × 25 steps per PR, more nightly | | Finds | Logic bugs inside the contracts | Bugs at the boundary between contracts and the code that drives them | Forge gives you breadth: huge numbers of sequences, cheap and fast. The end-to-end harness gives you depth: fewer sequences, but each one goes through the real code path your users and operators will hit. Keep your Forge suite. Add this one for the parts Forge can’t reach. * * * ## The System Under Test Our example is a small lending market with three moving parts. **1\. A price oracle** that only the keeper may update: ``` // SPDX-License-Identifier: MIT pragma solidity ^0.8.24; contract PriceOracle { address public immutable keeper; uint256 public price; // USD per WETH, 8 decimals uint256 public updatedAt; error NotKeeper(); constructor(address keeper_) { keeper = keeper_; } function setPrice(uint256 newPrice) external { if (msg.sender != keeper) revert NotKeeper(); price = newPrice; updatedAt = block.timestamp; } } ``` **2\. A lending pool.** Users deposit WETH as collateral and borrow a stablecoin against it, up to 75% of the collateral’s value. It refuses to price positions with an oracle value older than one hour: ``` // SPDX-License-Identifier: MIT pragma solidity ^0.8.24; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import {PriceOracle} from "./PriceOracle.sol"; contract LendingPool { uint256 public constant LTV_BPS = 7_500; // borrow up to 75% of collateral value uint256 public constant MAX_PRICE_AGE = 1 hours; IERC20 public immutable collateral; // WETH, 18 decimals IERC20 public immutable stable; // USD stablecoin, 18 decimals PriceOracle public immutable oracle; mapping(address => uint256) public collateralOf; mapping(address => uint256) public debtOf; uint256 public totalCollateral; uint256 public totalDebt; error Unhealthy(); error StalePrice(); constructor(IERC20 collateral_, IERC20 stable_, PriceOracle oracle_) { collateral = collateral_; stable = stable_; oracle = oracle_; } function deposit(uint256 amount) external { collateralOf[msg.sender] += amount; totalCollateral += amount; collateral.transferFrom(msg.sender, address(this), amount); } function withdraw(uint256 amount) external { collateralOf[msg.sender] -= amount; totalCollateral -= amount; _requireHealthy(msg.sender); collateral.transfer(msg.sender, amount); } function borrow(uint256 amount) external { debtOf[msg.sender] += amount; totalDebt += amount; _requireHealthy(msg.sender); stable.transfer(msg.sender, amount); } function repay(uint256 amount) external { debtOf[msg.sender] -= amount; totalDebt -= amount; stable.transferFrom(msg.sender, address(this), amount); } function _requireHealthy(address user) internal view { if (debtOf[user] == 0) return; if (block.timestamp - oracle.updatedAt() > MAX_PRICE_AGE) revert StalePrice(); uint256 value = (collateralOf[user] * oracle.price()) / 1e8; if (debtOf[user] * 10_000 > value * LTV_BPS) revert Unhealthy(); } } ``` **3\. An off-chain keeper** in TypeScript. It fetches the ETH/USD price from an HTTP API and pushes it to the oracle through an RPC endpoint: ``` // src/keeper.ts import type { Account, Address, Chain, Transport, WalletClient } from "viem"; import { oracleAbi } from "./abis"; export interface KeeperDeps { priceApiUrl: string; wallet: WalletClient; oracle: Address; } /** One keeper cycle. Returns true when a new price was pushed on-chain. */ export async function keeperTick({ priceApiUrl, wallet, oracle }: KeeperDeps): Promise { let quote: { price: number | null }; try { const res = await fetch(`${priceApiUrl}/v1/prices/ETH-USD`, { signal: AbortSignal.timeout(1_000), }); if (!res.ok) return false; // provider down: keep the last on-chain price quote = (await res.json()) as { price: number | null }; } catch { return false; // timeout or dropped connection } const price = BigInt(Math.round(Number(quote.price) * 1e8)); // 8-decimal fixed point try { await wallet.writeContract({ address: oracle, abi: oracleAbi, functionName: "setPrice", args: [price], }); return true; } catch { return false; // RPC failure: try again next cycle } } ``` Read that keeper again. It handles HTTP errors, timeouts and RPC failures. It looks careful. There’s still a bug in it, and Forge can’t find it, because Forge never runs this file. Let’s build a harness that can. * * * ## The Test Topology Everything runs in Docker through [Testcontainers](https://testcontainers.com/). One WireMock container plays two roles: - the **price API** at `/v1/prices/ETH-USD`, whose response the fuzzer controls - a **transparent JSON-RPC proxy** at `/rpc`, forwarding the keeper’s transactions to Anvil, so the fuzzer can break the keeper’s RPC connection flowchart LR subgraph host\["Test process (host)"\] direction TB fuzz\["Invariant runner
seeded step generator"\] keeper\["keeperTick()
(code under test)"\] actors\["Actors 2–5
anvil.testClientFor()"\] end subgraph net\["Docker network"\] direction TB wm\["WireMock
/v1/prices/ETH-USD
/rpc"\] anvil\["Anvil
alias anvil:8545
Oracle + LendingPool"\] wm -- "proxy /rpc" --> anvil end keeper -- "GET price" --> wm keeper -- "setPrice via /rpc" --> wm actors -- "deposit / borrow / repay / withdraw" --> anvil fuzz -. "runtime stubs: quotes, faults" .-> wm fuzz -. "invariant reads, time warp, checkpoint restore" .-> anvil The actors talk to Anvil directly, since their transactions are the fuzz input, not the thing being broken. Only the keeper’s traffic goes through WireMock. ### Start the containers `useAnvil()` manages one Anvil node per test file and runs a `setup` hook once after start. We use it to deploy the contracts from Foundry’s `out/` directory: ``` // test/invariant/lending.invariant.e2e.test.ts import { AnvilContainer, AnvilOptions, useAnvil, } from "@hellaweb3/foundryanvil-testcontainers-nodejs"; import { type StartedWiremockContainer, WiremockContainer, } from "@hellaweb3/wiremock-testcontainers-nodejs"; import { Network, type StartedNetwork } from "testcontainers"; import { createWalletClient, http } from "viem"; import { deployMarket, type Market } from "./fixtures"; let network: StartedNetwork; let market: Market; let wiremock: StartedWiremockContainer; const anvil = useAnvil( { start: async () => { network = await new Network().start(); return new AnvilContainer(new AnvilOptions().account.withAccounts(6).logs.quiet()) .withArtifactsDir("out") // forge build output .withTestClient((client) => client.withAccount(0)) .withNetwork(network) .withNetworkAliases("anvil") .start(); }, }, { setup: async (node) => (market = await deployMarket(node)) }, ); beforeAll(async () => { wiremock = await new WiremockContainer() .withNetwork(network) .withMapping("rpc-proxy", { json: PROXY_TO_ANVIL }) .withMapping("price-baseline", { json: quoteStub(3_000) }) .start(); await wiremock.waitUntilReady(); }, 120_000); afterAll(async () => { await wiremock?.stop(); await network?.stop(); }); ``` `deployMarket()` deploys two mock ERC-20s, the oracle and the pool, seeds the pool with stablecoin liquidity, gives every actor 100 WETH, approves the pool for both tokens, and has the keeper push an opening price of $3,000. Each deployment is one call: ``` const name = "LendingPool"; const receipt = await node.deployContract( node.contractAbi(`${name}.sol/${name}.json`), node.contractBytecode(`${name}.sol/${name}.json`), deployer, [weth, usd, oracle], ); const pool = receipt.contractAddress as Address; ``` The two baseline WireMock stubs are plain objects. The proxy forwards everything under `/rpc` to Anvil at low priority, and the quote stub serves a healthy price: ``` export const PRICE_PATH = "/v1/prices/ETH-USD"; export const PROXY_TO_ANVIL = { priority: 100, // lowest: any fault stub wins request: { method: "ANY", urlPath: "/rpc" }, response: { proxyBaseUrl: "http://anvil:8545", proxyUrlPrefixToRemove: "/rpc" }, }; export const quoteStub = (price: number | null, response: object = {}) => ({ priority: 5, request: { method: "GET", urlPath: PRICE_PATH }, response: { status: 200, jsonBody: { symbol: "ETH-USD", price }, ...response }, }); ``` 💡 Both `@hellaweb3/*` modules depend on `testcontainers@^12`. Keep your own `testcontainers` dependency on the same major version, or a `Network` created by one copy can’t be passed to containers from the other. * * * ## Step 1: Deterministic Fuzz Input A fuzzer you can’t replay is a fuzzer you can’t debug. Every random choice in the harness comes from one seeded PRNG, so a failing seed always reproduces the same sequence: ``` // test/invariant/rng.ts export type Rng = () => number; // uniform in [0, 1) /** mulberry32: tiny, fast and good enough for test input. */ export function mulberry32(seed: number): Rng { let a = seed >>> 0; return () => { a = (a + 0x6d2b79f5) >>> 0; let t = a; t = Math.imul(t ^ (t >>> 15), t | 1); t ^= t + Math.imul(t ^ (t >>> 7), t | 61); return ((t ^ (t >>> 14)) >>> 0) / 4_294_967_296; }; } /** * Like forge-std's bound(): maps a raw fuzz value into [min, max]. * The lowest and highest 5% of raw values snap to the edges, since edges are where bugs live. */ export function bound(raw: number, min: bigint, max: bigint): bigint { if (max <= min) return min; if (raw < 0.05) return min; if (raw >= 0.95) return max; return min + ((max - min) * BigInt(Math.floor(raw * 1e9))) / 1_000_000_000n; } ``` A **step** is pure data: which action to run, which actor runs it, and a raw number the action turns into concrete arguments. Generating steps up front, without reading chain state, matters later: it lets us replay and shrink a failing sequence exactly. ``` // test/invariant/steps.ts export type ActionName = | "deposit" | "withdraw" | "borrow" | "repay" | "keeperTick" | "quoteMoves" | "priceApiFault" | "rpcFault" | "warp"; export interface Step { action: ActionName; actor: number; // index into ctx.actors raw: number; // fuzz value in [0, 1), turned into arguments by the action } // Relative frequencies. Leaving an action out works like Foundry's targetSelector. const WEIGHTS: Record = { deposit: 3, withdraw: 2, borrow: 3, repay: 2, keeperTick: 3, quoteMoves: 2, priceApiFault: 1, rpcFault: 1, warp: 1, }; const BAG = (Object.entries(WEIGHTS) as [ActionName, number][]).flatMap(([name, weight]) => Array(weight).fill(name), ); export function generate(rng: Rng, depth: number): Step[] { return Array.from({ length: depth }, () => ({ action: BAG[Math.floor(rng() * BAG.length)]!, actor: Math.floor(rng() * 4), raw: rng(), })); } ``` * * * ## Step 2: Handlers for Users, Keepers and Chaos Handlers are the end-to-end version of a Forge handler contract. Each one bounds its input against **current chain state**, so most calls are realistic, and returns an outcome the runner counts: - `ok`: the transaction succeeded - `revert`: the contract rejected it on purpose (for example `Unhealthy`) - `discard`: the step makes no sense right now (no collateral to withdraw), so it’s skipped Every handler shares a context object that holds the containers, addresses and **ghost state**: values the test tracks off-chain so invariants can compare the chain against them. ``` // test/invariant/context.ts import type { StartedAnvilContainer } from "@hellaweb3/foundryanvil-testcontainers-nodejs"; import type { StartedWiremockContainer } from "@hellaweb3/wiremock-testcontainers-nodejs"; import type { Account, Address } from "viem"; export interface Ghost { quote: number; // USD price the API serves while healthy validQuotes: Set; // every well-formed price the API has served, 8 decimals faults: number; // counter for unique WireMock scenario names } export interface Ctx { anvil: StartedAnvilContainer; wiremock: StartedWiremockContainer; market: Market; // pool, oracle, weth, usd addresses + seeded liquidity actors: Address[]; // dev accounts 2–5 keeper: Address; // dev account 1 ghost: Ghost; } export const toFixed8 = (usd: number) => BigInt(Math.round(usd * 1e8)); export const freshGhost = (): Ghost => ({ quote: 3_000, validQuotes: new Set([toFixed8(3_000)]), faults: 0, }); ``` Two small helpers keep the handlers short. `tx()` sends a transaction as an actor and sorts failures into **expected reverts** and **everything else**: ``` // test/invariant/tx.ts import { AnvilTransactionRevertedError } from "@hellaweb3/foundryanvil-testcontainers-nodejs"; import { type Abi, type Address, BaseError, ContractFunctionRevertedError } from "viem"; export function isRevert(err: unknown): boolean { if (err instanceof AnvilTransactionRevertedError) return true; // mined, then reverted return ( err instanceof BaseError && // rejected during gas estimation err.walk((e) => e instanceof ContractFunctionRevertedError) !== null ); } export async function tx( ctx: Ctx, from: Address, call: { address: Address; abi: Abi; functionName: string; args: readonly unknown[] }, ): Promise<"ok" | "revert"> { try { await ctx.anvil.confirm(ctx.anvil.testClientFor(from).writeContract(call)); return "ok"; } catch (err) { if (isRevert(err)) return "revert"; throw err; // an RPC or encoding error is a harness bug, not a finding: fail loudly } } export const read = ( ctx: Ctx, address: Address, abi: Abi, functionName: string, args: readonly unknown[] = [], ) => ctx.anvil.testClient.readContract({ address, abi, functionName, args }) as Promise; ``` 💡 Don’t wrap handler calls in a `try`/`catch` that swallows every error. A blanket catch turns real bugs into “reverts” and quietly makes the suite useless. Only a contract revert is an expected outcome; anything else should fail the test. ### User actions The user handlers drive the pool from four actors. `borrow` deliberately overshoots the borrowing capacity by up to 10%, so the health check gets exercised too. It also checks a **postcondition**: if the oracle price was already stale, the borrow must not succeed. ``` // test/invariant/actions.ts type Outcome = "ok" | "revert" | "discard"; type Action = (ctx: Ctx, actor: Address, raw: number) => Promise; const userActions = { async deposit(ctx, actor, raw) { const { weth, pool } = ctx.market; const balance = await read(ctx, weth, erc20Abi, "balanceOf", [actor]); if (balance === 0n) return "discard"; const amount = bound(raw, 1n, balance); return tx(ctx, actor, { address: pool, abi: poolAbi, functionName: "deposit", args: [amount] }); }, async withdraw(ctx, actor, raw) { const { pool } = ctx.market; const deposited = await read(ctx, pool, poolAbi, "collateralOf", [actor]); if (deposited === 0n) return "discard"; const amount = bound(raw, 1n, deposited); return tx(ctx, actor, { address: pool, abi: poolAbi, functionName: "withdraw", args: [amount], }); }, async borrow(ctx, actor, raw) { const { pool, oracle } = ctx.market; const [collateral, debt, price, updatedAt, now] = await Promise.all([ read(ctx, pool, poolAbi, "collateralOf", [actor]), read(ctx, pool, poolAbi, "debtOf", [actor]), read(ctx, oracle, oracleAbi, "price"), read(ctx, oracle, oracleAbi, "updatedAt"), ctx.anvil.latestTimestamp(), ]); const capacity = (collateral * price * 7_500n) / (100_000_000n * 10_000n) - debt; if (capacity <= 0n) return "discard"; const amount = bound(raw, 1n, capacity + capacity / 10n); const stale = now - updatedAt > 3_600n; const outcome = await tx(ctx, actor, { address: pool, abi: poolAbi, functionName: "borrow", args: [amount], }); if (outcome === "ok" && stale) { throw new Violation( "noBorrowOnStalePrice", `borrowed ${amount} at a price ${now - updatedAt}s old`, ); } return outcome; }, async repay(ctx, actor, raw) { const { pool, usd } = ctx.market; const [debt, balance] = await Promise.all([ read(ctx, pool, poolAbi, "debtOf", [actor]), read(ctx, usd, erc20Abi, "balanceOf", [actor]), ]); const max = debt < balance ? debt : balance; if (max === 0n) return "discard"; return tx(ctx, actor, { address: pool, abi: poolAbi, functionName: "repay", args: [bound(raw, 1n, max)], }); }, } satisfies Record; ``` ### Keeper and chaos actions This is the part Forge can’t do. `keeperTick` runs the **real keeper module**, with its wallet pointed at WireMock’s `/rpc` proxy. The chaos actions change what the price API returns, break the keeper’s next transaction, or move time forward. Runtime stubs are POSTed to WireMock’s admin API at `wiremock.getMappingUrl()`. When two stubs have the same priority, WireMock uses the one added most recently, so each new quote or fault replaces the previous one. ``` const addStub = (ctx: Ctx, stub: object) => fetch(ctx.wiremock.getMappingUrl(), { method: "POST", body: JSON.stringify(stub) }); const PRICE_FAULTS = [ { label: "503", stub: () => quoteStub(null, { status: 503, jsonBody: undefined }) }, { label: "connection reset", stub: () => quoteStub(null, { fault: "CONNECTION_RESET_BY_PEER" }) }, { label: "slow (1.5s)", stub: (q: number) => quoteStub(q, { fixedDelayMilliseconds: 1_500 }) }, { label: "200 with null price", stub: () => quoteStub(null) }, ]; const systemActions = { async keeperTick(ctx) { const wallet = createWalletClient({ account: ctx.keeper, // unlocked dev account: Anvil signs chain: ctx.anvil.chain, transport: http(ctx.wiremock.getUrl("/rpc")), }); const pushed = await keeperTick({ priceApiUrl: ctx.wiremock.getUrl(), wallet, oracle: ctx.market.oracle, }); return pushed ? "ok" : "revert"; }, async quoteMoves(ctx, _actor, raw) { // The market moves up to ±10% per step const next = Math.round(ctx.ghost.quote * (0.9 + raw * 0.2) * 100) / 100; ctx.ghost.quote = next; ctx.ghost.validQuotes.add(toFixed8(next)); await addStub(ctx, quoteStub(next)); return "ok"; }, async priceApiFault(ctx, _actor, raw) { const fault = PRICE_FAULTS[Math.floor(raw * PRICE_FAULTS.length)]!; await addStub(ctx, fault.stub(ctx.ghost.quote)); // stays broken until the next quoteMoves return "ok"; }, async rpcFault(ctx) { // One-shot 503 on the keeper's next transaction, then back to proxying await addStub(ctx, { priority: 1, request: { method: "POST", urlPath: "/rpc", bodyPatterns: [{ contains: '"method":"eth_sendTransaction"' }], }, response: { status: 503 }, scenarioName: `rpc-blip-${ctx.ghost.faults++}`, requiredScenarioState: "Started", newScenarioState: "recovered", }); return "ok"; }, async warp(ctx, _actor, raw) { const seconds = Number(bound(raw, 60n, 2n * 3_600n)); await ctx.anvil.cheats.increaseTime({ seconds }).mine(); return "ok"; }, } satisfies Record; // The compiler checks that every ActionName has exactly one handler export const actions: Record = { ...userActions, ...systemActions }; ``` Together, `warp` and `rpcFault` make a stale oracle reachable: the keeper misses a few cycles, an hour passes, and the `noBorrowOnStalePrice` postcondition checks that the pool refuses to lend against the old price. * * * ## Step 3: Write the Invariants Each invariant reads the chain and returns `undefined` when it holds, or a message explaining why it broke. Checking them after **every step** means a failure points at the exact step that broke the system, not the end of the run. ``` // test/invariant/invariants.ts type Invariant = (ctx: Ctx) => Promise; export const invariants: Record = { /** Every WETH the pool holds is credited to someone, and vice versa. */ async collateralIsBacked(ctx) { const { pool, weth } = ctx.market; const [held, recorded] = await Promise.all([ read(ctx, weth, erc20Abi, "balanceOf", [pool]), read(ctx, pool, poolAbi, "totalCollateral"), ]); return held === recorded ? undefined : `pool holds ${held} WETH but records ${recorded}`; }, /** No interest yet, so stablecoins are conserved: in the pool or out on loan. */ async stableIsConserved(ctx) { const { pool, usd, seededLiquidity } = ctx.market; const [held, lent] = await Promise.all([ read(ctx, usd, erc20Abi, "balanceOf", [pool]), read(ctx, pool, poolAbi, "totalDebt"), ]); return held + lent === seededLiquidity ? undefined : `held ${held} + lent ${lent} != seeded ${seededLiquidity}`; }, /** Per-user debts add up to the pool's total (iterate over every actor). */ async debtsSumToTotal(ctx) { const { pool } = ctx.market; const debts = await Promise.all( ctx.actors.map((actor) => read(ctx, pool, poolAbi, "debtOf", [actor])), ); const sum = debts.reduce((a, b) => a + b, 0n); const total = await read(ctx, pool, poolAbi, "totalDebt"); return sum === total ? undefined : `actor debts sum to ${sum}, totalDebt is ${total}`; }, /** The cross-boundary invariant: the oracle only ever holds a price the API really served. */ async oracleTracksApi(ctx) { const price = await read(ctx, ctx.market.oracle, oracleAbi, "price"); return ctx.ghost.validQuotes.has(price) ? undefined : `oracle holds ${price}, which the price API never served as a valid quote`; }, }; ``` The first three are classic on-chain invariants, and you’d likely have them in Forge too. The last one is only possible end to end: it compares on-chain state against **ghost state about an off-chain system**, the quotes that WireMock actually served. * * * ## Step 4: The Runner, with Checkpoints and Shrinking The runner ties it together. For each run it generates a sequence from `seed + run`, executes it, and checks every invariant after every step. Between runs, an [Anvil checkpoint](https://hellalabs.dev/foundryanvil-testcontainers-nodejs/docs/tasks/test-suites/isolate-tests) puts the chain back to the post-deployment state in milliseconds, and `wiremock.reset()` drops every runtime stub, scenario and journal entry. No container restarts. ``` // test/invariant/runner.ts export class Violation extends Error { step = 0; constructor( readonly invariant: string, detail: string, ) { super(`${invariant}: ${detail}`); } } export async function execute(ctx: Ctx, steps: readonly Step[], metrics?: Metrics) { for (const [i, step] of steps.entries()) { try { const actor = ctx.actors[step.actor % ctx.actors.length]!; metrics?.record(step.action, await actions[step.action](ctx, actor, step.raw)); for (const [name, check] of Object.entries(invariants)) { const broken = await check(ctx); if (broken) throw new Violation(name, broken); } } catch (err) { if (!(err instanceof Violation)) throw err; err.step = i + 1; return err; } } return undefined; } ``` When a run fails, a 25-step sequence is hard to read. Forge shrinks failing sequences, and we can do the same: try deleting each step, replay from the checkpoint, and keep the deletion if the **same invariant** still breaks. ``` export async function shrink( ctx: Ctx, restore: () => Promise, steps: Step[], invariant: string, ): Promise { let current = steps; for (let i = current.length - 1; i >= 0; i--) { const candidate = current.toSpliced(i, 1); await restore(); if ((await execute(ctx, candidate))?.invariant === invariant) current = candidate; } return current; } ``` And the test itself: ``` const RUNS = Number(process.env.INVARIANT_RUNS ?? 32); const DEPTH = Number(process.env.INVARIANT_DEPTH ?? 25); const SEED = Number(process.env.INVARIANT_SEED ?? Date.now() % 2 ** 31); it( `holds every invariant (seed ${SEED}, ${RUNS} runs × ${DEPTH} steps)`, async () => { const addresses = await anvil.addresses(); const ctx: Ctx = { anvil, wiremock, market, keeper: addresses[1]!, actors: addresses.slice(2, 6), ghost: freshGhost(), }; const base = await anvil.checkpoint(); const restore = async () => { await base.restore(); await wiremock.reset(); ctx.ghost = freshGhost(); }; const metrics = new Metrics(); for (let run = 0; run < RUNS; run++) { const steps = generate(mulberry32(SEED + run), DEPTH); const failure = await execute(ctx, steps, metrics); if (failure) { const minimal = await shrink(ctx, restore, steps.slice(0, failure.step), failure.invariant); throw new Error(report(failure, minimal, SEED + run)); } await restore(); } console.table(metrics.table()); // calls / reverts / discards per action }, 30 * 60_000, ); ``` `Metrics` is a few lines of bookkeeping, and it plays the same role as Foundry’s `show_metrics` table. If `borrow` shows 200 discards and 3 calls, your bounds are wrong and the fuzzer is mostly doing nothing. Check the table before you trust a green run. * * * ## What the Fuzzer Found Run the suite with Docker running: ``` pnpm test:e2e -- lending.invariant ``` Within a handful of runs, the harness stops with a report like this (the format comes from our `report()` helper): ``` Invariant "oracleTracksApi" broken at step 9 of run 4 (seed 1849204121) oracle holds 0, which the price API never served as a valid quote Shrunk from 9 steps to 2: 1. priceApiFault → 200 with null price 2. keeperTick Replay: INVARIANT_SEED=1849204121 INVARIANT_RUNS=1 pnpm test:e2e -- lending.invariant ``` Two steps. The price API answers `200 OK` with `{"symbol":"ETH-USD","price":null}`, which degraded upstream providers really do send. The keeper sees a successful response and runs: ``` const price = BigInt(Math.round(Number(quote.price) * 1e8)); ``` `Number(null)` is `0`. So the keeper pushes a price of **zero** on-chain, and the oracle accepts it because nothing told it not to. Every borrower’s collateral is now worth nothing. Add a liquidation function to this pool and the next keeper run is a mass liquidation of every position. Notice what didn’t catch this: - **Unit tests of the keeper** mocked `fetch` with well-formed responses. - **Forge invariant tests** bound `setPrice` to a realistic range in the handler, because “the keeper would never send zero.” - **The contract** is correct given its inputs. The bug lives in the gap between the HTTP response and the transaction. ### The fix: defense in depth Fix it on both sides of the boundary. The keeper validates the quote before it ever builds a transaction: ``` const raw = quote.price; if (typeof raw !== "number" || !Number.isFinite(raw) || raw <= 0) return false; const price = BigInt(Math.round(raw * 1e8)); ``` And the oracle refuses zero prices and implausible jumps, so a future keeper bug can’t do the same damage: ``` uint256 public constant MAX_DEVIATION_BPS = 2_000; // 20% per update error ZeroPrice(); error PriceJump(); function setPrice(uint256 newPrice) external { if (msg.sender != keeper) revert NotKeeper(); if (newPrice == 0) revert ZeroPrice(); if (price != 0) { uint256 delta = newPrice > price ? newPrice - price : price - newPrice; if (delta * 10_000 > price * MAX_DEVIATION_BPS) revert PriceJump(); } price = newPrice; updatedAt = block.timestamp; } ``` Replay the exact failing seed to confirm the fix, then run the full budget again: ``` INVARIANT_SEED=1849204121 INVARIANT_RUNS=1 pnpm test:e2e -- lending.invariant INVARIANT_RUNS=256 pnpm test:e2e -- lending.invariant ``` Keep the fuzzer running after the fix, because fixes have side effects too. The new deviation guard means that if the keeper misses enough cycles while the market moves more than 20%, every push reverts with `PriceJump` and the oracle goes stale until someone steps in. `noBorrowOnStalePrice` keeps that failure safe (no lending against old prices), but it’s now a liveness problem you know about and can design for, instead of one you find during a volatile week on mainnet. * * * ## Practical Tips - **Always print the seed.** Put it in the test name and the failure report. A failure you can’t replay is a failure you’ll end up ignoring. - **Generate steps without reading state, bound them with state.** Steps that are pure data can be replayed and shrunk. Handlers then use `bound()` against the current chain, like a Forge handler. - **Classify reverts, don’t swallow them.** Count contract reverts as expected outcomes, and let RPC, encoding and timeout errors from the harness fail the test. - **Watch the metrics table.** High discard or revert counts mean the fuzzer is wasting its budget. Tune the bounds until most calls succeed. - **Restore, don’t restart.** `anvil.checkpoint()` and `wiremock.reset()` reset both containers in milliseconds. Starting fresh containers per run would cost seconds each time. - **Size the budget for the pipeline.** Around 32 runs × 25 steps finishes in a few minutes on a pull request. Run 256+ nightly with a random seed, and save any failing seed as a regression test. - **Mind WireMock’s matching rules.** Lower `priority` numbers win, and among equal priorities the newest stub wins. Use a unique `scenarioName` for one-shot faults, or the second one never fires. - **Keep Forge in the loop.** Port every on-chain invariant you find here back into your Forge suite, where it can run thousands of times faster. * * * ## Resources - **Invariant testing background:** [Solidity Testing Book: Invariant Tests](https://www.soliditytestingbook.com/advanced/invariant-tests) · [Foundry: Invariant Testing](https://getfoundry.sh/forge/invariant-testing) - **Anvil Testcontainers:** [npm](https://www.npmjs.com/package/@hellaweb3/foundryanvil-testcontainers-nodejs) · [GitHub](https://github.com/hella-labs/foundryanvil-testcontainers-nodejs) · [Docs](https://hellalabs.dev/foundryanvil-testcontainers-nodejs/) · [Project overview](/open-source/foundry-anvil-testcontainers/) - **WireMock Testcontainers:** [npm](https://www.npmjs.com/package/@hellaweb3/wiremock-testcontainers-nodejs) · [GitHub](https://github.com/hella-labs/wiremock-testcontainers-nodejs) · [Docs](https://hellalabs.dev/wiremock-testcontainers-nodejs/) · [Project overview](/open-source/wiremock-testcontainers/) - **WireMock docs:** [Stub priority](https://wiremock.org/docs/stubbing/#stub-priority) · [Simulating faults](https://wiremock.org/docs/simulating-faults/) · [Stateful scenarios](https://wiremock.org/docs/stateful-behaviour/) · [Proxying](https://wiremock.org/docs/proxying/) - **Related articles:** [Solidity Lifecycle Testing with Foundry Anvil](/solidity-lifecycle-testing-foundry-anvil/) · [On-Chain Chaos Engineering with WireMock and Anvil](/on-chain-chaos-engineering-ethereum-wiremock-anvil/) * * * ## How Hella Labs Can Help We build these harnesses for protocols that can’t afford to find boundary bugs on mainnet. If you’d rather have end-to-end invariant tests running in your pipeline next sprint than build them yourself, here’s what we do: ### DevOps & Test Automation Forge and end-to-end invariant suites on Anvil and WireMock, wired into CI/CD with seeded replays, shrinking and nightly deep runs. [See the service](/services/devops-test-automation/) ### Web3 Tooling & SDKs Keepers, oracle updaters, relayers and SDKs that validate every input before it reaches the chain, and come with the tests to prove it. [See the service](/services/web3-tooling-sdks/) ### Technical Articles Deep-dive tutorials like this one, with working example code, written for your protocol’s developer audience. [See the service](/services/technical-articles/) ### dApp Front-Ends Front-ends that show stale prices, paused markets and failed transactions honestly, instead of letting users act on bad data. [See the service](/services/dapp-web-front-end/) ### Find the bugs between your contracts and your keepers, before an attacker does. In a short engagement we map your protocol’s invariants, build an end-to-end fuzzing harness around **your** contracts, keepers and data feeds, and hand you every broken invariant we find, each with a minimal replayable sequence and the test that proves the fix. **Real transactions, real off-chain code, real failures.** Plus a CI pipeline that keeps catching regressions after we’re gone. [Book an Invariant Testing Audit](/contact/) [Explore All Service Offerings →](/web3-consultant-service-offerings/) * * * **Thanks for reading!** If this helped, star [Foundry Anvil Testcontainers](https://github.com/hella-labs/foundryanvil-testcontainers-nodejs) and [WireMock Testcontainers](https://github.com/hella-labs/wiremock-testcontainers-nodejs) on GitHub and share the article with your team. _Part of the Hella Labs commitment to open-source excellence and Web3 infrastructure._ Share: - [](https://twitter.com/intent/tweet?text=End-to-End%20Invariant%20Testing%20for%20Solidity%3A%20Fuzz%20the%20Whole%20Stack%20with%20Foundry%20Anvil%20and%20WireMock%20Testcontainers&url=https%3A%2F%2Fwww.hellalabs.dev%2Fe2e-invariant-testing-solidity-anvil-wiremock%2F) - [](https://www.linkedin.com/shareArticle?mini=true&url=https%3A%2F%2Fwww.hellalabs.dev%2Fe2e-invariant-testing-solidity-anvil-wiremock%2F&title=End-to-End%20Invariant%20Testing%20for%20Solidity%3A%20Fuzz%20the%20Whole%20Stack%20with%20Foundry%20Anvil%20and%20WireMock%20Testcontainers&summary=Forge%20invariant%20tests%20stop%20at%20the%20EVM%20boundary.%20Learn%20how%20to%20fuzz%20random%20sequences%20of%20real%20transactions%2C%20keeper%20runs%2C%20price-feed%20outages%20and%20RPC%20faults%20against%20a%20containerized%20Anvil%20node%2C%20and%20assert%20protocol%20invariants%20after%20every%20step.) ## Start the conversation Show Comments ## Related [![](/_astro/solidity-lifecycle-testing.BZoDoi4p_1u6A9p.jpg)](/solidity-lifecycle-testing-foundry-anvil/) - [Solidity](/tags/solidity/) - [Testing](/tags/testing/) - [Foundry](/tags/foundry/) - [Anvil](/tags/anvil/) - [Smart Contracts](/tags/smart-contracts/) - [Web3](/tags/web3/) ### [Mastering Solidity Lifecycle Testing with Foundry Anvil Testcontainers](/solidity-lifecycle-testing-foundry-anvil/) Learn how to implement comprehensive lifecycle tests for Solidity smart contracts and simplify complex test scenarios with Foundry Anvil Testcontainers 18 Nov, 2026 16 min read [![](/_astro/chaos-engineering.DFkfE7jN_Z2mHjmN.jpg)](/on-chain-chaos-engineering-ethereum-wiremock-anvil/) - [Testing](/tags/testing/) - [Chaos Engineering](/tags/chaos-engineering/) - [Ethereum](/tags/ethereum/) - [Anvil](/tags/anvil/) - [WireMock](/tags/wiremock/) - [EthersJS](/tags/ethersjs/) - [Nestjs](/tags/nestjs/) ### [Survive the Outage and Stop Writing Fake JSON-RPC Mocks: Real Life On-Chain Chaos Engineering for Ethereum Apps](/on-chain-chaos-engineering-ethereum-wiremock-anvil/) Put WireMock in front of a real Foundry Anvil node with Testcontainers to inject 503s, dropped connections, latency and 429s into your Ethereum app, without hand-writing a single fake JSON-RPC response. 19 Nov, 2026 14 min read [![](/_astro/github-open-source.BpYF5ln9_1UHugM.png)](/web3-ethereum-open-source/) - [Ethereum](/tags/ethereum/) - [Javascript](/tags/javascript/) - [Typescript](/tags/typescript/) - [Testcontainers](/tags/testcontainers/) - [Wiremock](/tags/wiremock/) - [Foundry](/tags/foundry/) ### [Open-Source Web3 Ethereum Projects at Hella Labs](/web3-ethereum-open-source/) Supporting the Web3 Ethereum ecosystem with open source projects, tools and test automation. 13 May, 2026 3 min read --- ## Lighthouse Reports | Hella Labs URL: https://www.hellalabs.dev/lighthouse-reports Google Lighthouse audits of hellalabs.dev on mobile and desktop: performance, accessibility, best practices, SEO and agentic browsing scores, with links to… Lighthouse is Google's open-source auditing tool, built into Chrome DevTools and PageSpeed Insights. It loads a page in a controlled lab environment, measures how quickly it renders and responds, and runs hundreds of automated checks for accessibility, security, search visibility and, most recently, how well AI agents can read and use the page. We hold our own site to the same standard we hold client front-ends to. These are unedited Lighthouse runs against the live production site; scroll down for the score summary of each device, with a link to its full interactive report. ## What Lighthouse Measures ### Performance How fast the page loads and becomes usable, from Core Web Vitals such as Largest Contentful Paint, Total Blocking Time and Cumulative Layout Shift. ### Accessibility Automated WCAG checks: color contrast, labels and names, ARIA usage, heading order and keyboard navigation. ### Best Practices Security and modern web hygiene: HTTPS, no browser console errors, no deprecated APIs and correctly sized images. ### SEO Whether search engines can crawl and understand the page: titles, meta descriptions, valid links, robots rules and mobile-friendliness. ### Agentic Browsing Lighthouse's newest category: whether AI agents can discover and operate the site, through a well-formed accessibility tree, a valid llms.txt and correct WebMCP integrations. Scores are 0–100: 90 and above is good, 50–89 needs improvement, below 50 is poor. These are lab measurements: every run uses the same emulated device and network, so results are repeatable and comparable over time, whereas real visitors' experience varies with their own hardware and connection. ## Mobile report Emulated mid-range phone on a throttled 4G connection with a slowed-down CPU, the stricter of the two runs. Audited [https://hellalabs.dev/](https://hellalabs.dev/) on November 22, 2026 with Lighthouse 13.5.0. - 100 Performance: 100 out of 100Performance - 96 Accessibility: 96 out of 100Accessibility - 100 Best Practices: 100 out of 100Best Practices - 100 SEO: 100 out of 100SEO - 100 Agentic Browsing: 100 out of 100Agentic Browsing First Contentful Paint 1.1 s Largest Contentful Paint 1.7 s Total Blocking Time 0 ms Cumulative Layout Shift 0.002 Speed Index 1.3 s [View the full mobile report](/_astro/lighthouse-mobile.B2OWmKyK.html) ## Desktop report Emulated desktop screen on a fast wired connection. Audited [https://hellalabs.dev/](https://hellalabs.dev/) on November 22, 2026 with Lighthouse 13.5.0. - 100 Performance: 100 out of 100Performance - 96 Accessibility: 96 out of 100Accessibility - 100 Best Practices: 100 out of 100Best Practices - 100 SEO: 100 out of 100SEO - 100 Agentic Browsing: 100 out of 100Agentic Browsing First Contentful Paint 0.5 s Largest Contentful Paint 0.6 s Total Blocking Time 0 ms Cumulative Layout Shift 0.002 Speed Index 0.5 s [View the full desktop report](/_astro/lighthouse-desktop.DQ9iz1zX.html) --- ## Survive the Outage and Stop Writing Fake JSON-RPC Mocks: Real Life On-Chain Chaos Engineering for Ethereum Apps | Hella Labs URL: https://www.hellalabs.dev/on-chain-chaos-engineering-ethereum-wiremock-anvil Put WireMock in front of a real Foundry Anvil node with Testcontainers to inject 503s, dropped connections, latency and 429s into your Ethereum app, without… ## Your RPC Provider Will Go Down. Will Your App? Every Ethereum app depends on a JSON-RPC endpoint it doesn’t control. Infura, Alchemy, QuickNode or your own node: at some point one of them sends back a `503`, drops a socket halfway through a response, slows to a crawl during a gas spike, or rate-limits you with a `429` at the worst possible moment. Most teams test for this in one of two ways, and both are bad: 1. **They don’t.** The happy path runs against a local node, and the first real outage is found in production. 2. **They hand-write JSON-RPC mocks.** Someone pastes a `eth_getBlockByNumber` response into a fixture, then another, then a batch array, then a mock for `eth_estimateGas`. Six months later the fixtures no longer match what a real node returns, and the tests pass while the app is broken. This article shows a third way: **real chain state from a real EVM node, with network-level chaos injected on the wire.** We’ll put [WireMock](https://wiremock.org/) in front of a [Foundry Anvil](https://getfoundry.sh/anvil/overview) node, both running as Docker containers through [Testcontainers](https://testcontainers.com/), and use it to test how a Nest.js + [ethers v6](https://docs.ethers.org/v6/) backend behaves when its RPC provider breaks. Everything here comes from a working, open-source test suite: [`test/ethers.e2e-spec.ts`](https://github.com/anataliocs/nestjs-typeorm-full-example/blob/main/test/ethers.e2e-spec.ts) in the [nestjs-typeorm-full-example](https://github.com/anataliocs/nestjs-typeorm-full-example) repo, with the full design notes in [`test/test-setup.md`](https://github.com/anataliocs/nestjs-typeorm-full-example/blob/main/test/test-setup.md). 💡 New to running Anvil in tests? Start with our guide to [Solidity lifecycle testing with Foundry Anvil Testcontainers](/solidity-lifecycle-testing-foundry-anvil/), then come back here to break things on purpose. * * * ## Why a Local Node Alone Isn’t Enough Anvil is an excellent test oracle. It runs real EVM execution, real gas accounting and real state, and it gives you cheat codes for mining, time travel, reorgs and rollbacks. If your test asks “what is the finalized block after a one-block reorg?”, Anvil gives you the true answer. What Anvil can’t do is **fail like a hosted provider fails**. It won’t send you: - an HTTP `503 Service Unavailable` - a connection reset in the middle of a response - an empty response or a truncated JSON body - 1.5 seconds of latency on one specific method - a `429 Too Many Requests` that clears up after one retry Those failures happen at the HTTP transport layer, between your app and the node. To test them you need something sitting **on the wire**, not a mock inside your JavaScript process. Client-side mocks (stubbing `provider.getBlockNumber()` in Jest) skip the very code you want to test: ethers’ HTTP transport, its batching, its retry logic and its error mapping. * * * ## The Architecture: WireMock as a Fault-Injecting Reverse Proxy The idea is simple. WireMock sits between the app and Anvil. **By default it forwards every JSON-RPC request unchanged, so Anvil produces every response.** WireMock never fakes chain data; it only injects faults, and only when a test asks it to. flowchart LR subgraph host\["Jest process (host)"\] direction TB spec\["ethers.e2e-spec.ts"\] appA\["Nest app
via: 'anvil'"\] appP\["Nest app
via: 'proxy'"\] end subgraph net\["Docker network (Testcontainers Network)"\] direction TB wm\["WireMock
/rpc"\] anvil\["anvil
alias: anvil:8545"\] wm -- "PROXY\_TO\_ANVIL
(priority 100)" --> anvil end appA -- "ETHERS\_RPC\_SERVER\_URL =
anvil.rpcUrl" --> anvil appP -- "ETHERS\_RPC\_SERVER\_URL =
wiremock.getUrl('/rpc')" --> wm spec -. "cheats / testClient
(mine, reorg, time travel)" .-> anvil spec -. "addStubs(): POST /\_\_admin/mappings
countRequests / findRequests / reset" .-> wm The spec can boot the app two ways: - **Direct** (`createApp()`): the app’s ethers provider points straight at `anvil.rpcUrl`. Used for chain-behavior tests. - **Proxied** (`createApp({ via: 'proxy' })`): the provider points at `wiremock.getUrl('/rpc')`. Used for transport-failure tests. Either way, the test drives the chain through the Anvil test client and uses the node itself as the source of truth for expected values. ### Zero EVM imitation Anvil handles state, gas and execution. You never maintain brittle fixtures for `eth_call` or `eth_estimateGas`. ### Surgical fault injection A high-priority stub breaks one JSON-RPC method. Every other call still reaches the real node. ### True network-level chaos 503s, connection resets, malformed JSON and latency hit ethers’ real HTTP transport. ### Clean assertion separation WireMock’s request journal checks client behavior (retries, payloads). Anvil checks chain state. * * * ## Step 1: Put Anvil and WireMock on One Docker Network Both containers come from Hella Labs’ open-source Testcontainers modules: - [`@hellaweb3/foundryanvil-testcontainers-nodejs`](https://www.npmjs.com/package/@hellaweb3/foundryanvil-testcontainers-nodejs) ([GitHub](https://github.com/hella-labs/foundryanvil-testcontainers-nodejs), [project page](/open-source/foundry-anvil-testcontainers/)) - [`@hellaweb3/wiremock-testcontainers-nodejs`](https://www.npmjs.com/package/@hellaweb3/wiremock-testcontainers-nodejs) ([GitHub](https://github.com/hella-labs/wiremock-testcontainers-nodejs), [project page](/open-source/wiremock-testcontainers/)) `useAnvil()` manages one Anvil node per test file. It starts it in `beforeAll`, restores a snapshot after every test, and stops it in `afterAll`. Its `start()` hook creates a [Testcontainers `Network`](https://node.testcontainers.org/features/networking/) and gives Anvil the alias `anvil`: ``` const anvil = useAnvil({ start: async () => { network = await new Network().start(); return new AnvilContainer( new AnvilOptions().account .withAccounts(3) .state.withTimestamp(GENESIS) // deterministic block dates .mining.withSlotsInAnEpoch(1) // finalized = head − 2 .logs.jsonLogFormat(), ) .withTestClient((client) => client.withAccount(0)) .withNetwork(network) .withNetworkAliases(ANVIL_ALIAS) // "anvil" .start(); }, }); ``` WireMock joins the same network, so from inside WireMock, Anvil is reachable at `http://anvil:8545`. Your test process on the host still talks to each container through its mapped port: ``` wiremock = await new WiremockContainer() .withNetwork(network) .withMapping("json-rpc/proxy-to-anvil", { json: PROXY_TO_ANVIL }) .start(); await wiremock.waitUntilReady(); ``` 💡 Keep Testcontainers versions aligned. Both `@hellaweb3/*` libraries depend on `testcontainers@^12`. If your project’s `testcontainers` or `@testcontainers/postgresql` is on a different major version, a `Network` from one copy can’t be passed to containers from the other. * * * ## Step 2: A Transparent, Low-Priority Proxy Stub The baseline stub matches everything under `/rpc` and forwards it to Anvil. It’s registered at **priority 100**, which in WireMock means low priority (lower numbers win): ``` export const RPC_PATH = "/rpc"; export const ANVIL_ALIAS = "anvil"; export const PROXY_TO_ANVIL: WiremockStubMapping = { priority: 100, request: { method: "ANY", urlPath: RPC_PATH }, response: { proxyBaseUrl: `http://${ANVIL_ALIAS}:8545`, proxyUrlPrefixToRemove: RPC_PATH, }, }; ``` With no other stubs registered, the app sees Anvil exactly as if it were connected directly. The first proxied test proves that: it mines seven blocks, reads the head and the finalized block through WireMock, and checks both against Anvil: ``` it("is transparent: real anvil data, one RPC call per request", async () => { await anvil.mine(7); const finalized = await blockAt(BigInt(7 - FINALITY_LAG)); const app = await createApp({ via: "proxy" }); await wiremock.resetRequests(); // ignore start-up network detection await request(app.getHttpServer()) .get("/v1/ethers/block-number") .expect(200) .expect({ blockNumber: 7 }); // ...finalized-block check against `finalized.hash`... expect(await wiremock.countRequests(callsTo("eth_blockNumber"))).toBe(1); const calls = await recordedRpcCalls(wiremock); expect(calls.filter((c) => c.method === "eth_getBlockByNumber").map((c) => c.params)).toEqual([ ["finalized", false], ]); }); ``` There’s no fixture anywhere in that test. The expected values come from the chain. Read more about how WireMock picks a stub in the [stub priority docs](https://wiremock.org/docs/stubbing/#stub-priority) and about forwarding in the [proxying docs](https://wiremock.org/docs/proxying/). * * * ## Step 3: Inject Faults Per Method at Runtime Every JSON-RPC request is a `POST` to the same path, so you can’t route faults by URL. Instead, a fault stub matches on the **request body**. Two small helpers do all the work: ``` /** Requests carrying a call to `method`, alone or inside a batch. */ export function callsTo(method: string): WiremockRequestCriteria { return { method: "POST", urlPath: RPC_PATH, bodyPatterns: [{ contains: `"method":"${method}"` }], }; } /** A priority-1 stub that overrides every request calling `method`. */ export function failCallsTo( method: string, response: object, extra: Record = {}, ): WiremockStubMapping { return { priority: 1, request: callsTo(method), response, ...extra }; } ``` `addStubs()` POSTs these to WireMock’s [admin API](https://wiremock.org/docs/standalone/admin-api-reference/) mid-test. Because the fault stub is priority 1, it beats the proxy for that one method and nothing else. Here’s what one fault test looks like on the wire, from boot to cleanup: sequenceDiagram autonumber participant T as Test participant A as Nest app (ethers) participant W as WireMock /rpc participant N as anvil:8545 Note over A,N: Boot: eth\_chainId has no fault stub, so it is proxied T->>A: createApp({ via: 'proxy' }) A->>W: POST /rpc {"method":"eth\_chainId"} W->>N: proxied (prefix /rpc removed) N-->>W: 0x7a69 W-->>A: 0x7a69 T->>W: addStubs(failCallsTo('eth\_blockNumber', { status: 503 })) T->>A: GET /v1/ethers/block-number A->>W: POST /rpc \[eth\_chainId, eth\_blockNumber\] Note right of W: Body contains "method":"eth\_blockNumber"
so the fault stub wins (priority 1) W-->>A: 503 Service Unavailable A-->>T: 500 Internal server error T->>W: countRequests(callsTo('eth\_blockNumber')) W-->>T: 1 (ethers did not retry) Note over T,W: afterEach: wiremock.reset() drops the stub and clears the journal From there, each failure mode is a few lines. ### HTTP 503: does the app fail cleanly, and does it retry? ``` it("fails with 500 and does not retry when the node returns 503", async () => { const app = await createApp({ via: "proxy" }); await addStubs( wiremock, failCallsTo("eth_blockNumber", { status: 503, body: "Service Unavailable" }), ); await request(app.getHttpServer()) .get("/v1/ethers/block-number") .expect(500) .expect({ statusCode: 500, message: "Internal server error" }); expect(await wiremock.countRequests(callsTo("eth_blockNumber"))).toBe(1); }); ``` The final assertion matters most. The journal shows that ethers sent the call **exactly once**. If you expected a retry policy, this test tells you that you don’t have one. ### Dropped connections and empty responses WireMock’s [simulated faults](https://wiremock.org/docs/simulating-faults/) break the socket itself: ``` it.each(["CONNECTION_RESET_BY_PEER", "EMPTY_RESPONSE"])( "fails with 500 on a %s network fault", async (fault) => { const app = await createApp({ via: "proxy" }); await addStubs(wiremock, failCallsTo("eth_blockNumber", { fault })); await request(app.getHttpServer()).get("/v1/ethers/block-number").expect(500); }, ); ``` ### A malformed JSON-RPC body, with the blast radius checked ``` await addStubs( wiremock, failCallsTo("eth_getBlockByNumber", { status: 200, headers: { "Content-Type": "application/json" }, body: '{"jsonrpc":"2.0",', }), ); await request(app.getHttpServer()).get("/v1/ethers/finalized-block").expect(500); await request(app.getHttpServer()) .get("/v1/ethers/block-number") .expect(200) .expect({ blockNumber: 2 }); // other routes unaffected ``` ### Latency on top of real data Spread the proxy response into the fault stub and add a delay. The app gets real Anvil data, just late: ``` await addStubs( wiremock, failCallsTo("eth_blockNumber", { ...PROXY_TO_ANVIL.response, fixedDelayMilliseconds: 1_500, }), ); ``` ### Rate limiting that recovers A [stateful scenario](https://wiremock.org/docs/stateful-behaviour/) returns a `429` once, then switches back to proxying: ``` await addStubs( wiremock, failCallsTo( "eth_blockNumber", { status: 429, body: "Too Many Requests" }, { scenarioName: "rate-limit", requiredScenarioState: "Started", newScenarioState: "recovered", }, ), ); await request(app.getHttpServer()) .get("/v1/ethers/block-number") .expect(200) .expect({ blockNumber: 6 }); expect(await wiremock.countRequests(callsTo("eth_blockNumber"))).toBe(2); ``` Two requests in the journal: ethers retried once after the `429` and got real data back. ### Partial outages You can also fault several methods at once and check that health reporting tells the truth: ``` await addStubs( wiremock, failCallsTo("eth_blockNumber", { status: 503 }), failCallsTo("eth_getBlockByNumber", { status: 503 }), ); const app = await createApp({ via: "proxy" }); await request(app.getHttpServer()).get("/v1/ethers/block-number").expect(500); await request(app.getHttpServer()).get("/v1/ethers/server-status").expect(200).expect("Connected"); // is that really what you want your status page to say? ``` This is the kind of finding chaos testing exists for. The status endpoint reports `Connected` while every block call fails. Now it’s a documented, tested behavior you can decide to change, not a surprise during an incident. * * * ## Step 4: Strict Isolation Between Tests Chaos tests are only useful if one test’s chaos can’t leak into the next. Two mechanisms handle that: - **Chain state:** `useAnvil` restores an Anvil snapshot after every test, so mined blocks, reorgs and time travel never carry over. - **Fault state:** `afterEach` closes every Nest app and calls `wiremock.reset()`. That removes runtime fault stubs (the proxy stub from `withMapping` stays), resets scenarios and clears the request journal. ``` afterEach(async () => { sockets.splice(0).forEach((socket) => socket.terminate()); await Promise.all(apps.splice(0).map((app) => app.close())); await wiremock.reset(); // drop runtime fault stubs, clear the journal }); ``` * * * ## Gotchas We Hit (So You Don’t Have To) - **ethers v6 batches requests.** After network detection, ethers sends an `eth_chainId` re-check in the same JSON array as most calls. Matching on `contains: '"method":"…"'` works for both single and batched bodies, because ethers serializes JSON without whitespace. A fault hits the whole batch, just as a real HTTP failure would. If you need stricter matching, WireMock’s [`matchesJsonPath`](https://wiremock.org/docs/request-matching/#json-path) can do it, but your expression must handle both object and array payloads. - **Never fault `eth_chainId` at boot.** The app calls `getNetwork()` on startup. If `eth_chainId` never succeeds, ethers retries network detection forever and the app never boots. - **Boot traffic is in the journal.** Call `wiremock.resetRequests()` after `createApp()` when you assert on total call counts. - **Preserve JSON-RPC ids in custom error bodies.** HTTP-level faults (503, resets) don’t need an id. If you return a JSON-RPC `error` object instead, use [response templating](https://wiremock.org/docs/response-templating/) (`{{jsonPath request.body '$.id'}}`) so the client can match the error to its request. - **Pin finality.** Anvil reports `finalized = max(0, head − 2 · slotsInAnEpoch)`. Setting `.mining.withSlotsInAnEpoch(1)` makes the finalized block lag the head by exactly two blocks. - **WebSockets bypass WireMock.** WireMock proxies HTTP/HTTPS only. If your app uses `eth_subscribe` over `ws://`, those connections need to go straight to Anvil or be tested separately. * * * ## Adding Your Own Fault Test Once the helpers exist, a new failure scenario is about ten lines: ``` it("fails with 500 when eth_getBlockByNumber drops the connection", async () => { const app = await createApp({ via: "proxy" }); await addStubs( wiremock, failCallsTo("eth_getBlockByNumber", { fault: "CONNECTION_RESET_BY_PEER" }), ); await request(app.getHttpServer()).get("/v1/ethers/finalized-block").expect(500); expect(await wiremock.countRequests(callsTo("eth_getBlockByNumber"))).toBe(1); }); ``` Run the suite with Docker running: ``` pnpm test:e2e ``` The same suite also covers the app’s REST, GraphQL, WebSocket and Server-Sent Events APIs against Anvil directly. For the streaming side of that backend, see [On-Chain Ethereum Data via WebSockets with Ethers.js, RxJS and Nest.js](/websocket-sse-graphql-nestjs-thinclient/). * * * ## Resources - **Example suite:** [anataliocs/nestjs-typeorm-full-example](https://github.com/anataliocs/nestjs-typeorm-full-example) ([`ethers.e2e-spec.ts`](https://github.com/anataliocs/nestjs-typeorm-full-example/blob/main/test/ethers.e2e-spec.ts), [`test-setup.md`](https://github.com/anataliocs/nestjs-typeorm-full-example/blob/main/test/test-setup.md)) - **Anvil Testcontainers:** [npm](https://www.npmjs.com/package/@hellaweb3/foundryanvil-testcontainers-nodejs) · [GitHub](https://github.com/hella-labs/foundryanvil-testcontainers-nodejs) · [Project overview](/open-source/foundry-anvil-testcontainers/) - **WireMock Testcontainers:** [npm](https://www.npmjs.com/package/@hellaweb3/wiremock-testcontainers-nodejs) · [GitHub](https://github.com/hella-labs/wiremock-testcontainers-nodejs) · [Project overview](/open-source/wiremock-testcontainers/) - **Docs:** [Foundry Anvil](https://getfoundry.sh/anvil/overview) · [WireMock](https://wiremock.org/docs/) · [Testcontainers for Node.js](https://node.testcontainers.org/) · [ethers v6](https://docs.ethers.org/v6/) · [NestJS testing](https://docs.nestjs.com/fundamentals/testing) * * * ## How Hella Labs Can Help We built these libraries because our clients kept finding RPC failures in production. If you’d rather have this running in your pipeline next sprint than build it yourself, here’s what we do: ### DevOps & Test Automation Chaos and end-to-end test suites built on Anvil and WireMock, wired into CI/CD so every pull request faces a simulated outage before your users do. [See the service](/services/devops-test-automation/) ### Web3 Tooling & SDKs Resilient RPC clients, retry and fallback strategies, and developer SDKs designed around how providers actually fail. [See the service](/services/web3-tooling-sdks/) ### Technical Articles Deep-dive tutorials like this one, with working example code, written for your protocol’s developer audience. [See the service](/services/technical-articles/) ### dApp Front-Ends Front-ends that degrade gracefully when the chain is slow or unreachable, instead of hanging on a spinner. [See the service](/services/dapp-web-front-end/) ### Find out how your app handles an outage, before your users do. In a short engagement we stand up an Anvil + WireMock chaos suite against **your** backend, run it through 503s, dropped connections, latency spikes and rate limits, and hand you a report of every failure mode we find, plus the tests that prove each fix. **No fake JSON-RPC fixtures, no guesswork.** Just real chain state, real failures and a CI pipeline that catches regressions for good. [Book a Resilience Audit](/contact/) [Explore All Service Offerings →](/web3-consultant-service-offerings/) * * * **Thanks for reading!** If this helped, star [WireMock Testcontainers](https://github.com/hella-labs/wiremock-testcontainers-nodejs) and [Foundry Anvil Testcontainers](https://github.com/hella-labs/foundryanvil-testcontainers-nodejs) on GitHub and share the article with your team. _Part of the Hella Labs commitment to open-source excellence and Web3 infrastructure._ Share: - [](https://twitter.com/intent/tweet?text=Survive%20the%20Outage%20and%20Stop%20Writing%20Fake%20JSON-RPC%20Mocks%3A%20Real%20Life%20On-Chain%20Chaos%20Engineering%20for%20Ethereum%20Apps&url=https%3A%2F%2Fwww.hellalabs.dev%2Fon-chain-chaos-engineering-ethereum-wiremock-anvil%2F) - [](https://www.linkedin.com/shareArticle?mini=true&url=https%3A%2F%2Fwww.hellalabs.dev%2Fon-chain-chaos-engineering-ethereum-wiremock-anvil%2F&title=Survive%20the%20Outage%20and%20Stop%20Writing%20Fake%20JSON-RPC%20Mocks%3A%20Real%20Life%20On-Chain%20Chaos%20Engineering%20for%20Ethereum%20Apps&summary=Put%20WireMock%20in%20front%20of%20a%20real%20Foundry%20Anvil%20node%20with%20Testcontainers%20to%20inject%20503s%2C%20dropped%20connections%2C%20latency%20and%20429s%20into%20your%20Ethereum%20app%2C%20without%20hand-writing%20a%20single%20fake%20JSON-RPC%20response.) ## Start the conversation Show Comments ## Related [![](/_astro/onchain-data-2.0cV1fDea_ZhrxY5.jpg)](/sse-graphql-ethereum-nestjs-thinclient/) - [Nestjs](/tags/nestjs/) - [Ethereum](/tags/ethereum/) - [EthersJS](/tags/ethersjs/) - [RxJS](/tags/rxjs/) - [Server-Sent Events](/tags/server-sent-events/) - [GraphQL](/tags/graphql/) ### [On-Chain Ethereum Data via Server-Sent Events and GraphQL with Ethers.js, RxJS and Nest.js](/sse-graphql-ethereum-nestjs-thinclient/) Re-use one Nest.js service layer to stream finalized Ethereum blocks over Server-Sent Events and serve block queries over GraphQL, with ultra-thin vanilla JS clients and RxJS Observables. 23 Nov, 2026 17 min read [![](/_astro/solidity-e2e-invariant-testing.C75b-0rk_Z14vja5.jpg)](/e2e-invariant-testing-solidity-anvil-wiremock/) - [Solidity](/tags/solidity/) - [Testing](/tags/testing/) - [Invariant Testing](/tags/invariant-testing/) - [Fuzzing](/tags/fuzzing/) - [Foundry](/tags/foundry/) - [Anvil](/tags/anvil/) - [WireMock](/tags/wiremock/) ### [End-to-End Invariant Testing for Solidity: Fuzz the Whole Stack with Foundry Anvil and WireMock Testcontainers](/e2e-invariant-testing-solidity-anvil-wiremock/) Forge invariant tests stop at the EVM boundary. Learn how to fuzz random sequences of real transactions, keeper runs, price-feed outages and RPC faults against a containerized Anvil node, and assert protocol invariants after every step. 21 Nov, 2026 27 min read [![](/_astro/onchain-data-1.DuOJwwRh_2ap8O6.jpg)](/websocket-sse-graphql-nestjs-thinclient/) - [Nestjs](/tags/nestjs/) - [Ethereum](/tags/ethereum/) - [EthersJS](/tags/ethersjs/) - [RxJS](/tags/rxjs/) - [WebSockets](/tags/websockets/) ### [On-Chain Ethereum Data via WebSockets with Ethers.js, RxJS and Nest.js](/websocket-sse-graphql-nestjs-thinclient/) Build more responsive, snappy, performant dApps with reactive streams with RxJS Observables, ethers.js and the power of a Nest.js backend 16 Jan, 2026 14 min read --- ## Open Source Projects | Hella Labs URL: https://www.hellalabs.dev/open-source Enterprise-grade test automation tools built by engineers who understand that quality and security aren't optional in Web3. ## Building the Foundation for Reliable Web3 Development At Hella Labs, we don’t just talk about quality and security—we build the tools that make them achievable. Our open-source contributions reflect our core engineering philosophy: **complex systems demand robust testing infrastructure**. In an industry where smart contract vulnerabilities can cost millions and API failures can halt operations, we’ve created test automation tools that development teams rely on daily. These aren’t side projects—they’re **production-grade solutions** born from real-world challenges in Web3 and enterprise software development. * * * ## Our Open Source Projects [![](/_astro/foundry-anvil.iR3SMHVx_Z1x8f0z.jpg)](/open-source/foundry-anvil-testcontainers/) ### [Foundry Anvil Testcontainers for Node.js](/open-source/foundry-anvil-testcontainers/) **Enterprise-grade test automation for Ethereum smart contract development.** Spin up isolated Foundry Anvil instances in seconds for truly reproducible blockchain testing. Zero configuration, full Testcontainers integration, and CI/CD ready out of the box. - **80% reduction** in test setup time - Near-zero flaky tests from environment drift - Full TypeScript support with Viem integration [GitHub](https://github.com/hella-labs/foundryanvil-testcontainers-nodejs) [NPM](https://www.npmjs.com/package/@hellaweb3/foundryanvil-testcontainers-nodejs) [Learn More](/open-source/foundry-anvil-testcontainers/) [![](/_astro/wiremock-testcontainers.BSrvmkeJ_H3VIh.jpg)](/open-source/wiremock-testcontainers/) ### [WireMock Testcontainers for Node.js](/open-source/wiremock-testcontainers/) **Professional API mocking for reliable integration testing.** Container-isolated WireMock instances that eliminate dependencies on external services. Test payment integrations, authentication flows, and third-party APIs with complete control and zero flakiness. - **90% faster** integration test execution - Complete isolation from external services - Flexible stub registration and verification [GitHub](https://github.com/hella-labs/wiremock-testcontainers-nodejs) [NPM](https://www.npmjs.com/package/@hellaweb3/wiremock-testcontainers-nodejs) [Learn More](/open-source/wiremock-testcontainers/) * * * ## Why This Demonstrates Our Excellence ### Quality is Non-Negotiable These tools exist because we’ve seen the cost of inadequate testing firsthand. We build infrastructure that makes comprehensive testing practical, not aspirational. ### Security Through Reliability Reproducible tests in isolated environments mean vulnerabilities get caught before deployment. No shared state, no race conditions, no surprises in production. ### Engineering Depth Creating developer tools requires understanding not just the technical implementation, but the workflows, pain points, and cognitive load of the teams using them. ### Community Investment We contribute these tools freely because rising tides lift all boats. A stronger testing ecosystem means more secure applications for everyone. * * * ## What This Means for Your Project If we can build test automation tools that: - Eliminate flaky tests across distributed blockchain networks - Integrate seamlessly with modern CI/CD pipelines - Handle the complexity of containerized environments - Support teams building mission-critical Web3 applications **Imagine what we can do when we focus exclusively on your specific challenges.** * * * ## Our Service Offerings The engineering principles behind these open-source tools power our consulting services: ### DevOps & Test Automation Comprehensive testing strategies, CI/CD pipeline optimization, and infrastructure automation that scales with your team. ### Web3 Development Smart contract development, dApp front-ends, and blockchain integration with security and testing built-in from day one. ### Technical Leadership Fractional CTO services, architecture review, and engineering process optimization for startups and scale-ups. ### Developer Relations & Technical Content Turn complex technical achievements into compelling narratives that resonate with developer communities. [Explore All Services →](/web3-consultant-service-offerings/) * * * ### Ship with confidence. Our automation strategies and Web3 expertise reduce your time-to-market while increasing the reliability of your protocol. Whether you’re launching a new project or scaling existing infrastructure, we bring Silicon Valley expertise with global cost-effectiveness. [Get a DevOps Audit](/contact/) --- ## Foundry Anvil Testcontainers for Node.js | Hella Labs URL: https://www.hellalabs.dev/open-source/foundry-anvil-testcontainers Enterprise-grade test automation for Web3 development. Simplify your Ethereum smart contract testing with containerized Foundry Anvil instances. ## Overview The **Foundry Anvil Testcontainers NodeJS Module** brings enterprise-grade test automation to Web3 development. This powerful module provides seamless integration between Testcontainers and Foundry’s Anvil local Ethereum node, enabling developers to run isolated, reproducible integration tests for smart contracts and decentralized applications. [![GitHub Stars](https://img.shields.io/github/stars/hella-labs/foundryanvil-testcontainers-nodejs?style=social)](https://github.com/hella-labs/foundryanvil-testcontainers-nodejs)[![NPM Downloads](https://img.shields.io/npm/dm/@hellaweb3/foundryanvil-testcontainers-nodejs)](https://www.npmjs.com/package/@hellaweb3/foundryanvil-testcontainers-nodejs)[![Code Coverage](https://codecov.io/gh/hella-labs/foundryanvil-testcontainers-nodejs/graph/badge.svg?token=WU523RPLO1)](https://codecov.io/gh/hella-labs/foundryanvil-testcontainers-nodejs)![TypeScript](https://img.shields.io/badge/TypeScript-100%25-blue) ### Key Features - **Zero Configuration Setup** - Spin up isolated Anvil instances with a single line of code - **Full Testcontainers Integration** - Leverages the battle-tested Testcontainers framework - **Parallel Test Execution** - Run multiple test suites simultaneously with isolated blockchain states - **CI/CD Ready** - Works seamlessly in GitHub Actions, GitLab CI, and other automation pipelines - **TypeScript Support** - Fully typed for enhanced developer experience - **Custom Network Configuration** - Configure block time, chain ID, and other network parameters - **Snapshot & Forking Support** - Test against mainnet forks or custom blockchain snapshots **[View Full Documentation](https://hellalabs.dev/foundryanvil-testcontainers-nodejs/)** Complete task guides, API reference, and working examples * * * ## Why This Matters In the rapidly evolving Web3 ecosystem, **quality and security are non-negotiable**. Smart contract bugs can lead to millions in losses. Our Foundry Anvil Testcontainers module reflects our commitment to building tools that: - **Eliminate Environment Drift** - Every test runs in a pristine, identical environment - **Accelerate Development Cycles** - Developers spend less time on test setup and more time building - **Improve Test Reliability** - Consistent, reproducible tests mean fewer false positives - **Enable Continuous Testing** - Seamless CI/CD integration ensures quality at every commit * * * ## Installation ``` npm install @hellaweb3/foundryanvil-testcontainers-nodejs ``` or ``` yarn add @hellaweb3/foundryanvil-testcontainers-nodejs ``` ## Quick Start ``` import { FoundryAnvilContainer } from "@hellaweb3/foundryanvil-testcontainers-nodejs"; // Start an Anvil container const container = await new FoundryAnvilContainer().start(); // Get the RPC endpoint const rpcUrl = container.getRpcUrl(); // Use with your favorite Web3 library const provider = new ethers.JsonRpcProvider(rpcUrl); // Run your tests... // Cleanup await container.stop(); ``` * * * ## Technical Excellence This project showcases our engineering philosophy: - **Comprehensive Test Coverage** - Dogfooding our own tools to ensure reliability - **Modern TypeScript Architecture** - Type-safe, maintainable, and extensible - **Performance Optimized** - Fast container startup and minimal resource overhead - **Extensive Documentation** - Clear examples and API references - **Active Maintenance** - Regular updates to support the latest Foundry releases ### Test Coverage [![Codecov sunburst graph of test coverage by file](https://codecov.io/gh/hella-labs/foundryanvil-testcontainers-nodejs/graphs/sunburst.svg?token=WU523RPLO1)](https://codecov.io/gh/hella-labs/foundryanvil-testcontainers-nodejs) Every commit runs the full test suite against real Anvil containers, and coverage is reported to [Codecov](https://codecov.io/gh/hella-labs/foundryanvil-testcontainers-nodejs) on every push. The sunburst maps coverage across the codebase: the center is the whole project, each ring drills into a directory and then individual files, and color shows how well each slice is covered. Coverage is public and checked in CI, so you can see exactly how well-tested the module is before you put it in your own pipeline. * * * ## Real-World Impact Development teams using this module report: - **80% reduction** in test environment setup time - **Near-zero** flaky tests due to environment inconsistencies - **Seamless onboarding** for new developers joining Web3 projects * * * ## Code Examples ### Complete Test Example A full test suite showing the power of the module: ``` import { AnvilContainer, AnvilOptions, Hardfork, useAnvil, } from "@hellaweb3/foundryanvil-testcontainers-nodejs"; import { parseEther } from "viem"; const options = new AnvilOptions().account .withAccounts(5) .withBalance(1_000) // ETH per dev account .evm.withChainId(1337) .withHardfork(Hardfork.Cancun) .logs.quiet(); // Starts in beforeAll, stops in afterAll, restores the state after every test. const anvil = useAnvil( new AnvilContainer(options).withTestClient((client) => client.withAccount(0)), ); it("sends Ether", async () => { const [, bob] = await anvil.addresses(); // No `account` needed: dev account 0 is the typed default signer. const receipt = await anvil.confirm( anvil.testClient.sendTransaction({ to: bob, value: parseEther("1") }), ); expect(receipt.status).toBe("success"); expect(await anvil.testClient.getChainId()).toBe(1337); }); it("manipulates the chain fluently", async () => { const whale = "0x1111111111111111111111111111111111111111"; await anvil.cheats .setBalanceEther(whale, 1_000) .impersonate(whale) .increaseTime({ days: 7 }) .mine(); expect(await anvil.getBalance(whale)).toBe(parseEther("1000")); }); ``` ### Impersonate Accounts and Fund Whales Perfect for testing complex DeFi scenarios: ``` // Act as any address and fund it instantly const whale = "0x1111111111111111111111111111111111111111"; await anvil.cheats.setBalanceEther(whale, 1_000).impersonate(whale).mine(); // Now execute transactions as the whale await anvil.testClient.sendTransaction({ account: whale, to: recipient, value: parseEther("100"), }); ``` ### Time Travel and Block Control Fast-forward time to test time-dependent contracts: ``` // Jump 7 days into the future await anvil.cheats.increaseTime({ days: 7 }).mine(); // Set exact timestamps and control block building await anvil.cheats.setNextBlockTimestamp(futureTimestamp).mine({ blocks: 10 }); ``` ### Fork Mainnet for Testing Test against real mainnet state: ``` const options = new AnvilOptions().fork.withUrl(mainnetRpcUrl).fork.withBlockNumber(latestBlock); const anvil = await new AnvilContainer(options).start(); // Now you're working with a local fork of mainnet // Make any changes without affecting the real chain ``` ### Mock Smart Contract Dependencies Replace contract code on the fly: ``` // Deploy mock code at a specific address await anvil.cheats.setCode(contractAddress, mockBytecode).mine(); // Perfect for testing integrations without dependencies ``` ### Real-World Use Cases #### DeFi Protocol Testing Fork mainnet and impersonate whales to test swaps, lending, and liquidations against real on-chain liquidity without spending a single wei. #### Security & Exploit Reproduction Recreate attack scenarios at a pinned block to verify patches and regression-test fixes before they reach production. #### Time-Dependent Contracts Fast-forward time to test vesting schedules, staking rewards, timelocks, and governance voting periods in milliseconds. #### dApp Backend Integration Run your indexers, relayers, and backend services against a disposable chain in CI, with a fresh, identical state for every suite. * * * ## Resources & Documentation #### Full Documentation Complete task guides, tutorials, and API reference for every container option and cheat. [View Docs →](https://hellalabs.dev/foundryanvil-testcontainers-nodejs/) #### NPM Package Install via npm or yarn. MIT licensed with full TypeScript support and Viem integration. [View on NPM →](https://www.npmjs.com/package/@hellaweb3/foundryanvil-testcontainers-nodejs) #### GitHub Repository Source code, examples, and contribution guidelines. PRs welcome! [View on GitHub →](https://github.com/hella-labs/foundryanvil-testcontainers-nodejs) #### Issues & Support Report bugs, request features, or get help with Docker, forking, and Anvil configuration. [Open an Issue →](https://github.com/hella-labs/foundryanvil-testcontainers-nodejs/issues) **Additional Resources:** - [Foundry Book: Anvil](https://book.getfoundry.sh/anvil/) - Learn about Anvil’s local node and cheatcode capabilities - [Testcontainers for Node.js](https://node.testcontainers.org/) - Understand the underlying container framework * * * ### Ship with confidence. Our automation strategies reduce your time-to-market while increasing the reliability of your protocol. This open-source project is just a glimpse of what we can deliver for your team. [Get a DevOps Audit](/contact/) * * * _Part of the Hella Labs commitment to open-source excellence and Web3 infrastructure._ --- ## WireMock Testcontainers for Node.js | Hella Labs URL: https://www.hellalabs.dev/open-source/wiremock-testcontainers Professional API mocking for Node.js testing. Containerized WireMock integration for reliable, reproducible integration tests. ## Overview The **WireMock Testcontainers for Node.js** module brings professional-grade API mocking to the Node.js ecosystem. By combining the power of WireMock with Testcontainers, this tool enables developers to create robust, isolated integration tests that mock external HTTP dependencies with precision and reliability. [![GitHub Stars](https://img.shields.io/github/stars/hella-labs/wiremock-testcontainers-nodejs?style=social)](https://github.com/hella-labs/wiremock-testcontainers-nodejs)[![NPM Downloads](https://img.shields.io/npm/dm/@hellaweb3/wiremock-testcontainers-nodejs)](https://www.npmjs.com/package/@hellaweb3/wiremock-testcontainers-nodejs)[![Code Coverage](https://codecov.io/gh/hella-labs/wiremock-testcontainers-nodejs/graph/badge.svg?token=Z8O1KEH03J)](https://codecov.io/gh/hella-labs/wiremock-testcontainers-nodejs)![TypeScript](https://img.shields.io/badge/TypeScript-100%25-blue) ### Key Features - **[Fluent, Typed Builder](https://hellalabs.dev/wiremock-testcontainers-nodejs/docs/guides/registering-stubs)** - Register stubs from directories, files, npm packages or inline objects – validated before Docker starts - **[Fast Test Isolation](https://hellalabs.dev/wiremock-testcontainers-nodejs/docs/guides/test-isolation)** - One container per suite; `reset()` restores stubs, scenarios and journal in milliseconds - **[Request Verification](https://hellalabs.dev/wiremock-testcontainers-nodejs/docs/guides/verifying-requests)** - Assert on what your code actually sent with `countRequests()` and `findRequests()` - **[WireMock Extensions](https://hellalabs.dev/wiremock-testcontainers-nodejs/docs/extensions/java-extensions)** - Load compiled extension JARs with typed stub helpers – no JDK needed - **[No Docker? Develop Anyway](https://hellalabs.dev/wiremock-testcontainers-nodejs/docs/guides/running-without-docker)** - Serve every container from a local WireMock JVM for development - **Response Templating** - Dynamic responses using Handlebars templates - **Stateful Scenarios** - Model complex multi-step API interactions - **TypeScript First** - Built with TypeScript for superior type safety and IntelliSense **[View Full Documentation](https://hellalabs.dev/wiremock-testcontainers-nodejs/)** - Complete guides, API reference, and working examples * * * ## Why This Matters Modern applications depend on numerous external APIs and services. Testing these integrations reliably requires **precision, control, and consistency**. Our WireMock Testcontainers module demonstrates our dedication to: - **Test Reliability** - No more flaky tests due to network issues or external service downtime - **Development Velocity** - Test without waiting for staging environments or third-party sandbox APIs - **Security Best Practices** - Test against realistic scenarios including error conditions and edge cases - **Team Productivity** - Developers can work offline with full testing capabilities * * * ## Installation ``` npm install @hellaweb3/wiremock-testcontainers-nodejs ``` or ``` yarn add @hellaweb3/wiremock-testcontainers-nodejs ``` ## Complete Test Suite Example Here’s a real-world example showing how to set up WireMock for your entire test suite: ``` import { afterAll, afterEach, beforeAll, expect, it } from "vitest"; // or Jest import { type StartedWiremockContainer, WiremockContainer, } from "@hellaweb3/wiremock-testcontainers-nodejs"; import { PaymentsClient } from "../app/payments-client"; // the code under test let wiremock: StartedWiremockContainer; beforeAll(async () => { wiremock = await new WiremockContainer() .withMappings("./__mocks__/wiremock") // mappings/ + __files/ .start(); await wiremock.waitUntilReady(); }, 120_000); // the first image pull can be slow afterEach(() => wiremock.reset()); // pristine stubs, empty journal – no restart afterAll(() => wiremock?.stop()); it("lists the recorded payments", async () => { const page = await new PaymentsClient(wiremock.getUrl()).list(); expect(page.meta.totalItems).toBe(2); expect(await wiremock.countRequests({ method: "GET", url: "/payments" })).toBe(1); }); ``` 💡 **Performance Tip:** Notice the `reset()` call in `afterEach` - this restores pristine stubs and empties the request journal without restarting the container, making your test suite dramatically faster. [Learn more about test isolation →](https://hellalabs.dev/wiremock-testcontainers-nodejs/docs/guides/test-isolation) * * * ## Engineering Excellence This project exemplifies our commitment to quality software engineering: - **Battle-Tested Architecture** - Built on the proven WireMock and Testcontainers foundations - **Comprehensive Testing** - Extensive test suite ensuring reliability - **Clean API Design** - Intuitive, developer-friendly interfaces - **Performance Optimized** - Fast container lifecycle with minimal overhead - **Production-Ready** - Used in real-world projects with demanding requirements - **Well-Documented** - Clear examples covering common use cases ### Test Coverage [![Codecov sunburst graph of test coverage by file](https://codecov.io/gh/hella-labs/wiremock-testcontainers-nodejs/graphs/sunburst.svg?token=Z8O1KEH03J)](https://codecov.io/gh/hella-labs/wiremock-testcontainers-nodejs) Every commit runs the full test suite against real WireMock containers, and coverage is reported to [Codecov](https://codecov.io/gh/hella-labs/wiremock-testcontainers-nodejs) on every push. The sunburst maps coverage across the codebase: the center is the whole project, each ring drills into a directory and then individual files, and color shows how well each slice is covered. Coverage is public and checked in CI, so you can see exactly how well-tested the module is before you put it in your own pipeline. * * * ## Advanced Features & Use Cases ### Registering Stubs from Multiple Sources The fluent builder API lets you register stubs from various sources: ``` await new WiremockContainer() .withMappings("./__mocks__/wiremock") // from recorded sessions .withMappingsFromFile("./stripe-stubs.json") // from individual files .withMappingsFromPackage("@acme/api-mocks") // from npm packages .withMapping({ // or inline request: { method: "POST", url: "/webhook" }, response: { status: 201 }, }) .start(); ``` [**Explore stub registration options →**](https://hellalabs.dev/wiremock-testcontainers-nodejs/docs/guides/registering-stubs) ### Request Verification Assert that your code made the correct HTTP calls: ``` // Count specific requests const count = await wiremock.countRequests({ method: "POST", urlPathPattern: "/api/payments/.*", }); // Find and inspect requests const requests = await wiremock.findRequests({ method: "GET", url: "/users/123", }); ``` [**Learn about request verification →**](https://hellalabs.dev/wiremock-testcontainers-nodejs/docs/guides/verifying-requests) ### Real-World Use Cases #### Payment Gateway Testing Mock Stripe, PayPal, or Square APIs to test payment flows without hitting real endpoints or incurring transaction fees. #### OAuth & Authentication Simulate OAuth providers and authentication services to test login flows, token refresh, and error scenarios. #### Microservices Integration Validate service-to-service communication patterns in isolation before integration, including failure scenarios. #### Third-Party API Contracts Ensure your code correctly handles API contracts from external services, including edge cases and version changes. * * * ## Real-World Benefits Teams integrating this module experience: - **90% faster** integration test execution compared to hitting real APIs - **Zero dependency** on external service availability during testing - **Complete control** over edge cases, error conditions, and timeout scenarios - **Simplified CI/CD** with no need for complex staging environment coordination * * * ## Resources & Documentation #### Full Documentation Complete guides, tutorials, and API reference with tested examples that cannot drift from the actual codebase. [View Docs →](https://hellalabs.dev/wiremock-testcontainers-nodejs/) #### API Reference Detailed API documentation for all container methods, stub registration, and verification functions. [API Docs →](https://hellalabs.dev/wiremock-testcontainers-nodejs/docs/api) #### Working Examples Real, runnable examples covering quick start, advanced features, and common integration patterns. [View Examples →](https://github.com/hella-labs/wiremock-testcontainers-nodejs/tree/main/examples) #### NPM Package Install via npm or yarn. MIT licensed with full TypeScript support and no peer dependencies. [View on NPM →](https://www.npmjs.com/package/@hellaweb3/wiremock-testcontainers-nodejs) #### GitHub Repository Source code, issue tracking, and contribution guidelines. PRs welcome! [View on GitHub →](https://github.com/hella-labs/wiremock-testcontainers-nodejs) #### Troubleshooting Common issues, solutions, and tips for Docker, networking, and WireMock configuration. [Troubleshooting →](https://hellalabs.dev/wiremock-testcontainers-nodejs/docs/reference/troubleshooting) **Additional Resources:** - [WireMock Official Documentation](http://wiremock.org/docs/) - Learn about WireMock’s powerful stubbing and matching capabilities - [Testcontainers for Node.js](https://node.testcontainers.org/) - Understand the underlying container framework * * * ### Need a high-performance testing infrastructure? These open-source contributions represent just a fraction of our expertise in test automation, DevOps, and software quality engineering. We help teams implement comprehensive testing strategies that accelerate delivery while maintaining the highest quality standards. [Contact Us for a Consultation](/contact/) * * * _Created with precision by Hella Labs - where quality meets innovation._ --- ## Topic Zero Blog, Page 2 | Hella Labs URL: https://www.hellalabs.dev/page/2 Page 2 of the Topic Zero Blog: articles on Web3, Ethereum, test automation and developer tooling from Hella Labs. # Topic Zero Blog, Page 2 [![](/_astro/solidity-lifecycle-testing.BZoDoi4p_1u6A9p.jpg)](/solidity-lifecycle-testing-foundry-anvil/) - [Solidity](/tags/solidity/) - [Testing](/tags/testing/) - [Foundry](/tags/foundry/) - [Anvil](/tags/anvil/) - [Smart Contracts](/tags/smart-contracts/) - [Web3](/tags/web3/) ### [Mastering Solidity Lifecycle Testing with Foundry Anvil Testcontainers](/solidity-lifecycle-testing-foundry-anvil/) Learn how to implement comprehensive lifecycle tests for Solidity smart contracts and simplify complex test scenarios with Foundry Anvil Testcontainers 18 Nov, 2026 16 min read [![](/_astro/github-open-source.BpYF5ln9_1UHugM.png)](/web3-ethereum-open-source/) - [Ethereum](/tags/ethereum/) - [Javascript](/tags/javascript/) - [Typescript](/tags/typescript/) - [Testcontainers](/tags/testcontainers/) - [Wiremock](/tags/wiremock/) - [Foundry](/tags/foundry/) ### [Open-Source Web3 Ethereum Projects at Hella Labs](/web3-ethereum-open-source/) Supporting the Web3 Ethereum ecosystem with open source projects, tools and test automation. 13 May, 2026 3 min read [![](/_astro/onchain-data-1.DuOJwwRh_2ap8O6.jpg)](/websocket-sse-graphql-nestjs-thinclient/) - [Nestjs](/tags/nestjs/) - [Ethereum](/tags/ethereum/) - [EthersJS](/tags/ethersjs/) - [RxJS](/tags/rxjs/) - [WebSockets](/tags/websockets/) ### [On-Chain Ethereum Data via WebSockets with Ethers.js, RxJS and Nest.js](/websocket-sse-graphql-nestjs-thinclient/) Build more responsive, snappy, performant dApps with reactive streams with RxJS Observables, ethers.js and the power of a Nest.js backend 16 Jan, 2026 14 min read [![](/_astro/css-animations-2.DpBqQg1V_Z2h3aIo.jpg)](/pure-css-animations/) - [CSS-tricks](/tags/css-tricks/) - [Animation](/tags/animation/) ### [Pure CSS Animated Gradient Background and More!](/pure-css-animations/) You can do amazing things with pure CSS nowadays, including animations without any Javascript. 05 Aug, 2025 18 min read --- ## Pure CSS Animated Gradient Background and More! | Hella Labs URL: https://www.hellalabs.dev/pure-css-animations You can do amazing things with pure CSS nowadays, including animations without any Javascript. ## CSS Tricks - Pure CSS Animated Gradient Background and More Let’s take a look at how to create a animated background with no Javascript and just plain CSS. 💡 Keep your code simple & manageable, with super fast page loads leveraging Pure CSS animations. > The best code is no code at all. > > \- Jeff Atwood(Founder of StackOverflow) * * * ## Live Example on CodePen ### Animated Gradient Background Now let’s check out a live example on [CodePen](https://codepen.io/anataliocs/pen/KwdWQqB)! 💡 [CodePen](https://codepen.io) is an amazing free resource for developers! Check out [CodePen Challenges](https://codepen.io/challenges) to learn more! See the Pen [🌈 Pure CSS Animated Gradient Background](https://codepen.io/anataliocs/pen/KwdWQqB) by Chris Anatalio ([@anataliocs](https://codepen.io/anataliocs)) on [CodePen](https://codepen.io). You can build super slick features and animations for your site + blog with just [Astro](https://astro.build/) hosted on Cloudflare. * * * The CSS `@keyframes` rule is the secret sauce for these slick animations that don’t require a single line of JS! Check out the [CSSKeyframesRule](https://developer.mozilla.org/en-US/docs/Web/API/CSSKeyframesRule) docs for more info. 💡 [Keyframes](http://developer.mozilla.org/en-US/docs/Web/CSS/@keyframes) control intermediate steps at explicitly set breakpoints in the animation sequence. These steps are also called waypoints and give more control then transitions. Learn more about declaring [Keyframes](https://drafts.csswg.org/css-animations/#keyframes) here. #### Keyframes Example: ``` @keyframes gradient { 0% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } 100% { background-position: 0% 50%; } } ``` In this example we can see keyframes at `0%`, `50%` and `100%` with the `background-position` property used to define the background image position style for each keyframe. As you can see, you define specific CSS styles that change over time as the animation progresses. You can change the angle, position, color or any number of properties over the course of an animation’s duration. Clever use of CSS functions like`linear-gradient` used with `::before` or `::after` pseudo-elements with properties like `box-shadow` can create really complex and visually dramatic effects! This gives you an incredible amount of power and versatility in creating novel animations and interactivity that can really make your UIs that much more intuitive and just plain fun to use. When a UI just clicks for users, it really is a joy! > Programming isn’t about what you know; it’s about what you can figure out. > > \- Chris Pine It is just so intuitive, fun and powerful to create cool new effects with just plain old CSS. 💡 Not that long ago it was a pain just to get stuff centered. ![Animated cartoon of a man fumbling with window blinds, captioned “CSS”](/images/css.gif) * * * ## Neon Button Animations ### Satisfying Unique Button Hover Animations You have so much creative freedom to create all different types of animations and behaviors that don’t just look cool but also contribute to a intuitive UX! In this example, for the first button, we use the `:hover` pseudo class along with the `box-shadow` property to create a simple glow mouse-over hover. The more complex examples, leverage `:before`, `:after`, `:hover:before` and `:hover:after` pseudo elements to create more unique effects using properties such as`transition`, `box-shadow` and `background-color`. **Live CodePen Example** See the Pen [Neon Button Animation](https://codepen.io/anataliocs/pen/ZYbKXqV) by Chris Anatalio ([@anataliocs](https://codepen.io/anataliocs)) on [CodePen](https://codepen.io). #### Box Shadow On-Hover Example: ``` .btn-1 { border: none; background-color: #ff9aff; box-shadow: 0 0 5px #ef97e8; } .btn-1:hover { box-shadow: 0 0 10px #ef97e8, 0 0 20px #ef97e8, 0 0 20px #fff inset; } ``` The opportunities for creativity are endless! * * * ## Much More Fun then a Plain Old Spinner ### Eye-Catching Loading Animations with Pure CSS You can get super creative with really expressive loading animations. See the Pen [Neon Grid Loaders](https://codepen.io/anataliocs/pen/jEbBZWZ) by Chris Anatalio ([@anataliocs](https://codepen.io/anataliocs)) on [CodePen](https://codepen.io). * * * ## Pure CSS Simulated IDE Coding This is probably the coolest thing I’ve seen though. Simulating an actual IDE with syntax highlighting with just CSS. See the Pen [Editor Illustration](https://codepen.io/anataliocs/pen/pvjeaPZ) by Chris Anatalio ([@anataliocs](https://codepen.io/anataliocs)) on [CodePen](https://codepen.io). Think twice before spinning up a React app next time you have a static site to build. I’ve been a long-time fan of [Gatsby](https://www.gatsbyjs.com/) but this super lean stack has really won me over :) > Clean code is code that is easy to read, easy to understand, and easy to modify. > > \- Robert C. Martin(Uncle Bob) * * * ## Macbook Stickers as Dynamic Interactive Elements At first, glance, it just looks like a img of a Macbook. But hover over a sticker and you’ll see each one is actually a interactive element! See the Pen [Personal Concept](https://codepen.io/anataliocs/pen/LEpWQNP) by Chris Anatalio ([@anataliocs](https://codepen.io/anataliocs)) on [CodePen](https://codepen.io). * * * ## Pure CSS Text Effects: A Deep Dive Backgrounds and buttons are only half the story. Type itself can be animated with nothing but CSS, and [Colorion’s CSS Text Effects library](https://text-effects.colorion.co/) is a great showcase: 123 copy-and-paste effects, each one a single class and a handful of declarations. Let’s break down a set of them line by line. Once you see the handful of building blocks they all share, you can mix and match your own. 💡 All snippets below come from [text-effects.colorion.co](https://text-effects.colorion.co/), lightly trimmed. Every effect shares one set of colour tokens, so re-skinning is a one-line change: ``` :root { --ink: currentColor; /* main text colour */ --ink-2: #ff4fd8; /* primary accent */ --ink-3: #4ff8ff; /* secondary accent */ } ``` ### The Building Blocks Almost every text effect is a combination of five techniques: 1. **`background-clip: text`**: paint a gradient (or any background) _inside_ the glyphs, then make the text itself `color: transparent`. 2. **Stacked `text-shadow`**: a comma-separated list of shadows builds glows, extrusions and long shadows. 3. **Pseudo-element copies**: `content: attr(data-text)` on `::before`/`::after` duplicates the word so each layer can be coloured, clipped and moved on its own. 4. **Per-letter custom properties**: wrap each letter in an element with `style="--i: n"` and use `calc(var(--i) * …)` to stagger the animation. 5. **`@keyframes` + timing functions**: `steps()` for mechanical, jumpy motion; `ease-in-out` for organic, floaty motion. * * * ### 1\. Aurora Gradient Text (`background-clip: text`) ```
BUILD SOMETHING
``` ``` .fx-aurora { background: linear-gradient(115deg, var(--ink-2), var(--ink-3), var(--ink-2), var(--ink-3)) 0 0 / 300% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: fx-aurora 7s linear infinite; } @keyframes fx-aurora { 0% { background-position: 0% 50%; filter: hue-rotate(0deg); } 100% { background-position: 300% 50%; filter: hue-rotate(360deg); } } ``` **Breakdown:** - The `background` shorthand sets a four-stop gradient and, after the `/`, a `background-size` of `300% 100%`. The gradient is three times wider than the text, so only a slice is visible at once. - `background-clip: text` (plus the `-webkit-` prefix that Safari and older Chromium still want) clips that background to the glyph shapes. `color: transparent` lets it show through. - The keyframes slide `background-position` from `0%` to `300%`. That is exactly the same trick as the animated background at the top of this post, only applied to text. - `filter: hue-rotate()` spins the whole colour wheel on top, so the palette keeps shifting instead of just scrolling. The gradient repeats its stops (`2, 3, 2, 3`), which keeps the loop seamless. * * * ### 2\. Glitch Text (pseudo-element copies + `clip-path`) ```
GLITCH
``` ``` .fx-glitch { position: relative; color: var(--ink); } .fx-glitch::before, .fx-glitch::after { content: attr(data-text); position: absolute; inset: 0; } .fx-glitch::before { color: var(--ink-2); clip-path: inset(0 0 55% 0); animation: fx-glitch-a 2.6s steps(1) infinite; } .fx-glitch::after { color: var(--ink-3); clip-path: inset(45% 0 0 0); animation: fx-glitch-b 2.6s steps(1) infinite; } @keyframes fx-glitch-a { 0%, 12%, 20%, 55%, 100% { transform: translate(0); opacity: 0; } 13% { transform: translate(-5px, -2px); opacity: 0.9; } 16% { transform: translate(4px, 1px); opacity: 0.9; } 48% { transform: translate(-3px, 2px); opacity: 0.9; } 51% { transform: translate(2px, -1px); opacity: 0.9; } } /* fx-glitch-b mirrors this with slightly offset timings and opposite directions */ ``` **Breakdown:** - `content: attr(data-text)` reads the `data-text` attribute so the pseudo-elements render a copy of the word with no duplicated markup. `position: absolute; inset: 0` stacks each copy exactly on top of the original. - `clip-path: inset(0 0 55% 0)` keeps only the top 45% of the `::before` copy; `inset(45% 0 0 0)` keeps only the bottom 55% of `::after`. Together they form two “slices” in different accent colours, which is the RGB channel-split look. - `steps(1)` is the key timing function here. It disables interpolation, so each keyframe _snaps_ into place rather than gliding. That’s what makes it read as digital corruption instead of a wobble. - Most of the timeline is `opacity: 0`. The glitch only fires in short bursts (13–16% and 48–51%), and the two layers use offset timings so they never quite line up. Short, irregular bursts look far more convincing than a constant jitter. * * * ### 3\. Typewriter (`steps()` + `ch` units) ```
TYPEWRITER
``` ``` .fx-typewriter { box-sizing: content-box; font: 600 24px/1.2 "JetBrains Mono", monospace; white-space: nowrap; overflow: hidden; width: 10ch; border-right: 0.55ch solid var(--ink-2); animation: fx-type 3.6s steps(10) infinite, fx-caret 0.65s steps(1) infinite; } @keyframes fx-type { 0%, 8% { width: 0; } 55%, 100% { width: 10ch; } } @keyframes fx-caret { 50% { border-color: transparent; } } ``` **Breakdown:** - The `ch` unit is the width of the `0` glyph. In a **monospace** font every character is that wide, so `10ch` is exactly ten letters. - `overflow: hidden` + `white-space: nowrap` turn `width` into a reveal mask. Animating it from `0` to `10ch` uncovers the word. - `steps(10)` splits that animation into ten discrete jumps, one per character, so letters appear whole rather than sliding in pixel by pixel. The step count must match the character count. - The caret is just `border-right`. A second animation with `steps(1)` blinks it by toggling `border-color` to `transparent` at 50%. Two animations, comma-separated, on one element. - `box-sizing: content-box` keeps the border _outside_ the `10ch` width so the caret doesn’t eat into the last letter. * * * ### 4\. Neon Sign Flicker (stacked `text-shadow`) ``` .fx-neon { color: var(--ink); animation: fx-neon 3.2s linear infinite; } @keyframes fx-neon { 0%, 18%, 21%, 24%, 100% { opacity: 1; text-shadow: 0 0 4px var(--ink), 0 0 11px var(--ink-2), 0 0 24px var(--ink-2), 0 0 48px var(--ink-2); } 19%, 22%, 62% { opacity: 0.35; text-shadow: none; } 63%, 64.5% { opacity: 0.6; text-shadow: 0 0 4px var(--ink-2); } } ``` **Breakdown:** - The glow is four shadows with zero offset and growing blur radii (`4px → 48px`). A tight white-ish core plus wider coloured halos imitates how a real gas tube bleeds light. This is the same layered `box-shadow` trick used in the neon buttons above, applied to text. - The flicker comes from keyframe _placement_, not easing. `18% → 19% → 21% → 22% → 24%` packs two quick off/on blinks into a tiny window, then the tube stays lit until a weaker stutter around 62–64.5%. - Irregular, clustered keyframes are what sell “faulty hardware.” Evenly spaced keyframes would just look like a pulse. * * * ### 5\. Liquid Fill (gradient hard stops + `-webkit-text-stroke`) ``` .fx-liquid { color: transparent; -webkit-text-stroke: 1px color-mix(in srgb, var(--ink-3) 65%, transparent); background: linear-gradient( 0deg, var(--ink-3) 0 46%, color-mix(in srgb, var(--ink-3) 55%, transparent) 48%, transparent 52% 100% ) 0 0 / 100% 220%; -webkit-background-clip: text; background-clip: text; animation: fx-liquid 3.4s ease-in-out infinite; } @keyframes fx-liquid { 0%, 100% { background-position: 0 -110%; } 50% { background-position: 0 10%; } } ``` **Breakdown:** - `-webkit-text-stroke` draws an outline around the transparent glyphs, so the empty “glass” letters are visible before they fill. - The gradient runs bottom-to-top (`0deg`) with near-hard stops: solid colour up to 46%, a semi-transparent band at 48% (the meniscus), then nothing from 52%. It’s a liquid level, not a smooth fade. - `background-size: 100% 220%` makes the gradient over twice the text height. Animating `background-position-y` raises and lowers the “water line” through the letters. - `color-mix(in srgb, var(--ink-3) 55%, transparent)` derives translucent variants from one token instead of hard-coding extra colours. - `ease-in-out` gives the slosh a natural slow-down at the top and bottom. * * * ### 6\. Wave Text (per-letter `--i` + negative delays) ``` ``` ``` .fx-wave b { font-weight: inherit; display: inline-block; animation: fx-wave 1.3s ease-in-out infinite; animation-delay: calc(var(--i) * -0.14s); } @keyframes fx-wave { 0%, 100% { transform: translateY(7px); } 50% { transform: translateY(-7px); } } ``` **Breakdown:** - Each letter gets its own element and an index custom property (`--i`). One keyframe animation is shared; only the delay differs. - `calc(var(--i) * -0.14s)` uses a **negative** delay. Negative delays start the animation _partway through_ its cycle immediately, so the wave is already in motion on page load instead of letters waking up one by one. - `display: inline-block` is required because `transform` doesn’t apply to plain inline elements. - Accessibility: splitting a word into letters makes screen readers spell it out. The wrapper’s `role="img"` + `aria-label` exposes the whole word once, and `aria-hidden` on each letter hides the fragments. * * * ### 7\. 3D Extruded Text (stepped `text-shadow`) ``` .fx-extrude { color: var(--ink); text-shadow: 1px 1px 0 color-mix(in srgb, var(--ink-2) 80%, #000), 2px 2px 0 color-mix(in srgb, var(--ink-2) 70%, #000), 3px 3px 0 color-mix(in srgb, var(--ink-2) 60%, #000), 4px 4px 0 color-mix(in srgb, var(--ink-2) 50%, #000), 5px 5px 0 color-mix(in srgb, var(--ink-2) 40%, #000), 6px 6px 0 color-mix(in srgb, var(--ink-2) 30%, #000), 7px 7px 12px rgba(0, 0, 0, 0.5); animation: fx-extrude 3s ease-in-out infinite; } @keyframes fx-extrude { 0%, 100% { transform: rotate(-3.5deg) translateY(2px); } 50% { transform: rotate(3.5deg) translateY(-4px); } } ``` **Breakdown:** - Six zero-blur shadows, each offset one more pixel diagonally, stack into a solid “side” of the letter. That’s the extrusion. - Each layer mixes in progressively more black (`80% → 30%` accent), so the depth darkens as it recedes, a cheap but convincing lighting cue. - The final shadow _does_ have blur (`12px`) and sits under everything as a soft drop shadow, grounding the block on the page. - A gentle `rotate` + `translateY` rock makes it feel like a physical object. * * * ### 8\. Long Shadow “Sundial” (animating `text-shadow` offsets) ``` @keyframes fx-sundial { 0%, 100% { text-shadow: 4px 0 var(--ink-2), 8px 0 color-mix(in srgb, var(--ink-2) 55%, transparent), 12px 0 color-mix(in srgb, var(--ink-2) 25%, transparent); } 25% { text-shadow: 0 4px var(--ink-2), 0 8px color-mix(in srgb, var(--ink-2) 55%, transparent), 0 12px color-mix(in srgb, var(--ink-2) 25%, transparent); } /* …50% (left), 75% (up), plus diagonal stops at every 12.5% */ } ``` **Breakdown:** - Three shadows at `4px`, `8px` and `12px` with fading opacity create a short trail. - Keyframes every 12.5% move the offsets around a circle: right, down-right, down, down-left and so on. The diagonals use `2.8px` (≈ `4 × cos 45°`) so the shadow stays the same length at every angle. - The browser interpolates between the shadow lists because each keyframe has the **same number** of shadows. Mismatched counts would snap instead of animating. * * * ### 9\. Animated SVG Outline (`stroke-dasharray` / `stroke-dashoffset`) ``` OUTLINE ``` ``` .fx-contour text { fill: color-mix(in srgb, var(--ink) 10%, transparent); stroke: var(--ink-3); stroke-width: 1.2; stroke-dasharray: 34 66; animation: fx-contour 3.2s linear infinite; } @keyframes fx-contour { to { stroke-dashoffset: -100; } } ``` **Breakdown:** - SVG `` can be styled with CSS `fill` and `stroke`, which unlocks the dash properties regular HTML text doesn’t have. - `stroke-dasharray: 34 66` draws a 34-unit dash then a 66-unit gap: a 100-unit repeating pattern. - Animating `stroke-dashoffset` by exactly one pattern length (`-100`) with `linear` timing makes the dashes crawl around the letterforms in a perfectly seamless loop. - `x="50%"`, `text-anchor="middle"` and `dominant-baseline="central"` centre the text in the `viewBox` on both axes. * * * ### 10\. Highlighter Marker (animating `background-size`) ``` .fx-marker { padding: 0.1em 0.2em; background: linear-gradient( 100deg, color-mix(in srgb, var(--ink-2) 85%, transparent), color-mix(in srgb, var(--ink-2) 60%, transparent) ) no-repeat 0 62%; background-size: 0% 46%; animation: fx-marker 3s ease-in-out infinite; } @keyframes fx-marker { 0% { background-size: 0% 46%; background-position: 0 62%; } 38%, 62% { background-size: 100% 46%; background-position: 0 62%; } 100% { background-size: 0% 46%; background-position: 100% 62%; } } ``` **Breakdown:** - A `no-repeat` gradient sized `46%` tall and positioned `62%` down sits behind the lower half of the text, just like a real highlighter stroke. - Growing `background-size` width from `0%` to `100%` “paints” it left to right. - The trick on the way out: the position jumps from `0` to `100%` while the size shrinks, so the stroke retracts toward the _right_ and appears to lift off the page instead of rewinding. - The `100deg` gradient with two opacities fakes uneven ink density. * * * ### 11\. Water Reflection (`-webkit-box-reflect`) ``` .fx-mirror { -webkit-box-reflect: below 2px linear-gradient(transparent 45%, rgba(255, 255, 255, 0.28)); animation: fx-mirror 3s ease-in-out infinite; } @keyframes fx-mirror { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } } ``` **Breakdown:** - `-webkit-box-reflect` renders a mirrored copy of the element `below` it, `2px` away. The optional gradient is a **mask** for the reflection, fading it out the further it gets from the text. - It’s non-standard (Chromium and Safari only), but it degrades gracefully: Firefox simply shows the text without a reflection. That’s a perfectly fine progressive enhancement. - The float animation moves the element _and_ its reflection together, so the word bobs over its own image. 💡 Notice the pattern: most of these effects animate cheap properties like `transform`, `opacity` and `background-position`. `transform` and `opacity` run on the compositor and stay smooth even on low-end phones. Animating `text-shadow`, `width` or `filter` triggers repaints, so use those sparingly and on small amounts of text. ### Respect Reduced Motion Fun animations shouldn’t make anyone feel ill. Colorion ships a global guard, and you should too: ``` @media (prefers-reduced-motion: reduce) { * { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; } } ``` **Breakdown:** - Users who enable “Reduce motion” in their OS settings match this media query. - Instead of `animation: none` (which can leave elements stuck in their hidden `0%` state, like an empty typewriter), it makes every animation finish almost instantly and run once. Elements land on their final keyframe and stay readable. 💡 Browse all 123 effects, grouped into gradient, glitch, neon, reveal, 3D, retro, letter and textured categories, at [text-effects.colorion.co](https://text-effects.colorion.co/). There’s also a [text effect generator](https://text-effects.colorion.co/text-effect-generator/) for tweaking colours and timing live. * * * I hope you had as much fun as I did walking through the amazing creativity present in our OSS community <3 It’s truly never been a better time to be a developer :D 💡 Hats off to [Mozilla](https://developer.mozilla.org/en-US/) and the OSS community for making this stuff happen! ## How Hella Labs Can Help Want a site that looks this good and still loads instantly? Here’s what we do: ### dApp Front-Ends Fast, responsive, animated front-ends built static-first, with polish from pure CSS instead of heavy JavaScript bundles. [See the service](/services/dapp-web-front-end/) ### Technical Articles Deep-dive tutorials like this one, with working example code, written for your developer audience. [See the service](/services/technical-articles/) ### GTM Launch Package Landing pages, launch content and developer-facing docs to get your product in front of the right people. [See the service](/services/gtm-launch-package/) ### DevOps & Test Automation CI/CD pipelines and automated test suites so every pull request ships with confidence. [See the service](/services/devops-test-automation/) ### Let's build something that pops. From animated hero sections to full dApp front-ends, we ship **fast, accessible, static-first** sites that look great without slowing your users down. [Start a Project](/contact/) [Explore All Service Offerings →](/web3-consultant-service-offerings/) * * * Thanks for reading! Check out more [CodePen here](https://codepen.io/anataliocs)! * * * _What are your favorite Pure CSS animations? Let me know in the comments below!_ Share: - [](https://twitter.com/intent/tweet?text=Pure%20CSS%20Animated%20Gradient%20Background%20and%20More!&url=https%3A%2F%2Fwww.hellalabs.dev%2Fpure-css-animations%2F) - [](https://www.linkedin.com/shareArticle?mini=true&url=https%3A%2F%2Fwww.hellalabs.dev%2Fpure-css-animations%2F&title=Pure%20CSS%20Animated%20Gradient%20Background%20and%20More!&summary=You%20can%20do%20amazing%20things%20with%20pure%20CSS%20nowadays%2C%20including%20animations%20without%20any%20Javascript.) ## Start the conversation Show Comments --- ## Custom Web3 Discord Bots & Embedded Apps: Turn Your Server into Part of Your Product | Hella Labs URL: https://www.hellalabs.dev/services/custom-discord-bot Custom Discord bots and embedded apps with on-chain abilities for Web3 teams. Token-gated onboarding, in-chat governance and rewards, and multiplayer dApp… Discord is where your community already spends its time. For most Web3 projects, it’s also where the experience breaks apart. A user hears about a proposal in chat, leaves for a governance site, connects a wallet, signs a message, and never makes it back to the conversation that brought them there. Most teams treat their Discord bot as a moderator: it bans spam, assigns a role, and posts announcements. That leaves most of what the platform can do unused. Discord’s developer platform now supports **OAuth2 identity and Linked Roles**, rich interactive **Components V2** messages, and full **Embedded Apps (Activities)** that run HTML5, WebGL, and WebAssembly right inside the Discord client. Put together, they let your server act as part of your product instead of a waiting room outside it. The difference looks like this: flowchart LR subgraph today\["A typical Web3 Discord"\] direction LR a1\["Announcement"\] --> a2\["Link to dApp"\] --> a3\["Connect wallet"\] --> a4\["Sign message"\] a2 -->|"tab closed"| a5\["Lost"\] a3 -->|"friction"| a5 end subgraph custom\["With a custom bot"\] direction LR b1\["Interactive card"\] --> b2\["One-click action"\] --> b3\["Result shared in channel"\] b3 -->|"social proof"| b1 end ## Why Listen to Us - **Inside the platforms.** Our engineers have shipped production code and supported developer ecosystems at **ConsenSys (Infura)**, **Stellar Development Foundation**, and **Uphold**, so we know how wallets, RPC providers, and on-chain data behave at scale. - **In the community.** We run hands-on Discord and Telegram community management and have launched campaigns that turn lurkers into contributors. We build bots for the problems we’ve seen moderators and members struggle with. - **In open source.** **945+ GitHub stars** across 200+ repositories. We’re also building open-source Discord modules for Web3 authentication and gated access (see below). ## Three Layers of an On-Chain Discord Experience | Layer | Discord capability | What it gives your community | | --- | --- | --- | | 1. Identity & onboarding | OAuth2 + Linked Roles | Verify once, get the right roles and channels automatically | | 2. In-chat action loops | Components V2 | Vote, claim, and check positions without leaving the channel | | 3. Embedded apps | Embedded App SDK (Activities) | Full dApps and multiplayer experiences running inside Discord | ### Layer 1: Frictionless Identity & Token-Gated Onboarding **Goal:** Link a user’s wallet to their Discord account once and keep it linked. - **Persistent cross-platform reputation.** Pairing Discord OAuth2 with Sign-In with Ethereum (SIWE) or smart account session keys binds a user’s on-chain identity to their Discord ID. Discord can also serve as the login for your own app, giving you one identity across both. - **Automated metadata and Linked Roles.** Your backend pushes on-chain traits such as governance participation, staking tier, or verifiable credentials (DIDs) straight to Discord’s Linked Roles metadata API. - **Zero-friction verification.** Users prove asset ownership once and unlock server roles, private channels, and badges automatically, without re-signing a message on every visit. sequenceDiagram participant U as User participant D as Discord participant B as Your Backend participant C as Chain U->>D: Authorize with Discord OAuth2 D->>B: Discord identity U->>B: Sign-In with Ethereum B->>C: Read balances, stake, votes C-->>B: On-chain traits B->>D: Push Linked Roles metadata D-->>U: Roles and private channels unlocked ### Layer 2: High-Signal, In-Chat Action Loops **Goal:** Let users act where the conversation is happening. - **Live governance and proposal feeds.** Instead of a plain link, the bot posts a structured Components V2 card with a media gallery (proposal visuals, token charts), a live quorum progress section, and **Vote For / Against** buttons. - **Private portfolio and position dashboards.** A **Check Position** or **Claim Rewards** button opens an ephemeral (visible only to that user) layout tailored to their linked address, showing unclaimed yield, vesting schedules, or NFT traits without cluttering public channels. - **Gasless actions and session keys.** With pre-authorized session keys or ERC-4337 gasless relayers, users can cast a vote, claim from a daily faucet, or tip a contributor with a single button click inside chat. flowchart LR P\["Proposal card posted"\] --> V\["Member clicks Vote"\] V --> S\["Session key signs"\] S --> R\["Relayer submits"\] R --> Q\["Quorum bar updates live"\] Q -->|"members see momentum"| V ### Layer 3: Co-Located Multiplayer & dApp Execution **Goal:** Bring your dApp into Discord so people use it together. - **In-client dApp mini-apps.** An Embedded App opens your web dApp inside Discord, which suits portfolio trackers, NFT minting interfaces, DEX swap widgets, and DAO treasury dashboards. Voice and text chat stay active alongside it. - **Social, multiplayer on-chain loops.** Activities can read who’s in the voice channel, so you can build experiences people use together in real time: - **Live DAO town halls** with real-time quadratic voting, delegate Q&As, and instant POAP or badge claims for people in the call. - **Co-op on-chain games and auctions**, live NFT drops, or group bidding pools where friends see each other’s avatars and reactions. - **Viral distribution through chat moments.** Activities can post Components V2 share cards back into the channel (“Alice just minted Rare #402,” “Guild raid boss defeated”), turning one person’s action into social proof that pulls the rest of the group in. flowchart LR VC\["Voice channel"\] --> A\["Activity launched"\] A --> M\["Group mints, votes, or plays"\] M --> C\["Share card posted to channel"\] C -->|"others join"| VC ## Putting It into Practice 1. **Map the journey.** Find where members leave Discord today: claims, votes, mints, support questions. 2. **Link identity first.** Ship OAuth2, SIWE, and Linked Roles so every later feature knows who it’s talking to. 3. **Add one action loop.** Pick the single highest-traffic action and bring it into chat with Components V2. 4. **Graduate to an Activity.** When a workflow needs a full UI or works better as a group, move it into an Embedded App. 5. **Measure and iterate.** Track verifications, button clicks, and share-card engagement, then keep what moves the numbers. flowchart LR J\["1. Map the journey"\] --> I\["2. Link identity"\] I --> L\["3. Add an action loop"\] L --> E\["4. Embedded App"\] E --> M\["5. Measure"\] M -->|"next feature"| L ## What We Offer ### Wallet Verification & Linked Roles OAuth2 and SIWE onboarding, token- and credential-gated roles, and a backend that keeps Discord in sync with on-chain state. ### Interactive Bots & Components V2 Governance feeds, reward claims, private dashboards, and gasless one-click actions built on Discord’s interactive components. ### Embedded Apps & Activities Your dApp, game, or live event running inside Discord with HTML5, WebGL, or WebAssembly, wired to the voice channel for multiplayer experiences. ### Hosting, Monitoring & Support Production deployment, uptime monitoring, rate-limit handling, and ongoing updates as Discord’s platform and your protocol evolve. ## Open Source Projects - **Coming Soon:** We’re building several open-source Discord modules for Web3 authentication and gated community access. Follow our [GitHub](https://github.com/hella-labs) for updates. ### Ready to engage your community? Book a free 30-minute call. We'll look at how your community uses Discord today, find the moments where users leave for your dApp and never come back, and sketch a bot that closes the gap. [Contact Us to Get Started](/contact/) --- ## dApp Front-End Development: Web2-Grade UX for On-Chain Apps | Hella Labs URL: https://www.hellalabs.dev/services/dapp-web-front-end Fast, accessible, mobile-first dApp front-ends with passkey onboarding, gasless transactions and sub-second loads. Stop losing 95% of new users before their… Most dApp teams spend nearly all of their energy on the Solidity smart contracts and treat the front-end as an afterthought. It’s often a starter template with a “Connect Wallet” button bolted on, shipped the week before launch. That’s backwards. **The greatest smart contract in the world is useless if no one uses it**, and the front-end is where users decide whether they will. Poor UX and slow load times are among the biggest reasons dApps fail to get adopted, and they’re entirely fixable. ## Why Listen to Us We’ve spent years building large Web2 SaaS products, where every change to a signup flow is A/B tested and every millisecond of load time shows up in revenue. That work makes it clear how sensitive users are to friction: - **Adding one or two input fields** to a form produced a **15–20% increase in drop-off** in A/B tests we ran. - **Removing a single click** from a key flow **raised conversion by 10%**. We bring that same discipline to Web3. Our engineers have shipped production code at **ConsenSys (Infura)**, **Stellar Development Foundation**, and **Uphold**, so we know the protocol side too. We also write openly about how we build fast dApps, like our deep dive on [reactive, streaming dApp architecture](/websocket-sse-graphql-nestjs-thinclient/) with WebSockets, Ethers.js, RxJS, and NestJS. ## Speed Is a Feature Users are extremely sensitive to performance. Industry research shows how quickly a slow page loses people: | Load time | Bounce probability (Google/SOASTA) | E-commerce conversion (Portent) | B2B / lead-gen conversion (Portent) | | --- | --- | --- | --- | | 1 second | Baseline | 3.05% | ~39–40% | | 2 seconds | — | 1.68% (−45% relative) | 34% | | 3 seconds | +32% | 1.12% | 29% | | 5 seconds | +90% | ~0.6–0.8% | ~13–15% (about 3× worse than 1s) | | 6+ seconds | +106% (6s) to +123% (10s) | Near the floor | ~50% lower than the 1–2s baseline | If your dApp is slow or confusing, users leave and don’t come back. Typical dApps are both. ## Why Most dApps Lose Users Before the First Transaction Traditional Web3 onboarding stacks every known conversion killer into one flow. It forces users into desktop-only browser extensions, seed-phrase setup, and RPC-induced latency before they see any value. The result is funnel abandonment of **95% to 99%+**. ### The Mobile Lockout Around 60% of global web traffic is mobile, and mobile Safari and Chrome don’t support browser extensions. Requiring MetaMask or Rabby excludes most of the internet. WalletConnect deep-linking to a separate wallet app and back often loses 50–75% of users to app-switching timeouts and broken sessions. ### The Extension Cliff Requiring a wallet extension drives away 70–95%+ of new visitors who don’t already have one. Asking a newcomer to install it, accept “read and change all your data” permissions, write down a 12-word seed phrase, and bridge gas tokens can lose 90–98% of them. ### Signature Fatigue One extra form field costs 4–11% of users in Web2. A single Web3 action often needs 4–6 approvals in a row: connect wallet, switch chain, sign in with Ethereum, approve an allowance, confirm. Every modal is a high-anxiety form field. ### RPC & Indexer Latency Public client-side RPC calls, uncached subgraph queries, and heavy wallet SDK bundles push time-to-interactive past 3–5 seconds, right where bounce rates spike by 32–90%+. ### What Does “Decentralized Front-End” Even Mean? A common objection is that the front-end has to be “decentralized.” But a smart contract is already public. Anyone can build a front-end or a back-end on top of the exact same on-chain data and functionality. That openness is the decentralization. A front-end is just a bundle your browser downloads, or a binary from an app store. Shipping a React app with 100+ runtime dependencies and a 5 MB+ bundle from your contracts repo doesn’t make it more “trustless.” It makes it slow. Self-custody and verifiability live in the contracts and the user’s keys, not in the bundle size. ## The Fix: A Zero-Friction Web3 Stack To match Web2 conversion rates while keeping self-custody, we take extensions, seed phrases, and gas prompts off the critical path. Users get a “Continue with Face ID” button. The chain is still there; it’s just no longer in the user’s way. 1. **Replace extensions with passkeys (WebAuthn / P-256).** Device biometrics (Face ID, Touch ID, Windows Hello) produce cryptographic signatures directly in mobile Safari, mobile Chrome, desktop browsers, and native iOS and Android apps. Nothing to install. 2. **Adopt smart accounts (ERC-4337 / EIP-7702).** Bind the user’s passkey to an on-chain smart contract wallet. The P-256 signature precompile (RIP-7212 on major L2s, EIP-7951 on Ethereum mainnet) makes verifying passkey signatures on-chain cheap. 3. **Sponsor gas and batch calls (paymasters).** An ERC-4337 paymaster means new users never have to buy ETH just to try your app, and bundling `approve()` and `execute()` turns a multi-step flow into a single biometric tap. 4. **Onboard progressively (value before custody).** Let users browse, simulate, and build up off-chain state as soon as they land. Create the passkey only when they commit to an action, and let power users link an external wallet later. ## Smart Wallets, Embedded Wallets, MPC, and Account Abstraction These terms get used interchangeably in pitch decks, but they answer two different questions. Getting them straight is the first step to choosing the right onboarding stack: - **Key management: who holds the key, and how does the user sign?** Browser extensions, passkeys, embedded wallets, and MPC all live here. - **The account: what is the user’s address on-chain, and what can it do?** A plain externally owned account (EOA) can only send transactions signed by one key. A smart account is a contract with its own rules. Account abstraction is the set of standards that makes smart accounts work. You pick one option from each layer, and they combine freely. An MPC signer can control a plain EOA or a smart account. A passkey can sign for a smart account directly. flowchart TB subgraph signer\["Key management: how the user signs"\] direction LR ext\["Browser extension
(seed phrase)"\] pk\["Passkey
(device biometrics)"\] emb\["Embedded wallet
(key in your app)"\] mpc\["MPC
(key split into shares)"\] end subgraph account\["Account: what lives on-chain"\] direction LR eoa\["EOA
one key, no rules"\] sa\["Smart account
ERC-4337 contract wallet"\] d7702\["EOA + EIP-7702
same address, smart features"\] end signer -- "signs for" --> account account --> features\["Batching · gas sponsorship · session keys
spending limits · social recovery"\] sa -.-> features d7702 -.-> features ### Embedded Wallets A wallet created inside your app the moment a user signs in with email, social login, or a passkey. There’s no extension and no seed phrase. The key is protected by MPC, a secure enclave, or the user’s device, and users can usually export it later. This is the fastest way to remove the extension cliff. ### MPC (Multi-Party Computation) The private key is never whole. It’s split into shares held by, for example, the user’s device, the wallet provider, and a backup, and a threshold of shares signs together. The result is a normal signature, so it works with any EOA. The trade-off is a dependency on the provider’s infrastructure and recovery process. ### Smart Wallets The account itself is a contract, so its rules are programmable: batch several calls into one signature, let a paymaster pay gas, grant scoped session keys to a game or trading bot, set spending limits, add multiple signers, or recover access through guardians instead of a seed phrase. ### Account Abstraction The standards that make smart wallets work. **ERC-4337** adds UserOperations, bundlers, the EntryPoint contract, and paymasters without a protocol change. **EIP-7702** lets an existing EOA delegate to smart-account code while keeping its address and history. **ERC-7579** makes account features pluggable modules. ### How the Options Compare | Approach | Onboarding | Gasless & batching | Recovery | Main trade-off | | --- | --- | --- | --- | --- | | Extension wallet + EOA | Install, seed phrase, desktop only | No | Seed phrase only | Loses most new and mobile users | | Embedded / MPC wallet + EOA | Email, social, or passkey | No (gas still needed) | Provider-managed | Depends on the provider; account has no smart rules | | Passkey + ERC-4337 smart account | One biometric tap | Yes, via paymaster | Guardians, multiple passkeys | Higher gas per operation; bundler and paymaster infra | | EIP-7702 upgraded EOA | Keep your existing wallet | Yes | Depends on the delegated code | Wallet support still maturing; delegation is powerful | | Embedded signer + smart account | Email, social, or passkey | Yes | Provider plus on-chain rules | Most moving parts, best overall UX | ### How We Choose for Your App There’s no single right answer. We pick based on who your users are and what they do: - **Consumer apps, games, and first-time crypto users:** an embedded wallet or passkey signer on a smart account, with gas sponsored by a paymaster. Users should never see the word “gas” in their first session. - **DeFi power users:** keep extension and hardware wallets as first-class options, and use EIP-7702 so they get batching and sponsorship without moving to a new address. - **Teams that want to own the stack:** passkeys with ERC-4337 smart accounts and your own bundler and paymaster policy, so there’s no dependency on a third-party custody provider. - **Regulated or treasury use cases:** MPC or multi-signer smart accounts with policy controls, approvals, and audit trails. - **Everyone:** support smart-account signatures in sign-in and off-chain messages (ERC-1271, and ERC-6492 for accounts that aren’t deployed yet), or smart-wallet users will hit “invalid signature” errors that EOA users never see. ## One Backend for Web, Mobile Web, and Native Apps Instead of building separate wallet adapters for React, React Native, Swift, and Kotlin, and exposing RPC endpoints directly to every client, we centralize session state, transaction simulation, and bundler relaying behind a **unified Web3 orchestration backend**. Every client gets the same API and the same speed. flowchart TB subgraph clients\["Client layer"\] direction LR web\["Desktop web
WebAuthn"\] mweb\["Mobile Safari / Chrome
WebAuthn"\] native\["Native iOS / Android
ASAuthorization / Credential Manager"\] end subgraph backend\["Unified backend orchestration layer"\] direction TB auth\["Auth & passkey verifier
JWTs, passkey → smart account address"\] intent\["Intent & calldata builder
builds + simulates UserOperations"\] policy\["Paymaster & policy engine
sponsorship rules, rate limits"\] bundler\["Bundler & RPC router
nonces, gas bumps, multi-RPC failover"\] cache\["Read cache & indexer sync
sub-100 ms balances and history"\] end subgraph chain\["Blockchain & settlement layer"\] direction LR entry\["ERC-4337 EntryPoint"\] --> account\["Smart account (P-256)"\] --> target\["Your dApp contracts"\] end clients -- "HTTPS (REST / GraphQL) + WebSockets" --> backend bundler --> entry cache -. "indexes events" .- chain ### How the Flow Works on Every Platform sequenceDiagram autonumber participant U as User device participant B as Backend participant C as Chain (ERC-4337) U->>B: Tap "Continue" (passkey created with Face ID / Touch ID) B-->>U: Smart account address (counterfactual, nothing deployed yet) U->>B: POST /v1/intents/prepare { action: "swap", amount: "100" } B->>C: Simulate UserOperation (eth\_call) B-->>U: Human-readable preview + userOpHash U->>B: POST /v1/intents/execute (biometric signature over userOpHash) B->>C: Submit sponsored UserOperation via bundler C-->>B: Included B-->>U: Confirmation over WebSocket or push notification 1. **Counterfactual account provisioning, with no on-chain wait.** The user taps “Continue” and the OS prompts for Face ID or Touch ID. Because the passkey is bound to your root domain through `apple-app-site-association` (iOS) and `assetlinks.json` (Android), the same passkey signs the user into your website and your native apps. The backend computes the user’s CREATE2 smart-account address without deploying anything yet. 2. **Backend-driven intents and simulation.** The client sends a business intent like “swap 100 USDC for ETH,” not raw calldata. The backend builds the UserOperation, simulates it so it won’t revert, attaches paymaster sponsorship, and returns a preview and the hash to sign. 3. **One biometric signature.** The client signs only the `userOpHash` with the native passkey prompt. There’s no extension and no wallet-app switch. The backend submits the operation, handles nonce queuing and gas spikes, and pushes confirmation back in real time. 4. **Sub-second reads from an indexed cache.** Clients never call RPC nodes directly. Balances, positions, and history come from the backend’s indexed cache (PostgreSQL + Redis), keeping page loads under a second on mobile and desktop. ## Quality Built In, Not Bolted On Every front-end we ship comes with the basics most dApps skip: - **Performance budgets** enforced in CI, with Core Web Vitals tracked on real devices, not just a fast laptop. - **Accessibility** to WCAG AA: semantic markup, keyboard navigation, screen-reader-friendly transaction states, and sufficient color contrast. - **SEO** with server-rendered or static pages, structured data, and shareable URLs, so your app can be found before anyone connects a wallet. - **Security** through strict Content Security Policies, minimal third-party scripts, pinned dependencies, and clear, human-readable transaction previews. - **Agent interop** through a well-formed accessibility tree, an `llms.txt`, and structured data, so AI agents and assistants can discover your app and act on it as reliably as people do. - **Honest failure states** for slow RPCs, pending transactions, stale prices, and reverts, tested with [on-chain chaos engineering](/on-chain-chaos-engineering-ethereum-wiremock-anvil/) so users never stare at an endless spinner. ### We hold our own site to the same bar Our public Lighthouse reports show unedited mobile and desktop audits of hellalabs.dev across performance, accessibility, best practices, SEO, and agentic browsing, Lighthouse's new category for how well AI agents can read and use a site. [See our Lighthouse reports](/lighthouse-reports/) ## How We Work 1. **Audit:** We measure your current funnel on desktop and mobile: load times, bundle size, number of signatures per action, and where users drop off. 2. **Design:** We map the shortest path from landing to first successful transaction, and decide what moves to passkeys, paymasters, and the backend. 3. **Build:** We ship the front-end and the orchestration backend with automated end-to-end tests against real, disposable chains. 4. **Measure:** We compare conversion and performance against the baseline and keep iterating on whatever moves the numbers. ## Sample Content - [**High Performance dApps**](/websocket-sse-graphql-nestjs-thinclient/): reactive, streaming on-chain data with WebSockets, Ethers.js, RxJS, and NestJS. - [**On-Chain Chaos Engineering**](/on-chain-chaos-engineering-ethereum-wiremock-anvil/): how your app behaves when its RPC provider fails, and how to test it. - [**Open-Source Web3 Ethereum Projects at Hella Labs**](/web3-ethereum-open-source/): the tooling we maintain for the ecosystem. ## What We Offer ### dApp UX & Performance Audit A measured teardown of your onboarding funnel, load times, and bundle size on desktop and mobile, with a ranked list of fixes by expected conversion lift. ### Front-End Development Fast, accessible, SEO-ready dApp front-ends with small bundles, real loading states, and clear transaction previews. ### Wallet & Onboarding Architecture Extension-free sign-up with passkeys, embedded or MPC wallets, and ERC-4337 / EIP-7702 smart accounts, plus paymaster gas sponsorship and batched one-tap transactions. ### Unified Web3 Backend One orchestration API for web, mobile web, and native apps: intent building, simulation, bundler relaying, multi-RPC failover, and a sub-second read cache. ### Mobile Web & Native Apps The same passkey and the same account across your website and iOS and Android apps, with Associated Domains and Credential Manager set up correctly. ### E2E Testing for Front-Ends Automated end-to-end tests against disposable Anvil chains and mocked RPC failures, so every release is proven on the flows your users actually take. ### Your smart contract deserves users. Book a free 30-minute UX teardown. We'll walk through your onboarding flow on desktop and mobile, measure where users drop off, and sketch the fastest path to a one-tap first transaction. [Book a UX Teardown](/contact/) --- ## DevOps & Test Automation | Hella Labs URL: https://www.hellalabs.dev/services/devops-test-automation A risk management framework for Web3 delivery. CI/CD pipelines and high-fidelity test automation that catch costly failures before they reach mainnet. In Web3, a bad release isn’t a rollback. It’s an exploit, a drained treasury, or an immutable bug that stays on-chain for good. We treat **CI/CD and test automation as a risk management framework**: find where your protocol can fail, measure how likely and how costly each failure is, and put automated controls in front of every one of them. For a startup competing with entrenched players, that framework also works as a force multiplier. Your team ships faster because every merge is checked against the risks that matter. ## The Risks We Manage ### Smart Contract Risk Logic errors, broken invariants, and upgrade regressions that become permanent once deployed. ### Integration Risk RPC providers, oracles, indexers, and third-party APIs that fail, slow down, or change their contracts under you. ### Environment Risk Drift between laptops, CI, staging, and mainnet that produces flaky tests and “works on my machine” releases. ### Release Risk Manual deploys, unverified contracts, and missing gates between a merged PR and a production transaction. ## Our Framework 1. **Identify:** We audit your contracts, dApp, backend services, and pipeline to map every point where a change can break production. 2. **Assess:** Each risk is ranked by likelihood and blast radius, so automation effort goes where a failure would cost the most. 3. **Control:** We build automated controls: isolated E2E suites on disposable chains, mainnet-fork tests, mocked external dependencies, and gated CI/CD pipelines. 4. **Monitor:** Controls run on every commit. Test reports, coverage, and pipeline metrics show whether your risk exposure is going up or down. ## Proven in Open Source We don’t just recommend this tooling. We build and maintain it. Our open-source Testcontainers modules are the same controls we deploy for clients: - [**Foundry Anvil Testcontainers**](/open-source/foundry-anvil-testcontainers/) manages **smart contract and environment risk**. It spins up isolated, reproducible Anvil nodes per test suite, with mainnet forking, account impersonation, and time travel for DeFi, governance, and exploit-reproduction scenarios. - [**WireMock Testcontainers**](/open-source/wiremock-testcontainers/) manages **integration risk**. It replaces RPC providers and third-party APIs with containerized, verifiable mocks, so you can test outages, timeouts, and malformed responses on demand. Together they let you run [on-chain chaos engineering](/on-chain-chaos-engineering-ethereum-wiremock-anvil/): deliberately injecting failures to prove your protocol degrades safely. ### Quality You Can Verify We hold our own code to the standard we set for clients. Every commit to our open-source modules runs in CI against real containers, and coverage is published publicly on Codecov, not claimed in a slide deck. The same pinned images and disposable environments mean a test that passes on one machine passes on every machine, so results are **reproducible by anyone**: your team, your auditors, or ours. [![Codecov sunburst graph of test coverage by file](https://codecov.io/gh/hella-labs/foundryanvil-testcontainers-nodejs/graphs/sunburst.svg?token=WU523RPLO1)](https://codecov.io/gh/hella-labs/foundryanvil-testcontainers-nodejs) **Foundry Anvil Testcontainers coverage.** Each ring drills from the whole project into directories and files; color shows how well each slice is tested. [See the full report](/open-source/foundry-anvil-testcontainers/). [![Codecov sunburst graph of test coverage by file](https://codecov.io/gh/hella-labs/wiremock-testcontainers-nodejs/graphs/sunburst.svg?token=Z8O1KEH03J)](https://codecov.io/gh/hella-labs/wiremock-testcontainers-nodejs) **WireMock Testcontainers coverage.** Each ring drills from the whole project into directories and files; color shows how well each slice is tested. [See the full report](/open-source/wiremock-testcontainers/). ## What We Deliver ### DevOps Risk Audit A prioritized risk register for your protocol and pipeline, with a roadmap of the controls that cut the most exposure first. ### E2E Test Automation High-fidelity test suites for smart contracts and dApps, built on disposable chains and mocked dependencies. ### CI/CD Pipelines GitHub Actions pipelines with quality gates, containerized test runs, and automated, verifiable deployments. ### Team Enablement Hands-on training and documentation so your engineers own the framework and keep extending it. ### Know your risk before you ship. Start with a DevOps audit. We map your delivery risks, rank them by impact, and give you a concrete plan to automate them away. [Get a DevOps Audit](/contact/) --- ## GTM Launch Package | Hella Labs URL: https://www.hellalabs.dev/services/gtm-launch-package Full go-to-market package tailored specifically for the unique challenges faced by startups in the Web3 space. Full go-to-market package tailored specifically for the unique challenges faced by startups in the Web3 space. ## Strategic Support - **Developer Relations:** We help you build authentic connections with the dev community. - **Content Strategy:** Aligning your technical strengths with market needs. - **Technical Documentation:** Making sure your users can get started in minutes, not hours. ### Make an impact from Day 1. Don't just launch—land. We provide the technical and strategic foundation for a successful GTM. [Plan Your Launch](/contact/) --- ## Developer Relations Strategy & Technical Content: Build a Measurable DevRel Funnel | Hella Labs URL: https://www.hellalabs.dev/services/technical-articles Data-driven developer relations and technical content for Web3 and developer-tools teams. Model your developer funnel, find the bottleneck, and ship content… Most DevRel programs aren’t short on effort. We’ve seen teams spend months on blog posts, livestreams, swag, and hackathon booths and still struggle to answer the question leadership keeps asking: **“What did all of that actually do?”** The issue is the model they’re working from. A typical funnel is drawn as a one-way slide from “aware” to “customer.” Developers don’t behave like that. They bounce, stall in a sandbox for weeks, churn after one broken quickstart, and come back six months later for a major release. The simple answer is **Markov chains**. Nearly every quantitative, scientific, and engineering discipline uses them. But not DevRel. A Markov chain is a mathematical model of states and transitions. In a DevRel context, the states are the stages of a developer’s journey and the transitions are the probabilities of moving from one stage to the next. By measuring your actual churn data, you can see exactly where developers are dropping off to focus your efforts. Each touchpoint is a lever that raises the odds of a developer moving forward. The difference looks like this: flowchart LR subgraph funnel\["The funnel everyone draws"\] direction LR a1\["Aware"\] --> a2\["Onboarding"\] --> a3\["Builder"\] --> a4\["Advocate"\] end subgraph real\["What developers actually do"\] direction LR b1\["Aware"\] --> b2\["Onboarding"\] b2 --> b3\["Builder"\] b3 --> b4\["Advocate"\] b2 -->|"broken quickstart"| b5\["Dormant"\] b1 -->|"bounce"| b5 b3 -->|"stalls"| b5 b5 -->|"major release"| b1 b2 -->|"stuck"| b2 b4 -->|"burnout"| b3 end ## Why Listen to Us We’ve worked on every side of the developer funnel: - **Inside the platforms.** Our engineers have shipped production code and supported developer ecosystems at **ConsenSys (Infura)**, **Stellar Development Foundation**, and **Uphold**, so we know what a developer hits between “sign up” and “first successful request.” - **On stage.** Talks at **ETH Denver 2023 & 2024**, **Devcon 2022 & 2024**, **ETH CC 2022**, and **ETH Seattle 2022** taught us what makes a room of builders go open a terminal and what makes them check their phones. - **In the classroom.** Courses for **LinkedIn Learning** and **Pluralsight**, including _Web3 Infrastructure Development Tools_ and smart contract development with Hardhat, Foundry, and ethers.js, have reached thousands of developers. Writing curriculum forces you to find every spot where a learner gets stuck. - **In open source.** **945+ GitHub stars** across 200+ repositories, plus tools like [Foundry Anvil Testcontainers](/open-source/foundry-anvil-testcontainers/) and [WireMock Testcontainers](/open-source/wiremock-testcontainers/). We maintain the kind of projects we’ll help you grow. - **In the community.** Hands-on Discord and Telegram community management and viral campaigns that turn lurkers into contributors. ## The Developer Journey as a State Machine At any point in time (say, a given week), every developer in your ecosystem is in exactly one state: | State | What it looks like | Example signal | | --- | --- | --- | | S0: Unaware | Outside your ecosystem | None yet | | S1: Discovering | Reading docs, browsing repos, watching a talk | Docs visit, repo star | | S2: Onboarding | Cloning starter kits, generating API keys, running local tests | API key created, template cloned | | S3: Active Builder | Integrating in staging or production, hitting usage milestones | 1,000+ weekly requests | | S4: Advocate | Opening PRs, answering forum questions, writing tutorials | 1+ merged PR or 5+ answered threads | | S5: Dormant | Gone quiet. Hard to recover, but not impossible | No activity for 60+ days | This is a Markov chain: the chance of moving to the next state depends only on where a developer is now. That simple assumption makes the whole funnel measurable. stateDiagram-v2 direction LR S0: S0 Unaware S1: S1 Discovering S2: S2 Onboarding S3: S3 Active Builder S4: S4 Advocate S5: S5 Dormant \[\*\] --> S0 S0 --> S1: talk, post, search S1 --> S2: quickstart S2 --> S3: first integration S3 --> S4: first PR or answer S4 --> S3: steps back S1 --> S5: bounce S2 --> S5: friction S3 --> S5: stall S4 --> S5: burnout S5 --> S1: win-back ## Find Your Bottleneck with a Transition Matrix For each state, track where developers end up one period later. Here’s a typical baseline for an ecosystem that hasn’t been tuned yet: | From \ To | Discovering | Onboarding | Active Builder | Advocate | Dormant | | --- | --- | --- | --- | --- | --- | | Discovering | 0.40 | 0.25 | 0.05 | 0.00 | 0.30 | | Onboarding | 0.05 | 0.35 | 0.20 | 0.00 | 0.40 | | Active Builder | 0.00 | 0.10 | 0.65 | 0.05 | 0.20 | | Advocate | 0.00 | 0.00 | 0.15 | 0.80 | 0.05 | | Dormant | 0.05 | 0.00 | 0.00 | 0.00 | 0.95 | Read across a row and the problem jumps out. In this example, **40% of onboarding developers go dormant every period**. That’s the “onboarding cliff,” and no amount of top-of-funnel awareness content will fix it. More conference sponsorships just push more developers off the same cliff. Drawn as a chain, with the thickest drop-offs in the baseline highlighted: flowchart LR S1(\["Discovering"\]) -->|0.25| S2(\["Onboarding"\]) S1 -->|0.05| S3(\["Active Builder"\]) S2 -->|0.20| S3 S3 -->|0.05| S4(\["Advocate"\]) S4 -->|0.15| S3 S3 -->|0.10| S2 S2 -->|0.05| S1 S1 ==>|0.30| S5(\["Dormant"\]) S2 ==>|"0.40 onboarding cliff"| S5 S3 -->|0.20| S5 S4 -->|0.05| S5 S5 -->|0.05| S1 S1 -->|0.40| S1 S2 -->|0.35| S2 S3 -->|0.65| S3 S4 -->|0.80| S4 style S5 fill:#7f1d1d,stroke:#f87171,color:#fff linkStyle 7,8 stroke:#f87171,stroke-width:3px With absorbing-chain math (the fundamental matrix _N = (I − Q)⁻¹_), you can also work out how many periods a developer typically takes to become an advocate or go dormant, and how much each improvement shortens that time. ## How to Build a High-Impact Funnel Every DevRel activity should be aimed at a specific transition. Here’s the playbook we use, with the kind of lift each stage is designed to produce. ### Stage 1: Discovering → Onboarding **Goal:** Shorten time-to-first-hello-world (TTFHW) to minutes. - Zero-config CLI scaffolds and starter templates - Browser playgrounds so developers can try it before they install anything - Short, code-first tutorials with opinionated architecture diagrams - Conference talks that end with a repo link and a five-minute challenge, not a logo slide **Target lift:** Discovering → Onboarding from **0.25 → 0.45**, with a lower bounce rate. > **From our work:** Our ETH Denver and Devcon talks are built around runnable repos. The talk is the trailer and the repo is the product. Attendees leave with something cloned, not just a sticker. flowchart LR subgraph before\["Before"\] direction LR A1(\["Discovering"\]) -->|0.25| A2(\["Onboarding"\]) A1 -->|0.30| A5(\["Dormant"\]) end subgraph after\["After: scaffolds, playgrounds, code-first talks"\] direction LR B1(\["Discovering"\]) ==>|0.45| B2(\["Onboarding"\]) B1 -->|"lower"| B5(\["Dormant"\]) end before --> after ### Stage 2: Onboarding → Active Builder **Goal:** Get rid of integration friction and unblock early failures quickly. - Error-message-driven troubleshooting guides (“If you see X, do Y”) - Integration testing templates such as local testnets and mock servers - Live office hours and clear response-time SLAs on Discord and GitHub - Migration and “production checklist” guides **Target lift:** Onboarding → Active Builder from **0.20 → 0.40**, closing the onboarding cliff. > **From our work:** We built [Foundry Anvil Testcontainers](/open-source/foundry-anvil-testcontainers/) and [WireMock Testcontainers](/open-source/wiremock-testcontainers/) because “how do I test this?” is where most Web3 integrations stall. Testing tooling is DevRel content. flowchart LR subgraph before\["Before"\] direction LR A2(\["Onboarding"\]) -->|0.20| A3(\["Active Builder"\]) A2 -->|0.40| A5(\["Dormant"\]) end subgraph after\["After: test templates, error guides, office hours"\] direction LR B2(\["Onboarding"\]) ==>|0.40| B3(\["Active Builder"\]) B2 -->|"cliff closed"| B5(\["Dormant"\]) end before --> after ### Stage 3: Active Builder → Advocate **Goal:** Turn production competence into public social proof. - “Good first issue” bounties and contributor guides - Guest blog spotlights and case studies featuring community builders - Co-speaking slots at meetups and conferences - Early beta access and a champion or ambassador tier **Target lift:** Active Builder → Advocate from **0.05 → 0.15**, plus better retention. flowchart LR subgraph before\["Before"\] direction LR A3(\["Active Builder"\]) -->|0.05| A4(\["Advocate"\]) A3 -->|0.65| A3 end subgraph after\["After: bounties, spotlights, ambassador tier"\] direction LR B3(\["Active Builder"\]) ==>|0.15| B4(\["Advocate"\]) B3 -->|"higher retention"| B3 end before --> after ### Stage 4: Sustain Advocates and Win Back Dormant Developers **Goal:** Prevent advocate burnout and bring dormant builders back. - Direct roadmap input sessions with core engineers - Release changelogs and migration guides aimed at developers who’ve gone dormant - “What’s changed since you left” email and content campaigns tied to major releases flowchart LR A4(\["Advocate"\]) -->|"roadmap sessions"| A4 A4 -.->|"burnout, reduced"| A3(\["Active Builder"\]) D5(\["Dormant"\]) ==>|"changelogs, migration guides, win-back campaigns"| D1(\["Discovering"\]) D1 --> D2(\["Onboarding"\]) ## Putting It into Practice 1. **Instrument the states.** Map product and community signals to each state: API keys created, request volume, merged PRs, answered threads. 2. **Measure the baseline.** Track cohort movement month over month to fill in your real transition matrix. 3. **Pick one bottleneck.** Find the row with the highest dormancy probability. That’s where your next quarter of effort goes. 4. **Ship targeted content.** Build the tutorials, tooling, and events aimed at that one transition. 5. **Re-measure.** Compare the matrix over the next two cycles. Keep what moved the numbers and cut what didn’t. flowchart LR I\["1. Instrument states"\] --> M\["2. Measure baseline matrix"\] M --> B\["3. Pick the worst row"\] B --> S\["4. Ship targeted content"\] S --> R\["5. Re-measure"\] R -->|"next cycle"| B When you’re done, the report to leadership is a chart showing more developers reaching production, faster. The tuned chain after a few cycles: flowchart LR S1(\["Discovering"\]) ==>|0.45| S2(\["Onboarding"\]) S2 ==>|0.40| S3(\["Active Builder"\]) S3 ==>|0.15| S4(\["Advocate"\]) S4 -->|"retained"| S4 S1 -.->|"less bounce"| S5(\["Dormant"\]) S2 -.->|"cliff closed"| S5 S5 ==>|"win-back"| S1 S4 -->|"referrals and tutorials"| S1 style S4 fill:#14532d,stroke:#4ade80,color:#fff ## Sample Content - [**Open-Source Web3 Ethereum Projects at Hella Labs**](/web3-ethereum-open-source/): an overview of our commitment to the ecosystem. - [**High Performance dApps**](/websocket-sse-graphql-nestjs-thinclient/): a deep dive into reactive architecture for Web3. - [**On-Chain Chaos Engineering**](/on-chain-chaos-engineering-ethereum-wiremock-anvil/): fault-injection testing for Ethereum apps with WireMock and Anvil. - [**Solidity Lifecycle Testing**](/solidity-lifecycle-testing-foundry-anvil/): end-to-end contract testing with Foundry and Anvil. ## What We Offer ### DevRel Funnel Audit We map your developer journey, instrument the states, and deliver your baseline transition matrix along with a ranked list of your highest-leverage bottlenecks. You’ll know exactly where developers are dropping off and why. ### Technical Article Series Multi-part series written by engineers who ship production code, matched to your audience’s experience level and backed by complete, runnable example repos. No fluff and no ghostwritten filler, just content developers bookmark and share. ### Quickstarts, Starter Kits & Testing Templates Zero-config scaffolds, sample apps, and integration testing templates that get a developer from first visit to first successful call in minutes. ### Conference Talks & Workshops Talks and hands-on workshops from speakers who’ve presented at ETH Denver, Devcon, and ETH CC, built around a repo attendees will actually clone. ### Courses & Curriculum Structured learning paths and workshop curriculum from instructors who’ve published with LinkedIn Learning and Pluralsight. ### Community Programs Discord and Telegram strategy, ambassador programs, bounty campaigns, and contributor onboarding that turn your best builders into your loudest advocates. ### Turn developer attention into developer adoption. Book a free 30-minute funnel review. We'll walk through your current DevRel motion, point out your biggest drop-off, and sketch the first content sprint to fix it. [Book a Funnel Review](/contact/) --- ## Web3 Tooling & SDKs | Hella Labs URL: https://www.hellalabs.dev/services/web3-tooling-sdks We build developer-centric tools, SDKs, and TUIs that simplify blockchain interactions. We build developer-centric tools, SDKs, and TUIs that simplify blockchain interactions. From fluent TypeScript APIs to terminal-based explorers like `etherscan-tui-go`, we create the infrastructure that makes your protocol accessible and easy to integrate for other developers. ## Open Source Projects - [**Ethereum Transaction Explorer TUI:**](https://github.com/anataliocs/etherscan-tui-go) A terminal Ethereum transaction explorer built with Go and the Bubble Tea TUI framework. ### Empower your developers. Great protocols need great tools. We build the SDKs and CLI tools that developers love to use. [Build Your Tooling](/contact/) --- ## Mastering Solidity Lifecycle Testing with Foundry Anvil Testcontainers | Hella Labs URL: https://www.hellalabs.dev/solidity-lifecycle-testing-foundry-anvil Learn how to implement comprehensive lifecycle tests for Solidity smart contracts and simplify complex test scenarios with Foundry Anvil Testcontainers ## Mastering Solidity Lifecycle Testing with Foundry Anvil Testcontainers Smart contracts control significant financial assets and execute critical business logic autonomously. There’s no easy rollback and patching. Deployed smart contracts behave more like hard-to-patch embedded software. Let’s explore **Lifecycle Testing,** an approach to ensure smart contracts behave correctly at each stage of their operation. We will show how [Foundry Anvil Testcontainers](https://hellalabs.dev/foundryanvil-testcontainers-nodejs/) dramatically simplifies this process. * * * ## What Are Lifecycle Tests? _Advanced end-to-end tests that validate the behavior of a smart contract throughout its lifecycle._ They ensure that contracts behave correctly over time, especially during state transition. Ultimately, we want to verify that contracts maintains integrity & correctness throughout all state changes. This “life story” includes several phases: - **Deployment** - Contract is deployed on-chain and initial config is set - **Configuration** - Params are set, roles are assigned to prepare contract for active operation - **Active operation** - Contract is invoked, state evolves, and business logic executes - **State transitions** - Contract transitions through operational states - **Emergency scenarios** - Circuit breakers, pauses, or liquidations occur in response to critical events ### Lifecycle _Let’s take a look at an example lifecycle._ **Consider a token vesting contract:** **Deployed** → **Init Stage**(beneficiaries & schedules are set) → **Active Phase**(tokens vest, claims are handled → **Completion**(all tokens are distributed) Each of these phases must be tested to ensure the contract behaves correctly throughout its entire lifecycle. * * * ## Why Not Just Unit or Integration Tests? Unit tests operate verify single functions. Integration tests verify component interactions. Lifecycle tests verify the evolution of a contract’s state and behavior during every stage. Think of it this way: - **Unit Tests:** checking individual car parts in isolation - **Integration Tests:** verify systems work together: drive train, brakes, transmission - **Lifecycle Tests:** ensure the car performs correctly every moment from when you start the engine to when you park it Lifecycle tests catch emergent behavior from the interplay of multiple operations over time, such as: - State corruption after a sequence of transactions - Reentrancy vulnerabilities in multistep workflows - Timing-dependent bugs that surface only after specific event sequences - Edge cases in state transitions that unit tests miss * * * ## Common Contract Lifecycle Patterns Smart contracts follow predictable lifecycle patterns: ### Time-Based Progression Contracts mature and/or evolve over time. **Examples:** - Vesting schedules - Escrow services - Time-locked governance Contracts transition through states based on temporal triggers. Testing requires simulating block timestamps and verifying behavior at key time points. ### User-Driven Evolution Contracts that progress based on user actions, like governance systems where proposal submission, voting, and execution drive state changes. Testing involves simulating multiple users and complex interaction sequences. ### Event-Triggered Changes Contracts that respond to external events or oracle data, transitioning states based on market conditions, price feeds, or external protocol interactions. Testing requires simulating external events and verifying appropriate state transitions. * * * ## Example: Lending Contract Lifecycle Let’s examine a lending contract that allows users to deposit collateral, borrow against it, repay loans, and face liquidation if collateral value drops. This is a perfect example of an event-triggered lifecycle where the contract’s state changes based on user actions and market conditions. **Key Lifecycle Stages:** 1. **Initialization** - Contract deployed with price feeds and configuration 2. **Collateral Deposit** - Users deposit assets to establish borrowing capacity 3. **Borrowing Phase** - Users borrow against their collateral up to a safe threshold 4. **Health Monitoring** - Continuous monitoring of collateral ratio vs. debt 5. **Market Volatility** - Price changes affect health factors 6. **Liquidation Event** - Undercollateralized positions trigger liquidation 7. **Recovery** - Borrowers repay debt or liquidators recover collateral A comprehensive lifecycle test would validate: - Initial deposit and borrow operations work correctly - Health factors are calculated accurately throughout the lifecycle - Price changes trigger appropriate liquidation conditions - Multiple users can operate simultaneously without interference - Edge cases like full liquidation vs. partial liquidation - State consistency after complex operation sequences * * * ## The Challenge: Complex Test Environment Setup Traditional lifecycle testing for Solidity smart contracts involves significant complexity: ### Environment Preparation Overhead Setting up a test environment requires: - Running a local Ethereum node (like Anvil or Ganache) - Managing node lifecycle (start, stop, restart) - Ensuring clean state between test runs - Handling port conflicts and resource management - Managing process cleanup and zombie processes ### Time Simulation Challenges Lifecycle tests often need to simulate: - Block timestamp progression for time-based logic - Block number advancement for block-dependent features - Consistent mining intervals - Realistic block production timing ### State Management Complexity Tests must handle: - Setting up initial contract states - Forking from mainnet for realistic conditions - Snapshotting and reverting to previous states - Managing multiple test environments in parallel ### Multi-User Scenario Complexity Realistic lifecycle tests require: - Multiple accounts with different roles - Coordinated sequences of transactions - Proper nonce management - Balance management across accounts **This is where Foundry Anvil Testcontainers transforms the landscape.** * * * ## Simplifying Lifecycle Tests with Foundry Anvil Testcontainers The **Foundry Anvil Testcontainers NodeJS Module** brings enterprise-grade test automation to Web3 development by eliminating the environmental complexity that plagues smart contract testing. ### What Problem Does It Solve? Foundry Anvil Testcontainers solves the core challenge of lifecycle testing: **environmental consistency and ease of setup**. By leveraging Docker containers and the battle-tested Testcontainers framework, it provides: #### Zero Configuration Setup Spin up isolated Anvil instances with a single line of code—no manual node management, no port conflicts, no cleanup scripts: ``` import { FoundryAnvilContainer } from "@hellaweb3/foundryanvil-testcontainers-nodejs"; // Start an Anvil container with a pristine blockchain state const container = await new FoundryAnvilContainer().start(); // Get the RPC endpoint ready for your tests const rpcUrl = container.getRpcUrl(); // Use with your favorite Web3 library const provider = new ethers.JsonRpcProvider(rpcUrl); ``` #### Parallel Test Execution Run multiple test suites simultaneously with completely isolated blockchain states. Each test gets its own Anvil instance, eliminating flaky tests caused by shared state: ``` describe("Lending Lifecycle - Happy Path", () => { let container; let provider; beforeEach(async () => { container = await new FoundryAnvilContainer().start(); provider = new ethers.JsonRpcProvider(container.getRpcUrl()); }); afterEach(async () => { await container.stop(); }); it("completes full borrow and repay cycle", async () => { // Test runs in complete isolation }); }); describe("Lending Lifecycle - Liquidation Path", () => { let container; let provider; beforeEach(async () => { // Another isolated Anvil instance for this test suite container = await new FoundryAnvilContainer().start(); provider = new ethers.JsonRpcProvider(container.getRpcUrl()); }); afterEach(async () => { await container.stop(); }); it("handles liquidation correctly", async () => { // Completely independent from other tests }); }); ``` #### Snapshot & Forking Support Test against mainnet forks or custom blockchain snapshots, essential for lifecycle tests that need realistic initial conditions: ``` // Fork from mainnet to test against real protocol state const container = await new FoundryAnvilContainer() .withFork("https://eth-mainnet.alchemyapi.io/v2/YOUR_KEY") .start(); // Or use a snapshot for consistent test conditions const container = await new FoundryAnvilContainer().withSnapshot("/path/to/snapshot.json").start(); ``` #### Custom Network Configuration Configure block time, chain ID, and mining behavior to match your lifecycle test requirements: ``` // Instant mining for fast tests const fastContainer = await new FoundryAnvilContainer().withBlockTime(0).start(); // Or realistic block times for time-sensitive lifecycle tests const realisticContainer = await new FoundryAnvilContainer() .withBlockTime(12) // 12 second blocks like mainnet .start(); ``` #### CI/CD Ready Works seamlessly in GitHub Actions, GitLab CI, and other automation pipelines. The container-based approach means your tests run identically locally and in CI: ``` # GitHub Actions example name: Smart Contract Lifecycle Tests on: [push, pull_request] jobs: test: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: node-version: "18" - run: npm install - run: npm test # Testcontainers automatically handles Docker in CI ``` * * * ## Real-World Impact: Before and After ### Before Foundry Anvil Testcontainers ``` // Complex manual setup const { spawn } = require("child_process"); let anvilProcess; beforeAll(async () => { // Manually start Anvil process anvilProcess = spawn("anvil", ["--port", "8545"]); // Wait for Anvil to be ready (unreliable) await new Promise((resolve) => setTimeout(resolve, 2000)); // Hope the port is available provider = new ethers.JsonRpcProvider("http://localhost:8545"); }, 30000); afterAll(async () => { // Manual cleanup (often leaves zombie processes) if (anvilProcess) { anvilProcess.kill(); } }); // Tests share state and can interfere with each other it("test 1", async () => { /* ... */ }); it("test 2", async () => { /* ... might fail due to test 1 state */ }); ``` **Problems:** - 80+ lines of boilerplate setup code - Flaky tests due to timing issues - Port conflicts when running multiple suites - Zombie processes requiring manual cleanup - Shared state causing test interference - Difficult to run tests in parallel - CI/CD environment differences ### After Foundry Anvil Testcontainers ``` import { FoundryAnvilContainer } from "@hellaweb3/foundryanvil-testcontainers-nodejs"; let container; let provider; beforeEach(async () => { container = await new FoundryAnvilContainer().start(); provider = new ethers.JsonRpcProvider(container.getRpcUrl()); }); afterEach(async () => { await container.stop(); }); // Each test gets a fresh blockchain state it("test 1", async () => { /* ... */ }); it("test 2", async () => { /* ... runs in complete isolation */ }); ``` **Benefits:** - 10 lines of clean, maintainable code - Zero flaky tests from environment issues - Automatic port management - Guaranteed cleanup - Complete test isolation - Parallel execution by default - Identical behavior locally and in CI **Development teams report:** - **80% reduction** in test environment setup time - **Near-zero** flaky tests due to environment inconsistencies - **Seamless onboarding** for new developers joining Web3 projects - **Faster CI/CD pipelines** with parallel test execution * * * ## Implementing a Complete Lifecycle Test Here’s how to implement a comprehensive lifecycle test for a lending protocol using Foundry Anvil Testcontainers: ``` import { FoundryAnvilContainer } from "@hellaweb3/foundryanvil-testcontainers-nodejs"; import { ethers } from "ethers"; describe("Lending Protocol - Full Lifecycle", () => { let container; let provider; let lendingContract; let collateralToken; let borrower; let liquidator; beforeEach(async () => { // Fresh blockchain for each test container = await new FoundryAnvilContainer() .withBlockTime(1) // 1 second blocks for time progression .start(); provider = new ethers.JsonRpcProvider(container.getRpcUrl()); // Setup accounts const accounts = await provider.listAccounts(); borrower = await provider.getSigner(accounts[0]); liquidator = await provider.getSigner(accounts[1]); // Deploy contracts const CollateralToken = await ethers.getContractFactory("MockERC20", borrower); collateralToken = await CollateralToken.deploy("Collateral", "COL"); const LendingContract = await ethers.getContractFactory("LendingWithLiquidation", borrower); lendingContract = await LendingContract.deploy(collateralToken.address); // Initial setup await collateralToken.mint(borrower.address, ethers.parseEther("1000")); await collateralToken.approve(lendingContract.address, ethers.MaxUint256); }); afterEach(async () => { await container.stop(); }); it("completes full lifecycle: deposit → borrow → price drop → liquidation", async () => { // Stage 1: Deposit collateral await lendingContract.deposit(ethers.parseEther("100")); const collateralAfterDeposit = await lendingContract.getCollateral(borrower.address); expect(collateralAfterDeposit).to.equal(ethers.parseEther("100")); // Stage 2: Set initial price and borrow await lendingContract.updatePrice(ethers.parseEther("100")); // $100 per token await lendingContract.borrow(ethers.parseEther("5000")); // Borrow $5000 const borrowAmount = await lendingContract.getBorrow(borrower.address); expect(borrowAmount).to.equal(ethers.parseEther("5000")); // Verify healthy position let isHealthy = await lendingContract.isHealthy(borrower.address); expect(isHealthy).to.be.true; // Stage 3: Price drops, position becomes unhealthy await lendingContract.updatePrice(ethers.parseEther("60")); // Price drops to $60 isHealthy = await lendingContract.isHealthy(borrower.address); expect(isHealthy).to.be.false; // Stage 4: Liquidation occurs const liquidatorBalanceBefore = await provider.getBalance(liquidator.address); await lendingContract .connect(liquidator) .liquidate(borrower.address, ethers.parseEther("5000"), { value: ethers.parseEther("5000") }); // Verify liquidation results const borrowAfterLiquidation = await lendingContract.getBorrow(borrower.address); expect(borrowAfterLiquidation).to.equal(0); const collateralAfterLiquidation = await lendingContract.getCollateral(borrower.address); expect(collateralAfterLiquidation).to.be.lessThan(ethers.parseEther("100")); // Liquidator receives bonus const liquidatorBalanceAfter = await provider.getBalance(liquidator.address); expect(liquidatorBalanceAfter).to.be.greaterThan(liquidatorBalanceBefore); }); it("handles time-based interest accrual throughout lifecycle", async () => { // Deposit and borrow await lendingContract.deposit(ethers.parseEther("100")); await lendingContract.updatePrice(ethers.parseEther("100")); await lendingContract.borrow(ethers.parseEther("5000")); const borrowAtStart = await lendingContract.getBorrow(borrower.address); // Simulate time passing (blocks advance automatically with blockTime: 1) await new Promise((resolve) => setTimeout(resolve, 10000)); // 10 seconds = ~10 blocks // Mine a block to trigger interest calculation await provider.send("evm_mine", []); const borrowAfterTime = await lendingContract.getBorrow(borrower.address); // Interest should have accrued expect(borrowAfterTime).to.be.greaterThan(borrowAtStart); }); it("handles multiple concurrent borrowers without interference", async () => { // Setup second borrower const accounts = await provider.listAccounts(); const borrower2 = await provider.getSigner(accounts[2]); await collateralToken.mint(borrower2.address, ethers.parseEther("1000")); await collateralToken.connect(borrower2).approve(lendingContract.address, ethers.MaxUint256); // Both borrowers deposit and borrow await lendingContract.deposit(ethers.parseEther("100")); await lendingContract.connect(borrower2).deposit(ethers.parseEther("200")); await lendingContract.updatePrice(ethers.parseEther("100")); await lendingContract.borrow(ethers.parseEther("5000")); await lendingContract.connect(borrower2).borrow(ethers.parseEther("10000")); // Price drops affecting only borrower1 await lendingContract.updatePrice(ethers.parseEther("60")); const isHealthy1 = await lendingContract.isHealthy(borrower.address); const isHealthy2 = await lendingContract.isHealthy(borrower2.address); expect(isHealthy1).to.be.false; // Borrower1 unhealthy expect(isHealthy2).to.be.true; // Borrower2 still healthy // Liquidate borrower1 await lendingContract .connect(liquidator) .liquidate(borrower.address, ethers.parseEther("5000"), { value: ethers.parseEther("5000") }); // Borrower2 unaffected const borrow2 = await lendingContract.getBorrow(borrower2.address); expect(borrow2).to.equal(ethers.parseEther("10000")); }); }); ``` This lifecycle test validates: - Complete user journey from deposit to liquidation - Time-based features like interest accrual - Multi-user scenarios without state interference - State transitions triggered by external events (price changes) - Edge cases in liquidation logic - Contract behavior throughout its operational lifetime **All with clean, maintainable test code and zero environmental complexity.** * * * ## Best Practices for Lifecycle Testing ### 1\. Test Realistic User Journeys Model your lifecycle tests after actual user behavior patterns. Don’t just test happy paths—include the messy reality of user mistakes, retries, and edge cases. ### 2\. Leverage Container Isolation Take advantage of Testcontainers’ isolation to run aggressive parallel testing. Each lifecycle test gets its own pristine blockchain, so you can run dozens simultaneously without conflicts. ### 3\. Use Snapshots for Complex Initial States For lifecycle tests requiring elaborate setup, use Anvil snapshots to establish a known starting point, then test from there: ``` // Create snapshot after setup await provider.send("evm_snapshot", []); const snapshotId = await provider.send("evm_snapshot", []); // Run test // Revert to snapshot for next test await provider.send("evm_revert", [snapshotId]); ``` ### 4\. Combine with Fuzzing Use Foundry’s fuzzing capabilities alongside lifecycle tests to explore edge cases in state transitions. ### 5\. Monitor Gas Throughout Lifecycle Track gas consumption at each lifecycle stage to identify optimization opportunities and detect unexpected gas spikes. * * * ## Why Hella Labs Built This At Hella Labs, we believe **quality and security are non-negotiable** in Web3 development. Smart contract bugs can lead to millions in losses—we’ve seen it happen repeatedly. Our Foundry Anvil Testcontainers module reflects our commitment to building tools that: - **Eliminate Environment Drift** - Every test runs in a pristine, identical environment - **Accelerate Development Cycles** - Developers spend less time on test setup and more time building - **Improve Test Reliability** - Consistent, reproducible tests mean fewer false positives - **Enable Continuous Testing** - Seamless CI/CD integration ensures quality at every commit This project showcases our engineering philosophy: - Comprehensive test coverage through dogfooding our own tools - Modern TypeScript architecture that’s type-safe and maintainable - Performance optimized for fast container startup - Extensive documentation with clear examples - Active maintenance supporting the latest Foundry releases * * * ## Get Started with Foundry Anvil Testcontainers ### Installation ``` npm install @hellaweb3/foundryanvil-testcontainers-nodejs ``` or ``` yarn add @hellaweb3/foundryanvil-testcontainers-nodejs ``` ### Quick Start ``` import { FoundryAnvilContainer } from "@hellaweb3/foundryanvil-testcontainers-nodejs"; // Start an Anvil container const container = await new FoundryAnvilContainer().start(); // Get the RPC endpoint const rpcUrl = container.getRpcUrl(); // Use with your favorite Web3 library const provider = new ethers.JsonRpcProvider(rpcUrl); // Run your lifecycle tests... // Cleanup await container.stop(); ``` ### Resources - **GitHub Repository:** [hella-labs/foundryanvil-testcontainers-nodejs](https://github.com/hella-labs/foundryanvil-testcontainers-nodejs) - **NPM Package:** [@hellaweb3/foundryanvil-testcontainers-nodejs](https://www.npmjs.com/package/@hellaweb3/foundryanvil-testcontainers-nodejs) - **Full Documentation:** [API Documentation](https://hellalabs.dev/foundryanvil-testcontainers-nodejs/) * * * ## Our Service Offerings: Beyond Open Source While our open-source tools like Foundry Anvil Testcontainers empower developers worldwide, we also provide **curated service offerings specifically tailored for emerging tech Web3 startups**. Our team brings **US-based expertise combined with global workforce cost effectiveness** to deliver exceptional value. ### DevOps & Test Automation We build robust CI/CD pipelines with a focus on **Web3 Test Automation**. As creators of `foundryanvil-testcontainers` and `wiremock-testcontainers`, we specialize in high-fidelity E2E testing for smart contracts and dApps. Your startup needs this automation as a force multiplier to compete with entrenched players. **Our automation strategies reduce your time-to-market while increasing the reliability of your protocol.** ### Web3 Tooling & SDKs Need custom tooling for your protocol? We build developer tools, SDKs, and testing frameworks that make your Web3 project more accessible and reliable. ### Technical Articles & Documentation Quality technical content drives developer adoption. We craft in-depth technical articles, documentation, and educational content that resonates with Web3 developers. ### dApp Web Front-Ends Beautiful, performant front-ends that connect seamlessly with your smart contracts. We specialize in modern web technologies optimized for Web3 interactions. ### Custom Discord Bots Engage your community with custom Discord bots tailored to your protocol’s needs—from token gating to on-chain data notifications. ### GTM Launch Packages Complete go-to-market support including technical content, video tutorials, documentation, and developer advocacy to ensure your protocol launches successfully. * * * ## Ready to Ship with Confidence? Whether you’re building a DeFi protocol, NFT marketplace, or the next breakthrough Web3 application, **comprehensive lifecycle testing is non-negotiable**. Foundry Anvil Testcontainers makes it easier than ever to implement the testing strategy your users deserve. ### Ship with confidence. Our automation strategies reduce your time-to-market while increasing the reliability of your protocol. This open-source project is just a glimpse of what we can deliver for your team. Get expert guidance on implementing lifecycle tests, building robust CI/CD pipelines, or developing custom Web3 tooling for your protocol. [Get a DevOps Audit](/contact/) [Explore All Service Offerings →](/web3-consultant-service-offerings/) * * * **Thanks for reading!** If you found this article helpful, consider starring our [Foundry Anvil Testcontainers repository](https://github.com/hella-labs/foundryanvil-testcontainers-nodejs) and sharing it with your Web3 developer community. _Part of the Hella Labs commitment to open-source excellence and Web3 infrastructure._ Share: - [](https://twitter.com/intent/tweet?text=Mastering%20Solidity%20Lifecycle%20Testing%20with%20Foundry%20Anvil%20Testcontainers&url=https%3A%2F%2Fwww.hellalabs.dev%2Fsolidity-lifecycle-testing-foundry-anvil%2F) - [](https://www.linkedin.com/shareArticle?mini=true&url=https%3A%2F%2Fwww.hellalabs.dev%2Fsolidity-lifecycle-testing-foundry-anvil%2F&title=Mastering%20Solidity%20Lifecycle%20Testing%20with%20Foundry%20Anvil%20Testcontainers&summary=Learn%20how%20to%20implement%20comprehensive%20lifecycle%20tests%20for%20Solidity%20smart%20contracts%20and%20simplify%20complex%20test%20scenarios%20with%20Foundry%20Anvil%20Testcontainers) ## Start the conversation Show Comments ## Related [![](/_astro/solidity-e2e-invariant-testing.C75b-0rk_Z14vja5.jpg)](/e2e-invariant-testing-solidity-anvil-wiremock/) - [Solidity](/tags/solidity/) - [Testing](/tags/testing/) - [Invariant Testing](/tags/invariant-testing/) - [Fuzzing](/tags/fuzzing/) - [Foundry](/tags/foundry/) - [Anvil](/tags/anvil/) - [WireMock](/tags/wiremock/) ### [End-to-End Invariant Testing for Solidity: Fuzz the Whole Stack with Foundry Anvil and WireMock Testcontainers](/e2e-invariant-testing-solidity-anvil-wiremock/) Forge invariant tests stop at the EVM boundary. Learn how to fuzz random sequences of real transactions, keeper runs, price-feed outages and RPC faults against a containerized Anvil node, and assert protocol invariants after every step. 21 Nov, 2026 27 min read [![](/_astro/chaos-engineering.DFkfE7jN_Z2mHjmN.jpg)](/on-chain-chaos-engineering-ethereum-wiremock-anvil/) - [Testing](/tags/testing/) - [Chaos Engineering](/tags/chaos-engineering/) - [Ethereum](/tags/ethereum/) - [Anvil](/tags/anvil/) - [WireMock](/tags/wiremock/) - [EthersJS](/tags/ethersjs/) - [Nestjs](/tags/nestjs/) ### [Survive the Outage and Stop Writing Fake JSON-RPC Mocks: Real Life On-Chain Chaos Engineering for Ethereum Apps](/on-chain-chaos-engineering-ethereum-wiremock-anvil/) Put WireMock in front of a real Foundry Anvil node with Testcontainers to inject 503s, dropped connections, latency and 429s into your Ethereum app, without hand-writing a single fake JSON-RPC response. 19 Nov, 2026 14 min read [![](/_astro/github-open-source.BpYF5ln9_1UHugM.png)](/web3-ethereum-open-source/) - [Ethereum](/tags/ethereum/) - [Javascript](/tags/javascript/) - [Typescript](/tags/typescript/) - [Testcontainers](/tags/testcontainers/) - [Wiremock](/tags/wiremock/) - [Foundry](/tags/foundry/) ### [Open-Source Web3 Ethereum Projects at Hella Labs](/web3-ethereum-open-source/) Supporting the Web3 Ethereum ecosystem with open source projects, tools and test automation. 13 May, 2026 3 min read --- ## On-Chain Ethereum Data via Server-Sent Events and GraphQL with Ethers.js, RxJS and Nest.js | Hella Labs URL: https://www.hellalabs.dev/sse-graphql-ethereum-nestjs-thinclient Re-use one Nest.js service layer to stream finalized Ethereum blocks over Server-Sent Events and serve block queries over GraphQL, with ultra-thin vanilla JS… ## On-Chain Ethereum Data via Server-Sent Events and GraphQL In [Part 1](/websocket-sse-graphql-nestjs-thinclient/) we built a [Nest.js](https://nestjs.com/) backend that wraps [Ethers.js](https://docs.ethers.org/) in a reusable module and streams finalized Ethereum blocks to an ultra-thin browser client over [WebSockets](https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API). This time we keep **every line of that SDK and service code** and put two new front doors on it: - **[Server-Sent Events (SSE)](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events)**: a one-way, plain-HTTP stream of finalized blocks, consumed in the browser with the built-in `EventSource` - **[GraphQL](https://graphql.org/)**: a typed query API that lets the client ask for exactly the block fields it needs Both are a single small Nest.js class each. That’s the payoff of the layered design from Part 1: the transport is a thin adapter, and the business logic lives in one place. 💡 New to the series? Part 1 walks through the **EthersSdk** module, its configuration and the **EthersService** in detail. This article only recaps the pieces SSE and GraphQL touch, so it’s worth a skim first. ### Why Server-Sent Events WebSockets are a two-way channel. Most dApp dashboards don’t need that: the server pushes new blocks, prices or events, and the client just listens. SSE is built for exactly this one-way flow: - **Plain HTTP**: a long-lived `GET` with `Content-Type: text/event-stream`. Proxies, load balancers, auth headers and CORS all behave the way they do for any other request. - **Built into the browser**: `EventSource` needs no library and no handshake protocol. - **Automatic reconnection**: the browser reconnects on its own if the connection drops, and can send the last event `id` it saw so the server can resume. - **Subscribing is connecting**: there’s no subscribe message to send; each endpoint _is_ a topic. 💡 Over HTTP/1.1, browsers allow only **6 open connections per domain**, and every `EventSource` holds one open. Serve your API over HTTP/2 (which multiplexes streams over one connection) or keep the number of concurrent streams per page small. ### Why GraphQL Streams are great for “tell me when something changes”. For “give me this specific block”, a query API is a better fit. GraphQL adds a few things over a plain REST endpoint: - **Clients pick their fields**: a mobile widget can ask for just `hash`, a dashboard for everything. - **One endpoint, one typed schema**: every query and type is discoverable and validated before it reaches your code. - **Code-first with Nest.js**: decorate TypeScript classes and Nest generates the schema for you. * * * ## Recap: One Service Layer, Many Transports You can follow along with the [GitHub Repo](https://github.com/anataliocs/nestjs-typeorm-full-example). 💡 Open this repo in a [GitHub Codespace Devcontainer](https://codespaces.new/anataliocs/nestjs-typeorm-full-example) to follow along! From Part 1, the `EthersSdkService` holds the Ethers.js `JsonRpcProvider`, and the `EthersService` turns raw SDK results into small DTOs. The **same** `_getFinalizedBlocksJson()` function feeds the WebSocket gateway, the REST controller and, in this article, the SSE controller. **ethers.service.ts excerpt** ``` @Injectable() export class EthersService { constructor(private readonly ethersSdkService: EthersSdkService) {} readonly _getFinalizedBlocksJson: () => Promise = async (): Promise => { const blockOrNull = await this.ethersSdkService.getFinalizedBlock(); if (blockOrNull === null) { return {} as FinalizedBlock; } return { blockNumber: blockOrNull.number, date: blockOrNull.date ?? "", hash: blockOrNull.hash ?? "", } as FinalizedBlock; }; // ... } ``` Each transport only differs in the **envelope** the data is wrapped in: | Transport | Nest.js entry point | Envelope | Client | | --- | --- | --- | --- | | WebSockets | @WebSocketGateway gateway | WsResponse | WebSocket | | SSE | @Sse() controller method | MessageEvent | EventSource | | GraphQL | @Resolver with @Query | GraphQL @ObjectType model | fetch + a query | * * * ## Server-Sent Events with Nest.js **Full example:** [ethers.sse.controller.ts](https://github.com/anataliocs/nestjs-typeorm-full-example/blob/main/src/ethers/ethers.sse.controller.ts) ### Message Utilities buildMessageEvent Function Where Part 1 used `buildWsResponse()`, SSE uses its sibling `buildMessageEvent()`. It awaits the passed-in SDK wrapper and wraps the result in a [Nest.js `MessageEvent`](https://docs.nestjs.com/techniques/server-sent-events), whose fields map to the `data:`, `id:` and `retry:` lines of the SSE wire format. **message-utils.ts excerpt** ``` export async function buildMessageEvent( n: number, sdkFunction: () => Promise, ): Promise> { return { type: "message", id: n, data: await sdkFunction(), retry: 0, } as unknown as MessageEvent; } ``` The `id` is the tick count from the RxJS interval, so every event gets an increasing id. ### Ethers Service subscribeToFinalizedBlocksForSse Function The service exposes a factory for the SSE controller, mirroring `finalizedBlocksStreamForWebsocket()` from Part 1. It returns a function that takes the interval tick `n` and converts the `Promise>` into an **Observable** with `from()`. **ethers.service.ts excerpt** ``` export class EthersService { // ... subscribeToFinalizedBlocksForSse(): (n: number) => Observable> { return (n: number): Observable> => from(buildMessageEvent(n, this._getFinalizedBlocksJson)); } // ... } ``` ### SSE Controller The controller is where SSE gets interesting, mostly because there’s so little of it. A method decorated with `@Sse()` returns an `Observable`, and Nest.js does the rest: it sets the `text/event-stream` headers, keeps the connection open and writes each emitted value as an SSE event. **ethers.sse.controller.ts** ``` @Controller("/ethers/sse") class EthersSseController { constructor(private readonly ethersService: EthersService) {} @Sse("/block-number") newBlocks(): Observable> { return interval(5000) .pipe(mergeMap(this.ethersService.subscribeToNewBlocksForSse())) .pipe(distinct(({ data }) => data.blockNumber)); } @Sse("/finalized-blocks") finalizedBlocks(): Observable> { return interval(5000) .pipe(mergeMap(this.ethersService.subscribeToFinalizedBlocksForSse())) .pipe(distinct(({ data }) => data.blockNumber)); } } ``` The pipeline is the same one the WebSocket gateway uses: - `interval(5000)` ticks every 5 seconds - `mergeMap()` calls the service on each tick and flattens the resulting Observable into the stream - `distinct()` drops events whose block number has already been sent, so the client only sees new blocks Compare this with Part 1’s gateway: there’s no `@SubscribeMessage`, no topic `switch` and no DTO validation. **Each URL is a topic**, and connecting to it is the subscription. 💡 **Two production notes for long-lived streams:** - `distinct()` remembers **every** key it has ever seen, so a stream left open for days keeps a growing set of block numbers in memory. Block numbers only go up, so `distinctUntilChanged((a, b) => a.data.blockNumber === b.data.blockNumber)` gives the same result in constant memory. - Each connected client gets its **own** interval and its own RPC calls. With many clients, build the stream once and `share()` it so every subscriber reads from a single poll of your RPC provider. ### Try It with cURL Because SSE is plain HTTP, you don’t need a client to test it. `-N` turns off cURL’s buffering so events print as they arrive. **sse-curl.sh excerpt** ``` curl -s -N -H "Accept: text/event-stream" "http://127.0.0.1:3000/ethers/sse/finalized-blocks/" ``` Each event arrives as `id:` and `data:` lines followed by a blank line, with `data` holding the JSON-serialized `FinalizedBlock`. * * * ## SSE Front-end Client As in Part 1, the thin client is a single `.html` file plus a small `.js` file, styled with [Pico CSS](https://picocss.com/) and no build step. ### SSE Front-end Client - HTML **finalized-blocks.html excerpt** ```
Emitted Events - Finalized Blocks

``` Notice what’s missing compared to the WebSocket page: there’s no **Subscribe** button. The stream starts as soon as the page opens the `EventSource`. ### SSE Front-end Client - Javascript **Full example:** [sseFinalizedBlock.js](https://github.com/anataliocs/nestjs-typeorm-full-example/blob/main/client/src/sse/ethers/js/sseFinalizedBlock.js) An `SSEConnect` object is created with the SSE endpoint and the same `createLinkEth` Etherscan link builder used by the WebSocket client. A click listener on `#close-connection-button` closes the stream. **sseFinalizedBlock.js** ``` const eventSource = new SSEConnect( "http://127.0.0.1:3000/ethers/sse/finalized-blocks/", createLinkEth, ); // Close SSE connection document.querySelector("#close-connection-button").addEventListener("click", () => { console.log("Closing SSE connection..."); eventSource.closeEventSource(); }); ``` ### Front-end Client - SSEConnect Class **Full example:** [sseConnect.js](https://github.com/anataliocs/nestjs-typeorm-full-example/blob/main/client/src/sse/common/sseConnect.js) **SSEConnect** is the SSE counterpart of Part 1’s **WsConnect**. Its constructor opens the stream with the standard [EventSource API](https://developer.mozilla.org/en-US/docs/Web/API/EventSource). **sseConnect.js excerpt** ``` export class SSEConnect { constructor(url, linkFunction) { this.eventSource = new EventSource(url, { withCredentials: false, }); this.linkFunction = linkFunction; this.setEventHandlers(); } // ... } ``` `setEventHandlers()` renders each event the same way `WsConnect` does: the raw JSON plus an Etherscan link. One difference: an SSE event’s `data` **is** the payload, so there’s no `.data` envelope to unwrap as there was with `WsResponse`. **sseConnect.js excerpt** ``` export class SSEConnect { // ... setEventHandlers() { this.eventSource.onmessage = (msg) => { const data = JSON.parse(msg.data); const message = document.createElement("div"); message.appendChild(document.createTextNode(msg.data)); message.appendChild(document.createElement("br")); const link = this.linkFunction(data); message.appendChild(link); message.appendChild(document.createElement("hr")); document.querySelector("#messages").appendChild(message); }; this.eventSource.onopen = () => { if (this.eventSource.readyState === 1) { document .querySelector("#connection-status") .appendChild(document.createTextNode("Connected!")); } }; // ... } // ... } ``` `closeEventSource()` resets the UI and closes the stream. Once closed, the browser will **not** reconnect. **sseConnect.js excerpt** ``` export class SSEConnect { // ... closeEventSource() { document.querySelector("#connection-status").innerHTML = ""; document.querySelector("#progress-bar").value = 0; this.eventSource.close(); } } ``` * * * ## GraphQL with Nest.js **Full example:** [ethers-graphql.resolver.ts](https://github.com/anataliocs/nestjs-typeorm-full-example/blob/main/src/ethers/ethers-graphql.resolver.ts) ### GraphQL Module Configuration Nest.js supports [code-first GraphQL](https://docs.nestjs.com/graphql/quick-start#code-first) with the Apollo driver. `autoSchemaFile` generates the GraphQL schema from your decorated TypeScript classes on startup, and `playground: true` serves an interactive query editor at `/graphql` during development. **app.module.ts excerpt** ``` GraphQLModule.forRoot({ driver: ApolloDriver, // 'autoSchemaFile' generates the schema file automatically autoSchemaFile: "src/schema.gql", // 'playground: true' enables the GraphiQL interface for testing (useful in development) playground: true, definitions: { path: join(process.cwd(), "src/graphql.ts"), }, }); ``` ### Block GraphQL Model **Full example:** [block.ts](https://github.com/anataliocs/nestjs-typeorm-full-example/blob/main/src/ethers/models/block.ts) The `Block` class is decorated with `@ObjectType()`, and each `@Field()` becomes a field in the generated schema. `blockNumber` is exposed as a GraphQL `ID`. **models/block.ts** ``` @ObjectType({ description: "EVM Block" }) export class Block { @Field((type) => ID) blockNumber?: number; @Field() creationDate: Date; @Field() hash?: string; @Field() nonce?: string; @Field() transactionCount?: number; } ``` ### Ethers Service getBlockByNumberForGraphQL Function The service gets one more SDK wrapper, this time calling `getBlock(blockNumber)` from Part 1’s `EthersSdkService` and mapping the Ethers.js `Block` onto the GraphQL model. `getBlockByNumberForGraphQL()` wraps it in an **Observable**, just like every other transport. **ethers.service.ts excerpt** ``` export class EthersService { // ... readonly _getBlockByNumberGraphQL = async (blockNumber: number) => { const blockOrNull = await this.ethersSdkService.getBlock(blockNumber); return blockOrNull === null ? ({} as Block) : ({ creationDate: blockOrNull.date ?? "", blockNumber: blockOrNull.number, hash: blockOrNull.hash ?? "", transactionCount: blockOrNull.length ?? 0, nonce: blockOrNull.nonce ?? "", } as Block); }; getBlockByNumberForGraphQL(blockNumber: number): Observable { return from(this._getBlockByNumberGraphQL(blockNumber)); } // ... } ``` In Ethers.js v6, a `Block`’s `length` is the number of transactions it contains, which is what feeds `transactionCount`. ### GraphQL Resolver The resolver is the GraphQL equivalent of a controller. `@Resolver()` ties it to the `Block` type, and `@Query()` exposes `getBlockByNumber` as a root query whose `blockNumber` argument comes from `@Args()`. **ethers-graphql.resolver.ts** ``` @Resolver((of) => Block) export class EthersGraphqlResolver { constructor(private readonly ethersService: EthersService) {} @Query((returns) => Block) getBlockByNumber(@Args("blockNumber") blockNumber: number): Observable { return this.ethersService.getBlockByNumberForGraphQL(blockNumber); } } ``` Nest.js resolvers can return an **Observable**: Nest waits for it to complete and sends its last value as the result. `from(promise)` emits once and completes, so the service layer stays reactive end to end, even for a single request/response query. 💡 The TypeScript `number` on `blockNumber` becomes a GraphQL `Float!` argument in the generated schema, which is why the client query below declares `$blockNumber: Float!`. Use `@Args("blockNumber", { type: () => Int })` if you’d rather expose an `Int`. ### Try It with cURL GraphQL is a `POST` of a JSON body with a `query` string. Ask for only the fields you need: **graphql-curl.sh excerpt** ``` curl 'http://127.0.0.1:3000/graphql' \ -H 'Content-Type: application/json' \ --data-binary '{"query":"{ getBlockByNumber(blockNumber: 24068107) { blockNumber hash transactionCount } }"}' ``` Or open `http://127.0.0.1:3000/graphql` in a browser and explore the schema in the playground. * * * ## GraphQL Front-end Client ### GraphQL Front-end Client - HTML **Full example:** [graphql-block-query.html](https://github.com/anataliocs/nestjs-typeorm-full-example/blob/main/client/src/graphql/ethers/graphql-block-query.html) The page has a block number input, a button to run the query, and the familiar `#messages` area for results. **graphql-block-query.html excerpt** ```
GraphQL Query - Get Block by Number

``` ### GraphQL Front-end Client - Javascript **Full example:** [getBlockByNumber.js](https://github.com/anataliocs/nestjs-typeorm-full-example/blob/main/client/src/graphql/ethers/js/getBlockByNumber.js) `getBlockByNumber()` reads and validates the input, then sends a named query with a `$blockNumber` variable. Passing the value as a **variable** instead of pasting it into the query string keeps the query static, cacheable and safe from injection. **getBlockByNumber.js excerpt** ``` export async function getBlockByNumber() { const blockNumber = parseInt(document.getElementById("blockNumber").value); if (!blockNumber || blockNumber < 0) { alert("Please enter a valid block number"); return; } const query = ` query GetBlockByNumber($blockNumber: Float!) { getBlockByNumber(blockNumber: $blockNumber) { blockNumber creationDate hash nonce transactionCount } } `; try { const response = await graphQLRequest(query, blockNumber); if (response.errors) { displayGraphQLErrors(response.errors); return; } const block = response.data.getBlockByNumber; displayResults(block, createLinkEth(block)); } catch (error) { displayGraphQLErrors(error.message); } } ``` GraphQL reports most problems (an unknown field, a bad argument type) in an `errors` array on a normal `200` response rather than with an HTTP error status, so the client checks `response.errors` before reading `data`. ### Front-end Client - graphQLRequest Function **Full example:** [graphqlClient.js](https://github.com/anataliocs/nestjs-typeorm-full-example/blob/main/client/src/graphql/common/graphqlClient.js) No GraphQL client library needed: a GraphQL request is a `fetch()` that POSTs the query and its variables as JSON. **graphqlClient.js excerpt** ``` export async function graphQLRequest(query, blockNumber) { const res = await fetch("http://127.0.0.1:3000/graphql", { method: "POST", headers: { "Content-Type": "application/json", }, body: JSON.stringify({ query: query, variables: { blockNumber: blockNumber }, }), }); return res.json(); } ``` * * * ## WebSockets vs. SSE vs. GraphQL: Which One When? All three now sit on the same `EthersService`, so you can offer every one of them and let each client pick: | Need | Best fit | | --- | --- | | Server pushes updates; client only listens | SSE | | Client and server both send messages, or change topics live | WebSockets | | Client asks for specific data, picking the fields it needs | GraphQL queries | | Typed, field-selected data and live updates | GraphQL subscriptions (over WebSockets) | | Strict proxies or firewalls that block WebSocket upgrades | SSE (it’s just HTTP) | * * * ## E2E Test Automation with Foundry Anvil Testcontainers Both new endpoints read from an Ethereum node, so the most useful tests run them against a real one. [Foundry Anvil Testcontainers](/open-source/foundry-anvil-testcontainers/) starts a disposable [Anvil](https://getfoundry.sh/anvil/overview) node in Docker for each test file, so the tests are fast, deterministic and need no RPC provider or API key. Here we mine a few blocks on a fresh chain, then check that the GraphQL query returns the same block Anvil reports and that the SSE stream emits the current block number. **ethers.e2e-spec.ts (example)** ``` import { AnvilContainer, AnvilOptions, type StartedAnvilContainer, } from "@hellaweb3/foundryanvil-testcontainers-nodejs"; import { ApolloDriver, type ApolloDriverConfig } from "@nestjs/apollo"; import type { INestApplication } from "@nestjs/common"; import { GraphQLModule } from "@nestjs/graphql"; import { Test } from "@nestjs/testing"; import { firstValueFrom } from "rxjs"; import request from "supertest"; describe("Ethers SSE + GraphQL E2E", () => { let anvil: StartedAnvilContainer; let app: INestApplication; beforeAll(async () => { anvil = await new AnvilContainer(new AnvilOptions().logs.quiet()).start(); await anvil.mine(5); // blocks 1..5 on a fresh chain const moduleRef = await Test.createTestingModule({ imports: [ EthersSdkModule.registerAsync({ useFactory: () => ({ network: "anvil", rpcServerUrl: anvil.rpcUrl, apiKey: "" }), }), GraphQLModule.forRoot({ driver: ApolloDriver, autoSchemaFile: true }), ], controllers: [EthersSseController], providers: [EthersService, EthersGraphqlResolver], }).compile(); app = moduleRef.createNestApplication(); await app.init(); }, 120_000); afterAll(async () => { await app?.close(); await anvil?.stop(); }); it("queries a block by number over GraphQL", async () => { const expected = await anvil.testClient.getBlock({ blockNumber: 3n }); const res = await request(app.getHttpServer()) .post("/graphql") .send({ query: "{ getBlockByNumber(blockNumber: 3) { blockNumber hash } }" }); expect(res.body.errors).toBeUndefined(); expect(res.body.data.getBlockByNumber).toEqual({ blockNumber: "3", hash: expected.hash }); }); it("emits the latest block number over SSE", async () => { const sse = app.get(EthersSseController); // The first event arrives on the first 5 s interval tick const event = await firstValueFrom(sse.newBlocks()); expect(event.data.blockNumber).toBe(5); }, 15_000); }); ``` 💡 `EthersSdkService` builds the RPC URL as `rpcServerUrl + apiKey`, so pass `apiKey: ""` for a local node. Leaving it out would append the string `undefined` to Anvil’s URL. A few things worth noticing: - **GraphQL `ID`s are strings on the wire**, so `blockNumber` comes back as `"3"`, not `3`. - The SSE test subscribes to the controller’s **Observable** directly. That tests the RxJS pipeline without parsing the `text/event-stream` format; cover the HTTP layer separately with a cURL smoke test if you need to. - Anvil can also **fast-forward time, reorg the chain or fork mainnet**, which is how you’d test the `distinct()` de-duplication or how your stream behaves during a reorg. See [End-to-End Invariant Testing for Solidity](/e2e-invariant-testing-solidity-anvil-wiremock/) for a deeper dive, and [On-Chain Chaos Engineering](/on-chain-chaos-engineering-ethereum-wiremock-anvil/) to inject RPC outages into exactly this kind of streaming backend. * * * ## Conclusion Thanks for reading! We took the Ethers.js module and service from [Part 1](/websocket-sse-graphql-nestjs-thinclient/) and, without touching them, exposed the same on-chain data two new ways: an SSE stream for push updates and a GraphQL API for typed, field-selected queries. Each transport was one small Nest.js class plus an ultra-thin vanilla JS client. ### Some Key Takeaways to Consider **Benefits:** - **Reuse**: `_getFinalizedBlocksJson()` now powers REST, WebSockets and SSE, and the GraphQL wrapper sits right beside it in the same service - **SSE Simplicity**: plain HTTP, a built-in browser client, automatic reconnection, and no subscribe protocol - **GraphQL Precision**: clients request exactly the fields they need from a typed, self-documenting schema - **Thin Clients**: no framework or client library on the front end, just `EventSource` and `fetch()` **Concepts:** - **Transport as an Adapter**: the controller, gateway or resolver only chooses the envelope; the service owns the logic - **Reactive End to End**: Nest.js accepts Observables from SSE controllers, gateways and resolvers alike - **Long-lived Streams Need Care**: bound memory with `distinctUntilChanged()` and `share()` a single upstream poll across clients Next in the series, [Part 3: On-Chain Solana Data via WebSockets](/websocket-solana-kit-rxjs-nestjs-thinclient/) re-uses the same pattern for [Solana](https://www.solanakit.com/), and [Bitcoin](https://github.com/bitcoinjs/bitcoinjs-lib) will follow; both modules already live alongside the Ethers.js module in the [example repo](https://github.com/anataliocs/nestjs-typeorm-full-example). 💡 **What should we cover next in the series?** Another chain, GraphQL subscriptions, indexing contract events, production hardening? [Tell us in the Disqus comments below](#comments) and we’ll use your votes to pick a future entry. _Thanks again for reading!_ * * * ## Need Real-Time On-Chain Data in Your dApp? Whether you’re streaming blocks to a trading dashboard, indexing contract events, or serving typed on-chain data to web, mobile and analytics clients, **the right transport and a well-tested backend** make the difference between a snappy dApp and a sluggish one. We design and build Nest.js and Web3 backends, real-time APIs and the E2E test automation that keeps them reliable when your RPC provider isn’t. [Talk to Hella Labs](/contact/) [Explore All Service Offerings →](/web3-consultant-service-offerings/) Share: - [](https://twitter.com/intent/tweet?text=On-Chain%20Ethereum%20Data%20via%20Server-Sent%20Events%20and%20GraphQL%20with%20Ethers.js%2C%20RxJS%20and%20Nest.js&url=https%3A%2F%2Fwww.hellalabs.dev%2Fsse-graphql-ethereum-nestjs-thinclient%2F) - [](https://www.linkedin.com/shareArticle?mini=true&url=https%3A%2F%2Fwww.hellalabs.dev%2Fsse-graphql-ethereum-nestjs-thinclient%2F&title=On-Chain%20Ethereum%20Data%20via%20Server-Sent%20Events%20and%20GraphQL%20with%20Ethers.js%2C%20RxJS%20and%20Nest.js&summary=Re-use%20one%20Nest.js%20service%20layer%20to%20stream%20finalized%20Ethereum%20blocks%20over%20Server-Sent%20Events%20and%20serve%20block%20queries%20over%20GraphQL%2C%20with%20ultra-thin%20vanilla%20JS%20clients%20and%20RxJS%20Observables.) ## Start the conversation Show Comments ## Related [![](/_astro/onchain-data-1.DuOJwwRh_2ap8O6.jpg)](/websocket-sse-graphql-nestjs-thinclient/) - [Nestjs](/tags/nestjs/) - [Ethereum](/tags/ethereum/) - [EthersJS](/tags/ethersjs/) - [RxJS](/tags/rxjs/) - [WebSockets](/tags/websockets/) ### [On-Chain Ethereum Data via WebSockets with Ethers.js, RxJS and Nest.js](/websocket-sse-graphql-nestjs-thinclient/) Build more responsive, snappy, performant dApps with reactive streams with RxJS Observables, ethers.js and the power of a Nest.js backend 16 Jan, 2026 14 min read [![](/_astro/chaos-engineering.DFkfE7jN_Z2mHjmN.jpg)](/on-chain-chaos-engineering-ethereum-wiremock-anvil/) - [Testing](/tags/testing/) - [Chaos Engineering](/tags/chaos-engineering/) - [Ethereum](/tags/ethereum/) - [Anvil](/tags/anvil/) - [WireMock](/tags/wiremock/) - [EthersJS](/tags/ethersjs/) - [Nestjs](/tags/nestjs/) ### [Survive the Outage and Stop Writing Fake JSON-RPC Mocks: Real Life On-Chain Chaos Engineering for Ethereum Apps](/on-chain-chaos-engineering-ethereum-wiremock-anvil/) Put WireMock in front of a real Foundry Anvil node with Testcontainers to inject 503s, dropped connections, latency and 429s into your Ethereum app, without hand-writing a single fake JSON-RPC response. 19 Nov, 2026 14 min read [![](/_astro/onchain-data-3.DKgNIT4I_dzzeC.jpg)](/websocket-solana-kit-rxjs-nestjs-thinclient/) - [Nestjs](/tags/nestjs/) - [Solana](/tags/solana/) - [Solana Kit](/tags/solana-kit/) - [RxJS](/tags/rxjs/) - [WebSockets](/tags/websockets/) ### [On-Chain Solana Data via WebSockets with Solkit, RxJS and Nest.js](/websocket-solana-kit-rxjs-nestjs-thinclient/) Wrap Solana Kit (@solana/kit) in a reusable Nest.js module and stream finalized Solana blocks over WebSockets to an ultra-thin vanilla JS client with RxJS Observables, re-using the exact pattern from the Ethereum articles. 24 Nov, 2026 21 min read --- ## Topics | Hella Labs URL: https://www.hellalabs.dev/tags Browse Hella Labs articles by topic: Ethereum, Solidity, Foundry, testing, Testcontainers, WebSockets, RxJS, CSS animation and more. # Topics 24 topics across the blog - [Animation1 post](/tags/animation/) - [Anvil3 posts](/tags/anvil/) - [Chaos Engineering1 post](/tags/chaos-engineering/) - [CSS-tricks1 post](/tags/css-tricks/) - [Ethereum4 posts](/tags/ethereum/) - [EthersJS3 posts](/tags/ethersjs/) - [Foundry3 posts](/tags/foundry/) - [Fuzzing1 post](/tags/fuzzing/) - [GraphQL1 post](/tags/graphql/) - [Invariant Testing1 post](/tags/invariant-testing/) - [Javascript1 post](/tags/javascript/) - [Nestjs4 posts](/tags/nestjs/) - [RxJS3 posts](/tags/rxjs/) - [Server-Sent Events1 post](/tags/server-sent-events/) - [Smart Contracts1 post](/tags/smart-contracts/) - [Solana1 post](/tags/solana/) - [Solana Kit1 post](/tags/solana-kit/) - [Solidity2 posts](/tags/solidity/) - [Testcontainers1 post](/tags/testcontainers/) - [Testing3 posts](/tags/testing/) - [Typescript1 post](/tags/typescript/) - [Web31 post](/tags/web3/) - [WebSockets2 posts](/tags/websockets/) - [WireMock3 posts](/tags/wiremock/) --- ## Animation Articles | Hella Labs URL: https://www.hellalabs.dev/tags/animation 1 Hella Labs post about Animation: Pure CSS Animated Gradient Background and More!. # Animation A collection of 1 Post [![](/_astro/css-animations-2.DpBqQg1V_Z2h3aIo.jpg)](/pure-css-animations/) - [CSS-tricks](/tags/css-tricks/) - [Animation](/tags/animation/) ## [Pure CSS Animated Gradient Background and More!](/pure-css-animations/) You can do amazing things with pure CSS nowadays, including animations without any Javascript. 05 Aug, 2025 18 min read --- ## Anvil Articles | Hella Labs URL: https://www.hellalabs.dev/tags/anvil 3 Hella Labs posts about Anvil: End-to-End Invariant Testing for Solidity: Fuzz the Whole Stack with Foundry Anvil and WireMock Testcontainers; Survive the… # Anvil A collection of 3 Posts [![](/_astro/solidity-e2e-invariant-testing.C75b-0rk_Z14vja5.jpg)](/e2e-invariant-testing-solidity-anvil-wiremock/) - [Solidity](/tags/solidity/) - [Testing](/tags/testing/) - [Invariant Testing](/tags/invariant-testing/) - [Fuzzing](/tags/fuzzing/) - [Foundry](/tags/foundry/) - [Anvil](/tags/anvil/) - [WireMock](/tags/wiremock/) ## [End-to-End Invariant Testing for Solidity: Fuzz the Whole Stack with Foundry Anvil and WireMock Testcontainers](/e2e-invariant-testing-solidity-anvil-wiremock/) Forge invariant tests stop at the EVM boundary. Learn how to fuzz random sequences of real transactions, keeper runs, price-feed outages and RPC faults against a containerized Anvil node, and assert protocol invariants after every step. 21 Nov, 2026 27 min read [![](/_astro/chaos-engineering.DFkfE7jN_Z2mHjmN.jpg)](/on-chain-chaos-engineering-ethereum-wiremock-anvil/) - [Testing](/tags/testing/) - [Chaos Engineering](/tags/chaos-engineering/) - [Ethereum](/tags/ethereum/) - [Anvil](/tags/anvil/) - [WireMock](/tags/wiremock/) - [EthersJS](/tags/ethersjs/) - [Nestjs](/tags/nestjs/) ## [Survive the Outage and Stop Writing Fake JSON-RPC Mocks: Real Life On-Chain Chaos Engineering for Ethereum Apps](/on-chain-chaos-engineering-ethereum-wiremock-anvil/) Put WireMock in front of a real Foundry Anvil node with Testcontainers to inject 503s, dropped connections, latency and 429s into your Ethereum app, without hand-writing a single fake JSON-RPC response. 19 Nov, 2026 14 min read [![](/_astro/solidity-lifecycle-testing.BZoDoi4p_1u6A9p.jpg)](/solidity-lifecycle-testing-foundry-anvil/) - [Solidity](/tags/solidity/) - [Testing](/tags/testing/) - [Foundry](/tags/foundry/) - [Anvil](/tags/anvil/) - [Smart Contracts](/tags/smart-contracts/) - [Web3](/tags/web3/) ## [Mastering Solidity Lifecycle Testing with Foundry Anvil Testcontainers](/solidity-lifecycle-testing-foundry-anvil/) Learn how to implement comprehensive lifecycle tests for Solidity smart contracts and simplify complex test scenarios with Foundry Anvil Testcontainers 18 Nov, 2026 16 min read --- ## Chaos Engineering Articles | Hella Labs URL: https://www.hellalabs.dev/tags/chaos-engineering 1 Hella Labs post about Chaos Engineering: Survive the Outage and Stop Writing Fake JSON-RPC Mocks: Real Life On-Chain Chaos Engineering for Ethereum Apps. # Chaos Engineering A collection of 1 Post [![](/_astro/chaos-engineering.DFkfE7jN_Z2mHjmN.jpg)](/on-chain-chaos-engineering-ethereum-wiremock-anvil/) - [Testing](/tags/testing/) - [Chaos Engineering](/tags/chaos-engineering/) - [Ethereum](/tags/ethereum/) - [Anvil](/tags/anvil/) - [WireMock](/tags/wiremock/) - [EthersJS](/tags/ethersjs/) - [Nestjs](/tags/nestjs/) ## [Survive the Outage and Stop Writing Fake JSON-RPC Mocks: Real Life On-Chain Chaos Engineering for Ethereum Apps](/on-chain-chaos-engineering-ethereum-wiremock-anvil/) Put WireMock in front of a real Foundry Anvil node with Testcontainers to inject 503s, dropped connections, latency and 429s into your Ethereum app, without hand-writing a single fake JSON-RPC response. 19 Nov, 2026 14 min read --- ## CSS-tricks Articles | Hella Labs URL: https://www.hellalabs.dev/tags/css-tricks 1 Hella Labs post about CSS-tricks: Pure CSS Animated Gradient Background and More!. # CSS-tricks A collection of 1 Post [![](/_astro/css-animations-2.DpBqQg1V_Z2h3aIo.jpg)](/pure-css-animations/) - [CSS-tricks](/tags/css-tricks/) - [Animation](/tags/animation/) ## [Pure CSS Animated Gradient Background and More!](/pure-css-animations/) You can do amazing things with pure CSS nowadays, including animations without any Javascript. 05 Aug, 2025 18 min read --- ## Ethereum Articles | Hella Labs URL: https://www.hellalabs.dev/tags/ethereum 4 Hella Labs posts about Ethereum: On-Chain Ethereum Data via Server-Sent Events and GraphQL with Ethers.js, RxJS and Nest.js; Survive the Outage and Stop… # Ethereum A collection of 4 Posts [![](/_astro/onchain-data-2.0cV1fDea_ZhrxY5.jpg)](/sse-graphql-ethereum-nestjs-thinclient/) - [Nestjs](/tags/nestjs/) - [Ethereum](/tags/ethereum/) - [EthersJS](/tags/ethersjs/) - [RxJS](/tags/rxjs/) - [Server-Sent Events](/tags/server-sent-events/) - [GraphQL](/tags/graphql/) ## [On-Chain Ethereum Data via Server-Sent Events and GraphQL with Ethers.js, RxJS and Nest.js](/sse-graphql-ethereum-nestjs-thinclient/) Re-use one Nest.js service layer to stream finalized Ethereum blocks over Server-Sent Events and serve block queries over GraphQL, with ultra-thin vanilla JS clients and RxJS Observables. 23 Nov, 2026 17 min read [![](/_astro/chaos-engineering.DFkfE7jN_Z2mHjmN.jpg)](/on-chain-chaos-engineering-ethereum-wiremock-anvil/) - [Testing](/tags/testing/) - [Chaos Engineering](/tags/chaos-engineering/) - [Ethereum](/tags/ethereum/) - [Anvil](/tags/anvil/) - [WireMock](/tags/wiremock/) - [EthersJS](/tags/ethersjs/) - [Nestjs](/tags/nestjs/) ## [Survive the Outage and Stop Writing Fake JSON-RPC Mocks: Real Life On-Chain Chaos Engineering for Ethereum Apps](/on-chain-chaos-engineering-ethereum-wiremock-anvil/) Put WireMock in front of a real Foundry Anvil node with Testcontainers to inject 503s, dropped connections, latency and 429s into your Ethereum app, without hand-writing a single fake JSON-RPC response. 19 Nov, 2026 14 min read [![](/_astro/github-open-source.BpYF5ln9_1UHugM.png)](/web3-ethereum-open-source/) - [Ethereum](/tags/ethereum/) - [Javascript](/tags/javascript/) - [Typescript](/tags/typescript/) - [Testcontainers](/tags/testcontainers/) - [Wiremock](/tags/wiremock/) - [Foundry](/tags/foundry/) ## [Open-Source Web3 Ethereum Projects at Hella Labs](/web3-ethereum-open-source/) Supporting the Web3 Ethereum ecosystem with open source projects, tools and test automation. 13 May, 2026 3 min read [![](/_astro/onchain-data-1.DuOJwwRh_2ap8O6.jpg)](/websocket-sse-graphql-nestjs-thinclient/) - [Nestjs](/tags/nestjs/) - [Ethereum](/tags/ethereum/) - [EthersJS](/tags/ethersjs/) - [RxJS](/tags/rxjs/) - [WebSockets](/tags/websockets/) ## [On-Chain Ethereum Data via WebSockets with Ethers.js, RxJS and Nest.js](/websocket-sse-graphql-nestjs-thinclient/) Build more responsive, snappy, performant dApps with reactive streams with RxJS Observables, ethers.js and the power of a Nest.js backend 16 Jan, 2026 14 min read --- ## EthersJS Articles | Hella Labs URL: https://www.hellalabs.dev/tags/ethersjs 3 Hella Labs posts about EthersJS: On-Chain Ethereum Data via Server-Sent Events and GraphQL with Ethers.js, RxJS and Nest.js; Survive the Outage and Stop… # EthersJS A collection of 3 Posts [![](/_astro/onchain-data-2.0cV1fDea_ZhrxY5.jpg)](/sse-graphql-ethereum-nestjs-thinclient/) - [Nestjs](/tags/nestjs/) - [Ethereum](/tags/ethereum/) - [EthersJS](/tags/ethersjs/) - [RxJS](/tags/rxjs/) - [Server-Sent Events](/tags/server-sent-events/) - [GraphQL](/tags/graphql/) ## [On-Chain Ethereum Data via Server-Sent Events and GraphQL with Ethers.js, RxJS and Nest.js](/sse-graphql-ethereum-nestjs-thinclient/) Re-use one Nest.js service layer to stream finalized Ethereum blocks over Server-Sent Events and serve block queries over GraphQL, with ultra-thin vanilla JS clients and RxJS Observables. 23 Nov, 2026 17 min read [![](/_astro/chaos-engineering.DFkfE7jN_Z2mHjmN.jpg)](/on-chain-chaos-engineering-ethereum-wiremock-anvil/) - [Testing](/tags/testing/) - [Chaos Engineering](/tags/chaos-engineering/) - [Ethereum](/tags/ethereum/) - [Anvil](/tags/anvil/) - [WireMock](/tags/wiremock/) - [EthersJS](/tags/ethersjs/) - [Nestjs](/tags/nestjs/) ## [Survive the Outage and Stop Writing Fake JSON-RPC Mocks: Real Life On-Chain Chaos Engineering for Ethereum Apps](/on-chain-chaos-engineering-ethereum-wiremock-anvil/) Put WireMock in front of a real Foundry Anvil node with Testcontainers to inject 503s, dropped connections, latency and 429s into your Ethereum app, without hand-writing a single fake JSON-RPC response. 19 Nov, 2026 14 min read [![](/_astro/onchain-data-1.DuOJwwRh_2ap8O6.jpg)](/websocket-sse-graphql-nestjs-thinclient/) - [Nestjs](/tags/nestjs/) - [Ethereum](/tags/ethereum/) - [EthersJS](/tags/ethersjs/) - [RxJS](/tags/rxjs/) - [WebSockets](/tags/websockets/) ## [On-Chain Ethereum Data via WebSockets with Ethers.js, RxJS and Nest.js](/websocket-sse-graphql-nestjs-thinclient/) Build more responsive, snappy, performant dApps with reactive streams with RxJS Observables, ethers.js and the power of a Nest.js backend 16 Jan, 2026 14 min read --- ## Foundry Articles | Hella Labs URL: https://www.hellalabs.dev/tags/foundry 3 Hella Labs posts about Foundry: End-to-End Invariant Testing for Solidity: Fuzz the Whole Stack with Foundry Anvil and WireMock Testcontainers; Mastering… # Foundry A collection of 3 Posts [![](/_astro/solidity-e2e-invariant-testing.C75b-0rk_Z14vja5.jpg)](/e2e-invariant-testing-solidity-anvil-wiremock/) - [Solidity](/tags/solidity/) - [Testing](/tags/testing/) - [Invariant Testing](/tags/invariant-testing/) - [Fuzzing](/tags/fuzzing/) - [Foundry](/tags/foundry/) - [Anvil](/tags/anvil/) - [WireMock](/tags/wiremock/) ## [End-to-End Invariant Testing for Solidity: Fuzz the Whole Stack with Foundry Anvil and WireMock Testcontainers](/e2e-invariant-testing-solidity-anvil-wiremock/) Forge invariant tests stop at the EVM boundary. Learn how to fuzz random sequences of real transactions, keeper runs, price-feed outages and RPC faults against a containerized Anvil node, and assert protocol invariants after every step. 21 Nov, 2026 27 min read [![](/_astro/solidity-lifecycle-testing.BZoDoi4p_1u6A9p.jpg)](/solidity-lifecycle-testing-foundry-anvil/) - [Solidity](/tags/solidity/) - [Testing](/tags/testing/) - [Foundry](/tags/foundry/) - [Anvil](/tags/anvil/) - [Smart Contracts](/tags/smart-contracts/) - [Web3](/tags/web3/) ## [Mastering Solidity Lifecycle Testing with Foundry Anvil Testcontainers](/solidity-lifecycle-testing-foundry-anvil/) Learn how to implement comprehensive lifecycle tests for Solidity smart contracts and simplify complex test scenarios with Foundry Anvil Testcontainers 18 Nov, 2026 16 min read [![](/_astro/github-open-source.BpYF5ln9_1UHugM.png)](/web3-ethereum-open-source/) - [Ethereum](/tags/ethereum/) - [Javascript](/tags/javascript/) - [Typescript](/tags/typescript/) - [Testcontainers](/tags/testcontainers/) - [Wiremock](/tags/wiremock/) - [Foundry](/tags/foundry/) ## [Open-Source Web3 Ethereum Projects at Hella Labs](/web3-ethereum-open-source/) Supporting the Web3 Ethereum ecosystem with open source projects, tools and test automation. 13 May, 2026 3 min read --- ## Fuzzing Articles | Hella Labs URL: https://www.hellalabs.dev/tags/fuzzing 1 Hella Labs post about Fuzzing: End-to-End Invariant Testing for Solidity: Fuzz the Whole Stack with Foundry Anvil and WireMock Testcontainers. # Fuzzing A collection of 1 Post [![](/_astro/solidity-e2e-invariant-testing.C75b-0rk_Z14vja5.jpg)](/e2e-invariant-testing-solidity-anvil-wiremock/) - [Solidity](/tags/solidity/) - [Testing](/tags/testing/) - [Invariant Testing](/tags/invariant-testing/) - [Fuzzing](/tags/fuzzing/) - [Foundry](/tags/foundry/) - [Anvil](/tags/anvil/) - [WireMock](/tags/wiremock/) ## [End-to-End Invariant Testing for Solidity: Fuzz the Whole Stack with Foundry Anvil and WireMock Testcontainers](/e2e-invariant-testing-solidity-anvil-wiremock/) Forge invariant tests stop at the EVM boundary. Learn how to fuzz random sequences of real transactions, keeper runs, price-feed outages and RPC faults against a containerized Anvil node, and assert protocol invariants after every step. 21 Nov, 2026 27 min read --- ## GraphQL Articles | Hella Labs URL: https://www.hellalabs.dev/tags/graphql 1 Hella Labs post about GraphQL: On-Chain Ethereum Data via Server-Sent Events and GraphQL with Ethers.js, RxJS and Nest.js. # GraphQL A collection of 1 Post [![](/_astro/onchain-data-2.0cV1fDea_ZhrxY5.jpg)](/sse-graphql-ethereum-nestjs-thinclient/) - [Nestjs](/tags/nestjs/) - [Ethereum](/tags/ethereum/) - [EthersJS](/tags/ethersjs/) - [RxJS](/tags/rxjs/) - [Server-Sent Events](/tags/server-sent-events/) - [GraphQL](/tags/graphql/) ## [On-Chain Ethereum Data via Server-Sent Events and GraphQL with Ethers.js, RxJS and Nest.js](/sse-graphql-ethereum-nestjs-thinclient/) Re-use one Nest.js service layer to stream finalized Ethereum blocks over Server-Sent Events and serve block queries over GraphQL, with ultra-thin vanilla JS clients and RxJS Observables. 23 Nov, 2026 17 min read --- ## Invariant Testing Articles | Hella Labs URL: https://www.hellalabs.dev/tags/invariant-testing 1 Hella Labs post about Invariant Testing: End-to-End Invariant Testing for Solidity: Fuzz the Whole Stack with Foundry Anvil and WireMock Testcontainers. # Invariant Testing A collection of 1 Post [![](/_astro/solidity-e2e-invariant-testing.C75b-0rk_Z14vja5.jpg)](/e2e-invariant-testing-solidity-anvil-wiremock/) - [Solidity](/tags/solidity/) - [Testing](/tags/testing/) - [Invariant Testing](/tags/invariant-testing/) - [Fuzzing](/tags/fuzzing/) - [Foundry](/tags/foundry/) - [Anvil](/tags/anvil/) - [WireMock](/tags/wiremock/) ## [End-to-End Invariant Testing for Solidity: Fuzz the Whole Stack with Foundry Anvil and WireMock Testcontainers](/e2e-invariant-testing-solidity-anvil-wiremock/) Forge invariant tests stop at the EVM boundary. Learn how to fuzz random sequences of real transactions, keeper runs, price-feed outages and RPC faults against a containerized Anvil node, and assert protocol invariants after every step. 21 Nov, 2026 27 min read --- ## Javascript Articles | Hella Labs URL: https://www.hellalabs.dev/tags/javascript 1 Hella Labs post about Javascript: Open-Source Web3 Ethereum Projects at Hella Labs. # Javascript A collection of 1 Post [![](/_astro/github-open-source.BpYF5ln9_1UHugM.png)](/web3-ethereum-open-source/) - [Ethereum](/tags/ethereum/) - [Javascript](/tags/javascript/) - [Typescript](/tags/typescript/) - [Testcontainers](/tags/testcontainers/) - [Wiremock](/tags/wiremock/) - [Foundry](/tags/foundry/) ## [Open-Source Web3 Ethereum Projects at Hella Labs](/web3-ethereum-open-source/) Supporting the Web3 Ethereum ecosystem with open source projects, tools and test automation. 13 May, 2026 3 min read --- ## Nestjs Articles | Hella Labs URL: https://www.hellalabs.dev/tags/nestjs 4 Hella Labs posts about Nestjs: On-Chain Solana Data via WebSockets with Solkit, RxJS and Nest.js; On-Chain Ethereum Data via Server-Sent Events and GraphQL… # Nestjs A collection of 4 Posts [![](/_astro/onchain-data-3.DKgNIT4I_dzzeC.jpg)](/websocket-solana-kit-rxjs-nestjs-thinclient/) - [Nestjs](/tags/nestjs/) - [Solana](/tags/solana/) - [Solana Kit](/tags/solana-kit/) - [RxJS](/tags/rxjs/) - [WebSockets](/tags/websockets/) ## [On-Chain Solana Data via WebSockets with Solkit, RxJS and Nest.js](/websocket-solana-kit-rxjs-nestjs-thinclient/) Wrap Solana Kit (@solana/kit) in a reusable Nest.js module and stream finalized Solana blocks over WebSockets to an ultra-thin vanilla JS client with RxJS Observables, re-using the exact pattern from the Ethereum articles. 24 Nov, 2026 21 min read [![](/_astro/onchain-data-2.0cV1fDea_ZhrxY5.jpg)](/sse-graphql-ethereum-nestjs-thinclient/) - [Nestjs](/tags/nestjs/) - [Ethereum](/tags/ethereum/) - [EthersJS](/tags/ethersjs/) - [RxJS](/tags/rxjs/) - [Server-Sent Events](/tags/server-sent-events/) - [GraphQL](/tags/graphql/) ## [On-Chain Ethereum Data via Server-Sent Events and GraphQL with Ethers.js, RxJS and Nest.js](/sse-graphql-ethereum-nestjs-thinclient/) Re-use one Nest.js service layer to stream finalized Ethereum blocks over Server-Sent Events and serve block queries over GraphQL, with ultra-thin vanilla JS clients and RxJS Observables. 23 Nov, 2026 17 min read [![](/_astro/chaos-engineering.DFkfE7jN_Z2mHjmN.jpg)](/on-chain-chaos-engineering-ethereum-wiremock-anvil/) - [Testing](/tags/testing/) - [Chaos Engineering](/tags/chaos-engineering/) - [Ethereum](/tags/ethereum/) - [Anvil](/tags/anvil/) - [WireMock](/tags/wiremock/) - [EthersJS](/tags/ethersjs/) - [Nestjs](/tags/nestjs/) ## [Survive the Outage and Stop Writing Fake JSON-RPC Mocks: Real Life On-Chain Chaos Engineering for Ethereum Apps](/on-chain-chaos-engineering-ethereum-wiremock-anvil/) Put WireMock in front of a real Foundry Anvil node with Testcontainers to inject 503s, dropped connections, latency and 429s into your Ethereum app, without hand-writing a single fake JSON-RPC response. 19 Nov, 2026 14 min read [![](/_astro/onchain-data-1.DuOJwwRh_2ap8O6.jpg)](/websocket-sse-graphql-nestjs-thinclient/) - [Nestjs](/tags/nestjs/) - [Ethereum](/tags/ethereum/) - [EthersJS](/tags/ethersjs/) - [RxJS](/tags/rxjs/) - [WebSockets](/tags/websockets/) ## [On-Chain Ethereum Data via WebSockets with Ethers.js, RxJS and Nest.js](/websocket-sse-graphql-nestjs-thinclient/) Build more responsive, snappy, performant dApps with reactive streams with RxJS Observables, ethers.js and the power of a Nest.js backend 16 Jan, 2026 14 min read --- ## RxJS Articles | Hella Labs URL: https://www.hellalabs.dev/tags/rxjs 3 Hella Labs posts about RxJS: On-Chain Solana Data via WebSockets with Solkit, RxJS and Nest.js; On-Chain Ethereum Data via Server-Sent Events and GraphQL… # RxJS A collection of 3 Posts [![](/_astro/onchain-data-3.DKgNIT4I_dzzeC.jpg)](/websocket-solana-kit-rxjs-nestjs-thinclient/) - [Nestjs](/tags/nestjs/) - [Solana](/tags/solana/) - [Solana Kit](/tags/solana-kit/) - [RxJS](/tags/rxjs/) - [WebSockets](/tags/websockets/) ## [On-Chain Solana Data via WebSockets with Solkit, RxJS and Nest.js](/websocket-solana-kit-rxjs-nestjs-thinclient/) Wrap Solana Kit (@solana/kit) in a reusable Nest.js module and stream finalized Solana blocks over WebSockets to an ultra-thin vanilla JS client with RxJS Observables, re-using the exact pattern from the Ethereum articles. 24 Nov, 2026 21 min read [![](/_astro/onchain-data-2.0cV1fDea_ZhrxY5.jpg)](/sse-graphql-ethereum-nestjs-thinclient/) - [Nestjs](/tags/nestjs/) - [Ethereum](/tags/ethereum/) - [EthersJS](/tags/ethersjs/) - [RxJS](/tags/rxjs/) - [Server-Sent Events](/tags/server-sent-events/) - [GraphQL](/tags/graphql/) ## [On-Chain Ethereum Data via Server-Sent Events and GraphQL with Ethers.js, RxJS and Nest.js](/sse-graphql-ethereum-nestjs-thinclient/) Re-use one Nest.js service layer to stream finalized Ethereum blocks over Server-Sent Events and serve block queries over GraphQL, with ultra-thin vanilla JS clients and RxJS Observables. 23 Nov, 2026 17 min read [![](/_astro/onchain-data-1.DuOJwwRh_2ap8O6.jpg)](/websocket-sse-graphql-nestjs-thinclient/) - [Nestjs](/tags/nestjs/) - [Ethereum](/tags/ethereum/) - [EthersJS](/tags/ethersjs/) - [RxJS](/tags/rxjs/) - [WebSockets](/tags/websockets/) ## [On-Chain Ethereum Data via WebSockets with Ethers.js, RxJS and Nest.js](/websocket-sse-graphql-nestjs-thinclient/) Build more responsive, snappy, performant dApps with reactive streams with RxJS Observables, ethers.js and the power of a Nest.js backend 16 Jan, 2026 14 min read --- ## Server-Sent Events Articles | Hella Labs URL: https://www.hellalabs.dev/tags/server-sent-events 1 Hella Labs post about Server-Sent Events: On-Chain Ethereum Data via Server-Sent Events and GraphQL with Ethers.js, RxJS and Nest.js. # Server-Sent Events A collection of 1 Post [![](/_astro/onchain-data-2.0cV1fDea_ZhrxY5.jpg)](/sse-graphql-ethereum-nestjs-thinclient/) - [Nestjs](/tags/nestjs/) - [Ethereum](/tags/ethereum/) - [EthersJS](/tags/ethersjs/) - [RxJS](/tags/rxjs/) - [Server-Sent Events](/tags/server-sent-events/) - [GraphQL](/tags/graphql/) ## [On-Chain Ethereum Data via Server-Sent Events and GraphQL with Ethers.js, RxJS and Nest.js](/sse-graphql-ethereum-nestjs-thinclient/) Re-use one Nest.js service layer to stream finalized Ethereum blocks over Server-Sent Events and serve block queries over GraphQL, with ultra-thin vanilla JS clients and RxJS Observables. 23 Nov, 2026 17 min read --- ## Smart Contracts Articles | Hella Labs URL: https://www.hellalabs.dev/tags/smart-contracts 1 Hella Labs post about Smart Contracts: Mastering Solidity Lifecycle Testing with Foundry Anvil Testcontainers. # Smart Contracts A collection of 1 Post [![](/_astro/solidity-lifecycle-testing.BZoDoi4p_1u6A9p.jpg)](/solidity-lifecycle-testing-foundry-anvil/) - [Solidity](/tags/solidity/) - [Testing](/tags/testing/) - [Foundry](/tags/foundry/) - [Anvil](/tags/anvil/) - [Smart Contracts](/tags/smart-contracts/) - [Web3](/tags/web3/) ## [Mastering Solidity Lifecycle Testing with Foundry Anvil Testcontainers](/solidity-lifecycle-testing-foundry-anvil/) Learn how to implement comprehensive lifecycle tests for Solidity smart contracts and simplify complex test scenarios with Foundry Anvil Testcontainers 18 Nov, 2026 16 min read --- ## Solana Articles | Hella Labs URL: https://www.hellalabs.dev/tags/solana 1 Hella Labs post about Solana: On-Chain Solana Data via WebSockets with Solkit, RxJS and Nest.js. # Solana A collection of 1 Post [![](/_astro/onchain-data-3.DKgNIT4I_dzzeC.jpg)](/websocket-solana-kit-rxjs-nestjs-thinclient/) - [Nestjs](/tags/nestjs/) - [Solana](/tags/solana/) - [Solana Kit](/tags/solana-kit/) - [RxJS](/tags/rxjs/) - [WebSockets](/tags/websockets/) ## [On-Chain Solana Data via WebSockets with Solkit, RxJS and Nest.js](/websocket-solana-kit-rxjs-nestjs-thinclient/) Wrap Solana Kit (@solana/kit) in a reusable Nest.js module and stream finalized Solana blocks over WebSockets to an ultra-thin vanilla JS client with RxJS Observables, re-using the exact pattern from the Ethereum articles. 24 Nov, 2026 21 min read --- ## Solana Kit Articles | Hella Labs URL: https://www.hellalabs.dev/tags/solana-kit 1 Hella Labs post about Solana Kit: On-Chain Solana Data via WebSockets with Solkit, RxJS and Nest.js. # Solana Kit A collection of 1 Post [![](/_astro/onchain-data-3.DKgNIT4I_dzzeC.jpg)](/websocket-solana-kit-rxjs-nestjs-thinclient/) - [Nestjs](/tags/nestjs/) - [Solana](/tags/solana/) - [Solana Kit](/tags/solana-kit/) - [RxJS](/tags/rxjs/) - [WebSockets](/tags/websockets/) ## [On-Chain Solana Data via WebSockets with Solkit, RxJS and Nest.js](/websocket-solana-kit-rxjs-nestjs-thinclient/) Wrap Solana Kit (@solana/kit) in a reusable Nest.js module and stream finalized Solana blocks over WebSockets to an ultra-thin vanilla JS client with RxJS Observables, re-using the exact pattern from the Ethereum articles. 24 Nov, 2026 21 min read --- ## Solidity Articles | Hella Labs URL: https://www.hellalabs.dev/tags/solidity 2 Hella Labs posts about Solidity: End-to-End Invariant Testing for Solidity: Fuzz the Whole Stack with Foundry Anvil and WireMock Testcontainers; Mastering… # Solidity A collection of 2 Posts [![](/_astro/solidity-e2e-invariant-testing.C75b-0rk_Z14vja5.jpg)](/e2e-invariant-testing-solidity-anvil-wiremock/) - [Solidity](/tags/solidity/) - [Testing](/tags/testing/) - [Invariant Testing](/tags/invariant-testing/) - [Fuzzing](/tags/fuzzing/) - [Foundry](/tags/foundry/) - [Anvil](/tags/anvil/) - [WireMock](/tags/wiremock/) ## [End-to-End Invariant Testing for Solidity: Fuzz the Whole Stack with Foundry Anvil and WireMock Testcontainers](/e2e-invariant-testing-solidity-anvil-wiremock/) Forge invariant tests stop at the EVM boundary. Learn how to fuzz random sequences of real transactions, keeper runs, price-feed outages and RPC faults against a containerized Anvil node, and assert protocol invariants after every step. 21 Nov, 2026 27 min read [![](/_astro/solidity-lifecycle-testing.BZoDoi4p_1u6A9p.jpg)](/solidity-lifecycle-testing-foundry-anvil/) - [Solidity](/tags/solidity/) - [Testing](/tags/testing/) - [Foundry](/tags/foundry/) - [Anvil](/tags/anvil/) - [Smart Contracts](/tags/smart-contracts/) - [Web3](/tags/web3/) ## [Mastering Solidity Lifecycle Testing with Foundry Anvil Testcontainers](/solidity-lifecycle-testing-foundry-anvil/) Learn how to implement comprehensive lifecycle tests for Solidity smart contracts and simplify complex test scenarios with Foundry Anvil Testcontainers 18 Nov, 2026 16 min read --- ## Testcontainers Articles | Hella Labs URL: https://www.hellalabs.dev/tags/testcontainers 1 Hella Labs post about Testcontainers: Open-Source Web3 Ethereum Projects at Hella Labs. # Testcontainers A collection of 1 Post [![](/_astro/github-open-source.BpYF5ln9_1UHugM.png)](/web3-ethereum-open-source/) - [Ethereum](/tags/ethereum/) - [Javascript](/tags/javascript/) - [Typescript](/tags/typescript/) - [Testcontainers](/tags/testcontainers/) - [Wiremock](/tags/wiremock/) - [Foundry](/tags/foundry/) ## [Open-Source Web3 Ethereum Projects at Hella Labs](/web3-ethereum-open-source/) Supporting the Web3 Ethereum ecosystem with open source projects, tools and test automation. 13 May, 2026 3 min read --- ## Testing Articles | Hella Labs URL: https://www.hellalabs.dev/tags/testing 3 Hella Labs posts about Testing: End-to-End Invariant Testing for Solidity: Fuzz the Whole Stack with Foundry Anvil and WireMock Testcontainers; Survive the… # Testing A collection of 3 Posts [![](/_astro/solidity-e2e-invariant-testing.C75b-0rk_Z14vja5.jpg)](/e2e-invariant-testing-solidity-anvil-wiremock/) - [Solidity](/tags/solidity/) - [Testing](/tags/testing/) - [Invariant Testing](/tags/invariant-testing/) - [Fuzzing](/tags/fuzzing/) - [Foundry](/tags/foundry/) - [Anvil](/tags/anvil/) - [WireMock](/tags/wiremock/) ## [End-to-End Invariant Testing for Solidity: Fuzz the Whole Stack with Foundry Anvil and WireMock Testcontainers](/e2e-invariant-testing-solidity-anvil-wiremock/) Forge invariant tests stop at the EVM boundary. Learn how to fuzz random sequences of real transactions, keeper runs, price-feed outages and RPC faults against a containerized Anvil node, and assert protocol invariants after every step. 21 Nov, 2026 27 min read [![](/_astro/chaos-engineering.DFkfE7jN_Z2mHjmN.jpg)](/on-chain-chaos-engineering-ethereum-wiremock-anvil/) - [Testing](/tags/testing/) - [Chaos Engineering](/tags/chaos-engineering/) - [Ethereum](/tags/ethereum/) - [Anvil](/tags/anvil/) - [WireMock](/tags/wiremock/) - [EthersJS](/tags/ethersjs/) - [Nestjs](/tags/nestjs/) ## [Survive the Outage and Stop Writing Fake JSON-RPC Mocks: Real Life On-Chain Chaos Engineering for Ethereum Apps](/on-chain-chaos-engineering-ethereum-wiremock-anvil/) Put WireMock in front of a real Foundry Anvil node with Testcontainers to inject 503s, dropped connections, latency and 429s into your Ethereum app, without hand-writing a single fake JSON-RPC response. 19 Nov, 2026 14 min read [![](/_astro/solidity-lifecycle-testing.BZoDoi4p_1u6A9p.jpg)](/solidity-lifecycle-testing-foundry-anvil/) - [Solidity](/tags/solidity/) - [Testing](/tags/testing/) - [Foundry](/tags/foundry/) - [Anvil](/tags/anvil/) - [Smart Contracts](/tags/smart-contracts/) - [Web3](/tags/web3/) ## [Mastering Solidity Lifecycle Testing with Foundry Anvil Testcontainers](/solidity-lifecycle-testing-foundry-anvil/) Learn how to implement comprehensive lifecycle tests for Solidity smart contracts and simplify complex test scenarios with Foundry Anvil Testcontainers 18 Nov, 2026 16 min read --- ## Typescript Articles | Hella Labs URL: https://www.hellalabs.dev/tags/typescript 1 Hella Labs post about Typescript: Open-Source Web3 Ethereum Projects at Hella Labs. # Typescript A collection of 1 Post [![](/_astro/github-open-source.BpYF5ln9_1UHugM.png)](/web3-ethereum-open-source/) - [Ethereum](/tags/ethereum/) - [Javascript](/tags/javascript/) - [Typescript](/tags/typescript/) - [Testcontainers](/tags/testcontainers/) - [Wiremock](/tags/wiremock/) - [Foundry](/tags/foundry/) ## [Open-Source Web3 Ethereum Projects at Hella Labs](/web3-ethereum-open-source/) Supporting the Web3 Ethereum ecosystem with open source projects, tools and test automation. 13 May, 2026 3 min read --- ## Web3 Articles | Hella Labs URL: https://www.hellalabs.dev/tags/web3 1 Hella Labs post about Web3: Mastering Solidity Lifecycle Testing with Foundry Anvil Testcontainers. # Web3 A collection of 1 Post [![](/_astro/solidity-lifecycle-testing.BZoDoi4p_1u6A9p.jpg)](/solidity-lifecycle-testing-foundry-anvil/) - [Solidity](/tags/solidity/) - [Testing](/tags/testing/) - [Foundry](/tags/foundry/) - [Anvil](/tags/anvil/) - [Smart Contracts](/tags/smart-contracts/) - [Web3](/tags/web3/) ## [Mastering Solidity Lifecycle Testing with Foundry Anvil Testcontainers](/solidity-lifecycle-testing-foundry-anvil/) Learn how to implement comprehensive lifecycle tests for Solidity smart contracts and simplify complex test scenarios with Foundry Anvil Testcontainers 18 Nov, 2026 16 min read --- ## WebSockets Articles | Hella Labs URL: https://www.hellalabs.dev/tags/websockets 2 Hella Labs posts about WebSockets: On-Chain Solana Data via WebSockets with Solkit, RxJS and Nest.js; On-Chain Ethereum Data via WebSockets with Ethers.js,… # WebSockets A collection of 2 Posts [![](/_astro/onchain-data-3.DKgNIT4I_dzzeC.jpg)](/websocket-solana-kit-rxjs-nestjs-thinclient/) - [Nestjs](/tags/nestjs/) - [Solana](/tags/solana/) - [Solana Kit](/tags/solana-kit/) - [RxJS](/tags/rxjs/) - [WebSockets](/tags/websockets/) ## [On-Chain Solana Data via WebSockets with Solkit, RxJS and Nest.js](/websocket-solana-kit-rxjs-nestjs-thinclient/) Wrap Solana Kit (@solana/kit) in a reusable Nest.js module and stream finalized Solana blocks over WebSockets to an ultra-thin vanilla JS client with RxJS Observables, re-using the exact pattern from the Ethereum articles. 24 Nov, 2026 21 min read [![](/_astro/onchain-data-1.DuOJwwRh_2ap8O6.jpg)](/websocket-sse-graphql-nestjs-thinclient/) - [Nestjs](/tags/nestjs/) - [Ethereum](/tags/ethereum/) - [EthersJS](/tags/ethersjs/) - [RxJS](/tags/rxjs/) - [WebSockets](/tags/websockets/) ## [On-Chain Ethereum Data via WebSockets with Ethers.js, RxJS and Nest.js](/websocket-sse-graphql-nestjs-thinclient/) Build more responsive, snappy, performant dApps with reactive streams with RxJS Observables, ethers.js and the power of a Nest.js backend 16 Jan, 2026 14 min read --- ## WireMock Articles | Hella Labs URL: https://www.hellalabs.dev/tags/wiremock 3 Hella Labs posts about WireMock: End-to-End Invariant Testing for Solidity: Fuzz the Whole Stack with Foundry Anvil and WireMock Testcontainers; Survive the… # WireMock A collection of 3 Posts [![](/_astro/solidity-e2e-invariant-testing.C75b-0rk_Z14vja5.jpg)](/e2e-invariant-testing-solidity-anvil-wiremock/) - [Solidity](/tags/solidity/) - [Testing](/tags/testing/) - [Invariant Testing](/tags/invariant-testing/) - [Fuzzing](/tags/fuzzing/) - [Foundry](/tags/foundry/) - [Anvil](/tags/anvil/) - [WireMock](/tags/wiremock/) ## [End-to-End Invariant Testing for Solidity: Fuzz the Whole Stack with Foundry Anvil and WireMock Testcontainers](/e2e-invariant-testing-solidity-anvil-wiremock/) Forge invariant tests stop at the EVM boundary. Learn how to fuzz random sequences of real transactions, keeper runs, price-feed outages and RPC faults against a containerized Anvil node, and assert protocol invariants after every step. 21 Nov, 2026 27 min read [![](/_astro/chaos-engineering.DFkfE7jN_Z2mHjmN.jpg)](/on-chain-chaos-engineering-ethereum-wiremock-anvil/) - [Testing](/tags/testing/) - [Chaos Engineering](/tags/chaos-engineering/) - [Ethereum](/tags/ethereum/) - [Anvil](/tags/anvil/) - [WireMock](/tags/wiremock/) - [EthersJS](/tags/ethersjs/) - [Nestjs](/tags/nestjs/) ## [Survive the Outage and Stop Writing Fake JSON-RPC Mocks: Real Life On-Chain Chaos Engineering for Ethereum Apps](/on-chain-chaos-engineering-ethereum-wiremock-anvil/) Put WireMock in front of a real Foundry Anvil node with Testcontainers to inject 503s, dropped connections, latency and 429s into your Ethereum app, without hand-writing a single fake JSON-RPC response. 19 Nov, 2026 14 min read [![](/_astro/github-open-source.BpYF5ln9_1UHugM.png)](/web3-ethereum-open-source/) - [Ethereum](/tags/ethereum/) - [Javascript](/tags/javascript/) - [Typescript](/tags/typescript/) - [Testcontainers](/tags/testcontainers/) - [Wiremock](/tags/wiremock/) - [Foundry](/tags/foundry/) ## [Open-Source Web3 Ethereum Projects at Hella Labs](/web3-ethereum-open-source/) Supporting the Web3 Ethereum ecosystem with open source projects, tools and test automation. 13 May, 2026 3 min read --- ## Hella Team | Hella Labs URL: https://www.hellalabs.dev/team Meet the Hella Labs team: Web3 engineers and community builders who've shipped at ConsenSys, Stellar and Uphold, plus a Manila office for cost-effective scale. ## Expertise That Spans the Full Stack The Team at Hella Labs brings together battle-tested expertise from Web2 enterprise systems, Silicon Valley startups, and cutting-edge Web3 protocols. Our engineers have shipped production code at **ConsenSys**, **Stellar**, and **Uphold**—organizations at the forefront of blockchain infrastructure. **What sets us apart:** - **12+ years** of distributed systems and cloud-native architecture experience - **Active open-source contributors** with tools used by development teams worldwide - **Technical educators** creating courses for LinkedIn Learning and Pluralsight that have taught thousands of developers - **Conference speakers** at ETH Denver, Devcon, and ETH CC, sharing knowledge with the global Web3 community - **Polkadot Blockchain Academy** graduates bringing formal blockchain education and best practices We don’t just build applications—we build the **testing infrastructure** and **developer tools** that make Web3 development reliable and scalable. Our open-source projects like [Foundry Anvil Testcontainers](https://github.com/hella-labs/foundryanvil-testcontainers-nodejs) and [WireMock Testcontainers](https://github.com/hella-labs/wiremock-testcontainers-nodejs) demonstrate our commitment to raising the bar for quality in blockchain development. > People, Product, Passion * * * ## Chris Anatalio ### Senior Backend Blockchain Engineer & Developer Advocate Veteran distributed systems engineer with 12+ years of experience specializing in cloud-native, containerized microservices deployed via a CI/CD pipeline. Currently Senior Backend Blockchain Engineer at Uphold, with previous experience at Stellar Development Foundation and ConsenSys (Infura). #### Professional Experience & Achievements - \*\*Polkadot Blockchain Academy—\*\*Cohort 7 Bali Graduate - **Developer DAO** - Member #4727 - **Conference Speaker** - ETH Denver 2023 & 2024, ETH Seattle 2022, ETH CC 2022, Devcon 2022 & 2024 - **945+ GitHub Stars** across 206 repositories #### Featured Talk [![ETH Denver 2024 talk by Chris Anatalio (video thumbnail)](https://img.youtube.com/vi/nyhw-KNx12k/mqdefault.jpg)](https://youtu.be/nyhw-KNx12k?si=px1TGNLTH_O8wnTe) ETH Denver 2024 - Decentralized Infrastructure and Web3 Development #### Technical Education ##### LinkedIn Learning Courses - [Building a Reactive App with Angular and Spring Boot 2](https://www.linkedin.com/learning/building-a-reactive-app-with-angular-and-spring-boot-2) (2019) and many others ##### Pluralsight Courses - [Web3 Infrastructure Development Tools](https://www.pluralsight.com/courses/web3-infrastructure-development-tools) - Smart Contract Development with Hardhat, Foundry, ethers.js, TypeScript, and Solidity #### Expertise Deep experience in service-oriented architecture with broad generalist experience across devops, smart contracts, dev tooling, automation, and front-end. Full SDLC expertise across architecture, implementation, automated testing (full testing pyramid), deployment pipelines, and service ownership. Specialized in async, reactive, non-blocking, event-driven services and blockchain infrastructure. > I work towards a global, inclusive, diverse vision of the tech industry where developers all over the world are empowered to dream, build and succeed together. ![Chris Anatalio](/_astro/chris-anatalio.CDZAjOM7_12Bjrx.webp) #### Connect - [LinkedIn](https://www.linkedin.com/in/anataliocs/) - [X (Twitter)](https://twitter.com/canatalio) - [GitHub](https://github.com/anataliocs) - [Stack Overflow](https://stackoverflow.com/users/555177/anataliocs) - [Medium](https://medium.com/@anataliocs) * * * ## Anna Lopatina ### Community Manager & Digital Marketing Specialist Web3 native and viral marketing specialist with expertise in building and engaging decentralized communities. Specializes in community growth strategies, social media management, and creating viral content campaigns in the Web3 space. #### Expertise - Community Building & Engagement - Social Media Strategy & Growth - Viral Marketing Campaigns - Web3 Ecosystem Development - Content Creation & Brand Management - Discord & Telegram Community Management > Ready to make a difference ![Anna Lopatina](/_astro/anna-lopatina.6tpREB2d_Emhqg.webp) #### Connect - [LinkedIn](https://www.linkedin.com/in/anna-lopatina-026bb0246/) - [X (Twitter)](https://x.com/bllaazed) - [GitHub](https://github.com/AnnaLopatinaa) * * * ## Global Talent, Silicon Valley Standards ### Leveraging World-Class Offshore Resources At Hella Labs, we combine Silicon Valley expertise with global talent efficiency. Our **Manila office** serves as a strategic hub for scaling development operations while maintaining the highest engineering standards. ![Hella Labs Manila office: a neon Philippine flag and Manila Office sign glowing above a laptop, with the city skyline at dusk through the windows](/_astro/manila-office-wide.CPX2vByj_1EcdcK.webp) #### Why Our Manila Office is Different ##### Cost-Effective Excellence Access top-tier engineering talent at 60-70% cost savings without compromising on quality or communication. ##### Time Zone Advantage Strategic overlap with US and Asia-Pacific markets enables true follow-the-sun development cycles. ##### Tech-Savvy Workforce The Philippines ranks highly in English proficiency and has a thriving tech education ecosystem producing skilled developers. ##### Proven Processes We bring Silicon Valley development methodologies, CI/CD best practices, and agile workflows to our Manila operations. **Our approach:** We don’t just outsource work—we build integrated teams. Manila-based developers work alongside our senior engineers in the US, participating in architecture decisions, code reviews, and strategic planning. This ensures knowledge transfer, maintains code quality, and delivers the innovation you expect from a world-class engineering team. Whether you need to rapidly scale your development capacity, establish a sustainable long-term engineering presence, or optimize your development costs while maintaining velocity, our Manila office provides the infrastructure and talent to make it happen. * * * ### Build with the best, scale with confidence. Our distributed team combines deep Web3 expertise, proven DevOps practices, and global talent efficiency. Whether you’re launching a new protocol, scaling existing infrastructure, or building the next generation of decentralized applications, we bring Silicon Valley standards with worldwide reach. [Start a Conversation](/contact/) --- ## Videos | Hella Labs URL: https://www.hellalabs.dev/videos Watch Hella Labs talks and demos on Web3 testing, chaos engineering, Foundry Anvil and Testcontainers, straight from our YouTube channel. Talks, walkthroughs and demos from the team. Subscribe on [YouTube](https://www.youtube.com/@hella-labs) to catch new uploads. ## Web3 Chaos Engineering with Anvil Foundry Testcontainers and a WireMock Proxy Simulate flaky RPC nodes and network faults in your integration tests by putting a WireMock proxy in front of a Foundry Anvil Testcontainer. --- ## Web3 Consulting Services | Hella Labs URL: https://www.hellalabs.dev/web3-consultant-service-offerings Specific service offerings tailored for your on-chain emerging technology startup delivered by experts with experience across Web2 and Web3. # Hella Labs Service Offerings US-based Expertise + Global Workforce Efficiency: Curated to specifically address unique issues and strengths present in emerging tech web3 startups * * * - ## [On-chain Web/Mobile Apps](/services/dapp-web-front-end/) Build - ## [DevOps+Automation](/services/devops-test-automation/) Build - ## [Web3 Tooling & SDKs](/services/web3-tooling-sdks/) Build - ## [Custom Discord Bot](/services/custom-discord-bot/) Build - ## [DevRel & Technical Content](/services/technical-articles/) Launch - ## [GTM Launch Package](/services/gtm-launch-package/) Launch * * * ## Global Talent, Silicon Valley Standards We combine Silicon Valley expertise with global talent efficiency. Our Manila office works alongside our senior US engineers as one integrated team, so your project keeps moving around the clock. ### 24/7 Development Cycles Strategic overlap with US and Asia-Pacific time zones enables true follow-the-sun development. Work handed off at the end of the US day is moving forward by morning. ### Cost-Effective Excellence Access top-tier engineering talent at 60-70% cost savings without compromising on quality or communication. ### Integrated Teams Manila-based developers work alongside our senior engineers in the US, taking part in architecture decisions, code reviews, and strategic planning. - NYC - Manila ![Hella Labs Manila office: a neon Philippine flag and Manila Office sign glowing above a laptop, with the city skyline at dusk through the windows](/_astro/manila-office-wide.CPX2vByj_tnkVJ.jpg) [Meet the Team](/team/) --- ## Open-Source Web3 Ethereum Projects at Hella Labs | Hella Labs URL: https://www.hellalabs.dev/web3-ethereum-open-source Supporting the Web3 Ethereum ecosystem with open source projects, tools and test automation. ## Open Source Web3 Ethereum Projects [Hella Labs](https://github.com/hella-labs) supports several Ethereum open-source projects. These projects specialize in test automation. **Projects:** - [Foundry Anvil Testcontainers Nodejs](https://www.npmjs.com/package/@hellaweb3/foundryanvil-testcontainers-nodejs) - [Wiremock Testcontainers Nodejs](https://www.npmjs.com/package/@hellaweb3/wiremock-testcontainers-nodejs) - [Ethereum Transaction Explorer TUI](https://github.com/anataliocs/etherscan-tui-go) * * * ## Foundry Anvil Testcontainers Nodejs This repository provides a [Testcontainers](https://testcontainers.com/) module for Node.js to run a customized Anvil node in your E2E tests. This Typescript module provides a **Fluent API** style method of configuring and starting the Anvil node, mapping every Anvil flag to a type-safe configuration builder. During your test execution, the module provides a [viem test client](https://viem.sh/docs/clients/test) and streamlined helper methods to interact with the node. **Key Features:** - **Full Anvil Flag Support:** Configure everything from mining modes to forking and EVM limits using a type-safe API. - **State Overrides & Fixtures:** Easily mock dependencies with `setCode`, state overrides, and custom genesis files. - **Advanced EVM Features:** Support for EIP-712 and EIP-7702 signing, chain reorgs, and call tracing. - **Improved DX:** Immediate validation of conflicting flags prevents misconfiguration before the container even starts. - [https://github.com/hella-labs/foundryanvil-testcontainers-nodejs](https://github.com/hella-labs/foundryanvil-testcontainers-nodejs) - [https://www.npmjs.com/package/@hellaweb3/foundryanvil-testcontainers-nodejs](https://www.npmjs.com/package/@hellaweb3/foundryanvil-testcontainers-nodejs) _Get started with Foundry Anvil Testcontainers Nodejs by following the steps below._ #### Install: ``` pnpm add -D @hellaweb3/foundryanvil-testcontainers-nodejs ``` #### Setup: ``` import { AnvilContainer, AnvilOptions, Hardfork, useAnvil, } from "@hellaweb3/foundryanvil-testcontainers-nodejs"; import { parseEther } from "viem"; const options = new AnvilOptions().account .withAccounts(5) .withBalance(1_000) .evm.withChainId(1337) .withHardfork(Hardfork.Cancun) .logs.quiet(); // Starts in beforeAll, stops in afterAll, restores the state after every test. const anvil = useAnvil( new AnvilContainer(options).withTestClient((client) => client.withAccount(0)), ); it("sends Ether", async () => { const [, bob] = await anvil.addresses(); // `account` is optional: the test client has a typed default account. const receipt = await anvil.confirm( anvil.testClient.sendTransaction({ to: bob, value: parseEther("1") }), ); expect(receipt.status).toBe("success"); expect(await anvil.testClient.getChainId()).toBe(1337); }); it("manipulates the chain fluently", async () => { const whale = "0x1111111111111111111111111111111111111111"; await anvil.cheats .setBalanceEther(whale, 1_000) .impersonate(whale) .increaseTime({ days: 7 }) .mine(); }); ``` Check out the [docs](https://hellalabs.dev/foundryanvil-testcontainers-nodejs/) for more info. * * * ## Wiremock Testcontainers Nodejs `wiremock-testcontainers-nodejs` is a Typescript nodejs library that spins up a WireMock instance with [Testcontainers](https://testcontainers.com/). It provides a fluent API to configure and start WireMock containers, including support for loading mappings and files from recorded [Wiremock](https://wiremock.org/) sessions. **Key Features:** - **Flexible Stub Registration:** Serve stubs from directories, files, npm packages, or inline JSON. - **Test Isolation:** Reset state between tests (`reset()`, `resetRequests()`) without restarting the container, significantly speeding up E2E suites. - **Verification API:** Verify what your code sent through WireMock’s request journal directly from your test suite. - **Extensibility:** Load WireMock extensions from JARs (no local JDK required) or use TypeScript extensions. - **No-Docker Mode:** Optional support for running via local JVM for environments without a container runtime. - [https://github.com/hella-labs/wiremock-testcontainers-nodejs](https://github.com/hella-labs/wiremock-testcontainers-nodejs) - [https://www.npmjs.com/package/@hellaweb3/wiremock-testcontainers-nodejs](https://www.npmjs.com/package/@hellaweb3/wiremock-testcontainers-nodejs) _Get started with Wiremock Testcontainers Nodejs by following the steps below._ #### Install: ``` pnpm add -D @hellaweb3/wiremock-testcontainers-nodejs testcontainers ``` #### Setup: ``` import { afterAll, afterEach, beforeAll, expect, it } from "vitest"; // or Jest import { type StartedWiremockContainer, WiremockContainer, } from "@hellaweb3/wiremock-testcontainers-nodejs"; import { PaymentsClient } from "../app/payments-client"; // the code under test let wiremock: StartedWiremockContainer; beforeAll(async () => { wiremock = await new WiremockContainer() .withMappings("./__mocks__/wiremock") // mappings/ + __files/ .start(); await wiremock.waitUntilReady(); }, 120_000); // the first image pull can be slow afterEach(() => wiremock.reset()); // pristine stubs, empty journal – no restart afterAll(() => wiremock?.stop()); it("lists the recorded payments", async () => { const page = await new PaymentsClient(wiremock.getUrl()).list(); expect(page.meta.totalItems).toBe(2); expect(await wiremock.countRequests({ method: "GET", url: "/payments" })).toBe(1); }); ``` Check out the [npm repo](https://www.npmjs.com/package/@hellaweb3/wiremock-testcontainers-nodejs) for more info. Check out the [docs](https://hellalabs.dev/wiremock-testcontainers-nodejs/) for more info. * * * ## Ethereum Transaction Explorer TUI A terminal(TUI) Ethereum transaction explorer built with Go and the [Bubble Tea](https://github.com/charmbracelet/bubbletea) TUI framework. Fetch, display and explore details for any Ethereum transaction hash using the Etherscan API V2 all in your terminal. **Key Features:** - **Multi-Network Support:** Seamlessly explore transactions on both Ethereum Mainnet and Sepolia. - **Rich Terminal UI:** Built with `bubbletea`, `bubbles`, and `lipgloss` for a high-fidelity terminal experience. - **Real-time Data:** Fetches transaction details, gas prices, and confirmations directly via Etherscan API. - **Developer-Centric:** Designed for developers who prefer staying in the terminal while debugging smart contract interactions. [https://github.com/anataliocs/etherscan-tui-go](https://github.com/anataliocs/etherscan-tui-go) * * * Help make ethereum more secure with better test automation. _Thanks for reading and supporting open source. Post your comments below!_ Share: - [](https://twitter.com/intent/tweet?text=Open-Source%20Web3%20Ethereum%20Projects%20at%20Hella%20Labs&url=https%3A%2F%2Fwww.hellalabs.dev%2Fweb3-ethereum-open-source%2F) - [](https://www.linkedin.com/shareArticle?mini=true&url=https%3A%2F%2Fwww.hellalabs.dev%2Fweb3-ethereum-open-source%2F&title=Open-Source%20Web3%20Ethereum%20Projects%20at%20Hella%20Labs&summary=Supporting%20the%20Web3%20Ethereum%20ecosystem%20with%20open%20source%20projects%2C%20tools%20and%20test%20automation.) ## Start the conversation Show Comments ## Related [![](/_astro/solidity-e2e-invariant-testing.C75b-0rk_Z14vja5.jpg)](/e2e-invariant-testing-solidity-anvil-wiremock/) - [Solidity](/tags/solidity/) - [Testing](/tags/testing/) - [Invariant Testing](/tags/invariant-testing/) - [Fuzzing](/tags/fuzzing/) - [Foundry](/tags/foundry/) - [Anvil](/tags/anvil/) - [WireMock](/tags/wiremock/) ### [End-to-End Invariant Testing for Solidity: Fuzz the Whole Stack with Foundry Anvil and WireMock Testcontainers](/e2e-invariant-testing-solidity-anvil-wiremock/) Forge invariant tests stop at the EVM boundary. Learn how to fuzz random sequences of real transactions, keeper runs, price-feed outages and RPC faults against a containerized Anvil node, and assert protocol invariants after every step. 21 Nov, 2026 27 min read [![](/_astro/chaos-engineering.DFkfE7jN_Z2mHjmN.jpg)](/on-chain-chaos-engineering-ethereum-wiremock-anvil/) - [Testing](/tags/testing/) - [Chaos Engineering](/tags/chaos-engineering/) - [Ethereum](/tags/ethereum/) - [Anvil](/tags/anvil/) - [WireMock](/tags/wiremock/) - [EthersJS](/tags/ethersjs/) - [Nestjs](/tags/nestjs/) ### [Survive the Outage and Stop Writing Fake JSON-RPC Mocks: Real Life On-Chain Chaos Engineering for Ethereum Apps](/on-chain-chaos-engineering-ethereum-wiremock-anvil/) Put WireMock in front of a real Foundry Anvil node with Testcontainers to inject 503s, dropped connections, latency and 429s into your Ethereum app, without hand-writing a single fake JSON-RPC response. 19 Nov, 2026 14 min read [![](/_astro/onchain-data-2.0cV1fDea_ZhrxY5.jpg)](/sse-graphql-ethereum-nestjs-thinclient/) - [Nestjs](/tags/nestjs/) - [Ethereum](/tags/ethereum/) - [EthersJS](/tags/ethersjs/) - [RxJS](/tags/rxjs/) - [Server-Sent Events](/tags/server-sent-events/) - [GraphQL](/tags/graphql/) ### [On-Chain Ethereum Data via Server-Sent Events and GraphQL with Ethers.js, RxJS and Nest.js](/sse-graphql-ethereum-nestjs-thinclient/) Re-use one Nest.js service layer to stream finalized Ethereum blocks over Server-Sent Events and serve block queries over GraphQL, with ultra-thin vanilla JS clients and RxJS Observables. 23 Nov, 2026 17 min read --- ## On-Chain Solana Data via WebSockets with Solkit, RxJS and Nest.js | Hella Labs URL: https://www.hellalabs.dev/websocket-solana-kit-rxjs-nestjs-thinclient Wrap Solana Kit (@solana/kit) in a reusable Nest.js module and stream finalized Solana blocks over WebSockets to an ultra-thin vanilla JS client with RxJS… ## On-Chain Solana Data via WebSockets with Solkit, RxJS and Nest.js In [Part 1](/websocket-sse-graphql-nestjs-thinclient/) we wrapped [Ethers.js](https://docs.ethers.org/) in a reusable [Nest.js](https://nestjs.com/) module and streamed finalized Ethereum blocks over [WebSockets](https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API). In [Part 2](/sse-graphql-ethereum-nestjs-thinclient/) we put Server-Sent Events and GraphQL in front of the same service layer without touching it. This time we **change the chain**. We swap Ethers.js for [Solana Kit](https://www.solanakit.com/) (`@solana/kit`, “Solkit” in the example repo) and stream finalized **Solana** blocks to the same kind of ultra-thin browser client. The point of this article is how little changes. The module shape, the service-layer wrappers, the RxJS pipeline in the gateway and the front-end `WsConnect` class are all the same pattern as the Ethereum version. What’s new is only the part that _should_ be new: how Solana Kit talks to a Solana RPC node, and how Solana’s data model differs from Ethereum’s. 💡 New to the series? Part 1 explains the layered design (SDK module → service → gateway → thin client) in detail. This article focuses on what’s different for Solana, so a quick skim of Part 1 first will help. ### What’s Different About Solana A few Solana concepts show up directly in the code, so they’re worth knowing up front: - **Slots vs. block height**: Solana produces a **slot** roughly every 400 ms, but not every slot produces a block. **Block height** counts only the blocks that were actually produced, so it’s always lower than the slot number. RPC methods like `getBlock` take a **slot**; `getBlockHeight` returns a **height**. - **Commitment levels**: every read can ask for `processed`, `confirmed` or `finalized` data. `finalized` means a supermajority of the cluster has rooted the block, and it won’t be rolled back. - **`bigint` everywhere**: Solana Kit returns slots, heights and timestamps as `bigint`, which `JSON.stringify()` can’t serialize. The service layer converts them to strings before they go over the wire. - **Fast blocks**: at ~400 ms per slot, a 5-second poll sees a new finalized block on every tick, so the stream is much busier than the Ethereum one (~12 s per block). ### Why Solana Kit [Solana Kit](https://www.solanakit.com/) is the successor to `@solana/web3.js` 1.x. It’s a full rewrite with a functional, tree-shakable API: - **Small, composable pieces**: you import functions like `createSolanaRpc()` instead of a large `Connection` class. - **Strong typing per RPC method**: an `Rpc` only exposes `getBlock`, and its return type follows the options you pass in. - **Lazy requests**: RPC calls return a `PendingRpcRequest` that does nothing until you call `.send()`, so you can build a request in one place and run it in another. - **Zero dependencies** and modern JS (native `bigint`, `fetch`, `AbortSignal`), which works well in Node and in the browser. * * * ## Getting Started You can follow along with the [GitHub Repo](https://github.com/anataliocs/nestjs-typeorm-full-example). The Solana code lives in two folders next to the Ethereum ones: - `src/solkitsdk/`: the reusable **SolkitSdk** module that wraps Solana Kit - `src/solkit/`: the **SolkitService**, the WebSocket gateway, plus the REST, SSE and GraphQL entry points 💡 Open this repo in a [GitHub Codespace Devcontainer](https://codespaces.new/anataliocs/nestjs-typeorm-full-example) to follow along! Set the Solana RPC endpoints in your `.env` file. Any Solana RPC provider works; a provider such as [Helius](https://www.helius.dev/) gives you both an HTTPS and a WSS endpoint with an API key query parameter. **.env excerpt** ``` SOLKIT_RPC_SERVER_URL=https://mainnet.helius-rpc.com SOLKIT_WS_SERVER_URL=wss://mainnet.helius-rpc.com/ SOLKIT_RPC_PROVIDER_KEY_PREFIX=?api-key= SOLKIT_RPC_API_KEY= ``` Here’s how the pieces fit together, from the browser down to the Solana cluster: flowchart LR Client\["Thin client
WsConnect"\] -- "solkit-subscribe-blocks" --> Gateway\["SolkitGateway
interval + mergeMap + distinct"\] Gateway --> Service\["SolkitService
DTO wrappers"\] Service --> Sdk\["SolkitSdkService
Solana Kit RPC clients"\] Sdk -- "getSlot / getBlock / getBlockHeight" --> RPC\[("Solana RPC node")\] Gateway -- "WsResponse stream" --> Client * * * ## Integrating Solana Kit As with Ethers.js, we start by wrapping the library in a [Nest.js module](https://docs.nestjs.com/modules) that owns its configuration and lifecycle. ### Solkit Sdk Config **Full example:** [solkitSdkConfig.ts](https://github.com/anataliocs/nestjs-typeorm-full-example/blob/main/src/solkitsdk/solkitSdkConfig.ts) The config interface is a little bigger than the Ethers one. Solana Kit uses **separate** clients for HTTP requests and WebSocket subscriptions, so it takes two URLs, plus a prefix that tells the SDK how to attach the API key. **solkitSdkConfig.ts** ``` export interface SolkitSdkConfig { // RPC URL used to connect to the blockchain rpcServerUrl: string; // WSS URL used to subscribe to the blockchain wsServerUrl: string; network: string; // e.g. "?api-key=" for providers that take the key as a query parameter providerKeyPrefix: string; } ``` ### Solkit Sdk Module Definition **Full example:** [solkitSdk.module.ts](https://github.com/anataliocs/nestjs-typeorm-full-example/blob/main/src/solkitsdk/solkitSdk.module.ts) The module is the same [dynamic module](https://docs.nestjs.com/fundamentals/dynamic-modules) pattern as `EthersSdkModule`, with a `registerAsync()` function that builds the config at runtime and exports a single `SolkitSdkService`. **solkitSdk.module.ts** ``` @Module({ imports: [ConfigModule] }) export class SolkitSdkModule { static registerAsync(options: SolkitSdkModuleAsyncOptions): DynamicModule { return { module: SolkitSdkModule, imports: [ConfigModule], providers: [ { provide: CONFIG_OPTIONS, useFactory: options.useFactory, inject: [ConfigService], }, SolkitSdkService, ], exports: [SolkitSdkService], }; } } ``` Put it next to `EthersSdkModule` and the only differences are the class names. That’s the reusable part of the pattern: adding a chain means adding a module with the same shape. ### Solkit Sdk Service **Full example:** [solkit.sdk.service.ts](https://github.com/anataliocs/nestjs-typeorm-full-example/blob/main/src/solkitsdk/solkit.sdk.service.ts) The SDK service extends the same `SdkServiceBase` as the Ethers version, which provides the connection status and a guarded `rpcServer` getter. The type parameter is what changes. Instead of one Ethers `Provider`, the `SolanaRpcServer` type holds a few Solana Kit clients, each **narrowly typed** to the RPC methods it’s used for. **solkit.sdk.service.ts excerpt** ``` export type SolanaRpcServer = { rpcBlockHeightApi: Rpc; rpcGetBlockApi: Rpc; rpcGetSlotApi: Rpc; rpcSubscriptions: RpcSubscriptions; }; ``` `createSolanaRpc()` returns a client for the full `SolanaRpcApi`, so storing it as `Rpc` simply limits what the rest of the class can call on it. `createSolanaRpcSubscriptions()` creates the WebSocket subscriptions client from the WSS URL. The constructor reads the config, builds the URLs with the API key appended and creates the clients. **solkit.sdk.service.ts constructor** ``` @Injectable() export class SolkitSdkService extends SdkServiceBase implements SdkService { private readonly logger: Logger = new Logger(SolkitSdkService.name); private readonly rpcServerUrl: string; private readonly wsServerUrl: string; private readonly providerKeyPrefix: string; private readonly network: string; constructor( private configService: ConfigService, @Inject(CONFIG_OPTIONS) private options: SolkitSdkConfig, ) { super(`Solana Kit SDK Rpc Server is not initialized.`); this.rpcServerUrl = options.rpcServerUrl || ""; this.wsServerUrl = options.wsServerUrl || ""; this.providerKeyPrefix = options.providerKeyPrefix || ""; this.network = options.network; this._rpcServer = { rpcBlockHeightApi: createSolanaRpc(this.rpcServerUrl + this.apiKeyString()), rpcGetBlockApi: createSolanaRpc(this.rpcServerUrl + this.apiKeyString(), {}), rpcGetSlotApi: createSolanaRpc(this.rpcServerUrl + this.apiKeyString()), rpcSubscriptions: createSolanaRpcSubscriptions(this.wsServerUrl + this.apiKeyString()), } as SolanaRpcServer; } private apiKeyString() { return ( (this.providerKeyPrefix || "") + (this.configService.get("SOLKIT_RPC_API_KEY") || "") ); } // ... } ``` 💡 Unlike the Ethers service, empty values fall back to `""`, so running against a local node with no API key and no prefix just works: the URL is used as-is. ### Solkit Sdk Service Functions The SDK functions show off Solana Kit’s **lazy request** model. Each RPC method builds a `PendingRpcRequest`, and nothing goes over the network until something calls `.send()`. `getBlockNumber()` returns the pending request itself and leaves sending to the caller. **solkit.sdk.service.ts excerpt** ``` export class SolkitSdkService extends SdkServiceBase implements SdkService { // ... getBlockNumber(): PendingRpcRequest { return this._rpcServer.rpcBlockHeightApi.getBlockHeight({ commitment: "finalized", }); } // ... } ``` Getting the latest finalized block takes **two** calls on Solana. There’s no “give me the finalized block” shortcut like Ethers’ `getBlock("finalized")`, so we first ask for the latest finalized **slot**, then fetch the block in that slot. **solkit.sdk.service.ts excerpt** ``` export class SolkitSdkService extends SdkServiceBase implements SdkService { // ... async getFinalizedBlock() { const finalizedSlot: bigint = await this._rpcServer.rpcGetSlotApi .getSlot({ commitment: "finalized" }) .send(); return this._rpcServer.rpcGetBlockApi.getBlock(finalizedSlot, { commitment: "finalized", maxSupportedTransactionVersion: 0, }); } // ... } ``` 💡 `maxSupportedTransactionVersion: 0` is required on mainnet. Without it, the RPC node returns an error for any block that contains a **versioned (v0) transaction**, which is nearly every block today. `getBlockByNumber()` (used by the REST and GraphQL entry points) sends the request itself and returns a `Promise`. Note the `BigInt(blockNumber)`: the argument arrives as a string from the API layer, and Solana Kit expects a `bigint` slot. **solkit.sdk.service.ts excerpt** ``` export class SolkitSdkService extends SdkServiceBase implements SdkService { // ... getBlockByNumber(blockNumber: string) { return this._rpcServer.rpcGetBlockApi .getBlock(BigInt(blockNumber), { maxSupportedTransactionVersion: 0, }) .send(); } // ... } ``` ### Solkit Sdk Service Lifecycle Hooks The same [lifecycle hooks](https://docs.nestjs.com/fundamentals/lifecycle-events) from `SdkService` mark the client as connected on startup and disconnected on shutdown. **solkit.sdk.service.ts excerpt** ``` export class SolkitSdkService extends SdkServiceBase implements SdkService { // ... onModuleInit() { this.connected(); this.logger.log( `Solana Kit SDK Rpc Server Status: ${this._rpcServerStatus} - RPC Server URL: ${this.rpcServerUrl}`, ); } onApplicationShutdown(_signal?: string) { this.disconnected(); this.logger.log(`Closing Solana Kit SDK Rpc Server Connection: ${_signal}`); } } ``` 💡 Solana Kit clients connect lazily, so `onModuleInit()` doesn’t make a network call. To fail fast on a bad URL or API key, make `onModuleInit()` `async` and `await` a cheap call such as `getSlot().send()` before calling `connected()`, the way the Ethers service awaits `getNetwork()`. ### Solkit Sdk Service Configuration `registerAsync()` wires the module to environment variables through `ConfigService`, right next to the Ethers module in `app.module.ts`. **app.module.ts excerpt** ``` SolkitSdkModule.registerAsync({ imports: [ConfigModule], useFactory: (configService: ConfigService) => ({ network: "Mainnet", rpcServerUrl: configService.get("SOLKIT_RPC_SERVER_URL"), wsServerUrl: configService.get("SOLKIT_WS_SERVER_URL"), providerKeyPrefix: configService.get("SOLKIT_RPC_PROVIDER_KEY_PREFIX"), }) as SolkitSdkConfig, inject: [ConfigService], }); ``` * * * ## Using the SolkitSdk Module **Full example:** [solkit.service.ts](https://github.com/anataliocs/nestjs-typeorm-full-example/blob/main/src/solkit/solkit.service.ts) The **SolkitService** plays the same role as **EthersService**: it calls the SDK and turns raw Solana Kit results into small, JSON-friendly DTOs that every transport can share. ### Solkit Service Constructor **solkit.service.ts excerpt** ``` @Injectable() export class SolkitService { private readonly logger = new Logger(SolkitService.name); constructor(private readonly solkitSdkService: SolkitSdkService) {} // ... } ``` ### Solana DTOs The DTOs mirror the Ethereum ones, with one difference: `blockNumber` is a **string**. Solana Kit hands back `bigint` values, and a string keeps the full precision while staying JSON-safe. **dto/solana-finalized-block.ts** ``` export class SolanaFinalizedBlock { blockNumber: string; date?: string; hash?: string; } ``` **dto/solana-block-number.ts** ``` export class SolanaBlockNumber { blockNumber: string; } ``` ### Solkit Service \_getBlockNumberJson Function This is where the lazy `PendingRpcRequest` from `getBlockNumber()` is finally sent. The `bigint` result is converted with `toString()` into a `SolanaBlockNumber`. **solkit.service.ts excerpt** ``` export class SolkitService { // ... private readonly _getBlockNumberJson: () => Promise = async (): Promise => ({ blockNumber: (await this.solkitSdkService.getBlockNumber().send()).toString(), }) as SolanaBlockNumber; // ... } ``` ### Solkit Service \_getFinalizedBlocksJson Function `_getFinalizedBlocksJson()` awaits the slot lookup, sends the `getBlock` request and maps the result to a `SolanaFinalizedBlock`. Two things differ from the Ethers version: - A missing block **throws** a `NotFoundException` instead of returning an empty object. - Solana’s `blockTime` is a Unix timestamp in **seconds** (a `bigint`), so `getCreationDateIso()` converts it to an ISO 8601 string. **solkit.service.ts excerpt** ``` export class SolkitService { // ... private readonly _getFinalizedBlocksJson: () => Promise = async (): Promise => { const finalizedBlock = await (await this.solkitSdkService.getFinalizedBlock()).send(); if (finalizedBlock === null) { throw new NotFoundException(`Latest finalized block not found.`); } return { blockNumber: finalizedBlock.blockHeight?.toString() ?? "0", date: this.getCreationDateIso(finalizedBlock.blockTime), hash: String(finalizedBlock.blockhash ?? ""), } as SolanaFinalizedBlock; }; private getCreationDateIso(solkitBlockTime: UnixTimestamp) { return solkitBlockTime != null ? new Date(Number(solkitBlockTime) * 1000).toISOString() : new Date(0).toISOString(); } // ... } ``` Note the double `await`: the first resolves `getFinalizedBlock()` (which already sent the `getSlot` request), and the second sends the `getBlock` request it returned. ### Solkit Service finalizedBlocksStreamForWebsocket Function This is the line-for-line twin of the Ethers version. The `_getFinalizedBlocksJson()` arrow function is passed to the **shared** `buildWsResponse()` helper from Part 1, and `from()` turns the resulting `Promise` into an **Observable**. **solkit.service.ts excerpt** ``` export class SolkitService { // ... finalizedBlocksStreamForWebsocket(): (n: number) => Observable> { return (n: number): Observable> => from(buildWsResponse(n, this._getFinalizedBlocksJson)); } newBlocksStreamForWebsocket(): (n: number) => Observable> { return (n: number): Observable> => from(buildWsResponse(n, this._getBlockNumberJson)); } // ... } ``` `buildWsResponse()` lives in `src/common/message-utils.ts` and is generic over the data type, so it serves Ethereum and Solana alike with no changes. The same service also exposes `subscribeToFinalizedBlocksForSse()` and `getBlockByNumberForGraphQL()`, so everything from [Part 2](/sse-graphql-ethereum-nestjs-thinclient/) works for Solana too. * * * ## Websocket Gateway **Full example:** [solkit.gateway.ts](https://github.com/anataliocs/nestjs-typeorm-full-example/blob/main/src/solkit/solkit.gateway.ts) ### Websocket Gateway Definition The **SolkitGateway** implements the three gateway lifecycle interfaces so it can log initialization, connections and disconnects. **solkit.gateway.ts excerpt** ``` @WebSocketGateway({ cors: { origin: "*" } }) export class SolkitGateway implements OnGatewayInit, OnGatewayConnection, OnGatewayDisconnect { private readonly logger = new Logger(SolkitGateway.name); @WebSocketServer() server: Server; constructor(private readonly solkitService: SolkitService) {} // ... } ``` 💡 Unlike `EthersGateway`, which listens on its own port (`81`), `@WebSocketGateway()` here has **no port**, so it attaches to the main Nest.js HTTP server on port `3000`. One port for REST, SSE, GraphQL and WebSockets is simpler to deploy behind a single load balancer or reverse proxy. 💡 `cors: { origin: "*" }` is fine for a local demo. In production, list the exact origins your clients are served from. ### Websocket Gateway Event Listener `onEvent()` listens for messages with `event: "solkit-subscribe-blocks"`. Just like the Ethers gateway, it validates the payload against the shared `WebSocketSubscribeDto`, then picks a stream based on the `topic`. An unknown topic gets a single error message back from `errorMsgWsResponse()`. **solkit.gateway.ts excerpt** ``` export class SolkitGateway implements OnGatewayInit, OnGatewayConnection, OnGatewayDisconnect { // ... @SubscribeMessage("solkit-subscribe-blocks") onEvent( @MessageBody(new ValidationPipe()) payload: WebSocketSubscribeDto, @ConnectedSocket() _client: WebSocket, ): Observable> { this.logger.log( `Event: solkit-subscribe-blocks Client: ${payload.client} Topic: ${payload.topic}`, ); switch (payload.topic) { case "block-number": return this.newBlocksStream(); case "finalized-blocks": return this.finalizedBlocksStream(); default: return errorMsgWsResponse(payload); } } // ... } ``` Because the event name is different (`solkit-subscribe-blocks` vs. `ethers-subscribe-blocks`), one client can hold subscriptions to both chains at once, and the topics (`block-number`, `finalized-blocks`) stay the same across chains. ### Websocket Gateway finalizedBlocksStream The RxJS pipeline is identical to Part 1: - `interval(5000)` ticks every 5 seconds - `mergeMap()` calls the service on each tick and flattens the resulting Observable into the stream - `distinct()` drops any block number that has already been sent **solkit.gateway.ts excerpt** ``` export class SolkitGateway implements OnGatewayInit, OnGatewayConnection, OnGatewayDisconnect { // ... private finalizedBlocksStream() { return interval(5000) .pipe(mergeMap(this.solkitService.finalizedBlocksStreamForWebsocket())) .pipe(distinct(({ data }) => data.blockNumber)); } private newBlocksStream() { return interval(5000) .pipe(mergeMap(this.solkitService.newBlocksStreamForWebsocket())) .pipe(distinct(({ data }) => data.blockNumber)); } // ... } ``` ### Websocket Gateway Lifecycle Hooks `handleConnection()` receives the raw Node.js `IncomingMessage` as its second argument, which is handy for logging the upgrade request’s headers (or, in production, checking an auth token before accepting the socket). **solkit.gateway.ts excerpt** ``` export class SolkitGateway implements OnGatewayInit, OnGatewayConnection, OnGatewayDisconnect { // ... handleConnection(client: any, ..._args: any[]) { const argsString = (_args[0] as IncomingMessage).rawHeaders.join(" "); this.logger.log(`Connected Websocket: ${argsString}`); } handleDisconnect(_client: any) { this.logger.log(`Received Websocket Disconnect`); } afterInit(_server: Server) { this.logger.log(`WebSocket Gateway Initialized`); } } ``` ### Ethers vs. Solkit, Side by Side | Layer | Ethereum (Parts 1–2) | Solana (this article) | | --- | --- | --- | | SDK client | One JsonRpcProvider | Several narrowly typed Rpc<...> clients | | Request model | Methods return a Promise | Methods return a PendingRpcRequest; call .send() | | Finalized | getBlock("finalized") | getSlot({ commitment }) then getBlock(slot) | | Block number | number | bigint, sent to clients as a string | | Gateway port | Dedicated port 81 | Shares the HTTP server on 3000 | | Event name | ethers-subscribe-blocks | solkit-subscribe-blocks | | Shared code | buildWsResponse, WebSocketSubscribeDto, errorMsgWsResponse, WsConnect | same | * * * ## Front-end Client The thin client is again a single `.html` file plus a small `.js` file, styled with [Pico CSS](https://picocss.com/) and no build step. The only Solana-specific pieces are the endpoint, the event name and the block explorer link. ### Front-end Client - HTML **Full example:** [ws-sol-finalized-blocks.html](https://github.com/anataliocs/nestjs-typeorm-full-example/blob/main/client/src/ws/solkit/ws-sol-finalized-blocks.html) **ws-sol-finalized-blocks.html excerpt** ```
Emitted Events - Finalized Blocks

``` The markup is the same as the Ethereum page, so the same `WsConnect` class can drive it. ### Front-end Client - Javascript **Full example:** [wsSolFinalizedBlock.js](https://github.com/anataliocs/nestjs-typeorm-full-example/blob/main/client/src/ws/solkit/js/wsSolFinalizedBlock.js) The `WsConnect` object from Part 1 is reused as-is. We pass in: - The Nest.js server on port `3000` (where the gateway is attached) - The `solkit-subscribe-blocks` event name - `createLinkSol`, which builds Solscan links instead of Etherscan ones **wsSolFinalizedBlock.js** ``` import { WsConnect } from "../../common/wsConnect.js"; import { createLinkSol } from "../../../../util/utils.js"; const websocket = new WsConnect("ws://localhost:3000", "solkit-subscribe-blocks", createLinkSol); // Sending websocket message to the server document.querySelector("#send-message-button").addEventListener("click", () => { console.log("Sending message to subscribe to finalized blocks"); websocket.sendMessage("finalized-blocks"); }); // Close websocket connection document.querySelector("#close-connection-button").addEventListener("click", () => { console.log("Closing finalized blocks websocket connection: User Requested"); websocket.closeConnection("User Requested"); }); ``` ### Front-end Client - createLinkSol Function **Full example:** [utils.js](https://github.com/anataliocs/nestjs-typeorm-full-example/blob/main/client/util/utils.js) `createLinkSol()` has the same signature as `createLinkEth()`: it takes the block DTO and returns an `` element. That shared signature is what lets `WsConnect` stay chain-agnostic. **utils.js excerpt** ``` export function createLinkSol(block) { const link = document.createElement("a"); link.href = `https://solscan.io/block/${block.blockNumber}`; link.text = `View Block ${block.blockNumber} on Solscan.io`; link.target = "_blank"; link.title = "Open Block in Solscan.io"; return link; } ``` 💡 **Slot vs. block height gotcha:** Solscan’s `/block/` URLs take a **slot**, but `blockNumber` in our DTO is the **block height**. Because skipped slots don’t produce blocks, the two numbers differ, and a height-based link opens a different (older) block. If you want accurate explorer links, add the slot to the DTO (it’s the `finalizedSlot` the SDK service already looked up) and build the link from that. * * * ## Taking the Solana Stream to Production The demo is intentionally simple. Before you point real users at it, a few Solana-specific tweaks are worth making. ### Fetch Less Per Block By default, `getBlock` returns **every transaction** in the block, and a mainnet block can hold well over a thousand. The finalized-blocks stream only needs the height, hash and time, so ask the RPC node to leave the rest out: **solkit.sdk.service.ts (suggested change)** ``` return this._rpcServer.rpcGetBlockApi.getBlock(finalizedSlot, { commitment: "finalized", maxSupportedTransactionVersion: 0, transactionDetails: "none", rewards: false, }); ``` That cuts each poll’s response from megabytes to a few hundred bytes. Keep the full response for `getBlockByNumber()`, where the GraphQL model reports a `transactionCount`. ### Push Instead of Poll Polling every 5 seconds skips roughly a dozen Solana slots per tick. The SDK service already creates an `rpcSubscriptions` client from the WSS URL, and Solana Kit’s subscriptions return an `AsyncIterable`, which RxJS’s `from()` accepts directly. A push-based stream could look like this: **Sketch: slot notifications as an Observable** ``` slotNotifications() { return defer(async () => this._rpcServer.rpcSubscriptions.slotNotifications().subscribe({ abortSignal: this.shutdownController.signal, }), ).pipe(mergeMap((notifications) => from(notifications))); } ``` `defer()` waits to open the subscription until a client subscribes, and the `AbortSignal` (here, an `AbortController` you’d abort in `onApplicationShutdown()`) closes it cleanly. The gateway’s `interval()` is then replaced by this stream, and the rest of the pipeline stays the same. 💡 **The same long-lived stream notes from Part 2 apply here, with more urgency on Solana’s faster chain:** - `distinct()` remembers every block number it has seen, so a stream open for days grows without bound. Use `distinctUntilChanged()` for the same result in constant memory. - Each client gets its own interval and its own RPC calls. `share()` one upstream stream across all subscribers to keep your RPC bill (and rate limits) under control. * * * ## Testing the Solana Stream Because the SDK sits behind its own Nest.js provider, you can test the service and gateway without touching a real Solana cluster. Swap `SolkitSdkService` for a mock that returns objects with a `send()` method, just like a `PendingRpcRequest`: **solkit.gateway.spec.ts (example)** ``` import { Test } from "@nestjs/testing"; import { firstValueFrom } from "rxjs"; import { SolkitGateway } from "./solkit.gateway"; import { SolkitService } from "./solkit.service"; import { SolkitSdkService } from "../solkitsdk/solkit.sdk.service"; const pending = (value: T) => ({ send: () => Promise.resolve(value) }); describe("SolkitGateway", () => { let gateway: SolkitGateway; beforeEach(async () => { const moduleRef = await Test.createTestingModule({ providers: [ SolkitGateway, SolkitService, { provide: SolkitSdkService, useValue: { getBlockNumber: () => pending(250_000_000n), getFinalizedBlock: async () => pending({ blockHeight: 250_000_000n, blockTime: 1_700_000_000n, blockhash: "8xK...Qm", }), }, }, ], }).compile(); gateway = moduleRef.get(SolkitGateway); }); it("streams finalized blocks as JSON-safe DTOs", async () => { const stream = gateway.onEvent( { client: "jest", topic: "finalized-blocks" }, undefined as unknown as WebSocket, ); const { data } = await firstValueFrom(stream); expect(data).toEqual({ blockNumber: "250000000", date: "2023-11-14T22:13:20.000Z", hash: "8xK...Qm", }); }, 10_000); it("rejects unknown topics", async () => { const stream = gateway.onEvent( { client: "jest", topic: "nope" }, undefined as unknown as WebSocket, ); expect(await firstValueFrom(stream)).toMatchObject({ event: "error", data: { message: "Invalid topic: nope" }, }); }); }); ``` The first test waits for the 5-second `interval()` tick. To skip the wait, use Jest fake timers or RxJS’s [`TestScheduler`](https://rxjs.dev/guide/testing/marble-testing). For end-to-end tests against a real chain, point `SOLKIT_RPC_SERVER_URL` and `SOLKIT_WS_SERVER_URL` at a local [`solana-test-validator`](https://solana.com/docs/toolkit/local-validator) (HTTP on `8899`, WebSockets on `8900`), the Solana counterpart of the Foundry Anvil node we used for Ethereum in Parts 1 and 2. Leave `SOLKIT_RPC_PROVIDER_KEY_PREFIX` and `SOLKIT_RPC_API_KEY` empty, and the URLs are used as-is. * * * ## Conclusion Thanks for reading! We added a second blockchain to the same Nest.js backend by following the pattern from [Part 1](/websocket-sse-graphql-nestjs-thinclient/): a dynamic SDK module wrapping Solana Kit, a service that turns raw RPC results into small DTOs, and a gateway that streams them with RxJS. The front end reused `WsConnect` unchanged and only swapped the event name and explorer link. ### Some Key Takeaways to Consider **Benefits:** - **Chain-agnostic Plumbing**: `buildWsResponse()`, `WebSocketSubscribeDto`, the RxJS pipeline and `WsConnect` are shared by Ethereum and Solana - **One Port, Many Transports**: the Solana gateway shares the HTTP server with REST, SSE and GraphQL - **Thin Clients**: still no framework or client library on the front end, just the browser’s `WebSocket` - **Typed RPC**: Solana Kit’s narrow `Rpc<...>` types and lazy `PendingRpcRequest`s make the SDK layer explicit and easy to mock **Concepts:** - **Slots vs. Block Height**: Solana RPC methods take slots; block height only counts produced blocks - **Commitment Levels**: ask for `finalized` when a value must never be rolled back - **JSON-safe DTOs**: convert `bigint` to strings at the service boundary, before any transport sees the data - **Poll vs. Push**: `interval()` polling is simple; Solana Kit subscriptions plus RxJS `from()` give you a true push stream 💡 **What should we cover next in the series?** Bitcoin with `bitcoinjs-lib`, Solana account and program subscriptions, GraphQL subscriptions, or production hardening? [Tell us in the Disqus comments below](#comments) and we’ll use your votes to pick a future entry. _Thanks again for reading!_ * * * ## Building a Multi-Chain dApp? Whether you’re streaming Solana and Ethereum data to a trading dashboard, indexing program events, or serving typed on-chain data to web, mobile and analytics clients, **a modular, well-tested backend** is what lets you add the next chain in days instead of months. We design and build Nest.js and Web3 backends, real-time APIs and the E2E test automation that keeps them reliable when your RPC provider isn’t. [Talk to Hella Labs](/contact/) [Explore All Service Offerings →](/web3-consultant-service-offerings/) Share: - [](https://twitter.com/intent/tweet?text=On-Chain%20Solana%20Data%20via%20WebSockets%20with%20Solkit%2C%20RxJS%20and%20Nest.js&url=https%3A%2F%2Fwww.hellalabs.dev%2Fwebsocket-solana-kit-rxjs-nestjs-thinclient%2F) - [](https://www.linkedin.com/shareArticle?mini=true&url=https%3A%2F%2Fwww.hellalabs.dev%2Fwebsocket-solana-kit-rxjs-nestjs-thinclient%2F&title=On-Chain%20Solana%20Data%20via%20WebSockets%20with%20Solkit%2C%20RxJS%20and%20Nest.js&summary=Wrap%20Solana%20Kit%20\(%40solana%2Fkit\)%20in%20a%20reusable%20Nest.js%20module%20and%20stream%20finalized%20Solana%20blocks%20over%20WebSockets%20to%20an%20ultra-thin%20vanilla%20JS%20client%20with%20RxJS%20Observables%2C%20re-using%20the%20exact%20pattern%20from%20the%20Ethereum%20articles.) ## Start the conversation Show Comments ## Related [![](/_astro/onchain-data-1.DuOJwwRh_2ap8O6.jpg)](/websocket-sse-graphql-nestjs-thinclient/) - [Nestjs](/tags/nestjs/) - [Ethereum](/tags/ethereum/) - [EthersJS](/tags/ethersjs/) - [RxJS](/tags/rxjs/) - [WebSockets](/tags/websockets/) ### [On-Chain Ethereum Data via WebSockets with Ethers.js, RxJS and Nest.js](/websocket-sse-graphql-nestjs-thinclient/) Build more responsive, snappy, performant dApps with reactive streams with RxJS Observables, ethers.js and the power of a Nest.js backend 16 Jan, 2026 14 min read [![](/_astro/onchain-data-2.0cV1fDea_ZhrxY5.jpg)](/sse-graphql-ethereum-nestjs-thinclient/) - [Nestjs](/tags/nestjs/) - [Ethereum](/tags/ethereum/) - [EthersJS](/tags/ethersjs/) - [RxJS](/tags/rxjs/) - [Server-Sent Events](/tags/server-sent-events/) - [GraphQL](/tags/graphql/) ### [On-Chain Ethereum Data via Server-Sent Events and GraphQL with Ethers.js, RxJS and Nest.js](/sse-graphql-ethereum-nestjs-thinclient/) Re-use one Nest.js service layer to stream finalized Ethereum blocks over Server-Sent Events and serve block queries over GraphQL, with ultra-thin vanilla JS clients and RxJS Observables. 23 Nov, 2026 17 min read [![](/_astro/chaos-engineering.DFkfE7jN_Z2mHjmN.jpg)](/on-chain-chaos-engineering-ethereum-wiremock-anvil/) - [Testing](/tags/testing/) - [Chaos Engineering](/tags/chaos-engineering/) - [Ethereum](/tags/ethereum/) - [Anvil](/tags/anvil/) - [WireMock](/tags/wiremock/) - [EthersJS](/tags/ethersjs/) - [Nestjs](/tags/nestjs/) ### [Survive the Outage and Stop Writing Fake JSON-RPC Mocks: Real Life On-Chain Chaos Engineering for Ethereum Apps](/on-chain-chaos-engineering-ethereum-wiremock-anvil/) Put WireMock in front of a real Foundry Anvil node with Testcontainers to inject 503s, dropped connections, latency and 429s into your Ethereum app, without hand-writing a single fake JSON-RPC response. 19 Nov, 2026 14 min read --- ## On-Chain Ethereum Data via WebSockets with Ethers.js, RxJS and Nest.js | Hella Labs URL: https://www.hellalabs.dev/websocket-sse-graphql-nestjs-thinclient Build more responsive, snappy, performant dApps with reactive streams with RxJS Observables, ethers.js and the power of a Nest.js backend ## On-Chain Ethereum Data via WebSockets with Ethers.js, RxJS and Nest.js Blockchain data is by nature, streaming event-based data. It’s a perfect fit for [Reactive Streams](https://www.reactive-streams.org/) with [RxJS](https://rxjs.dev/), and data streaming technologies like [Websockets](https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API) and [Server Sent Events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events). Let’s walk through how to build superfast dApps and offload the heavy lifting to a [Nest.js](https://nestjs.com/) backend. This Nest.js backend allows the client to be much thinner and allows the backend business logic to serve multiple clients such as web, mobile, native and various dev tools and analytics. Using NestJS will allow us to re-use our components with NestJS built-in functionality to create a structured, modular way of exposing [Websockets](https://docs.nestjs.com/websockets/gateways), [REST API](https://docs.nestjs.com/controllers), [Server Sent Events](https://docs.nestjs.com/techniques/server-sent-events) and [GraphQL](https://docs.nestjs.com/graphql/quick-start) for multiple chains such as Ethereum, Solana and Bitcoin in a single service. This is **Part 1** of a series. Here we stream blocks over WebSockets; [Part 2](/sse-graphql-ethereum-nestjs-thinclient/) re-uses the same service layer to expose Server-Sent Events and a GraphQL API. The approach detailed here is modular and re-usable, and we will be re-using the same components in future articles to demonstrate this technique with [Solana](https://www.solanakit.com/), [Bitcoin](https://github.com/bitcoinjs/bitcoinjs-lib), and other chains. **Thin clients have:** - Much faster initial load times - Drastically lower JS bundle download sizes - Faster & more responsive UX - Usability across even low-powered devices - Better SEO b/c load time is a factor - Less exposed attack surface exposed locally _⭐️ Some notes on ultra-thin clients vs full front-end frameworks:_ 💡 While the ultra-thin clients techniques demonstrated in this tutorial may not be ideal for some production dApps, you should spend time considering if stuffing a bunch of business logic into an already bloated ReactJS app is really the right choice for your users. ReactJS is a great full-featured framework for complex UIs with teams working on them but may not be the right choice for a prototype, hackathon project or early-stage project. You can read more about the clean separation of the presentation/UI layer and business logic [Martinfowler.com](https://martinfowler.com/articles/micro-frontends.html) and [here](https://blog.cleancoder.com/uncle-bob/2012/08/13/the-clean-architecture.html). Every application has its own needs and tradeoffs, and we hope you learn some new techniques to apply to your dApp in this article. ### Why Websockets WebSockets reduce overhead up to ~98.8% compared to HTTP, by eliminating repeated handshakes, large headers payloads and by leveraging smaller message frames. 💡 **Vs HTTP Polling:** WebSockets can handle up to ~390–400x more requests per second. Latency is reduced by up to ~1/3. Payload size can be ~500x-1000x smaller. Websockets can be a huge advantage when it comes to time-sensitive, event-driven applications. > The haves paid for nanoseconds; the have-nots had no idea that a nanosecond had value. > > \- Michael Lewis(Author of Flash Boys) * * * ## Getting Started with Nest.js NestJS is a comprehensive Node.js framework for building reliable, and super scalable server backends. Learn more about [Nest.js](https://docs.nestjs.com/). You can follow along with the following [GitHub Repo](https://github.com/anataliocs/nestjs-typeorm-full-example). 💡 Open this repo in a [GitHub Codespace Devcontainer](https://codespaces.new/anataliocs/nestjs-typeorm-full-example) to follow along! The [nestjs-typeorm-full-example](https://github.com/anataliocs/nestjs-typeorm-full-example) is also a template repo so you can make a copy by clicking the **Use this template** button. Otherwise, follow the [NestJS Quickstart](https://docs.nestjs.com/first-steps) in the project README. ## Integrating Ethers.js Ethers.js is the current most widely used library for interacting with the Ethereum ecosystem. Check out the [Ethers.js Docs](https://docs.ethers.org/v5/getting-started/). First we will review the [NestJS module](https://docs.nestjs.com/modules) to encapsulate the library and handle its lifecycle and configuration. ### Ethers Sdk Config **Full example:** [ethersSdkConfig.ts](https://github.com/anataliocs/nestjs-typeorm-full-example/blob/main/src/etherssdk/ethersSdkConfig.ts) The config file provides a strongly typed interface for configuring the module. **ethersSdkConfig.ts** ``` export interface EthersSdkConfig { rpcServerUrl: string; network: string; apiKey?: string; } ``` ### Ethers Sdk Module Definition **Full example:** [ethersSdk.module.ts](https://github.com/anataliocs/nestjs-typeorm-full-example/blob/main/src/etherssdk/ethersSdk.module.ts) The module file provides the structure for configuring the module using the `registerAsync()` function. 💡 This is a widespread pattern for [NestJS modules](https://docs.nestjs.com/fundamentals/dynamic-modules). **ethersSdk.module.ts** ``` @Module({ imports: [ConfigModule] }) export class EthersSdkModule { static registerAsync(options: EthersSdkModuleAsyncOptions): DynamicModule { return { module: EthersSdkModule, imports: [ConfigModule], providers: [ { provide: CONFIG_OPTIONS, useFactory: options.useFactory, inject: [ConfigService], }, EthersSdkService, ], exports: [EthersSdkService], }; } } ``` ### Ethers Sdk Service **Full example:** [ethers.sdk.service.ts](https://github.com/anataliocs/nestjs-typeorm-full-example/blob/main/src/etherssdk/ethers.sdk.service.ts) The service file provides an interface to a reusable singleton instance of a `Provider` for other classes to use. The constructor initializes the EthersJS `Provider`. **ethers.sdk.service.ts constructor** ``` export class EthersSdkService extends SdkServiceBase implements SdkService { // ... private readonly _rpcServerUrl: string; private network: string | ethers.Network; constructor( private _configService: ConfigService, @Inject(CONFIG_OPTIONS) private options: ethersSdkConfig.EthersSdkConfig, ) { super(`Ethers SDK Rpc Server is not initialized.`); this._rpcServerUrl = options.rpcServerUrl; this.network = options.network; this._rpcServer = new ethers.JsonRpcProvider(this._rpcServerUrl + options.apiKey); } // ... } ``` Various functions are exposed to allow other classes to access **Ethers.js** functionality. **ethers.sdk.service.ts function example** ``` export class EthersSdkService extends SdkServiceBase implements SdkService { // ... getBlock(blockHashOrBlockTag: ethers.BlockTag): Promise { return this._rpcServer.getBlock(blockHashOrBlockTag); } // ... } ``` Lifecycle hooks manage various lifecycle events in managing the server. **ethers.sdk.service.ts lifecycle hook example** ``` export class EthersSdkService extends SdkServiceBase implements SdkService { // ... async onModuleInit() { this.network = await this._rpcServer.getNetwork(); this.connected(); this.logger.log( `Ethers SDK Rpc Server Status: ${this._rpcServerStatus} - RPC Server URL: ${this._rpcServerUrl}`, ); } // ... } ``` ### Ethers Sdk Service Configuration The function `registerAsync()` configures the dynamic **EthersSdkModule** asynchronously at runtime. **app.module.ts excerpt** ``` EthersSdkModule.registerAsync({ imports: [ConfigModule], useFactory: (configService: ConfigService) => ({ network: "Mainnet", rpcServerUrl: configService.get("ETHERS_RPC_SERVER_URL"), apiKey: configService.get("ETHERS_RPC_API_KEY"), }) as EthersSdkConfig, inject: [ConfigService], }); ``` * * * ## Using the EthersSdk Module The **EthersSdk** module is a reusable component that can be used anywhere in your service. ### Ethers Service Constructor The **EthersSdkService** is injected into the **EthersService** as a dependency. **ethers.service.ts excerpt** ``` @Injectable() export class EthersService { // ... constructor(private readonly ethersSdkService: EthersSdkService) {} // ... } ``` ### Ethers Service getFinalizedBlocksJson Function The **EthersService** defines a function that invokes `getFinalizedBlock()` and transforms the response into a **FinalizedBlock**. **ethers.service.ts excerpt** ``` export class EthersService { // ... readonly _getFinalizedBlocksJson: () => Promise = async (): Promise => { const blockOrNull = await this.ethersSdkService.getFinalizedBlock(); if (blockOrNull === null) { return {} as FinalizedBlock; } return { blockNumber: blockOrNull.number, date: blockOrNull.date ?? "", hash: blockOrNull.hash ?? "", } as FinalizedBlock; }; // ... } ``` ### Ethers Service getFinalizedBlocksJson Function This function **finalizedBlocksStreamForWebsocket** passes the `_getFinalizedBlocksJson()` arrow function to `buildWsResponse()` with the generic type **FinalizedBlock**. The returned `WsResponse` is then wrapped into an **Observable** stream of data using `from()`. **ethers.service.ts excerpt** ``` export class EthersService { // ... finalizedBlocksStreamForWebsocket(): (n: number) => Observable> { return (n: number): Observable> => from(buildWsResponse(n, this._getFinalizedBlocksJson)); } // ... } ``` ### Message Utilities buildWsResponse Function The function `buildWsResponse()` creates a `WsResponse` object and sets the data field to the results of the passed in function `_getFinalizedBlocksJson()` **message-utils.ts excerpt** ``` export async function buildWsResponse( n: number, sdkFunction: () => Promise, ): Promise> { return { type: "events", data: await sdkFunction(), } as unknown as WsResponse; } ``` * * * ### Websocket Gateway Event Listener The `onEvent()` function is decorated with the `@SubscribeMessage('ethers-subscribe-blocks')` annotation that listens for incoming websocket messages that have `event: "ethers-subscribe-blocks"` in the payload. **It performs the following:** - Validates that the **data** is the correct JSON shape matching **WebSocketSubscribeDto** - Then returns a new stream of data based on the **topic** included in the DTO payload - A stream of **WsResponse** JSON objects are emitted with the data depending on the topic **ethers.gateway.ts excerpt** ``` @WebSocketGateway(81, { cors: { origin: "*" } }) export class EthersGateway { // ... @SubscribeMessage("ethers-subscribe-blocks") onEvent( @MessageBody(new ValidationPipe()) payload: WebSocketSubscribeDto, ): Observable> { switch (payload.topic) { case "block-number": return this.newBlocksStream(); case "finalized-blocks": return this.finalizedBlocksStream(); default: return errorMsgWsResponse(payload); } } // ... } ``` ### Websocket Gateway finalizedBlocksStream The function `finalizedBlocksStream()` uses the RxJS function `interval(5000)` to create an **Observable** stream of data that emits every 5 seconds. On each emission, the `finalizedBlocksStreamForWebsocket()` service function is called that emits a stream of finalized block data which is merged into the interval stream. Then the stream is de-duplicated using the `distinct` function, which emits data with a unique block number. **ethers.gateway.ts excerpt** ``` export class EthersGateway { // ... private finalizedBlocksStream() { return interval(5000) .pipe(mergeMap(this.ethersService.finalizedBlocksStreamForWebsocket())) .pipe(distinct(({ data }) => data.blockNumber)); } // ... } ``` * * * ## Front-end Client The thin client consists of a single `.html` file and a `.js` file. ### Front-end Client - HTML The `ws-finalized-blocks.html` file allows a user to subscribe to a websocket stream of finalized blocks. **The dynamic elements are:** - The `article` element with the id `messages` is appended with websocket data - The `send-message-button` subscribes to websocket messages - The `close-connection-button` closes the websocket stream **ws-finalized-blocks.html excerpt** ```
Emitted Events - Finalized Blocks

``` * * * ### Front-end Client - Javascript The `wsFinalizedBlock.js` defines the basic logic to: - Establish a websocket connection - Send and receive websocket messages - Close the connection A `WsConnect` object is instantiated passing in: - The websocket endpoint - The name of the event on sent websocket messages - The function used to generate block explorer links, `createLinkEth` **wsFinalizedBlock.js excerpt** ``` const websocket = new WsConnect("ws://localhost:81", "ethers-subscribe-blocks", createLinkEth); ``` A **click** event listener is attached to the button with the id, `#send-message-button`. When the button is clicked, the `sendMessage()` function on the **WsConnect** object is invoked subscribing to the `'finalized-blocks'` stream of data via websocket. **wsFinalizedBlock.js excerpt** ``` document.querySelector("#send-message-button").addEventListener("click", () => { console.log("Sending message to subscribe to finalized blocks"); websocket.sendMessage("finalized-blocks"); }); ``` A **click** event listener is attached to the button with the id, `#close-connection-button`. When the button is clicked, the `closeConnection()` function is called. **wsFinalizedBlock.js excerpt** ``` document.querySelector("#close-connection-button").addEventListener("click", () => { console.log("Closing finalized blocks websocket connection: User Requested"); websocket.closeConnection("User Requested"); }); ``` * * * ### Front-end Client - WsConnect Class The **WsConnect** abstracts away common functions used in all websocket clients. The constructor initializes the object and creates a `new WebSocket(url)` using the standard [The WebSocket API](https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API) **wsConnect.js excerpt** ``` export class WsConnect { // ... constructor(url, eventName, linkFunction) { this.url = url; this.socket = new WebSocket(url); this.eventName = eventName; this.linkFunction = linkFunction; this.setEventHandlers(); } // ... } ``` The `setEventHandlers()` parses the returned websocket messages from the backend service and formats them for display. The raw JSON data is displayed as well as a link to etherscan built using the passed in `linkFunction()`. ``` export class WsConnect { // ... setEventHandlers() { this.socket.onmessage = (msg) => { const data = JSON.parse(msg.data).data; const message = document.createElement("div"); message.appendChild(document.createTextNode(msg.data)); message.appendChild(document.createElement("br")); const link = this.linkFunction(data); message.appendChild(link); message.appendChild(document.createElement("hr")); document.querySelector("#messages").appendChild(message); }; } // ... } ``` The `sendMessage()` function sends a websocket message to subscribe to the desired topic. ``` export class WsConnect { // ... sendMessage(topic) { this.socket.send( JSON.stringify({ event: this.eventName, data: { client: "vanilla.js", topic: topic, }, }), ); } // ... } ``` The `closeConnection()` function closes the websocket connection. ``` export class WsConnect { // ... closeConnection(reason) { this.socket.close(1000, reason); document.querySelector("#connection-status").innerHTML = ""; document.querySelector("#progress-bar").value = 0; } // ... } ``` * * * ## E2E Test Automation with Foundry Anvil Testcontainers Testing blockchain applications end-to-end can be challenging, especially when you need a reliable, isolated Ethereum node for your test suite. Our [Foundry Anvil Testcontainers](https://github.com/hella-labs/foundryanvil-testcontainers-nodejs) provide a powerful solution for E2E test automation. ### Why Foundry Anvil Testcontainers? **Foundry Anvil** is a local Ethereum node optimized for development and testing. By packaging it as a **Testcontainer**, you get: - **Isolated Test Environments**: Each test suite runs against a fresh blockchain instance - **Fast Execution**: Anvil’s optimized performance means rapid block mining and transaction processing - **Deterministic Testing**: Consistent blockchain state across test runs - **CI/CD Ready**: Works seamlessly in containerized build environments - **Zero Configuration**: Automatically manages container lifecycle ### Integration with the NestJS Backend The Foundry Anvil Testcontainer integrates perfectly with the NestJS architecture demonstrated in this article: **Example Test Setup:** ``` import { AnvilContainer } from "@testcontainers/foundry-anvil"; describe("Ethers WebSocket E2E Tests", () => { let anvilContainer: AnvilContainer; let rpcUrl: string; beforeAll(async () => { // Start Anvil testcontainer anvilContainer = await new AnvilContainer().start(); rpcUrl = anvilContainer.getRpcUrl(); // Configure NestJS app with test RPC endpoint const moduleFixture = await Test.createTestingModule({ imports: [ EthersSdkModule.registerAsync({ useFactory: () => ({ network: "localhost", rpcServerUrl: rpcUrl, }), }), ], }).compile(); }); afterAll(async () => { await anvilContainer.stop(); }); it("should stream finalized blocks via websocket", async () => { // Your E2E test logic here }); }); ``` ### Real-World Testing Scenarios With Foundry Anvil Testcontainers, you can test: - **WebSocket Event Streams**: Verify block finalization events are emitted correctly - **Transaction Flows**: Test complete user journeys from transaction submission to confirmation - **Contract Interactions**: Deploy and interact with smart contracts in a controlled environment - **Error Handling**: Simulate network failures and validate recovery mechanisms - **Performance**: Measure WebSocket throughput and latency under load This approach ensures your reactive blockchain application behaves correctly in production, catching integration issues that unit tests might miss. Learn more about our [Foundry Anvil Testcontainers](https://github.com/hella-labs/foundryanvil-testcontainers-nodejs) and start building robust E2E test suites today. * * * ## Conclusion Thanks for reading! We walked through a performant, reactive dApp with WebSockets, Ethers.js, RxJS, and NestJS. This approach has a clean separation the client and a robust backend service capable of handling real-time blockchain data streams. The backend service can then be re-used for other front-end clients, such as desktop, terminal, mobile apps, analytics, and dev tooling. ### Some Key Takeaways to Consider While there is no one right answer for every application, we hope you learned some new techniques in this article. **Benefits:** - **Thin Client**: Reduced bundle sizes, faster load times, and better performance across devices - **Reactive Streams**: Perfect fit for blockchain’s event-driven nature using RxJS Observables - **WebSocket Efficiency**: Up to 98.8% overhead reduction and 390-400x more requests per second compared to HTTP polling - **Modular Design**: Reusable NestJS modules that can easily extend to multiple blockchain networks **Concepts:** - **Clean Separation**: Business logic resides in the backend, keeping frontend focused on presentation - **Real-time Data**: Efficient streaming of blockchain events with automatic deduplication - **Scalability**: Single backend service can serve multiple client types (web, mobile, analytics tools) The modular, reactive approach demonstrated here provides a clear example of a unique way of writing dApps that can scale efficiently with a snappy, responsive UX. 💡 **Next in the series:** [Part 2: On-Chain Ethereum Data via Server-Sent Events and GraphQL](/sse-graphql-ethereum-nestjs-thinclient/) re-uses the exact same `EthersService` to add an SSE stream and a GraphQL API, with no new SDK code. _Thanks again for reading and be sure to post your comments below!_ * * * ## Ready to Ship with Confidence? Whether you’re building a DeFi protocol, NFT marketplace, or the next breakthrough Web3 application, **comprehensive lifecycle testing is non-negotiable**. Foundry Anvil Testcontainers makes it easier than ever to implement the testing strategy your users deserve. Our automation strategies reduce your time-to-market while increasing the reliability of your protocol. This open-source project is just a glimpse of what we can deliver for your team. Get expert guidance on implementing lifecycle tests, building robust CI/CD pipelines, or developing custom Web3 tooling for your protocol. [Get a DevOps Audit](/contact/) [Explore All Service Offerings →](/web3-consultant-service-offerings/) Share: - [](https://twitter.com/intent/tweet?text=On-Chain%20Ethereum%20Data%20via%20WebSockets%20with%20Ethers.js%2C%20RxJS%20and%20Nest.js&url=https%3A%2F%2Fwww.hellalabs.dev%2Fwebsocket-sse-graphql-nestjs-thinclient%2F) - [](https://www.linkedin.com/shareArticle?mini=true&url=https%3A%2F%2Fwww.hellalabs.dev%2Fwebsocket-sse-graphql-nestjs-thinclient%2F&title=On-Chain%20Ethereum%20Data%20via%20WebSockets%20with%20Ethers.js%2C%20RxJS%20and%20Nest.js&summary=Build%20more%20responsive%2C%20snappy%2C%20performant%20dApps%20with%20reactive%20streams%20with%20RxJS%20Observables%2C%20ethers.js%20and%20the%20power%20of%20a%20Nest.js%20backend) ## Start the conversation Show Comments ## Related [![](/_astro/onchain-data-2.0cV1fDea_ZhrxY5.jpg)](/sse-graphql-ethereum-nestjs-thinclient/) - [Nestjs](/tags/nestjs/) - [Ethereum](/tags/ethereum/) - [EthersJS](/tags/ethersjs/) - [RxJS](/tags/rxjs/) - [Server-Sent Events](/tags/server-sent-events/) - [GraphQL](/tags/graphql/) ### [On-Chain Ethereum Data via Server-Sent Events and GraphQL with Ethers.js, RxJS and Nest.js](/sse-graphql-ethereum-nestjs-thinclient/) Re-use one Nest.js service layer to stream finalized Ethereum blocks over Server-Sent Events and serve block queries over GraphQL, with ultra-thin vanilla JS clients and RxJS Observables. 23 Nov, 2026 17 min read [![](/_astro/onchain-data-3.DKgNIT4I_dzzeC.jpg)](/websocket-solana-kit-rxjs-nestjs-thinclient/) - [Nestjs](/tags/nestjs/) - [Solana](/tags/solana/) - [Solana Kit](/tags/solana-kit/) - [RxJS](/tags/rxjs/) - [WebSockets](/tags/websockets/) ### [On-Chain Solana Data via WebSockets with Solkit, RxJS and Nest.js](/websocket-solana-kit-rxjs-nestjs-thinclient/) Wrap Solana Kit (@solana/kit) in a reusable Nest.js module and stream finalized Solana blocks over WebSockets to an ultra-thin vanilla JS client with RxJS Observables, re-using the exact pattern from the Ethereum articles. 24 Nov, 2026 21 min read [![](/_astro/chaos-engineering.DFkfE7jN_Z2mHjmN.jpg)](/on-chain-chaos-engineering-ethereum-wiremock-anvil/) - [Testing](/tags/testing/) - [Chaos Engineering](/tags/chaos-engineering/) - [Ethereum](/tags/ethereum/) - [Anvil](/tags/anvil/) - [WireMock](/tags/wiremock/) - [EthersJS](/tags/ethersjs/) - [Nestjs](/tags/nestjs/) ### [Survive the Outage and Stop Writing Fake JSON-RPC Mocks: Real Life On-Chain Chaos Engineering for Ethereum Apps](/on-chain-chaos-engineering-ethereum-wiremock-anvil/) Put WireMock in front of a real Foundry Anvil node with Testcontainers to inject 503s, dropped connections, latency and 429s into your Ethereum app, without hand-writing a single fake JSON-RPC response. 19 Nov, 2026 14 min read