Getting started with Onchain App Template
This guide uses Onchain App Template.
Create project
Clone the repository using the command below.
git clone https://github.com/coinbase/onchain-app-template.git
Setup project
To ensure all components work seamlessly, set the following environment variables in your .env
file:
-
API KEY
: Find this on the API page at the Coinbase Dev Portal. -
NEXT_PUBLIC_WC_PROJECT_ID
: Create a project at Wallet Connect to obtain this.
Add theses to you .env
file:
NEXT_PUBLIC_CDP_API_KEY=ADD_YOUR_API_KEY_HERE
NEXT_PUBLIC_WC_PROJECT_ID=ADD_YOUR_PROJECT_ID_HERE
Install dependencies and run dev server
Execute the following commands:
# Install bun in case you don't have it
bun curl -fsSL <https://bun.sh/install> | bash
# Install packages
bun i
# Run Next app
bun run dev
Test Your Setup
Visit your site locally and click the "Log in" button.
- A popup window will appear, displaying a Smart Wallet connection option.
- After connecting, click the "Transact" button.
- This action will initiate a transaction on Base Sepolia.
- The gas fees for this transaction will be sponsored by the Coinbase Developer Platform Paymaster.