
Deterministic programs in three languages
Program SDKs and porting kits
Rust, AssemblyScript and C bindings for the LayerX programs ABI, plus EVM, Solana and CosmWasm porting kits.
Write your program in Rust, AssemblyScript or C and compile it to deterministic WebAssembly for wasm32-unknown-unknown. Each SDK ships its own determinism lint and the same paid-counter reference with identical exports, storage keys and status numbers. The Rust lint reuses the node's own deterministic-subset validator, so a program the chain would reject fails on your machine first. Porting kits map an existing EVM, Solana or CosmWasm contract onto the programs ABI and name what does not carry over.
What it does
Three guest SDKs bind the LayerX programs ABI so a program compiles to deterministic WebAssembly for wasm32-unknown-unknown. Each language ships its own determinism lint, its own pinned toolchain description, and the same worked paid-counter reference with identical exports, storage keys, event layouts and status numbers. Three porting kits (EVM, Solana and CosmWasm) map an existing contract's vocabulary onto the programs ABI and name the constructs that do not carry over instead of emulating them. A port is a rewrite against the programs ABI, not bytecode compatibility; EVM bytecode runs on the Paxeer chain, which is a separate surface.
Key capabilities
- Rust
no_stdbindings that never allocate, with caller-owned buffers and checked 128-bit amounts. - AssemblyScript bindings with a source gate that refuses non-deterministic builtins before compilation.
- C bindings built freestanding with
-nostdlib, so no clock, socket or thread symbol links. - EVM, Solana and CosmWasm porting crates, each with a migration guide and an executable reference.
- One shared capability fixture read by all three languages' test suites.
layerx newscaffolds a program project;layerx program buildenforces the determinism policy locally.
Who it's for
Developers writing program logic for the LayerX agent domain, and teams porting Solidity, Anchor or CosmWasm contracts to it.
Why it matters
Determinism is refused at build time by a lint the node's own validator backs, so a program that would be rejected on-chain fails on the developer's machine first. The porting kits keep the three things a migration usually breaks (storage slot addresses, event topics and function selectors) byte-identical, so exported state imports cell for cell and existing indexer filters keep matching.
Differentiators
The EVM kit keeps keccak256(key . slot) storage slot addresses, event topic0 values and 4-byte function selectors unchanged after the port, computed with a real keccak256. A single fixture, programs/sdk/vectors/capability-boundary.kvx, is read by the Rust, AssemblyScript and C tests, so all three languages are held to the same encoded bytes. The Rust determinism lint reuses the runtime's own deterministic-subset validator and compares the SDK's frozen surface against layerx_programs_runtime, so the toolchain and the node cannot disagree.
Outcomes
- Fail a non-deterministic build on your machine before the chain rejects it.
- Keep storage slot addresses, event topics and function selectors unchanged after an EVM port.
- Hold all three languages to one shared capability fixture.
Technical notes
- Toolchain floors: cargo and rustc 1.91.1, Node.js 22 or newer with AssemblyScript pinned at 0.27.31, clang 15.0 or newer for the C bindings. The programs workspace pins edition 2021 and denies
unwrap_used,expect_used,float_arithmeticandlossy_float_literal. - All three guest toolchains declare
abi_version1 against thelayerx_v1import module. The runtime's frozen manifest also carrieslayerx_v2and alayerx_v3oracle_read, and the lint accepts--abi-version 1or2, so the v2 host surface is not yet described by a guest toolchain file. - New ports target ABI v2 through the
reference-v2guest in each kit.make programs-porting-v2-referencesbuilds all three for release, lints each at--abi-version 2, then runs them throughprograms_call_activity; execution and receipt qualification need the production C transition and that gate is recorded inqualification.kvxrather than met locally. - Two ABI v2 gaps are recorded, not papered over: Solana ports get no enumerable authenticated instruction account list, and CosmWasm's
MessageInfo.fundsis unavailable rather than empty, so monetary input stays an explicit 402LXP capability. - Guest execution is dispatched under kernel module ID 9 (
LXP_MODULE_PROGRAMS) as part of a LayerX activity, which costs 1/10 of a cent; a program writes no balances of its own. layerx new <name>scaffolds a Rust program only. The AssemblyScript and C paths start from theirexamples/paid-countertemplates.
#![no_std]
use layerx_program_sdk::{program, trap_on_panic, ProgramError};
trap_on_panic!();
program!(handle);
fn handle(value: i64) -> Result<i64, ProgramError> {
Ok(value)
}More in Developers
Payment middleware and framework integrations
Charge per request, not per checkout
ExplorePublic JSON-RPC gateway and OpenRPC schema
One endpoint for chain and agent reads
ExploreRepo build system and developer tooling
One command set builds the whole network
ExploreRunnable samples and reference apps
Samples that cannot go stale
ExploreBuild on Paxeer.
Give your agent a wallet, set its policy, and settle your first call on LayerX.