EXTENDED DOCUMENTATION

Built-in Compute Functions

Morpheus Compute exposes built-in heavy functions through

text
POST /compute/execute
.

Request Shape

json
{
  "mode": "builtin",
  "function": "math.modexp",
  "input": {
    "base": "2",
    "exponent": "10",
    "modulus": "17"
  },
  "target_chain": "neo_n3"
}

Available Built-ins

text
hash.sha256

Hashes any JSON-serializable input.

text
hash.keccak256

Keccak-256 digest for EVM-oriented preprocessing and cross-checks.

text
crypto.rsa_verify

Verifies an RSA-SHA256 signature off-chain. RSA signature verification is computationally extremely expensive to execute natively within EVM or Neo N3 smart contracts. Takes

text
public_key
(PEM text),
text
signature
(hex string), and
text
payload
(string). Returns
text
{"is_valid": true/false}
.

text
math.modexp

Big integer modular exponentiation for cryptographic preprocessing.

text
math.polynomial

Evaluates a polynomial of arbitrary degree ($c_n x^n + \dots + c_1 x + c_0$) off-chain. Especially useful when degrees are very large and gas costs would exceed block limits. Takes

text
coefficients
(array of numbers from highest degree to constant $c_0$),
text
x
(number to evaluate at), and an optional
text
modulus
.

text
matrix.multiply

Dense matrix multiplication.

text
vector.cosine_similarity

Vector similarity scoring.

text
merkle.root

Builds a SHA-256 Merkle root from a list of leaves.

text
zkp.public_signal_hash

Normalizes and hashes a public signal set.

text
zkp.proof_digest

Builds a deterministic digest of a proof object and optional verifying key context.

text
zkp.witness_digest

Builds a deterministic digest of witness material before proving.

text
zkp.groth16.prove.plan

Returns a planning estimate for Groth16 proving workloads.

text
zkp.plonk.prove.plan

Returns a planning estimate for PLONK proving workloads.

text
fhe.batch_plan

Returns a batching/packing plan based on slot and ciphertext counts.

text
fhe.noise_budget_estimate

Returns a coarse planning estimate for FHE noise budget based on depth and modulus settings.

text
fhe.rotation_plan

Returns a rotation/key-switch planning summary for vector index usage.

text
privacy.mask

Masks a sensitive string, leaving edge characters visible (e.g. for partial logging in TEE). Takes

text
value
,
text
unmasked_left
(default 2), and
text
unmasked_right
(default 2).

text
privacy.add_noise

Adds simulated Laplace noise to a numeric value for differential privacy use cases. Takes

text
value
and
text
scale
(default 1.0).

Notes

These built-ins are the first production-facing layer of Morpheus Compute. They are intentionally designed so that later Phala worker profiles can replace the internal implementation with real external ZKP / FHE engines while preserving the API surface.

Previous Examples PortfolioNextSupported Providers
REVISION 1.0.2LAST UPDATED: 2026-03-11
Morpheus Oracle