Skip to main content

Module protocol

Module protocol 

Source
Expand description

Public contracts for Arete Protocols.

Every contract is camelCase JSON that rejects unknown fields, floats and null for optional fields, is bounded, and is hashed with the Arete JCS profile under its own hash kind. Rust and TypeScript run the shared vectors in test-vectors/protocol-v1.json and must agree on every hash and every error code.

Structs§

AccountReadResultV1
One account as read from chain. A missing account has exists: false and no other data fields.
AtaGlueV1
BindV1
BuildCompilerV1
BuildDependencyV1
BuildOutputsV1
CtxCallRecordV1
DeploymentInputV1
The deployment an invocation runs under and the platform keys it names. The same values are the deployment.* expression root.
DeriveRuleV1
EventV1
ExecutionIntentV1
FeeAdjustmentV1
Why the platform leg differs from the fee policy’s rate.
FeeContextV1
FieldSchemaV1
GeneratorV1
GlueV1
GuardV1
InstanceInputV1
IntentDeploymentV1
IntentFeesV1
IntentSignerV1
IntentTransactionV1
MachineV1
MachinesV1
MemoV2
The fields of an attested Memo v2: arete:p2:<shortId>:<scope|->:<instance>:<participant|->:<step>:<n>/<count>.
MetadataFieldV1
MetadataSchemaV1
MetadataV1
ObjectSchemaV1
A restricted JSON Schema subset for args, params, resources and metadata.
ParticipantInputV1
PortableAccountMetaV1
PortableInstructionV1
PrepareInputV1
What the API hands the host for one invocation. Every value is fixed by the API before dispatch; handlers have no clock, RPC or randomness.
PreparedOperationV1
What a handler returns.
PreparedTransactionV1
ProgramDependencyV1
ProtocolBuildReceiptV1
ProtocolContractError
A contract validation failure with a stable, language-neutral code.
ProtocolExecutionReceiptV1
A signed execution receipt.
ProtocolReceiptKeySetV1
The published receipt keys. A retired key still verifies receipts issued before retiredAt, so old receipts stay checkable after a rotation.
ProtocolReceiptKeyV1
ProtocolReleaseReviewV1
ProtocolReleaseV1
ProtocolResourceV1
ProtocolSpecV1
ProtocolStackDependencyV1
ProtocolStackSourceV1
ProviderSnapshotV1
ReactionV1
ReadInputV1
A declared read: the raw account plus, for account reads, the fields decoded with the program’s ProgramSpec.
ReceiptDeploymentV1
ReceiptFeesV1
The fee legs charged in this intent, in base units of asset.
ReceiptSignatureV1
ReceiptTransactionV1
Which transaction of the intent this is: index counts from 0, the memo’s <n>/<count> counts from 1.
ReleaseDependenciesV1
RemainingAccountV1
One trailing account of a template instruction. pubkey is an account expression; remaining accounts never sign, so is_signer is always false.
ResourceDeclV1
RoleV1
SdkExtensionDependencyV1
ServerDerivedRelease
Everything server-side derivation produces from one upload.
SnapshotReadV1
StackActivityV1
StackDependencyV1
StackGenerationError
A spec or option the generator cannot turn into a stack. The messages match the TypeScript generator’s.
StackInstanceAccountV1
StackInstanceFieldV1
StackSourceOptions
Options of generate_stack_source. Field names match the TypeScript GenerateStackSourceOptions, so the shared vectors deserialize directly.
StackSurfaceV1
What the generated protocol stack tracks.
StateV1
StepV1
TemplateInstructionV1
TransitionV1
WrapSolV1

Enums§

ActionV1
AuthorityV1
BuildV1
BuiltinProgram
CtxMethod
The closed ctx method set of arete.protocol-ctx/v1.
FeeAdjustmentKind
FeeAssetV1
FeeBasisV1
FeePlacement
FieldType
InstanceVisibility
IntentFeeAssetV1
MachineKind
MetadataWriter
ObjectType
ProtocolContractKind
A contract kind that the shared vectors exercise.
ProtocolProgramV1
ReadV1
A declared chain read. Guards, derivations and templates see its result as reads.<name>.
ReceiptStatus
ReleaseDerivationError
A spec, bundle or stack the release cannot be derived from.
SessionKeyClass
SignerClass
StackProfile
StackProgramSource
Where a program’s IDL comes from in the generated Stack Source.
StateKind
StepAccess
StepScope
StringFormat
String formats. Integer base units are decimal strings.
TransactionFormat
TriggerV1
TrustTier
The trust tier a deployment runs at.

Constants§

