Skip to content

Expose storage price calculations and meaningful stamp purchase errors #5301

@crtahlin

Description

@crtahlin

Summary

Users currently need to call Gnosis RPC and inspect smart contracts to calculate storage costs. The Bee node has this information (via /chainstate) but doesn't expose it in a user-friendly way with calculations.

Additionally, when stamp purchases fail (e.g., duration too short), users get unhelpful error messages.

Current Behavior

  • /chainstate returns raw currentPrice (PLUR per chunk per block), but no calculations
  • Stamp purchase failures return generic errors without explaining why or what's needed

Expected Behavior

1. Storage price calculations endpoint

Extend /chainstate or add new endpoint that provides:

  • Current storage price (PLUR per chunk per block) - already in chainstate
  • Calculator: given amount + depth → expected duration
  • Calculator: given duration + depth → required amount
  • Calculator: given duration + depth → total cost to pay

2. Meaningful stamp purchase errors

When a stamp purchase fails due to constraints, return a clear error explaining:

  • Why it failed (e.g., "duration less than minimum 24 hours")
  • What's required (e.g., "use amount of at least XXX for 24h minimum")
  • Include current price context so user can adjust

Use Case

Developers and users want to purchase stamps without needing to:

  1. Query Gnosis RPC directly
  2. Understand PLUR/chunk/block calculations manually
  3. Guess why their purchase failed

This would significantly improve the stamp purchasing UX.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions