A high-performance blockchain inscription indexer for MetaID protocol, supporting Bitcoin, Dogecoin, and MicroVision Chain (MVC).
man-indexer-v2 is a multi-chain blockchain indexer designed specifically for the MetaID protocol. It efficiently indexes and queries inscription data (PINs) across multiple blockchain networks, providing RESTful API access for developers and applications.
- π Multi-Chain Support: Bitcoin (BTC), Dogecoin (DOGE), and MicroVision Chain (MVC)
- β‘ High Performance: Built on PebbleDB for optimized read/write operations
- π Real-Time Monitoring: ZMQ-based live transaction streaming
- π Comprehensive Indexing: Complete PIN inscription tracking and transfer history
- π RESTful API: Easy-to-use HTTP endpoints for data queries
- π― Protocol Support: Native MRC20 token transfers and MetaID operations
- π Network Flexibility: Mainnet, Testnet, and Regtest support for all chains
| Blockchain | Status | Networks | Inscription Format |
|---|---|---|---|
| Bitcoin (BTC) | β Stable | Mainnet, Testnet, Regtest | SegWit Witness (P2WSH/Taproot) |
| Dogecoin (DOGE) | β Stable | Mainnet, Testnet, Regtest | P2SH ScriptSig |
| MicroVision Chain (MVC) | β Stable | Mainnet | Custom Format |
The latest version includes comprehensive Dogecoin blockchain support with unique adaptations:
- β P2SH Inscription Parsing: Extracts inscriptions from Pay-to-Script-Hash scripts
- β MetaID-CLI Compatible: Fully compatible with metaid-cli Dogecoin inscription format
- β Multi-Network: Supports Mainnet, Testnet, and Regtest environments
- β ZMQ Integration: Real-time transaction monitoring via ZeroMQ
- β MRC20 Support: Native token transfer tracking
- β Complete Transfer Tracking: Full PIN ownership and transfer history
# Using the quick start script (recommended)
./start_doge_indexer.sh
# Manual start
./manindexer -chain doge -config config_doge.toml
# Multi-chain indexing
./manindexer -chain btc,doge -config config.tomlFor detailed Dogecoin setup and usage, see: Dogecoin Adapter Guide
- Go 1.20+: Required for compilation
- Docker (optional): For running blockchain nodes
- Blockchain Node: Access to RPC endpoints for each chain you want to index
# Clone the repository
git clone https://github.com/metaid-developers/man-indexer-v2.git
cd man-indexer-v2
# Build the binary
go build -o manindexer
# Verify installation
./manindexer --helpmake build # Build the binary
make test # Run tests
make clean # Clean build artifactsCreate a config.toml file with your blockchain settings:
# Protocol identifier (hex encoded "metaid")
protocolID = "6d6574616964"
# Bitcoin Configuration
[btc]
initialHeight = 844446 # Starting block height
rpcHost = "127.0.0.1:8332" # Bitcoin Core RPC endpoint
rpcUser = "bitcoin" # RPC username
rpcPass = "password" # RPC password
rpcHttpPostMode = true
rpcDisableTLS = true
zmqHost = "tcp://127.0.0.1:28332" # ZMQ endpoint for real-time updates
popCutNum = 21 # Proof-of-Publication cut number
# MicroVision Chain Configuration
[mvc]
initialHeight = 86500
rpcHost = "127.0.0.1:9882"
rpcUser = "mvc"
rpcPass = "password"
rpcHttpPostMode = true
rpcDisableTLS = true
zmqHost = "tcp://127.0.0.1:28882"
popCutNum = 21
# Dogecoin Configuration
[doge]
initialHeight = 0 # Start from genesis (or specify height)
rpcHost = "127.0.0.1:22555" # Dogecoin Core RPC endpoint
rpcUser = "dogecoin"
rpcPass = "password"
rpcHttpPostMode = true
rpcDisableTLS = true
zmqHost = "tcp://127.0.0.1:28555"
popCutNum = 21
# Database Configuration (PebbleDB)
[pebble]
dir = "./man_base_data_pebble" # Data storage directory
num = 10 # Number of shards for optimization
# Web API Configuration
[web]
port = "8080" # API server port
host = "localhost" # API server host
pemFile = "" # TLS certificate (optional)
keyFile = "" # TLS key (optional)- initialHeight: Block height to start indexing from. Set to 0 to index from genesis (may take significant time)
- rpcHost: Blockchain node RPC endpoint (ensure node is fully synced)
- zmqHost: ZeroMQ endpoint for real-time transaction broadcasting
- popCutNum: Proof-of-Publication parameter for MetaID protocol
- num: Database sharding level (higher = better performance, more disk usage)
# Index Bitcoin mainnet
./manindexer -chain btc -config config.toml
# Index Dogecoin mainnet
./manindexer -chain doge -config config.toml
# Index MVC
./manindexer -chain mvc -config config.toml# Index all three chains simultaneously
./manindexer -chain btc,mvc,doge -config config.toml
# Bitcoin + Dogecoin only
./manindexer -chain btc,doge -config config.toml# Mainnet (default)
./manindexer -chain btc -config config.toml
# Testnet
./manindexer -chain btc -test 1 -config config.toml
# Regtest (local testing)
./manindexer -chain btc -test 2 -config config.tomlUsage: ./manindexer [OPTIONS]
Core Options:
-chain string Blockchain type: btc, mvc, doge (comma-separated for multiple)
-config string Path to configuration file (default: config.toml)
-database string Database type: pebble (default: pebble)
-test string Network mode: 0=mainnet, 1=testnet, 2=regtest (default: 0)
-server string Start Web API server: 1=enable, 0=disable (default: 1)
Bitcoin-Specific Options:
-btc_height int Starting block height for Bitcoin
-btc_rpc_host string Bitcoin RPC endpoint
-btc_rpc_user string Bitcoin RPC username
-btc_rpc_password string Bitcoin RPC password
-btc_zmqpubrawtx string Bitcoin ZMQ endpoint
Dogecoin-Specific Options:
-doge_height int Starting block height for Dogecoin
-doge_rpc_host string Dogecoin RPC endpoint
-doge_rpc_user string Dogecoin RPC username
-doge_rpc_password string Dogecoin RPC password
-doge_zmqpubrawtx string Dogecoin ZMQ endpoint
MVC-Specific Options:
-mvc_height int Starting block height for MVC
-mvc_rpc_host string MVC RPC endpoint
-mvc_rpc_user string MVC RPC username
-mvc_rpc_password string MVC RPC password
-mvc_zmqpubrawtx string MVC ZMQ endpoint# Start with custom configuration
./manindexer -chain doge -config config_doge.toml -server 1
# Override RPC settings via command line
./manindexer \
-chain doge \
-test 2 \
-doge_rpc_host 127.0.0.1:18332 \
-doge_rpc_user regtest \
-doge_rpc_password regtest \
-doge_zmqpubrawtx tcp://127.0.0.1:18444
# Multi-chain with specific starting heights
./manindexer \
-chain btc,doge \
-btc_height 850000 \
-doge_height 5000000 \
-config config.tomlThe indexer automatically starts a RESTful API server (default port: 8080) for querying indexed data.
GET /api/block/{chain}/{height}Parameters:
chain: Blockchain identifier (btc, doge, mvc)height: Block height number
Response:
{
"height": 850000,
"hash": "00000000000000000002...",
"timestamp": 1705849200,
"txCount": 2543
}POST /api/pins/{chain}
Content-Type: application/json
{
"path": "/test",
"cursor": "",
"size": 20
}Parameters:
chain: Blockchain identifierpath: MetaID path filtercursor: Pagination cursor (empty for first page)size: Number of results (max: 100)
Response:
{
"code": 200,
"data": {
"list": [
{
"id": "abc123...",
"path": "/test",
"content": "Hello World",
"contentType": "text/plain",
"creator": "1A1zP1eP5QGefi...",
"timestamp": 1705849200
}
],
"total": 150,
"nextCursor": "xyz789..."
}
}GET /api/address/{chain}/{address}?size=20&cursor=Parameters:
chain: Blockchain identifieraddress: Blockchain addresssize: Results per page (optional, default: 20)cursor: Pagination cursor (optional)
GET /api/pin/{chain}/{pinId}Parameters:
chain: Blockchain identifierpinId: PIN inscription identifier
Response:
{
"id": "abc123...",
"txid": "def456...",
"output": "def456...:0",
"path": "/profile/name",
"content": "MetaID User",
"contentType": "text/plain",
"contentLength": 12,
"creator": "1A1zP1eP5QGefi...",
"owner": "1A1zP1eP5QGefi...",
"genesisHeight": 850000,
"timestamp": 1705849200,
"pop": "abc123...",
"popLv": 3
}GET /api/count- Get indexer statistics (total pins, blocks, metaids)GET /api/metaid/{metaidRoot}- Query by MetaID rootGET /api/path/{chain}/{path}- Get all pins for a specific pathPOST /api/transfers/{chain}- Query PIN transfer historyGET /content/{pinId}- Get raw content data for a PINGET /api/blockfile?chain={chain}&height={height}- Download block data file
For complete API documentation, visit /swagger after starting the server (if Swagger UI is enabled).
man-indexer-v2/
βββ adapter/ # Blockchain adapters
β βββ bitcoin/ # Bitcoin adapter implementation
β β βββ bitcoin.go # Chain interface
β β βββ indexer.go # Indexer implementation
β β βββ zmq.go # ZMQ handler
β βββ dogecoin/ # Dogecoin adapter implementation
β β βββ dogecoin.go # Chain interface
β β βββ indexer.go # P2SH inscription parser
β β βββ params.go # Network parameters
β β βββ zmq.go # ZMQ handler
β βββ microvisionchain/ # MVC adapter implementation
β β βββ mvc.go # Chain interface
β β βββ indexer.go # Indexer implementation
β β βββ zmq.go # ZMQ handler
β βββ chain.go # Chain interface definition
β βββ indexer.go # Indexer interface definition
β βββ metaid.go # MetaID protocol handlers
βββ api/ # RESTful API server
β βββ webapi.go # Web UI endpoints
β βββ btc_jsonapi.go # JSON API endpoints
β βββ respond/ # Response helpers
βββ common/ # Shared utilities
β βββ config.go # Configuration management
β βββ tools.go # Helper functions
β βββ id_coins.go # Chain ID mappings
β βββ pop.go # Proof-of-Publication
βββ docs/ # API documentation
β βββ swagger.json # Swagger/OpenAPI spec
β βββ swagger.yaml
βββ idaddress/ # ID address conversion
β βββ converter.go # Address converter
β βββ test_mvc.sh # MVC testing script
β βββ cmd/ # Command-line tools
βββ man/ # Core indexer logic
β βββ man.go # Main indexer orchestrator
β βββ indexer_pebble.go # PebbleDB indexer
β βββ blockfile.go # Block file management
β βββ mempool.go # Mempool monitoring
β βββ man_function.go # Helper functions
βββ mrc20/ # MRC20 token support
β βββ mrc20.go # Token operations
β βββ util.go # Utilities
βββ pebblestore/ # PebbleDB storage layer
β βββ store.go # Core storage operations
β βββ data.go # Data models
β βββ creatordb.go # Creator indexing
β βββ pincount.go # Statistics
βββ pin/ # PIN data structures
β βββ pin.go # PIN model
β βββ pop.go # Proof-of-Publication
β βββ validator.go # Data validation
β βββ blockfile.proto # Protocol buffers
βββ tools/ # Development tools
β βββ parse_doge_tx.go # Dogecoin transaction parser
βββ web/ # Web UI assets
β βββ static/ # Static files (CSS, JS)
β βββ template/ # HTML templates
βββ app.go # Application entry point
βββ config.toml # Main configuration file
βββ config_doge.toml # Dogecoin-specific config
βββ config_regtest.toml # Regtest configuration
βββ go.mod # Go module dependencies
βββ Makefile # Build automation
βββ Dockerfile # Container image
βββ README.md # This file
To add support for a new blockchain:
- Create Adapter Package: In
adapter/, create a new directory for your chain - Implement Interfaces: Implement both
ChainandIndexerinterfaces - Add Configuration: Update
common/config.gowith chain-specific config - Register Adapter: Add initialization in
man/man.goInitAdapter() - Add Network Params: Define network parameters (magic bytes, address prefixes, etc.)
- Implement Inscription Parser: Parse chain-specific inscription formats
- Add ZMQ Support: Implement real-time transaction monitoring
- Test Thoroughly: Create test cases for all inscription types
Reference the Dogecoin adapter implementation as a complete example.
# Run all tests
make test
# Run specific package tests
go test ./adapter/dogecoin/...
go test ./man/...
go test ./pebblestore/...
# Run with coverage
go test -cover ./...
# Generate coverage report
go test -coverprofile=coverage.out ./...
go tool cover -html=coverage.out# 1. Start a regtest blockchain node (example: Dogecoin)
docker run -d --name dogecoin-regtest \
-p 18332:18332 \
-p 18444:18444 \
-e NETWORK=regtest \
-e RPC_USER=regtest \
-e RPC_PASSWORD=regtest \
ich777/dogecoin-core
# 2. Build and run indexer
go build -o manindexer
./manindexer -chain doge -test 2 -config config_regtest.toml
# 3. Test inscription creation (requires metaid-cli)
cd /path/to/metaid-cli
./metaid-cli inscribe create \
--chain doge \
--payload '{"hello": "world"}' \
--path "/test" \
--address <your-doge-address>
# 4. Query indexed data
curl http://localhost:8080/api/pins/doge -X POST \
-H "Content-Type: application/json" \
-d '{"path": "/test", "size": 10}'For comprehensive Dogecoin-specific information:
- Dogecoin Adapter Guide - Detailed setup, configuration, and usage
- Implementation Summary - Technical architecture and design decisions
- Quick Start Script - One-command Dogecoin indexer deployment
Unlike Bitcoin's SegWit-based inscriptions, Dogecoin uses:
- P2SH Scripts: Inscriptions stored in ScriptSig redeem scripts
- Legacy Addresses: P2PKH/P2SH address formats (no Bech32)
- Different Network Magic: Unique protocol identifiers
- Custom Fee Calculation: Dogecoin-specific fee structures
# Start Bitcoin regtest node
docker run -d --name bitcoin-regtest \
-p 18443:18443 \
-p 18444:18444 \
ruimarinho/bitcoin-core:latest \
-regtest \
-rpcuser=regtest \
-rpcpassword=regtest \
-rpcallowip=0.0.0.0/0 \
-zmqpubrawtx=tcp://0.0.0.0:18444
# Start indexer
./manindexer -chain btc -test 2 -config config_regtest.toml
# Mine some blocks
bitcoin-cli -regtest -rpcuser=regtest -rpcpassword=regtest generate 101# Start Dogecoin regtest node
docker run -d --name dogecoin-regtest \
-p 18332:18332 \
-p 18444:18444 \
-e NETWORK=regtest \
-e RPC_USER=regtest \
-e RPC_PASSWORD=regtest \
ich777/dogecoin-core
# Start indexer
./manindexer -chain doge -test 2 \
-doge_rpc_host 127.0.0.1:18332 \
-doge_rpc_user regtest \
-doge_rpc_password regtest \
-doge_zmqpubrawtx tcp://127.0.0.1:18444
# Create test inscription (using metaid-cli)
./metaid-cli inscribe create \
--chain doge \
--payload '{"test": "Hello Dogecoin!"}' \
--path "/test" \
--address <your-address> \
--feerate 100000# Run end-to-end tests
cd tests/
./integration_test.sh
# Test specific chain
./integration_test.sh doge
# Test all chains
./integration_test.sh allProblem: Cannot connect to blockchain node
Solutions:
- Verify node is running:
ps aux | grep dogecoin(or bitcoin/mvc) - Check RPC port is correct in config
- Confirm RPC username/password match node configuration
- Test RPC connection:
curl --user username:password http://localhost:22555 - Check firewall rules allow local connections
- Review node logs for errors
Problem: Inscriptions not being indexed correctly
Solutions:
- Verify inscription format matches protocol specification
- For Dogecoin: Check P2SH redeem script structure
- For Bitcoin: Verify SegWit witness data format
- Enable debug logging: Add
-debug=1flag - Check indexer logs:
tail -f indexer.log - Verify
protocolIDin config matches inscription protocol
Problem: Slow indexing or high memory usage
Solutions:
- Increase database shards:
[pebble] num = 20 - Set higher starting block:
initialHeight = 5000000 - Disable full-node mode if not needed:
isFullNode = false - Increase system resources (RAM, CPU cores)
- Use SSD for database storage
- Enable query caching in configuration
Problem: PebbleDB corruption or errors
Solutions:
- Stop indexer gracefully:
kill -SIGTERM <pid> - Backup data:
cp -r man_base_data_pebble man_base_data_pebble.backup - Clear and re-index:
rm -rf man_base_data_pebble && ./manindexer ... - Check disk space:
df -h - Verify file permissions:
ls -la man_base_data_pebble/
For Dogecoin-specific troubleshooting, see: Dogecoin Adapter Troubleshooting
[pebble]
dir = "./man_base_data_pebble"
num = 20 # Increase shards for better parallel performanceRecommendations:
num = 10: Light usage, single-chain indexingnum = 20: Medium usage, multi-chain indexingnum = 30+: Heavy usage, high-performance requirements
# Skip early blocks without inscriptions
[btc]
initialHeight = 844446 # Start from first inscription block
[doge]
initialHeight = 5000000 # Skip early Dogecoin history
# Use appropriate database location
[pebble]
dir = "/fast/ssd/path/man_base_data_pebble" # Use SSD for performance# Increase RPC timeout for slow connections
[btc]
rpcTimeout = 60 # seconds
# Use local node for best performance
rpcHost = "127.0.0.1:8332" # Local > Remote
# Enable connection pooling
rpcMaxConnections = 10# Set Go garbage collection target
export GOGC=50 # More aggressive GC (lower memory, slight CPU increase)
# Limit max memory usage
ulimit -v 8388608 # 8GB limit (in KB)
# Monitor memory usage
watch -n 5 'ps aux | grep manindexer'# Build image
docker build -t manindexer:latest .
# Run container
docker run -d \
--name manindexer \
-p 8080:8080 \
-v $(pwd)/config.toml:/app/config.toml \
-v $(pwd)/data:/app/man_base_data_pebble \
--restart unless-stopped \
manindexer:latest \
-chain btc,doge -config /app/config.tomlCreate /etc/systemd/system/manindexer.service:
[Unit]
Description=MetaID Blockchain Indexer
After=network.target
[Service]
Type=simple
User=indexer
WorkingDirectory=/opt/manindexer
ExecStart=/opt/manindexer/manindexer -chain btc,doge -config /opt/manindexer/config.toml
Restart=on-failure
RestartSec=10
StandardOutput=append:/var/log/manindexer/output.log
StandardError=append:/var/log/manindexer/error.log
# Security hardening
NoNewPrivileges=true
PrivateTmp=true
ProtectSystem=strict
ProtectHome=true
ReadWritePaths=/opt/manindexer/man_base_data_pebble
[Install]
WantedBy=multi-user.targetEnable and start:
sudo systemctl daemon-reload
sudo systemctl enable manindexer
sudo systemctl start manindexer
sudo systemctl status manindexer# View logs
journalctl -u manindexer -f
# Check sync status
curl http://localhost:8080/api/count
# Monitor disk usage
du -sh man_base_data_pebble/
# Check process health
ps aux | grep manindexerWe welcome contributions from the community! Here's how you can help:
- Use GitHub Issues for bug reports
- Include: OS, Go version, chain type, config, error logs
- Provide steps to reproduce the issue
- Fork the repository
- Create a feature branch:
git checkout -b feature/your-feature - Commit changes:
git commit -am 'Add your feature' - Push to branch:
git push origin feature/your-feature - Open a Pull Request with detailed description
- Follow Go best practices and idioms
- Write unit tests for new features
- Update documentation for API changes
- Run
go fmtandgo vetbefore committing - Keep commits atomic and well-described
- All PRs require at least one review
- CI/CD tests must pass
- Documentation must be updated
- Maintain backward compatibility when possible
This project is licensed under the MIT License - see the LICENSE file for details.
- metaid-cli - Command-line tool for creating MetaID inscriptions
- Dogecoin Core - Official Dogecoin blockchain client
- Bitcoin Core - Official Bitcoin blockchain client
- MVC - MicroVision Chain official repositories
- Documentation: MetaID Protocol Docs
- GitHub: metaid-developers
- Community: Join our Discord/Telegram (links TBD)
- API Status: Check service health at
/api/health
- Bitcoin Core development team for foundational blockchain technology
- Dogecoin community for continued support and enthusiasm
- MVC team for innovative blockchain solutions
- All contributors who have helped improve this project
For questions and support:
- π Read the documentation first
- π Report bugs via GitHub Issues
- π¬ Join community discussions
- π§ Contact maintainers (see MAINTAINERS file)