[search-in-place-form in_current_page="1"]
[search-in-place-form in_current_page="1"]

Target Audience

The primary users of Kalp SDK are software developers and blockchain engineers. It also includes the System integrators, Research and academic communities, Enterprise application developers and student development community in Blockchain domain.

Key Value Proposition

Kalp SDK is a set of tools and libraries that helps developers build applications that can interact with a KALP blockchain network. It essentially acts as a middleman between your application and the blockchain, providing a simplified way to communicate and perform actions on the network.

  • Language: It supports Golang.
  • Simplified APIs: The SDK provides a clean and easy-to-use API that abstracts away the complexities of the underlying blockchain protocol. This lets developers focus on the application logic without getting bogged down in technical details.
  • Key functionalities: With the SDK, developers can perform various tasks on the blockchain network, including:

    a. Submitting transactions to update the ledger state.
    b. Querying the ledger to retrieve specific data.
    c. Managing channels and user identities within the network.
    d. Subscribing to events happening on the blockchain.

 

Overall, It empowers developers to leverage the power of Kalp DLT in their applications.

Introduction

Welcome to the documentation for the Kalp Software Development Kit (SDK). This SDK provides developers with the tools and libraries to interact with Kalptantra Blockchain, a popular permissioned blockchain ecosystem.

This documentation will guide you through the process of setting up the Kalp SDK, configuring it to connect to a Kalptantra network, and performing various operations on the network.

Overview

The KALP SDK is a comprehensive Golang package specifically designed to simplify the Smart contract development process on the Kalptantra blockchain network. It empowers developers to write and create compliant (Kalptantra acceptable) chaincode (or smart contracts). It provides a set of powerful APIs that streamline interaction with the network and offer a range of functionalities that enhance the overall development experience.

The Kalp SDK is a powerful tool that simplifies the development of applications interacting with KALP blockchain networks. It offers a higher-level abstraction over the underlying complexities, allowing developers to focus on application logic rather than intricate blockchain interactions.

Core functionalities include managing the lifecycle of transactions, handling user identities and permissions, interacting with the ledger, and subscribing to blockchain events.
The SDK plays a crucial role in constructing transactions, submitting them to the network, and managing communication with network components. It also facilitates querying data from the ledger and responding to blockchain events in real-time.

By abstracting away blockchain intricacies, the SDK accelerates development, enhances security through robust identity management, and ensures reliability with its transaction handling mechanisms. Its flexibility, supported by multiple languages and deployment environments, makes it a versatile choice for a wide range of blockchain applications.

Whether you’re building supply chain solutions, financial applications, or healthcare systems, the KALP SDK provides a solid foundation for your blockchain-based projects.

Key Features

The Kalp SDK offers a range of key features that simplify application development on the Kalptantra blockchain network.
These are the following key features of Kalp SDK:

Data Read and Write

The Kalp SDK provides functions to read and write data to the Kalptantra blockchain network. Developers can store and retrieve key-value pairs in the ledger using functions such as PutStateWithKYC, PutStateWithoutKYC, and GetState. This enables seamless integration of data storage and retrieval within smart contracts.

Transaction Management

With the Kalp SDK, developers can efficiently manage transactions on the blockchain network. It provides functions for submitting transactions, querying transaction information, and retrieving transaction history. This simplifies the process of interacting with the blockchain and ensures the integrity of transactional operations.

KYC Checks

The SDK includes built-in functionality for performing Know Your Customer (KYC) checks. Developers can leverage the GetKYC function to verify if a user has completed the KYC process on the network. This feature enhances the security and compliance of applications built on the Kalptantra network.

Logger functionality

The Kalp SDK provides a Logger support as well. You can create a Logger object which will give you better visibility of the kalpsdk operations.

Payment Tracking for Payable Contracts

The Kalp SDK supports payment tracking for Payable contracts. Developers can easily track payments made for Payable contracts and retrieve payment information using the provided functions. This simplifies the implementation of payment-related functionality within smart contracts, enabling the development of decentralized applications with payment capabilities.

Understand KALP Chain: The Next Generation Blockchain

