Skip to main content

Storage nodes

The storage nodes keep the metadata and the slivers of the blobs registered on IOTA, for the shards they hold, and sign the confirmations used to certify blobs. Their API takes and returns BCS for the data and JSON for everything else, and allows calls from any web page (CORS).

Most users never call it directly: the app, the reference client and the aggregator do.

Nodes: https://node-1.iotastorage.com to https://node-4.iotastorage.com. Each node's network address (node-N.iotastorage.com:443) and network key are registered on IOTA. Clients use HTTPS, and the reference client, the aggregator and the other nodes only accept the connection if the node's TLS certificate has its network key (TLS and the network key). The current committee is listed by the aggregator's /v1/status.

MethodPathBody or answer
GET/v1/healthNode ID, epoch, shards and blobs it is completing.
GET/v1/blobs/<blob ID>/statusRegistration status of the blob.
PUT/v1/blobs/<blob ID>/metadataBody: BCS BlobMetadata.
GET/v1/blobs/<blob ID>/metadataAnswer: BCS BlobMetadataWithId.
PUT/v1/blobs/<blob ID>/slivers/<pair>/<primary or secondary>Body: BCS SliverData.
GET/v1/blobs/<blob ID>/slivers/<pair>/<primary or secondary>Answer: BCS SliverData.
GET/v1/blobs/<blob ID>/confirmation/permanentSigned confirmation for a permanent blob.
GET/v1/blobs/<blob ID>/confirmation/deletable/<object ID>Signed confirmation for the deletable Blob with that object ID.
GET/v1/blobs/<blob ID>/recoverySymbols?targetType=<primary or secondary>&targetSliver=<index>Answer: BCS Vec<GeneralRecoverySymbol>, to rebuild slivers (recovery).
POST/v1/blobs/<blob ID>/inconsistencyProof/<primary or secondary>Body: BCS InconsistencyProof. Answer: signed InvalidBlobIdMsg (inconsistent blobs).
GET/v1/blobs/<blob ID>/denyListDeletionSigned DenyListBlobDeleted, if the node's operator lists the blob for deletion (data retention).

<pair> is the index of a sliver pair, from 0 to the number of shards minus one. The shard of each pair is rotated by the blob ID.

Envelopes​

JSON answers use this envelope:

{ "success": { "code": 200, "data": … } }
{
"error": {
"code": 400,
"status": "FAILED_PRECONDITION",
"message": "…",
"details": [{ "@type": "ErrorInfo", "reason": "NOT_REGISTERED", "domain": "storage-node" }]
}
}

reason says what went wrong, so a client can decide whether to try again without reading message:

reasonCodeWhen
NOT_REGISTERED400The node does not know a valid registration of the blob (or of that Blob object, or a permanent one). Nodes see a registration a few seconds after it is on IOTA, so a client tries again.
BLOB_EXPIRED400The registration of the blob has expired.
INVALID_BLOB400The blob ID was marked invalid on IOTA.
INVALID_METADATA400The metadata is not in canonical BCS (nothing left over, minimal lengths), or does not match the blob ID or the registered size.
METADATA_NOT_FOUND400, 404A sliver was sent before the metadata (400), or the node has no metadata of the blob (404).
INVALID_SLIVER400The sliver does not match its pair, type, size or hash in the metadata.
MISSING_SLIVERS400Confirmation asked for before the node has the metadata and all its slivers of the blob.
INVALID_BLOB_ID, INDEX_OUT_OF_RANGE400Malformed blob ID or sliver pair.
INVALID_PARAMS, TOO_MANY_TARGETS400Wrong targetType or targetSliver in recoverySymbols, or more targets at once than fit in one answer (16 MiB).
INVALID_PROOF400The inconsistency proof does not show that the blob is badly encoded.
SLIVER_NOT_FOUND, SYMBOLS_NOT_FOUND, UNKNOWN_ROUTE404The node does not have that sliver, or any sliver to compute those recovery symbols from, or the path does not exist.
BODY_TIMEOUT408See limits.
DIFFERENT_DATA_STORED409Different bytes are already stored there; they are never replaced.
BODY_TOO_LARGE413The body is larger than what it carries can be.
SHARD_NOT_ASSIGNED421The sliver is for a shard of another node.
NOT_DENY_LISTED403The node's operator does not list the blob for deletion.
BLOCKED451The node's operator has blocked the blob, after a notice or an order about it: the node does not serve it outside the committee, or, if it is to be deleted, neither serves nor stores it (data retention).
TOO_MANY_REQUESTS429See limits.
BUSY503See limits.
NO_DISK_SPACE507See limits.
INTERNAL_ERROR500Error inside the node.

