DIN is making several of our supported networks available to users without a subscription. Instead, the networks below can be accessed by making an x402 micro-payment for each call. This gateway is provided as a beta release and feedback from BUIDLRS is very appreciated. Submit feedback, feature requests and bug reports by filing issues in this repository.
Crypto-currency networks are specified as specific sub-domains on the DIN gateway and match the *.gateway.din.dev/rpc hostname pattern. The following networks are currently supported:
- Ethereum Mainnet: https://ethereum-mainnet.gateway.din.dev/rpc (
beta/near-head only) - Ethereum Hoodi: https://ethereum-hoodi.gateway.din.dev/rpc (
stable) - Base Mainnet: https://base-mainnet.gateway.din.dev/rpc (
beta) - Base Sepolia: https://base-sepolia.gateway.din.dev/rpc (
beta) - Blast Mainnet: https://blast-mainnet.gateway.din.dev/rpc (
stable) - Blast Sepolia: https://blast-sepolia.gateway.din.dev/rpc (
stable)
Also note that the words stable and beta shown after each network above refer to the quality of the network connection available through DIN.
The DIN gateway charges Base USDC for each Ethereum method that is called in accordance with the INFURA credit cost tables. The cost per credit is four (4) micro-ethers, which results in per-method costs that are approximately the same as INFURA's Developer plan. For batched requests, the cost charged for the batch will be the sum of the credit costs of the individual method calls included in the batch.
For applications where request-response latency is sensitive, micro-payments can be slower than desired. The long term solution to this issue is to sell bearer tokens via x402 which can then be sent in the Authorization header to bypass the extra buyer-to-seller call as well as the two calls from the seller to the facilitator. One existing strategy to increase the overall throughput of the system is to send batches of JSON-RPC requests as described in the JSON-RPC 2.0 Specification.
Examples are available for the following languages:
To run the Go example, first ensure the dependencies are up to date:
go mod tidyThen, set the X402_BUYER_PRIVATE_KEY environment variable and run the script:
export X402_BUYER_PRIVATE_KEY=<your_private_key>
go run main.goTo run the Python example, first create a virtual environment and install the dependencies:
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txtThen, set the X402_BUYER_PRIVATE_KEY environment variable and run the script:
export X402_BUYER_PRIVATE_KEY=<your_private_key>
python main.pyTo run the TypeScript example, first install the dependencies:
npm installThen, set the X402_BUYER_PRIVATE_KEY environment variable and run the script:
export X402_BUYER_PRIVATE_KEY=<your_private_key>
npm startClients are provided by external libraries and are available for the following languages:
The following feature list is a very rough roadmap for the DIN gateway. We'll be building more features and expanding this product after the code nyc hackathon. If you'd like to provide feedback or work with us, send us an email to din@consensys.net or post your thoughts to the discussions in this repository.
- Ethereum-compatible JSON-RPC service
- Ethereum-compatible MCP service
- API to list available networks and methods
- The rest of the DIN networks
- Micro-payments (one per request)
- Daily access tokens for different tiers