BuildBlueprintsPricing

Blueprint Pricing

Tangle v2 supports fixed-price and quote-based pricing. The pricing engine is the operator-side RFQ server that produces signed quotes for instant service creation.

When to Use the Pricing Engine

  • Use it when your blueprint expects RFQ quotes and you want customers to create services immediately with signed operator quotes.
  • If your blueprint uses standard pay-once or subscription pricing, you can skip the pricing engine.

End-to-End Flow

  1. Operator runs pricing-engine-server with a pricing config and the Tangle RPC + contract addresses.
  2. Customer requests quotes over gRPC (GetPrice) with TTL, proof-of-work, and security requirements.
  3. Operator returns a signed quote (ECDSA signature over ABI-encoded QuoteDetails).
  4. Customer creates a service by calling ITangleServices.createServiceFromQuotes with the selected quotes. Use extendServiceFromQuotes to add TTL later.

Quote Format

The gRPC schema matches ITangle.SignedQuote. The QuoteDetails payload looks like:

message QuoteDetails {
  uint64 blueprint_id = 1;
  uint64 ttl_blocks = 2;
  double total_cost_rate = 3;
  uint64 timestamp = 4;
  uint64 expiry = 5;
  repeated ResourcePricing resources = 6;
  repeated AssetSecurityCommitment security_commitments = 7;
}

Pricing Configuration

Pricing rates live in a TOML file. A default section applies to every blueprint, and you can override rates per blueprint ID. The SDK ships a sample at crates/pricing-engine/config/default_pricing.toml.

Runbook (Operator)

pricing-engine-server reads operator.toml and the pricing config, then watches the Tangle v2 contracts:

OPERATOR_HTTP_RPC=https://rpc.tangle.tools \
OPERATOR_WS_RPC=wss://rpc.tangle.tools \
OPERATOR_TANGLE_CONTRACT=0x... \
OPERATOR_RESTAKING_CONTRACT=0x... \
OPERATOR_STATUS_REGISTRY_CONTRACT=0x... \
cargo run -p blueprint-pricing-engine --bin pricing-engine-server

Important environment variables:

  • OPERATOR_CONFIG_PATH (operator.toml)
  • PRICING_CONFIG_PATH (pricing TOML)
  • OPERATOR_HTTP_RPC / OPERATOR_WS_RPC
  • OPERATOR_TANGLE_CONTRACT
  • OPERATOR_RESTAKING_CONTRACT
  • OPERATOR_STATUS_REGISTRY_CONTRACT

Security Notes

  • GetPrice uses proof-of-work to rate-limit RPC abuse.
  • Quotes include TTL + expiry and are signed with the operator ECDSA key to prevent replay.

Source of Truth

  1. Get Multiple Quotes: Always request quotes from all registered operators to compare prices
  2. Verify All Signatures: Always verify the signature of each quote before using it
  3. Check Expiry Times: Ensure quotes haven’t expired before submitting them to the blockchain
  4. Include Complete Security Requirements: Specify all necessary security parameters in your requests
  5. Handle Errors Gracefully: Implement proper error handling for failed quote requests
  6. Keep Quotes Intact: Never modify quote details after receiving them
  7. Use Fresh Proof-of-Work: Generate a new proof-of-work for each request
  8. Expect Price Variation: Don’t assume all operators will provide the same price