Metadata and slivers are sent and returned as raw BCS bytes (application/octet-stream). A body can be as large as what it carries: the metadata for the network's shards, or a sliver of the registered blob. A larger one gets 413.

Limits​

A node bounds the memory it spends on uploads and on recovery symbols, the signatures it makes or checks for anyone who asks, and the requests it serves at once:

CodeMeaning
503The node is already receiving too much data or too many uploads at once, serving too many requests at once, computing too many recovery symbols or checking too many inconsistency proofs, sending too many recovery symbols that have not been read yet, or checking too many storage challenges that do not come from the committee's nodes. The answer has a Retry-After header (in seconds); try again after it. The reference client and the app do it automatically.
429Too many requests at once, or too many confirmations to sign or storage challenges and signatures to check, from the same IP. The answer has a Retry-After header; try again after it. A confirmation already signed in the epoch does not count: asking for it again gets the same signature. The nodes of the committee have no limit.
408The body did not arrive within its deadline: 15 s plus 1 s for every 50 KB of the expected size. The node closes the connection.
507The node is out of disk space.

A node also accepts a limited number of connections at once, and closes a connection that stays idle for 2 minutes. Slivers are streamed from disk, and a sliver has 15 s plus 1 s for every 50 KB to be read; an answer of recoverySymbols, 15 s plus 1 s for every 200 KB. Past it, the node closes the connection.

Recovery symbols and inconsistency proofs are for the nodes of the committee, which have most of the room for them. From anywhere else, a node computes one at a time, for at most a tenth of a second every second for all of them together, and keeps fewer answers waiting to be read: past that, 503.

Health​

curl https://node-1.iotastorage.com/v1/health
{
"success": {
"code": 200,
"data": {
"nodeId": "0x…",
"epoch": 1,
"shards": [25, 26, 27, "…", 49],
"pendingBlobs": 0,
"blocklist": { "sha256": "…", "bot": { "sha256": null, "sites": 0, "blobs": 0, "paused": [] }, "failed": false, "blobs": 0, "deletions": 0, "sites": 0, "names": 0, "sitesPaused": false, "sitesReview": 12, "sitesByName": false, "filesPaused": false, "appPaused": false },
"epochSyncPending": 0,
"epochSyncLate": 0,
"storageChallenges": {
"active": true,
"certified": false,
"attestations": 2,
"others": { "passed": 2, "failing": [{ "node": "0x…", "attempts": 3, "refusals": 1 }] }
}
}
}
}

nodeId is the ID of the node's staking pool on IOTA; shards are the shards it holds in the current epoch. pendingBlobs counts certified blobs that may still lack some of its data (it is fetching or rebuilding it). After a change of committee, epochSyncPending counts those that still lack slivers of the shards it gained, which it waits for before confirming the epoch, and epochSyncLate, those still lacking them once it stopped waiting (changes of committee). storageChallenges says whether storage challenges count in this epoch, whether the node already has its storage certificate and how many signatures of other nodes it has collected for it; others, how the challenges it makes to the other nodes in the epoch are going: how many passed and, for each node it challenged that has not passed yet, how many attempts it made and how many of them were refusals (storage challenges).

blocklist says with what list of its operator the node serves (see the terms of use and the legal notice): the SHA-256 of the file it read, whether a newer one could not be read (failed: it keeps serving with the previous one), how many blobs are blocked and how many are to be deleted, how many sites and names, and its switches for the portal: the sites paused, how many have been approved in the review (null without a review) and the sites only by name; and the maintenance of the files and of the app. bot is the list of the operator's Telegram bot, added to the operator's: the SHA-256 of its file (null while it is empty), how many sites and blobs it hides and which parts it paused (sites, files or app). Nothing of the notes of the list. null if the node runs without a list.

Status of a blob​

data is one of:

  • "nonexistent": no valid registration;
  • { "invalid": {} }: the blob ID was marked invalid on IOTA;
  • { "permanent": { "endEpoch", "isCertified", "objects" } } if there is a permanent registration, or { "deletable": { … } } if all are deletable. endEpoch is the latest end epoch, isCertified says whether one of them is certified and objects counts the Blob objects that register this blob ID.

Storing a blob​

This is what a client does to store a blob after registering it on IOTA:

  1. PUT …/metadata on every node. The node accepts it only if the blob is registered and still valid, the metadata is in canonical BCS and matches the blob ID and the registered size.
  2. PUT …/slivers/<pair>/primary and …/secondary for each pair whose shard the node holds. A sliver for a shard of another node is rejected with 421. The node checks the shape of the sliver (pair, type, size) and its content against the hashes in the metadata: a sliver that does not match gets 400. Stored metadata and slivers are never replaced: sending the same bytes again is accepted, different bytes get 409.
  3. GET …/confirmation/permanent or …/confirmation/deletable/<object ID>. The node signs only if it has the metadata and all its slivers of the blob:
{
"success": {
"code": 200,
"data": { "signed": { "serializedMessage": "<base64>", "signature": "<base64>" } }
}
}

