Skip to content

Technical Overview ​

This document provides a technical deep dive into the Bittensor subnet architecture and implementation details for developers and technical stakeholders.

Architecture Overview ​

The SecureTrade Bittensor subnet operates as a decentralized marketplace for credit line issuance, connecting traders with miners through a three-tier architecture:

┌─────────────────┐    ┌─────────────────┐    ┌─────────────────┐
│   SecureTrade   │    │   Bittensor     │    │   Smart         │
│   Application   │◄──►│   Subnet        │◄──►│   Contracts     │
│                 │    │                 │    │                 │
│ • Trader UI     │    │ • Validators    │    │ • TRADE-S       │
│ • Admin Panel   │    │ • Miners        │    │ • TRADE-P       │
│                 │    │ • Subtensor     │    │                 │
└─────────────────┘    └─────────────────┘    └─────────────────┘

Core Components ​

1. Validators ​

Validators serve as the orchestration layer, managing the credit line issuance process:

Responsibilities:

  • Receive Credit Line Requests (CLRs) from SecureTrade application
  • Distribute CLRs to all active miners
  • Collect and evaluate Credit Line Offers (CLOs)
  • Select optimal offers based on objective criteria
  • Coordinate on-chain execution
  • Score miner performance and set weights

Technical Implementation:

  • REST API endpoint for CLR reception
  • P2P communication with miners via Bittensor
  • On-chain weight setting for TAO distribution
  • Performance tracking and scoring algorithms

2. Miners ​

Miners are the risk-takers who provide credit lines:

Responsibilities:

  • Receive and analyze CLRs
  • Perform risk assessment using AI models
  • Submit competitive CLOs
  • Execute on-chain collateral deposits
  • Maintain network participation

Technical Implementation:

  • AI model deployment and inference
  • P2P communication with validators
  • Smart contract interactions
  • Performance optimization

3. Smart Contracts ​

The subnet interacts with several smart contracts:

TRADE-S Token (Public Network):

  • ERC-20 token on Optimism
  • Used as collateral for credit lines
  • Transferred to trader public safes

TRADE-P Token (Private Network):

  • ERC-3643 compliant token
  • Minted equivalent to TRADE-S deposits
  • Used for PayPledge transactions

Data Flow ​

1. Credit Line Request Flow ​

Trader → SecureTrade App → Validator → Miners
  1. Trader submits CLR via SecureTrade application
  2. Application validates and formats request
  3. Validator receives CLR via REST API
  4. Validator broadcasts CLR to all miners
  5. Miners analyze request and prepare offers

2. Offer Evaluation Flow ​

Miners → Validator → Selection → On-chain Execution
  1. Miners submit CLOs via P2P messages
  2. Validator evaluates offers using objective criteria
  3. Validator selects optimal offer
  4. Winning miner deposits TRADE-S tokens
  5. Application mints equivalent TRADE-P tokens

3. Performance Scoring Flow ​

Transaction Data → Validator → Weight Calculation → Subtensor
  1. Validator tracks all transaction outcomes
  2. Performance scores calculated for each miner
  3. Weights normalized and set on Subtensor
  4. TAO rewards distributed based on weights

Protocol Implementation ​

1. Credit Line Request (CLR) ​

python
class CreditlineIssuanceRequest(BaseModel):
    borrower_id: str
    lockin_period: int
    borrower_data: Dict[str, Any]
    metadata: Dict[str, str]
    clr_id: str = ""
    credit_amount: Optional[float] = None

2. Credit Line Offer (CLO) ​

python
class CreditlineIssuanceOffer(BaseModel):
    borrower_id: str
    credit_amount: float
    premium: float
    timestamp: float
    clo_id: str
    clr_id: str
    tx_ref: str
    miner_details: Dict[str, str]

3. Bittensor Synapse ​

python
class CreditlineIssuance(Synapse):
    request: Optional[CreditlineIssuanceRequest] = None
    response: Optional[CreditlineIssuanceOffer] = None

Network Configuration ​

1. Subtensor Network ​

  • Network: Localnet- nodes running at: port 9943 & 9944
  • Subnet UID: Unique identifier for Credit Line Issuance subnet
  • Tempo: 24-hour weight setting cycle
  • Emission: 41% to validators, 41% to miners, 18% to subnet creator

2. P2P Communication ​

  • Axon: Validator endpoint for miner communication
  • Dendrite: Miner client for validator communication
  • Timeout: Configurable response timeouts
  • Retry Logic: Automatic retry for failed communications

3. Smart Contract Integration ​

  • RPC Endpoints: Optimism connection
  • Contract Addresses: Deployed contract addresses
  • ABI Files: Contract interface definitions
  • Gas Management: Transaction fee optimization