Skip to content

casibase/chainserver

Repository files navigation

ChainServer

semantic-release docker pull casbin/chainserver GitHub Workflow Status (branch) GitHub Release Docker Image Version (latest semver)

Go Report Card license GitHub issues GitHub stars GitHub forks Discord

ChainServer

A HTTP service wrapper for ChainMaker SDK, designed to work with Casibase without requiring CGO support.

Overview

ChainServer is a lightweight HTTP service that provides a bridge between Casibase and ChainMaker blockchain. Instead of directly integrating ChainMaker SDK (which requires CGO), this service offers HTTP endpoints to interact with ChainMaker blockchain, making it more flexible and easier to deploy.

Features

  • RESTful API interface for ChainMaker operations
  • Easy integration with Casibase
  • No CGO dependency required for client applications

Compatibility Notice

Important:
Currently, ChainServer only supports ChainMaker blockchains with TLS disabled and authtype set to permissionedWithCert. If you encounter errors when invoking transaction or query APIs, please verify that your ChainMaker server configuration meets these requirements.
Additionally, ensure that the provider configuration in your Casibase setup is consistent with your ChainMaker network settings.

For details on how to check and modify your ChainMaker chain configuration, please refer to the official documentation:

If your configuration does not meet the above requirements, the service may not function as expected.

Technical Stack

  • Go 1.22+
  • Beego Framework
  • ChainMaker SDK v2.2.0

Configuration

The server runs on port 13900 by default. You can modify the port in the configuration file.

API Endpoints

The service provides HTTP endpoints for ChainMaker operations. Detailed API documentation will be provided separately.

Docker Deployment Guide

The recommended way to deploy is to use the official image from Docker Hub:

docker run -d --name chainserver -p 13900:13900 casbin/chainserver:latest

Alternatively, you can use Docker Compose (recommended for production or multi-container setups):

docker-compose up -d

You can also build the image locally if you want to use your own changes:

docker build -t chainserver .
docker run -d --name chainserver -p 13900:13900 chainserver

The default service port is 13900. For troubleshooting or advanced usage, see the Dockerfile and build.sh, or open an issue if you encounter problems.

API Documentation (Swagger)

See: https://chainserver.casibase.com/swagger/index.html

Building and Running

  1. Install Go 1.22 or later
  2. Clone the repository
git clone https://github.com/casibase/chainserver.git
  1. Install dependencies
go mod tidy
  1. Run the server
go run main.go

License

Apache-2.0

Related Projects