CKB Explorer Web API is a REST API service developed based on Spring Boot, providing data query and operation interfaces for the Nervos CKB blockchain explorer.
CKB Explorer Web API offers comprehensive CKB blockchain data query capabilities, including retrieval and statistical analysis of blocks, transactions, addresses, UDT tokens, and more. This service exposes blockchain data through RESTful interfaces to support frontend applications.
- Backend Framework: Spring Boot 3.2.10
- Programming Language: Java 21
- Build Tool: Maven
- ORM Framework: MyBatis-Plus
- API Documentation: Swagger/OpenAPI 3.0
- Database: RisingWave (for data analysis and statistics)
- Caching: Redis
- Service Communication: Feign
- JDK 21 or higher
- Maven 3.8+ or higher
- Redis 6.0+ (optional, for caching)
- PostgreSQL 14+ database
- RisingWave database
├── src/
│ ├── main/
│ │ ├── java/ # Java source code
│ │ │ └── com/ckb/explorer/ # Main package
│ │ │ ├── controller/ # REST controllers
│ │ │ ├── service/ # Business logic layer
│ │ │ ├── mapper/ # Data access layer
│ │ │ ├── domain/ # Data models
│ │ │ ├── config/ # Configuration classes
│ │ │ └── common/ # Common utilities and constants
│ │ └── resources/ # Configuration files
│ │ ├── application.yml # Main configuration file
│ │ ├── mapper/ # MyBatis mapping files
│ │ └── static/ # Static resources
│ └── test/ # Test code
└── pom.xml # Maven configuration file
The main configuration is located in src/main/resources/application.yml and includes:
- Server configuration (port, context path, etc.)
- SpringDoc/Swagger configuration
- MyBatis-Plus configuration
- Database connection configuration
The project supports multi-environment configuration:
application-testnet.yml: testnet environment configurationapplication-mainnet.yml: Mainnet environment configuration
This project implements basic access control mechanisms:
- Management Interface Protection: Sensitive operations such as resetting statistical tasks require an access token provided through the
X-Auth-Tokenrequest header - Token Configuration: Configure
reset.statistics.passwordinapplication.ymlto set the access token
Note: Always use a strong randomly generated security token in production environments
mvn clean installmvn spring-boot:runchmod +x start.sh
./start.shAfter starting the service, you can access the interactive API documentation at:
http://localhost:8081/api/swagger-ui/index.html
API endpoint documentation URL:
http://localhost:8081/v3/api-docs
- Block Query: Get block details, latest blocks, block lists, etc.
- Transaction Query: Get transaction details, transaction lists, transaction inputs/outputs, etc.
- Address Query: Get address information, balances, transaction history, etc.
- UDT Tokens: UDT token information query, holder distribution, transaction statistics, etc.
- DAO Functionality: DAO depositor query, etc.
- Statistical Analysis: Daily statistical tasks, etc.
Contributions to this project are welcome! If you want to participate in development, please follow these steps:
- Fork this repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License. See the LICENSE file for details.
If you have any questions or suggestions, please contact us through:
- Project Repository: https://github.com/appfi5/ckb-explorer-web.git
- Issues: https://github.com/appfi5/ckb-explorer-web/issues