ChainServer
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
- Install Go 1.22 or later
- Clone the repository
git clone https://github.com/casibase/chainserver.git
- Install dependencies
go mod tidy
- Run the server
go run main.go
License
Apache-2.0