0G_DevTool
Lightweight JS SDK build, test, and monitor apps on 0G Mainnet.
Problem Statement
This project is a developer toolkit for the 0G Mainnet (EVM-compatible chain) that provides a JavaScript SDK to simplify building, testing, and monitoring decentralized applications. Our goal is to strengthen the 0G ecosystem by lowering the barrier to entry for developers and enabling production-ready workflows out of the box.With this SDK, developers can: • Connect easily to 0G Mainnet/Testnet using HTTP or WebSocket providers, without manually handling chain IDs or RPC quirks.• Deploy and interact with smart contracts programmatically, making it simple to script deployments and run read/write operations.• Query past events and subscribe to live events via WebSockets, with automatic retries and error handling built in.• Monitor contracts, accounts, and transactions programmatically through the SDK, turning blockchain data into actionable insights.• Build scripts and testing tools for dApps on 0G without having to reinvent common utilities like log queries, retries, or wallet setup.Why this matters for 0G: • Ecosystem growth: Today, 0G lacks streamlined developer tooling (SDKs, monitoring, testing utilities). By filling this gap, more developers can experiment and deploy faster.• Production readiness: Our focus is on stability—features like retry logic, static/dynamic network handling, and contract abstractions make this more than just a demo helper.• Extensible design: This SDK forms a base that others can fork or extend for dashboards, indexers, or advanced monitoring services in the 0G ecosystem.Features: • Lightweight JavaScript SDK with Ethers v6 under the hood• Supports both auto-detected chainId and static network locking• Contract deploy/read/write helpers• Event logs + subscriptions with retry mechanisms• Future CLI interface planned for common tasks like deploy, call, listen, and monitor• Easy integration into hackathon projects, dApps, or developer workflowsImpact By delivering this SDK, we’re creating the first step toward a robust developer experience on 0G. This empowers the ecosystem with reusable tooling, accelerates hackathon projects, and ensures developers can focus on innovation instead of plumbing.P.S.- We have added the support for websockets as well but we couldn't find any link for them :p. Also while testing we ran out of Mainnet Tokens.
Solution
This project is built as a JavaScript SDK for the 0G Mainnet (EVM-compatible chain), designed to simplify blockchain interactions, event monitoring, and contract management for developers. The focus was on creating a lightweight, modular, and production-ready toolkit, with a CLI planned for future development to further streamline workflows.Core Technologies: • Node.js & ES Modules: The SDK is written in modern JavaScript (ESM), making it compatible with Node.js.• Ethers.js v6: Handles all blockchain interactions, including provider management, contract deployment, reading/writing data, and event subscriptions.• HTTP & WebSocket Providers: Supports both RPC connections and live event subscriptions for real-time monitoring.• Custom Retry Mechanism: A small utility ensures that queries to contracts and events automatically retry on transient network issues, improving reliability.Project Structure: • /src – Core SDK modules• provider.js → Manages HTTP and WebSocket providers with dynamic chain detection and optional static network locking.• contracts.js → Helper functions to deploy contracts and interact with their methods (read/write).• events.js → Handles fetching past events and subscribing to live events, with built-in retry logic.• utils/retry.js → Lightweight retry wrapper for network calls.• utils/validate.js → Utility functions to validate inputs, addresses, and parameters.• utils/constants.js → Holds constant values used across the SDK.•utils/wallet.js → Helper functions for wallet management, signing, and key handling.• utils/index.js → Central export point for all utility functions.• .gitignore → Specifies files/folders to ignore in version control.•README.md → Documentation and usage instructions.• package.json → Configured for npm publishing with "exports" and "files" to include only the SDK code.• package-lock.json → Auto-generated lockfile for exact dependency versions.Workflow• Initialize providers via HTTP/WebSocket → auto-detect network or optionally lock to a chainId. • Deploy and interact with contracts → use deploy/read/write helpers. • Subscribe or query events → retry-safe and real-time.
Hackathon
ETHGlobal New Delhi
2025
Contributors
- JasmeetSingh7314
6 contributions