Skip to content

PrabalParihar/Certify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

2 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŽ“ Build Your Own Certification System using Soulbound Tokens

License Platform Version

An interactive blockchain development challenge for students

Start Challenge ยท View Demo ยท Report Bug ยท Request Feature


Certify

Screenshot 2025-01-21 at 3 19 25โ€ฏPM

๐ŸŒŸ Achievement Tracks

๐Ÿ† Beginner Track (0-400 points)

๐Ÿ“š Learn Blockchain Basics  [50 points]
๐Ÿ”ง Setup Development Environment [50 points]
๐Ÿš€ Deploy First Smart Contract [100 points]
๐Ÿ’Ž Create Your First SBT [100 points]
๐Ÿ” Execute Basic Queries [100 points]

๐ŸŽฏ Intermediate Track (400-700 points)

๐Ÿ”„ Implement Advanced Contract Functions [100 points]
๐ŸŽจ Build Basic Frontend [100 points]
๐Ÿ”Œ Integrate Contract with Frontend [100 points]

๐Ÿ‘‘ Advanced Track (700-1000 points)

๐ŸŽฎ Create Interactive UI [100 points]
๐Ÿ“Š Implement Analytics Dashboard [100 points]
๐ŸŒ Deploy Full Production DApp [100 points]

๐ŸŽฏ Challenge Overview

Welcome to the Certify DApp Challenge! This hands-on tutorial will guide you through building a complete blockchain-based certification system. By the end, you'll have created a fully functional DApp that issues and manages Soulbound Tokens (SBTs) on the Kalp blockchain.

What You'll Build

graph LR
    A[Smart Contract] --> B[SBT Token]
    B --> C[Frontend]
    C --> D[User Interface]
    D --> E[Certification System]
Loading

Learning Outcomes

  • ๐Ÿ”ท Master Soulbound Token implementation
  • ๐Ÿ”ท Develop production-grade smart contracts
  • ๐Ÿ”ท Build modern web frontends with Next.js
  • ๐Ÿ”ท Integrate blockchain with web applications
  • ๐Ÿ”ท Deploy full-stack DApps

๐Ÿš€ Getting Started

Prerequisites

Tool Version Download
Go >=1.19, <1.20 Download
Node.js >=14.x Download
npm >=6.x Included with Node.js
Postman Latest Download
Kalp Studio Account - Sign Up

๐Ÿ“ฆ Quick Start

  1. Clone Repository

    git clone https://github.com/thekalpstudio/Certify.git
    cd certify
  2. Setup Smart Contract

    cd sbtkalp
    go mod tidy
  3. Configure Frontend

    cd ../certification
    npm install
    cp .env.example .env.local

๐Ÿ’Ž Challenge Modules

Module 1: Smart Contract Development [300 points]

๐ŸŽฏ Learning Objectives

  • Understand Soulbound Token (SBT) implementation
  • Master Kalp SDK functionalities
  • Learn blockchain state management
  • Implement secure smart contract patterns

๐Ÿ“‹ Prerequisites [25 points]

  • Install Go (>=1.19, <1.20)
  • Set up GOPATH and workspace
  • Basic understanding of blockchain concepts
  • Familiarity with Go programming

๐Ÿš€ Setup Environment [25 points]

  1. Create project directory:

    mkdir sbtkalp
    cd sbtkalp
  2. Initialize Go module:

    go mod init sbtkalp
  3. Install Kalp SDK:

    go get -u github.com/p2eengineering/kalp-sdk-public/kalp
  4. Initialize vendor directory:

    go mod vendor

๐Ÿ’Ž Core Contract Components [100 points]

1. Data Structures [25 points]

// SBT Metadata structure
type NFTMetadata struct {
    Description  string `json:"description"`
    Name         string `json:"name,omitempty"`
    Organization string `json:"organization,omitempty"`
    DateOfIssue  string `json:"dateOfIssue,omitempty"`
}

// Main SBT structure
type SoulboundToken struct {
    Owner    string `json:"owner"`
    TokenID  string `json:"tokenID"`
    Metadata string `json:"metadata"`
}

// Smart Contract structure
type SmartContract struct {
    kalpsdk.Contract
}

2. State Management [25 points]

// State prefixes for organization
const sbtPrefix = "soulboundToken"
const ownerMappingPrefix = "sbtOwnerMapping"

// Composite key creation example
compositeKey, err := sdk.CreateCompositeKey(sbtPrefix, []string{owner, tokenID})

3. Core Functions [50 points]

a. Initialize Contract [15 points]

Challenge Task: Implement the initialization function with the following requirements:

  • Check if contract is already initialized
  • Store metadata in JSON format
  • Set contract state
  • Handle errors appropriately

b. MintSBT Function [20 points]

Challenge Task: Implement token minting with these features:

  • Generate unique TokenID using UUID
  • Validate owner status
  • Store token data
  • Create composite keys

c. QuerySBT Function [15 points]

Challenge Task: Implement query functionality that:

  • Retrieves token details
  • Validates existence
  • Returns formatted data

๐ŸŽฎ Implementation Challenges [150 points]

Challenge 1: Implement Token Management [50 points]

Contract State Initialization

func (s *SmartContract) Initialize(sdk kalpsdk.TransactionContextInterface, description string) error {
    // Your initialization code here
    // Hint: Use the provided metadata structure
}

Tasks:

  • Check contract status
  • Create metadata
  • Store initialization flag
  • Handle errors

Token Creation System

func (s *SmartContract) MintSBT(sdk kalpsdk.TransactionContextInterface, address string) error {
    // Your minting code here
    // Hint: Use UUID for token generation
}

