Obtaining an Ethereum Project ID using Infura
As a developer working on an Ethereum-based project, you will need to interact with various Ethereum services, including the Interplanetary File System (IPFS) and the Ethereum Virtual Machine (EVM). To connect to these services, you need a valid Ethereum Project ID. In this article, we will walk you through the process of obtaining an Ethereum Project ID using Infura.
Prerequisites
Before you begin, make sure you have:
- A verified Ethereum wallet with an existing public address.
- An Infura account, which provides a free Ethereum testnet for testing and development purposes.
- An introduction to Ethereum wallets, blockchain networks, and the Ethereum Virtual Machine (EVM).
Step 1: Create an Ethereum wallet on Infura
To begin the process, you need to create an Ethereum wallet on the Infura testnet. Follow the steps below.
- Go to [Infura]( and sign up for a new account.
- Click “Testnet” in the top menu bar and select the Ethereum testnet (mainnet is not recommended for production).
- Click “Create Wallet” and follow the instructions to create an Ethereum wallet.
- Select a wallet type (e.g. MetaMask or Truffle) and set your public address.
Step 2: Get your Ethereum project ID
To get your Ethereum project ID, you need to create a new resolver configuration using the Infura “createAgent” function from “@veramo/core”. You will also need the “ethr-did-resolver” library, which provides an easy way to interact with IPFS and EVM services.
Here is an example code snippet:
import { CreateAgent } from '@veramo/core';
import { DIDResolverPlugin } from '@veramo/did-resolver';
import { getResolver as ethrDidResolver } from 'ethr-did-resolver';
const projectID = 'YOUR_PROJECT_ID_HERE'; // Replace with your Ethereum project ID
const agentConfig: CreateAgentConfig = {
projectID: projectID,
networkName: 'mainnet', // You can use testnet, but it is not recommended for production
};
const solverConfig = { ...getResolver as IResolver};
solverConfig.infuraUrl = `
const agent = createAgent(agentConfig);
Replace “YOUR_PROJECT_ID_HERE” with your actual Ethereum project ID.
Step 3. Use your Resolver configuration to connect to IPFS and EVM services
With the resolver configuration in place, you can now connect to IPFS and EVM services using ethr-did-resolver. Here is an example code snippet:
import { IResolvers } from 'infura-node';
import { getResolver as ethrDidResolver } from 'ethr-did-resolver';
const projectID = 'YOUR_PROJECT_ID_HERE'; // Replace with your Ethereum project ID
const resolvers: IResolvers = {};
const resolverConfig = { ...ethrDidResolver };
resolverConfig.projectId = projectID;
const resolver = getResolver(resolvers, resolverConfig);
This code sets up an IResolvers object and uses the getResolver function as ethr-did-resolver to create the resolver configuration. Replace “YOUR_PROJECT_ID_HERE” with your actual Ethereum project ID.
Conclusion
With these steps, you have successfully obtained your Ethereum project ID using Infura. This allows you to connect to IPFS and EVM services for testing and development purposes. Remember to use this configuration in your production-ready codebase. If you have any further questions or need help integrating your Ethereum project with other blockchain services, feel free to ask!