Skip to content
ReferenceTestnet: see pageMainnet: Not availableSoftware: Core bad4a06ea · protocol pqwerai-v8-testnet/1Updated

WASM deployment and verification

Use Contract Studio to build the artifact, encode constructor arguments, simulate creation, estimate gas, sign locally and verify the deployed module. Standard JSON-RPC carries the transactions and reads; there is no separate WASM account or wallet balance.

Creation payload and artifacts

The adapter wraps the compiled module using the following byte layout:

creation transaction data:
  ef 57 49 00 | module length (u32, big-endian) | module bytes | ABI constructor arguments

WASM module header:
  00 61 73 6d 01 00 00 00

stored-code identifying prefix:
  ef 57 41 00

The module-length field counts only module bytes. Constructor arguments are appended after the module, without a selector. Send creation data with no recipient address. A raw .wasm module or a C# DLL is not the complete creation payload. The stored-code prefix identifies a WASM account; it is not itself a source-verification proof.

eth_call can simulate the exact creation transaction. Studio refuses a WASM deployment when its connected-chain capability check says the VM is unavailable. eth_estimateGas estimates the whole transaction, including constructor execution; do not copy EVM tutorial gas measurements into a WASM deployment.

Verify the module

After a successful receipt, Studio checks that eth_getCode returns the WASM stored-code marker and locates the contract's WasmDeployed(bytes32,uint32) deployment log. It compares the recorded module hash with Keccak-256 of the raw module it compiled, excluding the creation wrapper and constructor arguments.

Result Meaning
WASM module verified Recorded module hash matches the compiled module
WASM contract present, record missing Verification is unknown; required deployment logs may be unavailable
Module differs Deployment identity does not match the selected artifact
Code is not WASM Wrong address, failed deployment or incompatible execution result

Retain the receipt and deployment block. For another verification, query the address's deployment logs and compare the module hash against a reproducible rebuild. Confirm the receipt is still canonical and apply your finality policy. A matching module hash does not prove constructor arguments, current storage or contract safety. Record those separately.

Reproduce the build

Keep the project source and attachments, SDK version, compiler archive and executable identities, wallet build and translator revision, flags, ABI and constructor arguments. Build twice with the same inputs and compare the raw module bytes and hash. For C#, Roslyn's deterministic flag alone does not pin the IL-to-WASM translator. For C++, keep the complete wasi-sdk toolchain and linker identity.

Store the module identity alongside chain ID, genesis identity, address, transaction, block and verification result. Save the Studio project after deployment so these records remain associated with the build.

Troubleshooting

Symptom Check and correction
C++ / C# absent from language list Use a wallet build containing the corresponding Studio adapter
WASM VM unavailable Run Check connected chain; verify the node and its authenticated chain profile
System.Runtime.dll missing Select csc.dll inside a complete SDK with its reference packs
C# feature not supported Rewrite within the supported subset; Roslyn success is only the first compilation stage
C++ include refused Attach the file using a project-relative path; use allowed SDK or freestanding headers
Undefined libc / foreign import Remove runtime dependencies; the VM provides only its approved host interface
No functions in console Add correct // @abi declarations and recompile
Function reverts with empty data Check selector, argument size and padding, attached value, bounds and explicit revert paths
Increment appears to disappear Send a transaction and wait for its receipt; eth_call only simulates it
Count resets between calls Persist it through storage imports, not static fields or linear memory
Out of gas Estimate the exact transaction; bound loops, recursion, copies and subcalls
Verification is unknown Retrieve deployment logs from a node retaining them; keep the receipt and module
Rebuilt module differs Compare source, SDK, compiler, linker, translator revision and flags

Verification limits

The checked-in wallet has compiler, ABI, deployment and VM-conformance tests for C++ and C#. Historical test results have their own source pins. For these tutorial files, local verification on 21 November 2026 compiled each language twice with the pinned compiler, confirmed identical module bytes and checked the generated ABI and deployment plan. The modules were 723 bytes (C++) and 1,331 bytes (C#). No live deployment of these tutorial files was performed in that verification. These guides do not establish a new network deployment or independent security audit. Public release acceptance, mixed-version rollout, explorer presentation and independent assurance remain separate requirements. Generic Rust, Go, C or AssemblyScript contracts have no supported Studio authoring workflow in this revision.

For the EVM runtime-bytecode procedure, see Contract verification.


Sources at 83ff5b69f0 (project repository, not public yet): apps/pqwerai-wallet-windows/src/PqwerAI.Wallet.Core/Studio/Wasm/WasmAdapters.cs · apps/pqwerai-wallet-windows/src/PqwerAI.Wallet.Core/Studio/StudioEngine.cs · apps/pqwerai-wallet-windows/src/PqwerAI.Wallet.Core/Studio/StudioModels.cs · apps/pqwerai-wallet-windows/docs/STUDIO_DEVELOPER_GUIDE.md · developers/examples/wasm/Counter.cpp · developers/examples/wasm/Counter.cs

Found a problem? Report a documentation issue · Build testnet-20778+83ff5b69f0