Skip to content

Operate your feed

This page covers managing a feed on testnet after it is deployed. The examples use the variables and, for the API, the signing script set up in Publish a feed on testnet.

Testnet only

The hold and notice periods on this page apply to testnet only. Mainnet-beta will use different values.

The CLI identifies a feed by its code and its metro, so the feed commands take both --code and --exchange. The API identifies it by its address, $FEED_KEY.

Halt and resume

Halting a feed stops it from admitting new subscribers. Existing subscribers stay connected. Halt a feed during maintenance, or when your upstream data is unreliable.

doublezero feed halt --code $FEED --exchange $METRO
doublezero feed resume --code $FEED --exchange $METRO
curl -sS -X POST $API/builders/$BUILDER/feeds/$FEED_KEY/halt | node ~/dz-sign/sign.mjs $LEDGER_RPC $KEY
curl -sS -X POST $API/builders/$BUILDER/feeds/$FEED_KEY/resume | node ~/dz-sign/sign.mjs $LEDGER_RPC $KEY

Resuming returns the feed to Active. Check the current status:

doublezero feed list --code $FEED
curl -sS $API/builders/$BUILDER/feeds | jq -r '.feeds[] | select(.code == env.FEED) | .status'

Retire

Retiring a feed is permanent. It starts a 30-day notice period so that subscribers can move to another feed. The feed keeps publishing during the notice period and is retired automatically at the end of it.

doublezero feed retire --code $FEED --exchange $METRO
curl -sS -X POST $API/builders/$BUILDER/feeds/$FEED_KEY/retire | node ~/dz-sign/sign.mjs $LEDGER_RPC $KEY

Add a multicast group

A feed can use more than one multicast group, for example one per metro or one per set of instruments. Create the new group against the same bond and grant your host publish access:

doublezero multicast group create --code acme-tob-ams --max-bandwidth $RATE --bond-ref $BOND --wait
doublezero multicast group allowlist publisher add --code acme-tob-ams --client-ip $HOST_IP --user-payer me
curl -sS -X POST $API/builders/$BUILDER/multicast-groups \
  -H 'content-type: application/json' \
  -d "{\"code\": \"acme-tob-ams\", \"max_bandwidth_bits_per_sec\": $RATE_BPS, \"bond_index\": 0}" \
  | node ~/dz-sign/sign.mjs $LEDGER_RPC $KEY
export GROUP2_KEY=$(curl -sS $API/builders/$BUILDER/feeds \
  | jq -r '.multicast_groups[] | select(.code == "acme-tob-ams") | .multicast_group')
curl -sS -X POST $API/builders/$BUILDER/multicast-groups/$GROUP2_KEY/publishers \
  -H 'content-type: application/json' \
  -d "{\"client_ip\": \"$HOST_IP\", \"user_payer\": \"$BUILDER\"}" \
  | node ~/dz-sign/sign.mjs $LEDGER_RPC $KEY

Then add it to the feed. --group replaces the feed's full list of groups, so include every group the feed should keep. The API has no request for this yet, so use the CLI either way:

doublezero feed update --code $FEED --exchange $METRO --group $GROUP --group acme-tob-ams

Add a feed

A bond supports one feed. To deploy another feed, create a second bond at bond index 1, then repeat Steps 3 to 6 of Publish a feed on testnet using that bond.

doublezero-solana bond init -u devnet -k $KEY --committed-rate $RATE --bond-index 1
doublezero-solana bond post -u devnet -k $KEY --amount 1 --bond-index 1
doublezero-solana bond show -u devnet --builder $BUILDER --bond-index 1
curl -sS -X POST $API/builders/$BUILDER/bonds \
  -H 'content-type: application/json' \
  -d "{\"bond_index\": 1, \"committed_rate_bits_per_sec\": $RATE_BPS}" \
  | node ~/dz-sign/sign.mjs $SOLANA_RPC $KEY
curl -sS -X POST $API/builders/$BUILDER/bonds/1/post \
  -H 'content-type: application/json' \
  -d '{"amount": 100000000}' \
  | node ~/dz-sign/sign.mjs $SOLANA_RPC $KEY
curl -sS $API/builders/$BUILDER/bonds | jq '.[] | select(.bond_index == 1)'

In the API requests for the new group and feed, set bond_index to 1.

Change tier

A bond's committed rate is set when the bond is created and cannot be changed. To move to a higher tier, create a new bond at the next bond index with the new committed rate, and deploy a new feed against it.

Withdraw from a bond

After the hold, which is 180 days on testnet, you can withdraw any 2Z in the bond above what its tier requires.

bond show reports this amount as Withdrawable. --amount is in 2Z.

doublezero-solana bond show -u devnet --builder $BUILDER
doublezero-solana bond withdraw -u devnet -k $KEY --amount <Withdrawable>

The amount is bonded_2z_amount minus required_2z_amount, in base units. The hold ends at hold_expires_at, in Unix seconds.

curl -sS $API/builders/$BUILDER/bonds | jq '.[] | select(.bond_index == 0)'
curl -sS -X POST $API/builders/$BUILDER/bonds/0/withdraw \
  -H 'content-type: application/json' \
  -d '{"amount": <base units>}' \
  | node ~/dz-sign/sign.mjs $SOLANA_RPC $KEY

Planned

Withdrawing the required amount after a feed is retired is not supported yet.