API Reference
Complete technical specifications for the Morpheus smart contracts and the Enclave Javascript SDK.
1. Smart Contract Interface (Solidity Reference)
Neo X live contract publication is still pending, but the reference interface below matches the current repository contracts and examples.
2. Smart Contract Interface (C#)
To interact with the Morpheus Oracle on Neo N3 mainnet, use Contract.Call against 0x017520f068fd602082fe5572596185e62a4ad991 or NeoNS oracle.morpheus.neo.
3. Enclave SDK (Javascript)
When using built-in compute, Morpheus exposes a fixed catalog of functions. Custom JS compute receives input and helpers; Oracle custom JS receives data, context, and helpers.
hash.sha256HashHashes any JSON-serializable payload with SHA-256.
const digest = await morpheus.hash.sha256({ data: '...' });hash.keccak256HashHashes any JSON-serializable payload with Keccak-256.
const digest = await morpheus.hash.keccak256({ data: '...' });crypto.rsa_verifyCryptoVerifies an RSA-SHA256 signature (computationally efficient in TEE).
const isValid = await morpheus.crypto.rsa_verify(input);math.modexpMathPerforms big integer modular exponentiation.
const result = await morpheus.math.modexp({ base: '2', exponent: '10', modulus: '100' });math.polynomialMathEvaluates a polynomial of arbitrary degree.
const y = await morpheus.math.polynomial({ coefficients: ['1', '0', '1'], x: '2' });matrix.multiplyLinear AlgebraMultiplies two dense matrices.
const matrix = await morpheus.matrix.multiply({ left: [[1,2]], right: [[3],[4]] });vector.cosine_similarityLinear AlgebraComputes cosine similarity between two vectors.
const sim = await morpheus.vector.cosine_similarity({ left: [1,0], right: [0,1] });merkle.rootMerkleBuilds a SHA-256 Merkle root from a list of leaves.
const root = await morpheus.merkle.root({ leaves: ['a', 'b', 'c'] });zkp.public_signal_hashZKPComputes a deterministic digest over public signals.
const hash = await morpheus.zkp.public_signal_hash({ circuit_id: '...', signals: [] });zkp.proof_digestZKPComputes a deterministic digest over a proof object and optional verifying key.
const digest = await morpheus.zkp.proof_digest({ proof, verifying_key });zkp.witness_digestZKPComputes a digest over witness material before proving.
const digest = await morpheus.zkp.witness_digest({ witness, circuit_id: 'demo' });zkp.groth16.prove.planZKPReturns a planning estimate for Groth16 proving workloads.
const plan = await morpheus.zkp.groth16.prove.plan({ constraints: 120000, witness_count: 4096 });zkp.plonk.prove.planZKPReturns a planning estimate for PLONK proving workloads.
const plan = await morpheus.zkp.plonk.prove.plan({ gates: 90000 });fhe.batch_planFHEBuilds a ciphertext batching plan.
const plan = await morpheus.fhe.batch_plan({ slot_count: 4096, ciphertext_count: 8 });fhe.noise_budget_estimateFHEEstimates a rough FHE noise budget.
const estimate = await morpheus.fhe.noise_budget_estimate({ multiplicative_depth: 4, scale_bits: 40, modulus_bits: 218 });fhe.rotation_planFHEReturns a rotation and key-switch planning summary.
const plan = await morpheus.fhe.rotation_plan({ indices: [1, 3, -2] });privacy.maskPrivacyMasks a sensitive string, leaving edges visible.
const masked = await morpheus.privacy.mask({ value: 'secret_key', unmasked_left: 2, unmasked_right: 2 });privacy.add_noisePrivacyAdds simulated Laplace noise for differential privacy.
const noisy = await morpheus.privacy.add_noise({ value: 100, scale: 1.0 });