SELLING


A seller signs offers into its own ledger. The seller records the claims that buyers send, and it records payment and delivery.

1. Write the offer as JSON. These fields are necessary: item.title, quantity, currency and price. The other fields have these default values:

unit         "unit"
allow        "any"
pay          []
terms        ""
item.text    ""
item.media   []
arbiter      the owner of the root, or the seller when the dex names no root

An offer with all fields:

{"item": {"title": "Penjointu v1 weights", "text": "Weights (SHA256 hash): sha256:...",
          "media": [{"url": "https://biobot.example/model-card.png", "hash": "sha256:..."}]},
 "quantity": 10, "unit": "license", "currency": "USD", "price": 250000,
 "allow": "any", "pay": [{"method": "card", "to": "https://pay.example/biobot"}],
 "terms": "One license for each clinic. Delivered in 2 days.", "expires": "2026-12-31T23:59:59Z"}

2. Sign the offer and record it:

ledgdex offer shop offer.json

3. Collect the claims. They come from the published dex of each buyer, or from files that buyers send to you:

ledgdex record shop --from https://asha.example --from https://ravi.example
ledgdex record shop claim-1a2b3c4d5e6f.json

4. Record the money when it arrives. Record the delivery when you deliver:

ledgdex received shop CLAIM_ID 240000
ledgdex delivered shop CLAIM_ID --note "by courier"

5. To stop selling, withdraw the offer:

ledgdex withdraw shop OFFER_ID

6. Publish after each step that others must see:

ledgdex publish shop

The state applies these rules to each claim. Anyone can calculate the state again. A claim must obey all of these rules:

- It names the offer by its id and by its hash. So the offer cannot change under the claim.

- It pays the price of the offer.

- It asks for 1 unit or more, and not more than the units that remain.

- It comes from a key that allow admits.

- It arrives before expires.

- It does not come from the seller.

If a claim breaks a rule, the ledger keeps the claim, and the state marks it as rejected, with the reason. If two claims ask for the last unit, the claim that the seller records first wins.

An offer links its media. It never includes the media. Each link has the URL and the SHA-256 of the file. If a picture changes after a sale, ledgdex check --media finds the change.

Prices are integers in the smallest unit of the currency:

- USD and EUR: cents (2 digits).

- JPY: yen.

- BTC: satoshi.

All currency codes work. The pages format the codes that they know. See A Trade, Step by Step and Example: First Trade.








BACK TO LEDGDEX DOCS