/api/raida/keys/rekey

POST

Powns coins to fresh random authenticity numbers on all 25 RAIDAs, commits the ANs each RAIDA accepted, and rewrites the coin files. By default it takes the identity coin plus every coin in Default/Bank that holds an all-zero AN on any RAIDA (up to 50 per call); with sn it takes exactly the serials named. A zero AN is a known value: a coin holding one can be taken by anyone on that RAIDA and cannot serve as Type 8 encryption key material. Coins minted through join were found on several RAIDAs in that state, so provisioning runs this automatically on the three coins it installs, and operators can run it on demand.

Parameters

NameTypeRequiredDescription
snstringNoComma-separated serial numbers to re-key (looked up in Mail and in Default Bank/Fracked), at most 50. Omit to sweep: the identity coin plus the first 50 Default/Bank coins with a zero AN.

Responses

Success Response (200)

{
    "command": "raida-keys-rekey",
    "success": true,
    "coins": 2,
    "results": [
        { "denomination": 2, "serial_number": 34448, "raidas_rekeyed": 25, "zero_an_raidas_before": 12, "zero_an_raidas_after": 0, "file_written": true },
        { "denomination": 2, "serial_number": 34449, "raidas_rekeyed": 25, "zero_an_raidas_before": 12, "zero_an_raidas_after": 0, "file_written": true }
    ],
    "coins_rekeyed_on_majority": 2
}
FieldTypeDescription
coinsintegerCoins selected. 0 with sn means none of the serials was found.
results[].raidas_rekeyedintegerRAIDAs that accepted the new AN. Others keep the previous one and are retried by the next call.
results[].zero_an_raidas_before / _afterintegerHow many RAIDAs held an all-zero AN for the coin before and after.
results[].file_writtenbooleanThe coin file was rewritten with the accepted ANs.
coins_rekeyed_on_majorityintegerCoins where 13 or more RAIDAs took the new AN.

Error Responses

404 Not Found

No identity coin in the Mail wallet. The identity coin is the encryption key for the whole batch, so re-keying needs it even when only Default coins are named.

{ "error": true, "message": "No identity coin in the Mail wallet", "code": 404 }

Examples

cURL Example

# sweep: identity + Default/Bank coins with a zero AN
curl -X POST "http://localhost:8080/api/raida/keys/rekey"

# exactly these coins
curl -X POST "http://localhost:8080/api/raida/keys/rekey?sn=34448,34449"

JavaScript Example

fetch(`http://localhost:8080/api/raida/keys/rekey`, { method: 'POST' })
    .then(r => r.json())
    .then(d => d.results.forEach(c => console.log(c.serial_number, `${c.raidas_rekeyed}/25`, `zeros ${c.zero_an_raidas_before} -> ${c.zero_an_raidas_after}`)));

Python Example

import requests
d = requests.post('http://localhost:8080/api/raida/keys/rekey', params={'sn': '34448,34449'}).json()
for c in d['results']:
    print(c['serial_number'], c['raidas_rekeyed'], c['zero_an_raidas_after'])

Notes

  • The sweep is capped at 50 coins per call; run it again until coins is 1 (the identity alone).
  • A RAIDA that is offline keeps the old AN for that coin; the file keeps it too, so nothing is lost. Re-run later.
  • RAIDAs now refuse to store an all-zero AN on join, pown and fix, so new coins cannot re-enter this state.