A Bitcoin Attestation Protocol (BAP) indexer written in Go. Parses and indexes BAP transactions from the Bitcoin SV blockchain.
This project is a blockchain indexer specifically designed for BAP (Bitcoin Attestation Protocol) transactions. It crawls the Bitcoin SV blockchain, processes BAP-related transactions, and maintains an indexed database of identities, attestations, and profiles.
- Real-time blockchain crawling using JungleBus
- BAP transaction processing and indexing using go-bmap
- Identity and attestation management
- Profile data storage and retrieval
- RESTful API endpoints for data access
- State management for reliable indexing
- Support for various image formats (base64, bitfs://, ordfs.network)
- OpenAPI/Swagger documentation
-
Parsers: go-bmap provides parsers
-
Crawler: Processes blockchain data in real-time
- Handles transaction events
- Processes BAP and AIP (Author Identity Protocol) data
- Manages block synchronization
-
Server: Provides HTTP API endpoints
- Identity management
- Profile retrieval
- Attestation verification
- Image handling
-
State Management: Tracks indexer progress
- Uses MongoDB
_state
collection - Allows for indexer rewinding
- Maintains synchronization state
- Uses MongoDB
bap.id
: Stores identity informationbap.attest
: Stores attestationsbap.profile
: Stores profile databap._state
: Tracks indexer state
The indexer can be configured through environment variables:
PORT
: API server port (default: 3000)JUNGLEBUS_ENDPOINT
: JungleBus API endpointFROM_BLOCK
: Starting block height for indexingSUBSCRIPTION_ID
: JungleBus subscription ID
The indexer uses a special MongoDB collection called _state
to track its progress. This collection contains a single document with the structure:
{
"_id": "_state",
"height": <current_block_height>
}
To rewind the indexer to a previous block:
- Access your MongoDB instance
- Update the height in the _state collection:
db.bap._state.updateOne( { "_id": "_state" }, { "$set": { "height": <target_block_height> } } )
- Restart the indexer
The indexer will resume processing from the specified block height.
The API documentation is available in two formats:
https://api.sigmaidentity.com/swagger/
The classic Swagger UI provides:
- Interactive API documentation
- Try-it-out functionality for testing endpoints
- Raw OpenAPI specification viewing
https://api.sigmaidentity.com/docs
Redoc provides a modern, responsive interface with:
- Dark theme by default
- Better readability and organization
- Improved search functionality
- Three-column layout for better navigation
- Automatic code sample generation
Both interfaces use the same OpenAPI specification and provide:
- Complete endpoint documentation
- Request/response schemas
- Authentication requirements
- Example requests and responses
GET /v1/identity
: List identities (paginated)POST /v1/identity/get
: Get identity by IDPOST /v1/identity/getByAddress
: Get identity by addressPOST /v1/identity/history
: Get identity historyPOST /v1/identity/validByAddress
: Validate identity by address
GET /v1/profile
: List profiles (paginated)GET /v1/person/:field/:bapId
: Get specific field from a profile
POST /v1/attestation/get
: Get attestation by hash
- Go 1.21.3 or higher
- MongoDB
- Access to a JungleBus endpoint
go build
./go-bap-indexer
To regenerate the Swagger documentation after making API changes:
swag init -g server/server.go
[Add your license information here]