Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Getting Started

Welcome! This guide will get you up and running with the D_D Cloud RPC in under five minutes.

Follow along to make your first RPC request and start building amazing DApps.

Prerequisites

Before you begin, make sure you have:

  • A D_D Cloud account (sign up is free!)
  • Basic knowledge of a programming language like JavaScript, TypeScript, Python, Rust, or Bash Script.
  • Internet connection for API requests.

Getting an API key

If you already created an API key, you can find it in your D_D Cloud Dashboard; otherwise, you must create a new one.

  1. Open your D_D Cloud Dashboard.
  2. Click the Generate New API Key button.
  3. Copy the new API key and store it in a secure location.

Take The .env Pledge

The .env Pledge outlines best practices for handling crypto keys. Taking it is a fun way to remind yourself about safe key management.

Installing Dependencies

Choose your preferred language and install the required packages.

npm install ethers

Sending the first request

Now that you set everything up, let’s fetch the latest finalized block from Ethereum.

Replace YOUR_API_KEY with your actual API key.

import { ethers } from "ethers"

async function main() {
  const rpcClient = new ethers.JsonRpcProvider(
    "https://api.cloud.developerdao.com/rpc/eth/YOUR_API_KEY"
  )

  try {
    // Get the most recent finalized block
    const block = await rpcClient.getBlock("finalized")


    // Log the block details
    console.log("✅ Most recent, finalized block:", {
      number: block.number,
      hash: block.hash,
      timestamp: new Date(block.timestamp * 1000).toISOString(),
      transactions: block.transactions.length
    })
  } catch (error) {
    console.error("❌ Failed to fetch block:", error.message)
  }
}

main()

Next Steps

After getting your first connection up and running, check out what D_D Cloud has to offer.