DEFAULT_MEMO_PROGRAM_IDL
The default IDL file of the SPL Memo program in the full profile.
EXECUTION_INTENT_SCHEMA_V1
MAX_CTX_CALLS
MAX_HANDLER_RESULT_BYTES
MAX_INSTRUCTION_ACCOUNTS
MAX_INSTRUCTION_DATA_BYTES
MAX_INTENT_TRANSACTIONS
MAX_OPERATION_TRANSACTIONS
MAX_RECEIPT_KEYS
At most this many keys in a published key set.
MAX_RECEIPT_SIGNATURES
At most this many receipt-key signatures, sorted by keyId.
MAX_TRANSACTION_INSTRUCTIONS
MEMO_PROGRAM_ALIAS
The program alias the full profile gives the SPL Memo program.
MEMO_V2_PREFIX
The memo prefix of Memo v2.
PROTOCOL_BUILD_RECEIPT_SCHEMA_V1
PROTOCOL_CTX_V1
PROTOCOL_ERROR_CODES
Every stable error code a protocol contract validator can return.
PROTOCOL_EXECUTION_RECEIPT_SCHEMA_V1
PROTOCOL_HANDLER_ABI_V1
PROTOCOL_RECEIPT_KEYS_SCHEMA_V1
PROTOCOL_RELEASE_REVIEW_SCHEMA_V1
PROTOCOL_RELEASE_SCHEMA_V1
PROTOCOL_RESOURCE_SCHEMA_V1
PROTOCOL_SPEC_SCHEMA_V1
PROTOCOL_STACK_SOURCE_SCHEMA_V1
PROVIDER_SNAPSHOT_SCHEMA_V1
RESERVED_GUARD_CODES
Validate a ProtocolSpec JSON value and return the typed model. Rejection codes a prepare returns for access refusals and terminal lifecycle states. A guard may not use them, so a client can always tell a guard failure from these.
SERVER_COMPILER_ESBUILD
The server never bundles: the uploaded bundle is used as is. The receipt contract requires a semver here, so the server records 0.0.0.
SERVER_COMPILER_NAME
The compiler and stack-generator name of server-side derivation.
SERVER_DERIVATION_VERSION
The version of server-side derivation. It changes only when the derived documents for the same inputs change, never with crate releases, so re-uploading the same spec stays idempotent across server upgrades.
STACK_SOURCE_SCHEMA_V1

Functions§

decode_base64
Strict standard base64 with padding. Returns None for any non-canonical encoding.
default_stack_generator
The default generator identity: this crate’s name and version.
derive_release
The release document of a spec, its handler bundle (exactly when a step has a handler) and its stack source, under compiler.
derive_server_release
Derive the stack source, release and receipt of an uploaded spec (and bundle) under server_compiler. Deterministic: identical inputs give identical documents and hashes.
encode_base64
generate_stack_source
Generate the protocol stack source of a validated spec.
hash_handler_bundle
The identity of a handler bundle: its exact ESM bytes.
instance_owned_accounts
The accounts the create step binds from one of its ephemeral keys, the instance’s own accounts: the only accounts the full profile matches direct activity on (see the TypeScript generator’s “Direct activity”). A binding qualifies only when its whole expression is a pure derivation of a key the create step declares (see [is_fresh_derivation]); one that merely mentions ephemeral.<name> somewhere (under if, ?? or an operator, say) could evaluate to some other, possibly shared, account.
memo_id
The memo form of an instance or participant UUID: base58 of its 16 bytes. None for text that is not a lowercase UUID.
parse_contract_json
Parse contract JSON bytes with the strict hash-profile parser, mapping its failures to protocol error codes.
parse_memo_v2
Parse an attested Memo v2 text. None when it is not one.
parse_prepared_operation_v1
Validate a handler’s result shape and size bounds. Program, account and signer policy is checked afterwards against the step by the trusted transaction compiler.
parse_protocol_spec_v1
Parse and fully validate a ProtocolSpec from JSON bytes.
receipt_body_bytes
The body of a receipt JSON value (signatures removed) in Arete JCS form. Works on any receipt-shaped value, so verifiers can hash the body exactly as served.
receipt_signing_message
The exact bytes a receipt key signs: arete.protocol-execution-receipt/v1\n<keyId>\n<bodySha256>.
release_dependencies
Release dependencies: every ProgramSpec program and stack, sorted by alias; builtins excluded.
review_signing_message
The exact bytes a reviewer signs: arete.protocol-release-review/v1\n<keyId>\n<trustTier>\n<releaseHash>. Hosts and the API verify against these bytes with the same public keys.
server_compiler
The compiler identity of server-side derivation.
server_stack_generator
The stack generator identity of server-side derivation.
server_stack_source_options
Stack-source options of server-side derivation: the interim profile, the generator defaults for program sources, and the server generator identity.
validate_execution_intent_value
validate_prepared_operation_value
validate_protocol_build_receipt_value
validate_protocol_execution_receipt_value
validate_protocol_receipt_key_set_value
validate_protocol_release_review_value
validate_protocol_release_value
validate_protocol_resource_value
validate_protocol_spec_value
validate_protocol_stack_source_value
validate_provider_snapshot_value

Type Aliases§

ContractValue
Parsed form of the canonical JSON value of any contract.
ProtocolResult