A full-stack starter template featuring Next.js & Go, designed for building dApps and developing smart contracts on the Kalp DLT blockchain. This starter kit provides a simple greeting dApp to demonstrate interaction with a Kalp DLT smart contract.
npx create-kalp-dapp <your-dapp-name>
# cd into the directory
cd <your-dapp-name>
Open your terminal and run:
npx create-kalp-dapp <your-dapp-name>
cd <your-dapp-name>
After creation, your project should look like this:
<your-dapp-name>/
βββ backend/
β βββ vendor/
β βββ go.mod
β βββ go.sum
β βββ main.go
β βββ krc.go
βββ frontend/
β βββ src/
β β βββ app/
β β βββ hooks/
β β βββ utils/
β βββ .env.local.example
β βββ next.config.mjs
β βββ package.json
β βββ tailwind.config.ts
βββ README.md
-
Navigate to the smart contract directory:
cd backend
-
Install dependencies:
go mod tidy
The main smart contract file is krc.go
. It includes a simple greeting contract with Init
, SetGreeting
, and GetGreeting
functions.
-
Sign Up and Log In to Kalp Studio Platform
-
Go to Kalp Instant Deployer
-
Click on "Create New" Smart Contract
-
Enter the details:
- Name: Enter a name for your smart contract
- Category: Choose a category
- Description: Add a description (optional)
-
Upload your
backend.zip
file (zip the contents of thebackend
folder) -
Deploy your contract
After deployment, Kalp Studio will provide you with API endpoints for each function of your smart contract.
In Kalp Studio, navigate to the API key generation section and generate a new API key to authenticate your API requests.
-
Navigate to the frontend directory:
cd frontend
-
Install dependencies:
npm install
-
Set up environment variables:
- Copy
.env.local.example
to.env.local
- Update
NEXT_PUBLIC_API_KEY
andNEXT_PUBLIC_CONTRACT_ID
with your Kalp Studio API key and deployed contract ID
- Copy
Start the development server:
npm run dev
Visit http://localhost:3000
to see your dApp in action.
The frontend includes a simple interface to interact with your greeting smart contract:
- View the current greeting
- Set a new greeting
All interactions are handled through the Kalp DLT API, using the endpoints provided by Kalp Studio.
The useKalpApi
hook in src/hooks/useKalpApi.tsx
handles all API calls to your smart contract. Make sure to update the contract ID and API key in your .env.local
file for proper functionality.
We welcome contributions! Please see our CONTRIBUTING.md file for details on how to get started.
create-kalp-dapp is licensed under the MIT License.
βοΈ If you find this project helpful, please give it a star on GitHub!