Basic Usage
To get started, wrap your app withOnchainKitProvider
and provide the required props described below.
Also, import '@coinbase/onchainkit/styles.css'
to ensure OnchainKit’s components are styled correctly.
In the example below, we’re creating a RootProvider
to keep our code organized.
RootProvider.tsx
RootProvider
in our root layout.
layout.tsx
Props
Prop | Description | Required |
---|---|---|
chain | The blockchain network your app operates on. | Yes |
apiKey | Coinbase Developer Platform API key for accessing OnchainKit services. | No |
projectId | Coinbase Developer Platform Project ID for funding components. | No |
rpcUrl | Custom RPC endpoint for blockchain requests. | No |
config | Configuration object for appearance, wallet settings, and paymaster. | No |
miniKit | MiniKit configuration for mini app features. | No |
analytics | Enable/disable usage analytics (defaults to true). | No |
defaultPublicClients | Custom viem public clients for specific chains. | No |
Chain
Specifies the blockchain network your OnchainKit components will use. This is required for all OnchainKit functionality.API Key
Your Coinbase Developer Platform API key enables access to OnchainKit services like token data, swap quotes, and transaction sponsorship. Required for:- Swap components and APIs
- Transaction components with sponsorship
- Token data and metadata
- NFT minting components

RPC URL
Custom RPC endpoint for blockchain requests. If not provided, OnchainKit uses the Coinbase Developer Platform Node (requiresapiKey
).
apiKey
.
Project ID
Your Coinbase Developer Platform Project ID, required for funding and onramp components.
Config
Configuration object to customize OnchainKit’s appearance, wallet behavior, and gas sponsorship.Appearance
Controls visual styling and branding:name
— Your app’s name displayed in componentslogo
— URL to your app’s logomode
— Color scheme:'auto'
,'light'
, or'dark'
theme
— Visual theme:'default'
,'base'
,'cyberpunk'
,'hacker'
, or custom
Wallet
Wallet connection and display settings:display
— Interface style:'modal'
(overlay) or'classic'
(inline)preference
— Coinbase Wallet preference:'all'
,'smartWalletOnly'
, or'eoaOnly'
termsUrl
— Link to your terms of serviceprivacyUrl
— Link to your privacy policysupportedWallets
— Enable additional wallets:rabby
,trust
,frame
Paymaster
URL for gas sponsorship. Configure through Coinbase Developer Platform.Analytics
Enable/disable usage analytics (defaults totrue
).
MiniKit
Configuration for mini app features. Only needed when building mini apps.enabled
— Enable MiniKit features (defaults tofalse
)autoConnect
— Auto-connect when in mini apps (defaults totrue
)notificationProxyUrl
— Custom notification proxy URL (defaults to/api/notify
)
Analytics
Enable or disable OnchainKit usage analytics.true
. Analytics help improve OnchainKit but can be disabled for privacy.
Default Public Clients
Custom viem public clients for specific chains. Useful when you need custom RPC configurations or want to use your own client settings.- Custom RPC endpoints with specific configurations
- Enhanced client settings (batching, caching, retries)
- Private or premium RPC providers
- Multi-chain applications with different client requirements per chain