Multi-Language VM Support

Developers can leverage multiple programming languages within our virtual machine, enhancing flexibility and ease of use.

Efficient Scheduling

Our intelligent scheduling system optimizes resource allocation and transaction processing, maximizing throughput.

Regulatory Compliance

Built with regulatory frameworks in mind, Kalp Chain ensures adherence to the highest standards of compliance.

Note: The specific function names mentioned in the description are for illustrative purposes. The actual function names may vary based on the implementation and version of the Kalp SDK.

By incorporating these key features, the Kalp SDK empowers developers to build robust and efficient decentralized applications on the Kalptantra blockchain network. It abstracts away the complexities of low-level blockchain operations, allowing developers to focus on core application logic and providing a seamless development experience.

Benefits of Kalp SDK

These are the following benefits of using Kalp SDK for smart contract creation:

Smart Contract Development

With the Kalp SDK, developers can write and create Kalptantra blockchain-acceptable chaincode, which forms the core logic of smart contracts on the network. It provides a set of powerful APIs and utilities that facilitate the development, testing, and deployment of smart contracts. Developers can easily define the contract’s structure, define transaction functions, manage the state, and handle events.

Simplified Data Management

The Kalp SDK simplifies data management on the Kalptantra blockchain network by providing convenient functions for reading and writing data. Developers can easily store and retrieve key-value pairs in the ledger, reducing the complexity of data handling within smart contracts.

Enhanced Security and Compliance

The built-in KYC check functionality of the Kalp SDK helps enforce security and compliance standards on the network. Developers can verify if users have completed the KYC process, enabling the development of applications that adhere to regulatory requirements and maintain a trusted environment.

Seamless Payment Tracking

The Kalp SDK’s support for payment tracking in Payable contracts simplifies the integration of payment capabilities into decentralized applications. Developers can easily track and retrieve payment information, enabling the creation of applications that facilitate secure and efficient transactions on the network.

Efficient Transaction Handling

The SDK’s transaction management capabilities streamline the process of submitting and querying transactions on the blockchain network. Developers can handle transactions with ease, ensuring the integrity and consistency of their applications’ operations.

Reliable Testing and Debugging

The SDK’s testing and debugging tools contribute to the reliability and stability of developed applications. Developers can validate and troubleshoot their chaincode in a simulated blockchain environment, ensuring that issues are identified and resolved before deploying to the live network.

Enhanced Development Experience

Developers using the Kalp SDK benefit from a streamlined development experience. The SDK offers features which enhance productivity and reduce development time. It also provides extensive documentation, examples, and tutorials to help developers get started quickly and efficiently.

Method Description

Read Transactions

S No.

Method Name

Description

1

GetChannel Name

GetChannelName retrieves the name of the channel associated with the transaction context. It returns the channel name as a string and an error if the channel ID is empty or retrieval fails.

2

GetChannelID

GetChannelID returns the channel the proposal is sent to for chaincode to process. This would be the channel_id of the transaction proposal

3

GetKYC

GetKYC checks if a user has completed KYC on our network by invoking the KycExists function on the kyc chaincode for the given user ID in the universalkyc channel.

4

GetUserID

GetUserID retrieves the name of the minter from the CA certificate embedded in the client identity. It returns the user ID extracted from the client identity and an error if there was a failure in reading or extracting the user ID..

5

GetState

GetState retrieves the value of the specified key from the ledger. If the key does not exist in the state database, the function returns (nil, nil) indicating the absence of the key in the ledger.

6

SetEvent

SetEvent allows the chaincode to set an event on the response to the proposal to be included as part of a transaction. The event will be available within the transaction in the committed block regardless of the validity of the transaction.

Only a single event can be included in a transaction, and must originate from the outer-most invoked chaincode in chaincode-to-chaincode scenarios. The marshaled Chaincode Event will be available in the transaction's ChaincodeAction. events field.

7

GetTxID

GetTxID returns the transaction ID of the transaction proposal. The transaction ID is unique per transaction and per client. It can be used to uniquely identify and track a specific transaction within the blockchain network.

