Daemon for TFChain (Substrate) to Mycelium Ledger (NEAR) token transfers.
- Rust 98.6%
- Makefile 0.7%
- Dockerfile 0.7%
|
|
||
|---|---|---|
| .forgejo/workflows | ||
| docs | ||
| migrations | ||
| src | ||
| tests | ||
| .dockerignore | ||
| .env.example | ||
| .gitignore | ||
| Cargo.lock | ||
| Cargo.toml | ||
| docker-compose.yml | ||
| Dockerfile | ||
| Makefile | ||
| README.md | ||
hero_tfspores
Bridge daemon that converts TFT (TFChain/Substrate) to SPORE (Mycelium Ledger/NEAR). Optionally refunds TFT for invalid transfers.
Quick Start
cp .env.example .env # Edit with your values
make build
make run
Docker
cp .env.example .env # Edit with your values
make docker-build
make docker-run # Starts via docker compose
make docker-logs # Tail logs
Configuration
Create a .env file from the template. See docs/configuration.md for the full reference.
Required variables:
TFCHAIN_NETWORK=devnet
TFCHAIN_TREASURY_ADDRESS=5G...
NEAR_NODE_URL=http://YOUR_NEAR_NODE:3030
NEAR_BRIDGE_ACCOUNT_ID=your_bridge_account_hex
NEAR_BRIDGE_PRIVATE_KEY=ed25519:...
Block Cursor
The daemon tracks progress in node.json. On first run it defaults to block 0 — scanning from genesis is extremely slow on a live chain.
For a fresh deployment, set the cursor to a recent block:
echo '{"last_block":20417000}' > node.json
make run
Or use the env var override:
RESCAN_FROM_BLOCK=20417000 make run
Refunds (Optional)
Enable automatic TFT refunds for transfers with no or invalid memo:
REFUND_ENABLED=true
TFCHAIN_TREASURY_MNEMONIC=word1 word2 ... word12
REFUND_FEE_PLANCK=100000 # 0.01 TFT fee
See docs/configuration.md for details.
HTTP API
The daemon exposes a JSON API on API_PORT (default 3030):
| Endpoint | Description |
|---|---|
GET /health |
Liveness probe |
GET /status |
Uptime, cursor position, tx counts |
GET /txs |
List/filter transactions |
GET /txs?tx=<hash> |
Look up a single transaction |
See docs/api.md for endpoint details and docs/api-integration.md for the frontend polling guide.
Documentation
| Doc | Description |
|---|---|
| Configuration | Environment variables reference |
| Architecture | Component overview and database schema |
| Flows | Token conversion flow diagrams |
| HTTP API | REST endpoint reference |
| API Integration | Frontend integration and polling guide |
| CLI | Commands, admin operations, and recovery |
Development
make help # Show all available commands
make check # Type check
make test # Run tests
make fmt # Check formatting
make clippy # Run linter