Networks and Endpoints
The Morpher Oracle is available on both Radix Mainnet and Stokenet (testnet). This page provides the network configurations, API endpoints, and component addresses for both networks.
Oracle Request Flow
The following diagram illustrates the complete flow of a signed price request in the Morpher Oracle system:
Detailed Flow Explanation
-
User Request: The user interacts with the frontend application and initiates a transaction that requires price data.
-
DApp Backend Signing: The DApp backend creates a signed request that includes:
- Market ID (e.g., “GATEIO:XRD_USDT”)
- NFT ID (subscription identifier)
- Public key (stored in the NFT)
- Signature (signed with the DApp’s private key)
-
Oracle Request: The signed request is sent to the Oracle backend.
-
Oracle Verification: The Oracle backend verifies:
- The signature is valid (signed by the DApp)
- The NFT exists and is valid
- The public key in the request matches the one stored in the NFT
-
Oracle Response: If verification passes, the Oracle:
- Gets the latest price data
- Signs it with the Oracle’s private key
- Returns the signed price data
-
Transaction Creation: The frontend creates a transaction manifest that includes the signed price data.
-
Smart Contract Verification: The process works as follows:
- The smart contract calls the Oracle component with the signed price data
- The Oracle component verifies the signature and returns a PriceMessage
- The smart contract checks that the price data is fresh (not too old)
- The smart contract executes its business logic (e.g., minting a Gumball token)
For more details on how the Oracle handles timestamp validation, especially for markets with limited trading hours, see our Timestamp Validation guide.
This secure flow ensures that only authorized DApps can access Oracle data and that the data used in transactions is authentic and up-to-date.
Network Configurations
Mainnet Configuration
Component | Address/URL |
---|---|
Network ID | 1 (RadixNetwork.Mainnet) |
API Endpoint | https://radix-oracle-api.morpher.com |
Sample API Endpoint | https://radix-sample-dapp-api.morpher.com |
Dapp Definition Address | account_rdx1298rzsrujtaqsd2nv4skp8p7er5s6egeyhwtkrxx0lnksgyd270dex |
Oracle Component Address | component_rdx1cpqcyrrmjtkm8a34nj8u4lu63ljq93uajzh385r7c94vfptqm4jqj6 |
Oracle Subscription Component Address | component_rdx1cqeam5fe0jmy2x0hfanzcherd8tvfg5pqwfa8sjzw7azuk0d3vwygl |
Oracle Subscription Resource Address | resource_rdx1nfeeyrpqdkrcjmng09tdrtr6cpknlz0qadra0p3wc3ffg7p6w848gd |
Gumball Resource Address | resource_rdx1thx5qvj20fayeyxs0zhcsd95jw8773mg62x7l8e59rfp7dfswkhjyc |
Gumball Component Address | component_rdx1cqn8rzy7ejdz497jy8u5qpgrwe0lvhvdhz6jmht4ng99fd825smkyp |
XRD Address | resource_rdx1tknxxxxxxxxxradxrdxxxxxxxxx009923554798xxxxxxxxxradxrd |
Stokenet Configuration
Component | Address/URL |
---|---|
Network ID | 2 (RadixNetwork.Stokenet) |
API Endpoint | https://dev-test-radix-oracle-api.morpher.com |
Sample API Endpoint | https://dev-test-radix-sample-dapp-api.morpher.com |
Dapp Definition Address | account_tdx_2_12xmevme9ujzqe3yuyq37ampaa2dw633luw8446gumfycltqe5qty66 |
Oracle Component Address | component_tdx_2_1cqv8gntu3avns3e8ft3v9ju7wk2n7yhlzrkygc64hpvjkcnjpyglr8 |
Oracle Subscription Component Address | component_tdx_2_1cqd5w7as9mq5rzrjtavnaauhtwh7kgu9lxumdtdpqkv3erj0u9dy2n |
Oracle Subscription Resource Address | resource_tdx_2_1nt8kpf7m6g9l0p6w6yu4jd0pc4vac564s8f20qmzf782r90fmrgrpt |
Gumball Resource Address | resource_tdx_2_1t4tf97xvmkkjsdwejp40h942wgftaefa07jl7m4m0akwwqdq7s9nsn |
Gumball Component Address | component_tdx_2_1cz7h4d9vvq76w9mwly2g2nma7h3h4rfu2gf6cc02w56fs3xsw5cueh |
XRD Address | resource_tdx_2_1tknxxxxxxxxxradxrdxxxxxxxxx009923554798xxxxxxxxxtfd2jc |
Environment Variables
When integrating the Morpher Oracle into your application, you should use environment variables to configure the network settings. The tables above show the current values for reference, but you should always use the environment variables in your code to ensure you’re using the correct values for your environment.
For a complete implementation example of how to use these environment variables, see the Integration Guide.
API Endpoints
Oracle API
The Oracle API provides endpoints for requesting signed price data:
- Price Endpoint (v2):
{API_ENDPOINT}/v2/price/{marketId}/{publicKey}/{nftId}/{signature}
marketId
: The ID of the market (e.g., “GATEIO:XRD_USDT”)publicKey
: Your BLS public keynftId
: Your subscription NFT IDsignature
: Signature of the request
Sample API
The Sample API provides simplified endpoints for demonstration purposes:
- Get Price:
{SAMPLE_API_ENDPOINT}/example/getPrice
- Returns signed price data for a predefined market
Using the Network Configuration
In your application, you can use the network configuration as follows:
import { RadixNetwork } from '@radixdlt/radix-dapp-toolkit';
// Network configuration based on selected network
const getNetworkConfig = (network: 'mainnet' | 'stokenet') => {
return {
networkId: network === 'mainnet' ? RadixNetwork.Mainnet : RadixNetwork.Stokenet,
apiEndpoint: network === 'mainnet'
? process.env.NEXT_PUBLIC_RADIX_MAINNET_API_ENDPOINT
: process.env.NEXT_PUBLIC_RADIX_STOKENET_API_ENDPOINT,
sampleApiEndpoint: network === 'mainnet'
? process.env.NEXT_PUBLIC_RADIX_MAINNET_SAMPLE_API_ENDPOINT
: process.env.NEXT_PUBLIC_RADIX_STOKENET_SAMPLE_API_ENDPOINT,
dappDefinitionAddress: network === 'mainnet'
? process.env.NEXT_PUBLIC_RADIX_MAINNET_DAPP_DEFINITION_ADDRESS
: process.env.NEXT_PUBLIC_RADIX_STOKENET_DAPP_DEFINITION_ADDRESS,
oracleComponentAddress: network === 'mainnet'
? process.env.NEXT_PUBLIC_RADIX_MAINNET_ORACLE_COMPONENT_ADDRESS
: process.env.NEXT_PUBLIC_RADIX_STOKENET_ORACLE_COMPONENT_ADDRESS,
// ... other configuration properties
};
};
// Get the configuration for the current network
const networkConfig = getNetworkConfig(currentNetwork);
For a complete implementation example, see the Integration Guide.