Quickstart
Integrate the Morpheus Privacy Oracle into your Neo smart contracts in under 5 minutes. This guide covers the end-to-end flow from encrypting secrets to reading the TEE-verified result on-chain.
Step 1: Understand the Data Flow
The Morpheus network requires an asynchronous request-callback pattern. You must implement a callback function in your contract to receive the response.
Step 2: Seal Your Parameters (Off-Chain)
Before calling the Oracle contract, encrypt any sensitive API keys or parameters locally. The worker's active X25519 public key is exposed through the frontend proxy and also published on-chain in the Oracle registry metadata.
Step 3: Submit On-Chain Request
Build a JSON payload, then pass that payload bytestring to the Oracle contract. On Neo N3 the request currently costs 0.01 GAS of prepaid credit; on Neo X the reference interface uses requestFee().
Step 4: Await the Relayer Callback
Once the transaction is mined, the Morpheus Relayer detects the event, forwards the encrypted payload to the Phala TEE, and then submits a callback transaction back to your contract containing the signed result envelope. If the upstream fetch or compute fails, the request should still finalize with a failure callback instead of being silently dropped.
Zero-Code Testing (Mainnet)
You don't need to write or deploy your own Consumer contract to test Morpheus! We have deployed a universal OracleCallbackConsumer shell on Neo N3 mainnet at 0x89b05cac00804648c666b47ecb1c57bc185821b7.
1. Submit Request: Generate your JSON payload using the Dashboard Oracle Builder. Then, invoke request on the MorpheusOracle ({NETWORKS.neo_n3.oracle}) directly using NeoLine or Neo-CLI:
- Arg 1 (String):
"privacy_oracle"or"compute" - Arg 2 (ByteString): Your generated JSON payload string
- Arg 3 (Hash160):
0x89b05cac00804648c666b47ecb1c57bc185821b7 - Arg 4 (String):
"onOracleResult" - Fee: Attach exactly
0.01 GASto the transaction invocation.
2. Read Result: Check your transaction to get the requestId. Wait about 60 seconds, then perform a read-only invoke of getCallback(requestId) on the consumer script hash above to view your completely executed result envelope!