This Paymaster quickstart tutorial explains how to set up a basic app and sponsor transactions using OnchainKit and Coinbase Smart Wallet.
How to Get a Paymaster & Bundler endpoint on Base testnet (Sepolia) from CDP
Create a new CDP account or sign in to your existing account.
Navigate to Paymaster.
Add the following address to the allowlist under Configuration—this is the address of the contract we are calling:
Switch to Base testnet (Sepolia) in the top right of the configuration.
Copy your endpoint to use later.
Expand for images and click to enlarge
Clone the repo
You can find the API key on the Coinbase Developer Portal’s OnchainKit page. If you don’t have an account, you will need to create one.
You can find your Wallet Connector project ID at Wallet Connect.
Add the following to your .env
file
Install dependencies - run these in your terminal in the root of the project
Navigate to /src/components/OnchainProviders.tsx
and modify the OnchainKitProvider’s config
object to include the paymaster URL.
Navigate to /src/components/TransactionWrapper.tsx
and modify the Transaction component to use the isSponsored
prop.
Navigate to http://localhost:3000
Click connect and sign in with your smart wallet or create a new one.
Click the “Collect” button and your paymaster will sponsor. Note only Smart Wallets can have sponsored transactions so EOA accounts will not get sponsorship.
Thats it! You’ve successfully set up your paymaster on your application.
Additional documentation and information on Coinbase Smart Wallet is at smartwallet.dev.
Check out how to build onchain applications with ease using OnchainKit!