DEVELOPER REFERENCE

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.

IMorpheusOracleX.sol
interface IMorpheusOracleX {
    /**
     * @dev Submit an Oracle request to the TEE prover network.
     * @param requestType Type of request ("privacy_oracle", "oracle", "compute", "automation_register", ...).
     * @param payload UTF-8 JSON payload bytes. Confidential fields stay inside encrypted_params / encrypted_payload.
     * @param callbackContract Address of the consumer contract to receive the callback.
     * @param callbackMethod String callback entrypoint on the consumer contract.
     * @return requestId The unique ID of the request.
     */
    function requestFee() external view returns (uint256);
    function request(
        string memory requestType,
        bytes memory payload,
        address callbackContract,
        string memory callbackMethod
    ) external payable returns (uint256 requestId);
}

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.

Oracle Call Pattern
// Contract Script Hash: 0x017520f068fd602082fe5572596185e62a4ad991

string payloadJson = "{"provider":"twelvedata","symbol":"NEO-USD","json_path":"price","target_chain":"neo_n3"}";

Contract.Call(
    MorpheusOracleHash,
    "request",
    CallFlags.All,
    "privacy_oracle",
    (ByteString)payloadJson,
    Runtime.ExecutingScriptHash,
    "onOracleResult"
);

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.sha256Hash

Hashes any JSON-serializable payload with SHA-256.

// PARAMETERS
input: any
// EXAMPLE
const digest = await morpheus.hash.sha256({ data: '...' });
hash.keccak256Hash

Hashes any JSON-serializable payload with Keccak-256.

// PARAMETERS
input: any
// EXAMPLE
const digest = await morpheus.hash.keccak256({ data: '...' });
crypto.rsa_verifyCrypto

Verifies an RSA-SHA256 signature (computationally efficient in TEE).

// PARAMETERS
public_key: string, signature: string, payload: string
// EXAMPLE
const isValid = await morpheus.crypto.rsa_verify(input);
math.modexpMath

Performs big integer modular exponentiation.

// PARAMETERS
base: string, exponent: string, modulus: string
// EXAMPLE
const result = await morpheus.math.modexp({ base: '2', exponent: '10', modulus: '100' });
math.polynomialMath

Evaluates a polynomial of arbitrary degree.

// PARAMETERS
coefficients: string[], x: string, modulus?: string
// EXAMPLE
const y = await morpheus.math.polynomial({ coefficients: ['1', '0', '1'], x: '2' });
matrix.multiplyLinear Algebra

Multiplies two dense matrices.

// PARAMETERS
left: number[][], right: number[][]
// EXAMPLE
const matrix = await morpheus.matrix.multiply({ left: [[1,2]], right: [[3],[4]] });
vector.cosine_similarityLinear Algebra

Computes cosine similarity between two vectors.

// PARAMETERS
left: number[], right: number[]
// EXAMPLE
const sim = await morpheus.vector.cosine_similarity({ left: [1,0], right: [0,1] });
merkle.rootMerkle

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

// PARAMETERS
leaves: string[]
// EXAMPLE
const root = await morpheus.merkle.root({ leaves: ['a', 'b', 'c'] });
zkp.public_signal_hashZKP

Computes a deterministic digest over public signals.

// PARAMETERS
circuit_id: string, signals: any[]
// EXAMPLE
const hash = await morpheus.zkp.public_signal_hash({ circuit_id: '...', signals: [] });
zkp.proof_digestZKP

Computes a deterministic digest over a proof object and optional verifying key.

// PARAMETERS
proof: any, verifying_key?: any
// EXAMPLE
const digest = await morpheus.zkp.proof_digest({ proof, verifying_key });
zkp.witness_digestZKP

Computes a digest over witness material before proving.

// PARAMETERS
witness: any, circuit_id?: string
// EXAMPLE
const digest = await morpheus.zkp.witness_digest({ witness, circuit_id: 'demo' });
zkp.groth16.prove.planZKP

Returns a planning estimate for Groth16 proving workloads.

// PARAMETERS
constraints: number, witness_count: number
// EXAMPLE
const plan = await morpheus.zkp.groth16.prove.plan({ constraints: 120000, witness_count: 4096 });
zkp.plonk.prove.planZKP

Returns a planning estimate for PLONK proving workloads.

// PARAMETERS
gates: number
// EXAMPLE
const plan = await morpheus.zkp.plonk.prove.plan({ gates: 90000 });
fhe.batch_planFHE

Builds a ciphertext batching plan.

// PARAMETERS
slot_count: number, ciphertext_count: number
// EXAMPLE
const plan = await morpheus.fhe.batch_plan({ slot_count: 4096, ciphertext_count: 8 });
fhe.noise_budget_estimateFHE

Estimates a rough FHE noise budget.

// PARAMETERS
multiplicative_depth: number, scale_bits: number, modulus_bits: number
// EXAMPLE
const estimate = await morpheus.fhe.noise_budget_estimate({ multiplicative_depth: 4, scale_bits: 40, modulus_bits: 218 });
fhe.rotation_planFHE

Returns a rotation and key-switch planning summary.

// PARAMETERS
indices: number[]
// EXAMPLE
const plan = await morpheus.fhe.rotation_plan({ indices: [1, 3, -2] });
privacy.maskPrivacy

Masks a sensitive string, leaving edges visible.

// PARAMETERS
value: string, unmasked_left: number, unmasked_right: number
// EXAMPLE
const masked = await morpheus.privacy.mask({ value: 'secret_key', unmasked_left: 2, unmasked_right: 2 });
privacy.add_noisePrivacy

Adds simulated Laplace noise for differential privacy.

// PARAMETERS
value: number, scale: number
// EXAMPLE
const noisy = await morpheus.privacy.add_noise({ value: 100, scale: 1.0 });
Previous Networks & ContractsNextAttestation Spec
REVISION 1.0.2LAST UPDATED: 2026-03-11