Quickstart- Set up your Paymaster on your application
This Paymaster quickstart tutorial explains how to set up a basic app and sponsor transactions using OnchainKit and Coinbase Smart Wallet.
Getting an endpoint on Base Sepolia
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.
Setting up an app template
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
Add your paymaster to the transact button
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.
Start the app locally
Open the app in your browser and sign in with a smart wallet
Navigate to http://localhost:3000
Click connect and sign in with your smart wallet or create a new one.
Initiate the transaction
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.
Other Examples
Additional documentation and information on Coinbase Smart Wallet is at smartwallet.dev.
Check out how to build onchain applications with ease using OnchainKit!