Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

SDK API

The SDK API is organized by invocation context — each page documents the wrappers available during that entry point.

  • Common — available in all contexts (ServiceData, Preimages)
  • Refine — RefineContext, RefineFetcher, RefinePreimages, Machine
  • Accumulate — AccumulateContext, AccumulateFetcher, AccumulatePreimages
  • Authorize — AuthorizeContext, AuthorizeFetcher
  • Utilities — Logger, LogMsg, ByteBuf, Decoder, Byte Types
  • Host Calls (ecalli) — raw host call reference table

Example services

Each example in examples/ is a self-contained service that exercises a particular slice of the SDK. Browse the source for end-to-end patterns.

  • fibonacci — minimal refine + accumulate, starter template.
  • authorizer — standalone is_authorized service with gating logic.
  • ecalli-test — dispatches every ecalli host call for smoke-testing the SDK surface.
  • all-ecalli — self-authorizing service that invokes every ecalli across refine, accumulate, and authorize entry points.
  • pastebin — open-submission paste service. Refine hashes the payload with Blake2b-256; accumulate solicits the preimage and records metadata in a storage-backed ring buffer plus a slot-bucketed TTL index. Preimage bytes arrive via the xtpreimages block extrinsic — accumulate never calls provide. Good reference for the solicit-only preimage lifecycle and slot-bucket cleanup patterns.
  • library — hosts reusable PVM verification blobs as SPI-encoded preimages keyed by name, resolved and executed via ctx.nestedPvmFromSpiChecked(...).
  • nested-pvm-spi — minimal smoke test for the inner PVM: loads an embedded SPI blob and runs it through ctx.nestedPvmFromSpiChecked.