The message is a StorageConfirmation (epoch, blob ID and, for a deletable blob, its object ID), signed with the node's BLS key. The client aggregates the signatures of nodes holding a quorum of shards and certifies the blob on IOTA with certify_blob. It checks each one with the key the node has in the committee of the epoch, the one IOTA checks the certificate with, and once it has a quorum it waits for the other nodes only half the time that took, plus half a second: a node that does not answer does not hold the write, and it rebuilds its part from the others later.

What the reference client and the app try again: NOT_REGISTERED (until the node sees the registration), 503 (after its Retry-After, never more than 5 s) and 429, and, a couple of times, a request that got no answer at all. Any other error is final for that node, and the client goes on with the others. Each request has 10 s plus 1 s for every 50 KB of what it sends or expects back, so a large sliver can be uploaded or downloaded at 50 KB/s, the minimum speed the nodes accept.

Reading a blob​

A reader gets the metadata from any node and checks it against the blob ID. Then it downloads primary slivers from the nodes until it has n − 2f valid ones (34 with 100 shards). Each one is checked against its hash in the metadata, as the nodes do when they store it; one that does not match is discarded and another one is requested. The first n − 2f primary slivers are the rows of the blob, so the reader asks for them first: if they all arrive, there is nothing to decode. Otherwise it decodes the blob and checks every row of the result against its hash in the metadata.

The reader never accepts more bytes than an answer can have (the metadata for the network's shards, or a primary sliver of the blob's size): a node that sends more, or does not answer in time, is left out of the read, and so is one that sends a sliver that does not match. It asks for the metadata from three nodes at a time, and a sliver that is slow to arrive is asked for from another node meanwhile, so a slow node does not hold the read up. It reports that a blob does not exist (404) only when nodes holding a quorum of shards say they do not have it; if too many nodes do not answer, the blob may still be there and the error is 503.

During a change of epoch, if the node of a shard does not have a sliver yet (it may still be fetching it), the reader asks the node that held that shard in the previous epoch.

Recovery between nodes​

A node may lack data of a certified blob: it did not receive the upload (a blob is certified with a quorum of nodes), it was stopped, or it has just gained the shard. It notices when it sees the certification on IOTA (10 seconds later, since the client may still be uploading) and when it starts, and then:

  1. gets the metadata from another node, checked against the blob ID;
  2. for a shard it gained in this epoch, asks the node that held it in the previous epoch for its slivers, and checks each one against the metadata;
  3. rebuilds any other missing sliver from recovery symbols of the other nodes: a primary sliver from symbols of n − f secondary slivers (67 with 100 shards) and a secondary sliver from symbols of n − 2f primary slivers (34). Each symbol comes with a Merkle proof against the hash of the sliver it was computed from: the node checks each answer as it arrives, keeps only its valid symbols, one per source sliver, and asks other nodes for more. It reads from each node at most the symbols of the shards that node holds in this epoch or held in the previous one, and a node that sent a wrong symbol is not asked again until the next attempt. The rebuilt sliver is checked against the metadata before storing it. It rebuilds its secondary slivers first: they need fewer symbols, so even if only nodes with n − 2f shards have the blob, the nodes that lack it rebuild their secondary slivers and, with them, give each other the symbols for their primary slivers.

If something fails (the other nodes do not answer, not enough valid symbols), it keeps what it already rebuilt and tries the rest again later, waiting longer each time, up to 10 minutes.

recoverySymbols computes, from every sliver of the other type the node keeps for the blob, the symbol at the position of each target sliver. targetSliver is a sliver index (for a primary sliver, its pair; for a secondary sliver, n − 1 − its pair) and can be repeated to ask for several targets at once, as long as the answer fits in 16 MiB.

Changes of committee​

When stake moves between nodes, the next committee can assign some shards to other nodes. At the start of the epoch (EpochChangeSync), a node that gains shards fetches their slivers of every certified blob (from the previous holder, or by rebuilding them) and only then confirms the epoch with epoch_sync_done. The epoch is done when nodes holding a quorum of shards have confirmed it. The node waits only for the slivers of the shards it gains, and at most 1/24 of the epoch (an hour with epochs of a day; at least 5 minutes): the length of the epoch counts from the moment the change is done, so a blob that cannot be completed must not hold back the whole network. Past that, it confirms the epoch anyway and keeps fetching what it lacks in the background (epochSyncLate in its health). A node keeps the shards it loses for one more epoch, to serve them to the new holder and to readers, and deletes them at the next change of epoch.

