Building with SettleMint/Hyperledger Fabric Guide

Setup code studio

Guide to setup Code Studio IDE to develop and deploy chaincodes and sub-graphs

Summary

To start developing and deploying chaincodes on the SettleMint platform, you’ll first need to add Code Studio to your application. This provides you with a full-featured web-based IDE, pre-configured for blockchain development. Once added, you can use built-in tasks to build, test and deploy chaincodes, all within the same environment.


You can add Code Studio through the Platform UI by selecting it as a dev tool and linking it with a chaincode set and a template. Alternatively, you can use the SDK CLI or SDK JS to programmatically create and manage chaincode sets. These interfaces give you flexibility depending on whether you’re working from the console or integrating via scripts or automation.


After setup, you’ll be able to customize your chaincodes directly within the IDE. A task manager will guide you through building and deploying them to local or SettleMint-hosted blockchain networks.


To speed up development, SettleMint offers a rich library of open-source chaincode templates. These templates can be modified, extended, or used as-is, and you also have the option to create and manage custom templates within your consortium for reuse across projects.


How to setup code studio and deploy chaincode on SettleMint platform

Code Studio is SettleMint’s fully integrated, web-based IDE built specifically for blockchain development. It provides developers with a familiar Visual Studio Code experience directly in the browser, pre-configured with essential tools. Code Studio enables seamless development, testing, deployment, and indexing of chaincodes and subgraphs, all within a unified environment.

It eliminates the need for complex local setups, simplifies DevOps workflows, and reduces time-to-market by combining infrastructure, templates, and automation under one interface. By offering pre-built tasks, contract templates, and GitHub integration, it solves the traditional challenges of fragmented tooling, inconsistent environments, and steep setup requirements for web3 development.

Add Code Studio

Despite offering full configurability, Code Studio includes all essential dependencies pre-installed, saving time and avoiding setup friction. It supports extensions for formatting, linting, testing, and AI-assisted development, mirroring the convenience of a local VS Code setup. Every component, from contracts to testing and subgraph development is wired into a well-structured, maintainable codebase that is continuously updated and thoroughly tested to align with the latest development standards. This makes it ideal for both rapid prototyping and production-grade blockchain applications.

Fabric Chaincode IDE

Smart contract sets allow you to incorporate business logic into your application by deploying chaincodes that run on the blockchain. You can add a chaincode set via different methods as part of your development workflow.

Fabric IDE project structure

The Fabric IDE project structure in Code Studio is tailored to support robust development and lifecycle management of Hyperledger Fabric chaincode. It includes all necessary files for building, deploying, and managing chaincode with automation support, organized in a modular and maintainable layout.

Folder / FileDescription
lib/btp-chaincode-lifecycle/Contains shell scripts and helper logic to automate the Fabric chaincode lifecycle (e.g., install, approve, commit).
├─ chaincode.shShell script to execute full chaincode lifecycle steps such as packaging, installing, and committing.
├─ utils.shUtility shell functions used within lifecycle scripts for reusability and simplification.
├─ README.mdDocumentation for using the lifecycle management tools provided in this library.
src/Contains the TypeScript source code for your chaincode logic. Each file typically represents a chaincode or asset handler.
├─ asset.tsDefines the asset structure and related helper functions.
├─ assetTransfer.tsImplements the core logic for asset transfer operations (e.g., create, read, update, delete).
├─ index.tsEntry point of the chaincode; registers the contracts to be used by the Fabric runtime.
.envEnvironment configuration file for local or platform-specific variables (e.g., peer addresses, identities).
.eslintrc.jsLinting configuration for enforcing code quality and style in the TypeScript codebase.
.gitignoreSpecifies intentionally untracked files to ignore in version control.
.gitmodulesReferences Git submodules (if any) used in the project.
index.d.tsType declaration file for shared interfaces or types used across the project.
LICENSEOpen-source license governing use and distribution of the project.
npm-shrinkwrap.jsonLocked npm dependency versions to ensure deterministic builds.
package.jsonDeclares project metadata, dependencies, and npm scripts (e.g., lint, test, build).
bun.lockLock file used by Bun (alternative JavaScript runtime) to freeze dependency versions.
README.mdProject-level documentation outlining setup, commands, and usage for developers.
tsconfig.jsonTypeScript compiler configuration, defining how the chaincode is transpiled to JavaScript.
node_modules/Automatically generated directory containing all installed npm dependencies.

