Skip to content

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.

License

Notifications You must be signed in to change notification settings

Spydiecy/create-kalp-dapp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

43 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

create-kalp-dapp

Kalp DLT

Platform License NPM Version

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.

image

πŸš€ Quick Start

npx create-kalp-dapp <your-dapp-name>

# cd into the directory
cd <your-dapp-name>

πŸ“¦ Installation

Open your terminal and run:

npx create-kalp-dapp <your-dapp-name>
cd <your-dapp-name>

πŸ— Project Structure

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

πŸ“œ Smart Contract Development

Setting up the Smart Contract Project

  1. Navigate to the smart contract directory:

    cd backend
    
  2. Install dependencies:

    go mod tidy
    

Smart Contract Code

The main smart contract file is krc.go. It includes a simple greeting contract with Init, SetGreeting, and GetGreeting functions.

Compiling and Deploying the Smart Contract

  1. Sign Up and Log In to Kalp Studio Platform

  2. Go to Kalp Instant Deployer

  3. Click on "Create New" Smart Contract

  4. Enter the details:

    • Name: Enter a name for your smart contract
    • Category: Choose a category
    • Description: Add a description (optional)

    image

  5. Upload your backend.zip file (zip the contents of the backend folder)

    image

  6. Deploy your contract

After deployment, Kalp Studio will provide you with API endpoints for each function of your smart contract.

image

Generating API Key

In Kalp Studio, navigate to the API key generation section and generate a new API key to authenticate your API requests.

πŸ’» Frontend Development

Setting up the Frontend

  1. Navigate to the frontend directory:

    cd frontend
    
  2. Install dependencies:

    npm install
    
  3. Set up environment variables:

    • Copy .env.local.example to .env.local
    • Update NEXT_PUBLIC_API_KEY and NEXT_PUBLIC_CONTRACT_ID with your Kalp Studio API key and deployed contract ID

Running the Frontend

Start the development server:

npm run dev

Visit http://localhost:3000 to see your dApp in action.

image

πŸ”§ Interacting with the Smart Contract

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.

πŸ”‘ API Integration

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.

➑️ Contributing

We welcome contributions! Please see our CONTRIBUTING.md file for details on how to get started.

βš–οΈ License

create-kalp-dapp is licensed under the MIT License.

⭐️ If you find this project helpful, please give it a star on GitHub!

About

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.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published