Inconsistent blobs​

A writer could upload slivers that each match their hash in the metadata but do not come from the same data. The nodes accept them one by one, but a node that rebuilds one of them gets something else. With the same recovery symbols, it has an inconsistency proof: it sends it to the other nodes of the committee (POST …/inconsistencyProof/<type>), which check it and sign an InvalidBlobIdMsg for the current epoch. With the signatures of nodes holding f + 1 shards, it calls invalidate_blob_id on IOTA. With the committee closed (with the allowlist of version 5 of iota_storage, see operate a node), every node deletes the data of the blob right away and reading it gives 404. Without the allowlist, f + 1 shards could be in the hands of whoever joined the committee, so the nodes only mark the blob invalid and delete its data when it expires.

Storage challenges​

From version 6 of the iota_storage package, a node is paid for an epoch only if it proves that it keeps the data of its shards (storageChallenges.active in health says whether they count in the current epoch). Every epoch, each node of the committee challenges each of the others once, at a random time between 10 % and 50 % of the epoch, and tries again later (until 80 % of the epoch) if the answer is wrong or late.

  1. The challenger sends POST /v1/storage-challenges with a JSON body: the version of the challenges (2), the epoch, its node ID, a random 32-byte nonce, how many blobs can be challenged and a digest of their list (the blobs certified before the epoch, still valid, sorted by blob ID), signed with its BLS key. The challenged node only answers nodes of the current committee, once per nonce and up to 64 times per challenger and epoch. If it does not see the same list of blobs, it answers 409 VIEW_MISMATCH.
  2. The challenged node walks a chain of up to 2048 symbols of its own slivers: each step picks, from the hash of the previous step, a position uniform over all the bytes of its slivers (so each blob weighs what it takes), and the next hash covers the bytes of the symbol at that position. The chain stops earlier at 4 MiB of symbols or at 256 MiB of slivers touched. It answers with the final hash and the number of steps, in about 1.7 seconds plus 1 millisecond per step at most (3.8 seconds for 2048 steps): each step depends on the previous one, so a node without its slivers would have to fetch the symbols from the network one after the other. Without one of the slivers it cannot answer (400 MISSING_SLIVERS).
  3. The challenger then asks for the proofs with POST /v1/storage-challenges/proofs (the version, the epoch, its node ID and the nonce): for each sliver the chain touched, the symbols at the positions of its steps, each one with its Merkle proof against the hash of that sliver in the blob metadata (BCS). It checks them and rebuilds the chain. If it reaches the same hash, it signs a storage certificate message for that node and epoch and sends it with POST /v1/storage-challenges/attestations.
  4. When the signatures it received, together with its own, come from nodes holding a quorum of shards (2f + 1), the node submits its certificate to system::certify_storage on IOTA.

Each attempt carries a new nonce, and the challenged node walks its chain before answering. A challenger tries again after a minute or so when the answer is a refusal that an honest node gives for a moment (BUSY, VIEW_MISMATCH, WRONG_EPOCH or NOT_IN_COMMITTEE), but only the first 4 times per node and epoch. After that, and after any other failure, it waits 5 % of the epoch (an hour at most). Without that limit, a node could refuse every nonce whose chain falls on data it does not keep until it got one that does not.

At the change of epoch, the rewards of every node of the committee without a certificate for the epoch that ends, commission included, go to the project treasury (StorageRewardsWithheld event). Those who staked on that node get no rewards for that epoch, but keep their IOTA.

Nodes keep serving reads during challenges. Challenges make not keeping the data slow and costly, but they are not a cryptographic proof: a node very close to the others could rebuild in time what it does not keep.

Data retention​

Nodes follow the events of the iota_storage package on IOTA:

  • a renewal (BlobCertified with is_extension) extends the end epoch of that Blob;
  • when a blob ID has no valid registration left, because all its Blob objects expired or were deleted with delete_blob, the nodes delete its data;
  • when a blob ID is marked invalid (InvalidBlobID), the nodes delete its data right away if the committee is closed by the allowlist, and when it expires otherwise (inconsistent blobs);
  • burning a Blob emits no event, so the nodes keep the data until its end epoch;
  • each operator can block a blob in its own nodes, after a notice or an order about it: they stop serving it outside the committee (451), and the other nodes still get it, so it is stored and challenged like any other. Content that is illegal to keep at all is listed for deletion: the node deletes its data, neither serves nor stores it, and gathers the signatures of the nodes whose operators also list it; with nodes holding f + 1 shards, it sends delete_deny_listed_blob, and with its event (DenyListBlobDeleted) every node treats the blob ID as invalid.