Pando Exchange Docs Build your marketplace
On this page

Build

Setup

Your site's /setup page - the admin token, storing a settings code, the one-time claim and what protects it, the five checks, and changing settings later.

What /setup does#

Every marketplace made from the template has a page at /setup. It reads a settings code, checks it, asks for your admin token and stores the settings in your site's own storage. Then it runs five checks and says whether the site is working. The page runs on your own site, and Pando keeps no copy of your settings.

A site with no settings sends ordinary page visits to /setup. The setup page, its files and the data console have their own routes. The page's routes are in Setup and administration.

Storing a settings code#

You arrive in one of two ways:

  • From the builder's Open setup on your site. The link is https://marketplace.example/setup#settings=pando1.…. The part after the # is not sent when the page loads; the page reads it in your browser and opens straight on the review.
  • By opening https://marketplace.example/setup yourself, pasting the settings code under Now give your site its settings. and choosing Review settings.

On Check your settings, the page shows every setting from the code, and the fee wallet in full. Check them. Enter your admin token in the Admin token field, which appears on this review, and choose Store settings. Your browser then sends the code and the token to your own site. When they are stored the page reloads and shows your settings and the five checks.

Claim promptly. Until a site is claimed, whoever holds the admin token can make the first claim and set the first fee wallet.

What happens next: the site measures where to keep its storage (about three seconds), stores the settings in the chosen place and, on Ethereum, starts the first read of each collection in the background.

What protects the claim#

  • The admin token. The MARKET_ADMIN_TOKEN secret, at least 32 characters. Without one the page says "Set MARKET_ADMIN_TOKEN to at least 32 random characters in your hosting dashboard."
  • The attempt counter. Five tries for each visitor in ten minutes, counted in the site's own storage before the token is looked at. A correct token gives its try back. An IPv6 visitor is counted by their whole /64. Past the limit the answer is "Too many tries. Wait and try again.", with how long to wait. Someone on your network address can use up the five tries and delay a change for up to ten minutes at a time.
  • One claim only. Once settings are stored, another claim answers "Nothing was changed. This site already has its settings." Replacing them also needs the unlock code (below).
  • Its own origin. The claim must be JSON with an Origin header that matches your site's own address, and carry the admin token. Replacing stored settings also needs the unlock code.
  • No variables by hand. With no stored record, a value in any of the five marketplace variables prevents a first claim. Stored settings take precedence over variables. See Settings.

What the admin token can do#

The admin token opens two things, and nothing about trading:

  • POST /setup/claim, to store settings (and, with the unlock code, to replace them);
  • the operator data console's POST routes under /operator/data/api/, for the optional data service.

There is no admin route that fills, rewrites, moves or deletes a shopper's order, and none that signs or sends a transaction. Your site's server never holds a key that could.

The five checks#

Check What it reads Passes with
Settings The stored record, or the variables set by hand, checked by this version "Marketplace settings in use."
OpenSea key One request to OpenSea's API with your key. Skipped when OpenSea is off "OpenSea key works." or "OpenSea is switched off. No API key is needed."
RPC Your RPC's chain id and latest block, then a simulated one-wei transfer with eth_simulateV1 and transfer tracing. Nothing is sent "RPC answers and can simulate a sale." or, with no RPC_URL, "The shared public RPC answers and can simulate a sale."
Storage That the settings binding exists and your R2 media bucket answers a list request "Storage ready."
First book read On Ethereum, whether a sync of the first collection has completed and its first NFTX pool prices have landed or failed. On Ink, the first page of listings made on your site, read from R2. Neither checks Ink's OpenSea checkout "First book read complete."

The book check waits for the OpenSea key, RPC and storage checks to pass. While the first read runs it shows "Reading the first book…" or "Reading the first NFTX pool prices…". While only the first book is still reading, the title says "Reading your collection for the first time" and the page asks again by itself, waiting five seconds after each answer, for at most 36 status requests in all; how long that takes depends on how long each request takes. When all five pass it says "Your marketplace is live." and offers Open your marketplace.

The same checks are at /setup/status as JSON:

bash
curl https://marketplace.example/setup/status

The route allows 60 requests a minute for each visitor and then answers "Too many setup checks. Wait and try again." Do not poll it. Its answer is described in Setup and administration.

When a check fails#

It says What to do
Set OPENSEA_API_KEY in your hosting dashboard. Add your key as a secret, or switch OpenSea off
OpenSea refused this key. Create a new one and replace it in your hosting dashboard. OpenSea answered that it refuses the key: it may be wrong, expired or lack access. Check its permissions and expiry, or make a new one: Your OpenSea key
The RPC couldn't simulate a transfer with tracing. Check your RPC provider. The endpoint did not return the transfer trace the check needs. Check your provider's supported methods and status. On Ethereum only, you can remove RPC_URL to use the shared one
The RPC answered for a different chain. Check the endpoint in your hosting dashboard. The RPC is for another chain
The RPC address redirects. Set RPC_URL to the final address in your hosting dashboard. Get the final HTTPS address from your provider. The check does not follow redirects, so do not copy whatever address it redirects to without knowing who runs it
Set INK_RPC_URL in your hosting dashboard. On Ink, an RPC of your own is needed for this check and for listings on your site
Storage couldn't be read. Check your hosting dashboard. Check that R2 is on and the Worker's media bucket exists, and that the deploy finished with its Durable Object bindings
The first book read failed. Retry. Reload the page. If it persists, see Troubleshooting
Couldn't read … Retry. The check could not reach the service. Reload
The stored settings no longer pass this version's checks. Store a new settings code from the builder, with the unlock code

Troubleshooting has more.

Changing settings later#

  1. Make a new settings code in the builder.
  2. On /setup, open Change settings and copy the unlock code.
  3. If an older deployment of your site may still be reachable, change the admin token first.
  4. Set the unlock code as the secret MARKET_SETUP_UNLOCK and redeploy.
  5. Open the new setup link from the builder, or paste the new code, enter your admin token and store.
  6. Delete MARKET_SETUP_UNLOCK and redeploy.
bash
npx wrangler secret put MARKET_SETUP_UNLOCK
# after storing the new settings
npx wrangler secret delete MARKET_SETUP_UNLOCK

The unlock code is derived from the stored record, so a new record has a new one. A restore from backup can bring back a record that an old code unlocks.

If the site cannot record where it placed its storage after storing settings, the claim answers 503 and the page says to press Store settings again, which restores the record.

Setting up by hand#

With JavaScript off, or without the builder, follow Set up by hand in Cloudflare on /setup. Put the variables it gives in the Worker's Settings, Variables and Secrets and redeploy. Settings lists each one.

Next#

Pando Exchange is software published by Simple Things Ltd. Each marketplace made with it is run by its operator, in the operator's own account.