8

GetStateBy Partial Composite Key

GetStateByPartial CompositeKey queries the state in the ledger based on a given partial composite key. This function returns an iterator which can be used to iterate over all composite keys whose prefix matches the given partial composite key. However, if the number of matching composite keys is greater than the totalQueryLimit (defined in core.yaml), this iterator cannot be used to fetch all matching keys, and the results will be limited by the totalQueryLimit.

9

GetStateBy Range

GetStateByRange returns a range iterator over a set of keys in the ledger. The iterator can be used to iterate over all keys between the startKey (inclusive) and endKey (exclusive).

10

TotalQuery LImit

However, if the number of keys between startKey and endKey is greater than the totalQueryLimit (defined in core.yaml), this iterator cannot be used to fetch all keys, and the results will be capped by the totalQueryLimit. The keys are returned by the iterator in lexical order. Note that startKey and endKey can be an empty string, which implies an unbounded range query on the start or end.

The query is NOT re-executed during the validation phase, and phantom reads are not detected. This means that other committed transactions may have added, updated, or removed keys that impact the result set, but this would not be detected at validation/commit time.

Applications that are susceptible to this should avoid using GetQueryResult as part of transactions that update the ledger, and should limit its use to read-only chaincode operations.

11

GetQuery Result

GetQueryResult performs a "rich" query against a state database that supports rich query, such as CouchDB. The query string is provided in the native syntax of the underlying state database. An iterator is returned, which can be used to iterate over all keys in the query result set.

12

InvokeChain code

InvokeChaincode locally calls the specified chaincode Invoke using the same transaction context. It allows one chaincode to invoke another chaincode within the same transaction. If the called chaincode is on the same channel as the calling chaincode, the called chaincode's read set and write set are added to the calling transaction.

13

Create Composite Key

CreateCompositeKey combines the given attributes to form a composite key. The object Type and attributes are expected to have only valid utf8 strings and should not contain U+0000 (nil byte) and U+10FFFF (biggest and unallocated code point).

14

Split Composite Key

SplitCompositeKey splits the specified key into attributes on which the composite key was formed. Composite keys found during range queries or partial composite key queries can therefore be split into their composite parts.

15

GetStateBy Partial Composite Key

It queries the state in the ledger based on a given partial composite key. This function returns an iterator which can be used to iterate over all composite keys whose prefix matches the given partial composite key.

16

GetClient Identity

It represents information about the identity that submitted the transaction.

17

GetClient Identity

It returns the timestamp when the transaction was created. The timestamp is extracted from the transaction's ChannelHeader, which ensures that it indicates the client's timestamp and has the same value across all endorsers.

18

GetFunction And Parameters

It returns the function name and parameters extracted from the transaction proposal. The first argument in the transaction proposal is considered as the function name, while the rest of the arguments are treated as parameters and returned as a string array.

Write Transactions

S No.

Method Name

Description

1

PutKYC

PutKYC records the KYC information associated with a user. It invokes the "kyc" chaincode with the specified parameters to create a KYC record. This function should only be used by administrators to create KYC records. It invokes the "kyc" chaincode with the specified parameters using the "universalkyc" chaincode name.

2

PutState With KYC

IT puts the specified key and value into the transaction's writeset as a data-write proposal, only if the user has completed KYC. If the user has not completed KYC, an error is returned. The data is not immediately written to the ledger, but instead, it becomes part of the transaction proposal and will be committed if the transaction is validated successfully.

3

PutState Without KYC

It puts the specified key and value into the transaction's writeset as a data-write proposal without requiring KYC verification. The data is not immediately written to the ledger, but instead, it becomes part of the transaction proposal and will be committed if the transaction is validated successfully.

This function does not enforce KYC restrictions, allowing any user to write data to the ledger without completing KYC.

Use this function with caution as it may bypass security and compliance measures. It is recommended to use PutStateWithKYC instead, which enforces KYC restrictions and provides an additional layer of security.

4

InvokeChain code

It locally calls the specified chaincode Invoke using the same transaction context. It allows one chaincode to invoke another chaincode within the same transaction.