Tasks:

  • Generate token ID
  • Validate address
  • Create token record
  • Update state

Challenge 2: Query System [50 points]

Implement these query functions:

  1. Basic Token Query
func (s *SmartContract) QuerySBT(sdk kalpsdk.TransactionContextInterface, owner string, tokenID string) (*SoulboundToken, error)
  1. Owner-Based Query
func (s *SmartContract) GetTokenMetadata(sdk kalpsdk.TransactionContextInterface, owner string) (*SoulboundToken, error)
  1. Token Listing
func (s *SmartContract) GetAllTokenIDs(sdk kalpsdk.TransactionContextInterface) ([]string, error)

Challenge 3: Advanced Features [50 points]

  1. Transfer Prevention System
func (s *SmartContract) TransferSBT(sdk kalpsdk.TransactionContextInterface, from string, to string, tokenID string) error {
    // Implement transfer prevention
    // Hint: This should always return an error
}
  1. Composite Key Management
// Example composite key creation
mappingKey, err := sdk.CreateCompositeKey(ownerMappingPrefix, []string{address})

๐Ÿ“ Code Quality Guidelines [25 points]

  1. Code Organization

    • Clean file structure
    • Consistent naming
    • Clear documentation
  2. Error Handling

    • Descriptive messages
    • Proper propagation
    • Recovery handling
  3. Documentation

    • Function comments
    • Usage examples
    • State management explanation

๐Ÿ† Success Criteria

To complete Module 1:

  1. โœ… Implement all core functions
  2. โœ… Pass provided test cases
  3. โœ… Follow code guidelines
  4. โœ… Document your code
  5. โœ… Handle errors properly

๐Ÿ“š Resources

  1. Development Tools:

  2. Documentation:

๐ŸŽฏ Next Steps

After completion:

  1. Review your implementation
  2. Document your learnings
  3. Prepare for Module 2
  4. Share your achievements

Good luck with the challenge! ๐Ÿš€

Module 2: Frontend Integration [300 points]

// Example: Mint New Token [100 points]
const mintSBT = async (recipientAddress: string) => {
  try {
    await fetch('https://gateway-api.kalp.studio/v1/contract/kalp/invoke/[CONTRACT_ID]/MintSBT', {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
        'x-api-key': process.env.NEXT_PUBLIC_API_KEY!,
      },
      body: JSON.stringify({
        network: "TESTNET",
        blockchain: "KALP",
        walletAddress: "[YOUR_WALLET]",
        args: {
          address: recipientAddress
        }
      })
    });
  } catch (error) {
    console.error('Error minting SBT:', error);
  }
};

Module 3: Deployment & Testing [400 points]

  1. Smart Contract Deployment [150 points]

  2. Frontend Deployment [150 points]

    npm run build
    npm run dev
  3. Integration Testing [100 points]

Example:๐Ÿ”’ Interact with Smart Contract Using Postman

Prerequisites:

After executing the above setup:

  1. Sign-Up

  2. Deploy-the-smart-contract

  3. postman

After deploying the smart contract in Kalp Studio, an API endpoint will be generated. This API endpoint can be used to interact with the deployed smart contract.

  • Here is an example of a generated API endpoint route in Kalp Studio:

  • Screenshot 2025-01-21 at 2 45 09โ€ฏPM

Click on Check Params, and the routing details and parameters should look like this:

  • Screenshot 2025-01-21 at 2 47 04โ€ฏPM

An API key is required for authorization in API POST requests.

It looks like this in Kalp Studio:

Screenshot 2025-01-21 at 2 49 31โ€ฏPM

Setting Headers in Postman:

  • Set the required headers for authentication:
  1. Key: x-api

  2. Value: Paste the auth key you obtained after API key generation in Kalp Studio.

Screenshot 2025-01-21 at 2 56 08โ€ฏPM

๐ŸŒ Required Resources

Smart Contract Links

API Configuration

  • Contract ID: vHYQcRijQGB3UpVhqc3UeBM2D3ztjPuS1732534432325
  • Default Wallet: ded665bca7d412891f44a571d908b66184b0ee10
  • API Documentation

๐Ÿ† Achievement Unlocking

Beginner Achievements

  • ๐ŸŽฏ Environment Wizard
  • ๐ŸŽฏ Contract Master
  • ๐ŸŽฏ Token Creator

Intermediate Achievements

  • ๐ŸŽฏ Frontend Pioneer
  • ๐ŸŽฏ Integration Specialist
  • ๐ŸŽฏ Testing Guru

Advanced Achievements

  • ๐ŸŽฏ DApp Architect
  • ๐ŸŽฏ Production Master
  • ๐ŸŽฏ Full Stack Developer

๐Ÿ†˜ Support & Community

๐Ÿ“œ Certification Process

  1. Complete all challenge modules
  2. Submit your project for review
  3. Pass the technical assessment
  4. Receive your SBT certification
  5. Join the Kalp Developer Community

๐ŸŽฎ Best Practices

  • โœ… Follow Go programming conventions
  • โœ… Write comprehensive tests
  • โœ… Document your code
  • โœ… Use proper error handling
  • โœ… Implement security best practices

๐Ÿ”œ Next Steps

After completing this challenge:

  1. Explore advanced Kalp features
  2. Contribute to open source projects
  3. Join the developer community
  4. Build your own DApps

Happy Coding! ๐Ÿš€

Get Started | Join Community | View Documentation

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

About

Build Your Own Certification System using Soulbound Tokens

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published