Code studio task manager for fabric

The Code Studio Task Manager for Hyperledger Fabric provides a curated set of tasks to manage the full chaincode lifecycle, perform channel operations, and view network configuration , all without needing to manually run CLI commands. These tasks are pre-wired into the Fabric project template and are executable from within the IDE interface.

Chaincode lifecycle tasks

Task NameDescription
chaincode lifecycle - 1. packagePackages the chaincode source into a compressed archive for deployment.
chaincode lifecycle - 2. deployInstalls the packaged chaincode on the target peer.
chaincode lifecycle - 3. approveApproves the chaincode definition for the organization.
chaincode lifecycle - 4. check commit readinessChecks if all required organizations have approved the chaincode.
chaincode lifecycle - 5. commitCommits the chaincode definition to the channel.
chaincode lifecycle - 6. initInitializes the chaincode after commit (if required).

Chaincode interactions

Task NameDescription
chaincode - invokeExecutes a transaction on the deployed chaincode.
chaincode - queryReads data from the ledger using the chaincode query function.

Channel operations

Task NameDescription
channel - createCreates a new Fabric channel.
channel - orderer joinAdds an orderer to the specified channel.
channel - orderer leaveRemoves an orderer from the channel.
channel - peer joinAdds a peer node to the specified channel.
channel - peer leaveRemoves a peer node from the channel.

Listing & query utilities

Task NameDescription
list - approved chaincodeLists chaincode definitions approved by the organization.
list - committed chaincodeLists chaincodes that have been committed to the channel.
list - deployed chaincodeLists deployed chaincode instances on the network.
list - channels - ordererLists channels associated with the orderer.
list - channels - peerLists channels associated with a specific peer.
list - nodesDisplays all nodes in the current environment.
list - orderersLists all orderer nodes available.
list - peersLists all peer nodes available in the network.

Build & test tasks

Task NameDescription
build packageCompiles the chaincode package.
build workspaceBuilds the full workspace and all its dependencies.
test packageExecutes tests for the chaincode package.
test workspaceRuns all available tests in the workspace.

Customize chaincodes

You can customize your chaincodes using the built-in IDE. The smart contract sets include a Generative AI plugin to assist with development. Learn more about the AI plugin here.

Chaincode template library

SettleMint's chaincode templates serve as open-source, ready-to-use foundations for blockchain application development, significantly accelerating the deployment process. These templates enable users to quickly customize and extend their blockchain applications, leveraging tested and community-enhanced frameworks to reduce development time and accelerate market entry.

Open-source chaincode templates under the mit license

Benefit from the expertise of the blockchain community and trust in the reliability of your chaincodes. These templates are vetted and used by major enterprises and institutions, ensuring enhanced security and confidence in your deployments.

Chaincode template library

The programming language used depends on the target protocol:

  • TypeScript or Go for Hyperledger Fabric
TemplateDescription
Empty typescriptBasic TypeScript chaincode for Hyperledger Fabric with no business logic.
Empty typescript with PDCEmpty TypeScript template with support for private data collections in Fabric.
Empty goMinimal Go chaincode scaffold for Hyperledger Fabric.

Create your own chaincode templates for your consortium

Within the self-managed Blockchain SettlMint platform, you can create and add your own templates for use within your consortium. This fosters a collaborative environment where templates can be reused and built upon, promoting innovation and efficiency within your network.

To get started, visit: SettleMint GitHub Repository


Congratulations.!!

You have succesfully deployed the code studio. From here you can proceed for development and deployment of chaincodes.