IdentityServer Wallet v1
Replit for easy deploymentsReplit is an AI-powered software development & deployment platform for building, sharing, and shipping software fast.
Coinbase has partnered with Replit to create a template that enables developers to register their AI agent onchain
in just minutes.Get started with our Basename registration template.
If you plan to deploy this template publicly, read Securing a Wallet to learn
how to protect your wallets.
Prerequisites
- Install the CDP SDK.
- Have a persisted funded API Wallet on the Base network (minimum of 0.005 Base mainnet ETH). See creating a wallet to quickly spin up a 1-of-1 Developer-Managed wallet, and refer to persisting a wallet for more information on how to save it.
Step-by-Step guide
Step 1. Import Required Modules
register-basename.js
Step 2. Define Contract ABIs and Addresses
Set up the ABIs for the L2 Resolver and Registrar contracts, and define theBaseNamesRegistrarControllerAddress
.
The Registrar contract is responsible for registering Basenames. By calling the contract alongside an ETH payment, you buy the name and associate it with your address on the Resolver.
The Resolver is what allows wallets to resolve a certain Basename to its proper address.
register-basename.js
Step 3. Create Register Contract Method Arguments
Here, we create the arguments for the register contract method using the Resolver and Registrar ABIs.register-basename.js
Step 4. Implement Basename Registration Function
This function will handle the registration of the Basename.register-basename.js
Step 5. Main Execution Flow
Here, we’ll be using the information returned when persisting the wallet to import the wallet and register a Basename. Save these values as environment variables by running the following commands:register-basename.js