Skip to main content

Contracts and testnet IDs

The network runs on two Move packages on IOTA:

PackageWhat it contains
almacenThe system (System: BLS committee, prices, capacity, accounting per epoch), Blob and Storage, staking (Staking, pools, committee by stake, epochs), the project treasury (treasury), events and Display. Payments and stake are in iota::iota::IOTA.
sitiosSites: Site (with Display), one Resource per path, routes, redirects, metadata and events.

IOTA testnet​

ObjectID
Package almacen0x6c5fef208f3d3de114b9debdfeeed88762bff823486135c82b0447b5541ac142
System0xedc9b3efa90d0bba4da9819e2c08becc0d230de36b7921040c1f53c0c6ee90cc
Staking0x44d4a6a113cd7530cab0a6a8dd40717534cd5a89be78e130c72504c08f92b5a2
Treasury0x8e28d541b98302744afc9b0dbbd9a7680200c7a63d70839057429ca7ea1fa64c
Package sitios0xfffd81708ef3474d7cbd5a496246b03603a27c8a747415ea1d1e2632019a3c30
  • Chain: IOTA testnet. Public RPC: https://api.testnet.iota.cafe.
  • Configuration: 4 storage nodes with 25 shards each (100 shards), 1 IOTA of stake in each, 1-day epochs and at most 53 epochs per purchase.
  • Types: a stored blob is a <almacen>::blob::Blob and a site is a <sitios>::site::Site, where <almacen> and <sitios> are the package IDs above.

Main functions​

Storing and managing blobs (package almacen):

FunctionWhat it does
system::reserve_spaceBuys a Storage of a given encoded size for some epochs, paying in IOTA.
system::register_blobRegisters a blob ID on a Storage and creates the Blob, paying the write fee. The contract recomputes the blob ID from the Merkle root and the size.
system::certify_blobCertifies the blob with the aggregated BLS signature of a quorum of shards and the bitmap of the signers.
system::extend_blobRenews a certified, unexpired Blob for more epochs, paying in IOTA.
system::delete_blobDeletes a deletable Blob and returns its Storage.
blob::burnDestroys a Blob object.

reserve_space, register_blob and extend_blob take the payment as a &mut Coin<IOTA> and charge exactly what is due, so the client can pay storage from the gas coin in the same transaction.

Sites (package sitios, module site): new_site, new_resource, add_header, add_resource, remove_resource_if_exists, create_routes, insert_route, remove_all_routes_if_exist, create_redirects, insert_redirect, take_redirects_if_exist, update_name, update_metadata and burn.

Treasury (module treasury): anyone can deposit; only the holder of the TreasuryAdminCap can withdraw.

Events​

The storage nodes follow the events of the events module: BlobRegistered, BlobCertified (also emitted by a renewal, with is_extension), BlobDeleted and InvalidBlobID, among others. The treasury emits TreasuryDeposit and TreasuryWithdrawal.

Notes​

  • BLS keys. IOTA testnet and mainnet disable the uncompressed G1 functions, so the nodes' public keys are stored as Element<G1> and added with g1_add. A certificate is the aggregated signature of the signers, verified with bls12381_min_pk_verify against the sum of their keys.
  • Treasury. The treasury module receives 3 % of the rewards of each epoch and the commission of slashed nodes.
  • IOTA Names. The sitios package does not depend on IOTA Names: the portal resolves the names.

Tests​

  • almacen: 268/268 Move tests, 5 of them for the treasury.
  • sitios: 39/39 Move tests.
  • End-to-end tests on IOTA testnet: storing through the publisher, paying from a wallet and renewing, transferring and deleting, and publishing, serving, updating and destroying sites.