If the called chaincode is on the same channel as the calling chaincode, the called chaincode's read set and write set are added to the calling transaction.

If the called chaincode is on a different channel, only the response from the called chaincode is returned to the calling chaincode. Any state changes made by the called chaincode will not affect the ledger. Essentially, the called chaincode on a different channel acts like a Query, and its read set and write set are not applied during the state validation checks in the subsequent commit phase. Only the calling chaincode's read set and write set are applied to the transaction.

5

DelState Without KYC

It records the specified key to be deleted in the writeset of the transaction proposal. The key and its value will be deleted from the ledger when the transaction is validated and successfully committed. This function does not require KYC verification, allowing any user to delete data from the ledger without KYC restrictions

Use this function with caution as it may bypass security and compliance measures. It is recommended to use DelStateWithKYC instead, which enforces KYC restrictions and provides an additional layer of security.

6

DelStateWith KYC

It records the specified key to be deleted in the writeset of the transaction proposal. The key and its value will be deleted from the ledger when the transaction is validated and successfully committed. It requires the user to have completed the KYC process before deleting the state.

This ensures that only authorized users can delete data from the ledger, providing an additional layer of security and compliance.

Validate Transactions

S No.

Method Name

Description

1

ValidateCreate Token Transaction

It checks if the contract has been initialized, if the operator is authorized to create the token, and if the token with the given ID and document type is already minted. Returns an error if any of the checks fail, or nil if the transaction is valid.

2

IsMinted

It checks whether a token with the specified ID and document type is already minted or not. Returns true if minted, false otherwise.

Description of SDK

The KALP SDK acts as a software development kit (SDK), essentially a toolkit that simplifies your interaction with a KALP network. Imagine it as a translator between your application and the complex world of blockchain. Here’s a breakdown of what the SDK does:

  • Provides a User-Friendly Interface: It offers a set of functions that developers can use in programming language to perform actions on the blockchain. This saves time from writing complex code to interact directly with the network protocols.
  • Handles Communication: The SDK takes care of all the communication between your smart contract and the blockchain network. It sends transaction proposals, retrieves data, and manages user identities, shielding you from the underlying technical details.
  • Manages Transactions: The SDK helps you construct transactions, which are essentially requests to update the blockchain. It collects necessary information, gets approvals from relevant parties, and submits the transaction to the network for processing.
  • Secures Your Application: The SDK handles user identities and access control. It ensures only authorized users can perform actions on the blockchain, keeping your application secure.

 

By using the SDK, you can focus on building the core logic of your application without getting bogged down in the intricacies of blockchain technology. It streamlines the development process and makes it easier to create secure and efficient blockchain applications.

Analogy

Imagine you want to order a meal at a fancy restaurant with a complex menu. The waiter (SDK) acts as your guide, deciphering the menu (blockchain functionalities), taking your order (constructing transactions), and ensuring everything is delivered smoothly (secure communication and transaction processing).

For Internal User Only

  • Design: It Kalp-SDK is basically a Golang wrapper package around shim and contractapi modules. Below mentioned is diagram which shows where Kalp-SDK fits in Kalptantra Blockchain.
  • Technology Stack: Hyperledger Fabric, Hyperledger contractapi, GoLang is used to build Kalp-SDK.

Conclusion

Kalp SDK empowers developers to build secure and feature-rich decentralized applications on the Kalptantra blockchain network. It simplifies the development process by providing a comprehensive set of tools and libraries. These tools abstract away the complexities of interacting with the blockchain at a low level. Developers benefit from features like simplified smart contract development, efficient data management, enhanced security, seamless payment tracking, and more. Kalp SDK also offers robust testing and debugging tools and an overall user-friendly experience, ultimately reducing development time and effort. With Kalp SDK, developers can focus on building innovative applications that leverage the power of the Kalptantra blockchain network.

Ready to revolutionize your blockchain experience?

Contact us today to learn how KALP Chain Infrastructure can
transform your operations

Was this page helpful?

© Copyright 2024. All rights reserved.