The Static Oracle is a lightweight, configuration-driven Account Lookup Service (ALS) oracle implementation designed for resolving party lookups to Digital Financial Service Providers (DFSPs) without relying on a database.
It primarily supports Sub-ID based routing, specifically for use cases where the Payer DFSP explicitly specifies the Payee DFSP. This is common in environments where infrastructure or specific scheme rules require the sender to select the destination provider (e.g., selecting a bank from a list).
This approach provides elegant solutions for several common challenges:
- Solves the "Duplicate Wallet" Problem: By routing based on the combination of ID and Target Provider (Sub-ID), it allows a single identifier (like an MSISDN) to be associated with multiple wallets across different providers.
- Supports Inherent Routing Info: It seamlessly handles traditional identifiers where routing logic can be derived directly from the ID itself (e.g., account numbers containing bank codes or specific mobile prefixes).
- Lowers Barriers to Adoption: It eliminates the need for a complex central registry or user "opt-in" process. Users are reachable immediately as long as the sender can select the correct provider, simplifying integration for DFSPs.
In this flow:
- The Payer provides the Payee ID and a Sub-ID (representing the target DFSP code, e.g.,
UG-ORG001). - The Oracle maps this
subIdto the corresponding network-levelFSP_ID. - The ALS routes the transaction to the resolved DFSP.
While designed for this explicit selection model, the Oracle is generic enough to also support:
- Full match based routing (e.g., exact MSISDN)
- Prefix-based routing
The oracle evaluates incoming party lookup requests against a set of static rules defined via configuration and returns the corresponding DFSP ID.
This service is ideal when:
- DFSP routing logic is known in advance.
- Routing is based on Sub-ID, prefix, or exact identifier match.
- Dynamic registration (POST /participants) is not required.
- Operational simplicity is preferred over maximum flexibility.
- Stateless: No database dependency.
- Config-driven: All routing logic defined in configuration (rules).
- Deterministic: First matching rule wins.
- Deployable independently: Not a hard dependency of Mojaloop core Helm charts.
- Environment-specific: Different rule sets per environment.
Instead of querying a dynamic database, the Static Oracle uses a high-performance Routing Engine to compile a "Decision Table" (JSON configuration) into optimized lookup structures (maps, tries, regex arrays) at startup.
For deep technical details on the matching algorithm, performance, and rule configuration, please refer to the Routing Engine Documentation.
The service is typically deployed as an environment-specific add-on rather than a core dependency.
- Rule Definition: Rules are defined in a configuration file (typically via Helm values or a
default.jsonin local development). - Deployment: The service is enabled in the environment pipeline (e.g., set
mlSubIdMappingOracleEnabled: true). - Mapping Config: The actual mappings are provided in the values file.
Example Configuration (Conceptual):
subIdMap:
ACCOUNT_ID: &dfspCodeMap
"dfsp_a_code": "DFSP_A"
"dfsp_b_code": "DFSP_B"
MSISDN: *dfspCodeMapTo enable the Static Oracle:
- Deploy: Enable the add-on in the environment pipeline configuration.
- Configure: Provide the DFSP mappings in the values file (
mlSubIdMappingOracle.yaml). - Update ALS: Ensure the Account Lookup Service (ALS) is configured to route lookup requests to this Static Oracle endpoint.
git clone git@github.com:mojaloop/als-static-oracle-svc.gitAdd the 127.0.0.1 als-static-oracle-svc.local entry in your /etc/hosts so the als-static-oracle-svc is reachable on http://als-static-oracle-svc.local:3000. Elsewhere use http://localhost:3000
cd als-static-oracle-svc
npm cinpm run docker:build
npm run docker:runTo check the als-static-oracle-svc health visit http://als-static-oracle-svc.local:3000/health
docker-compose up -d mysql
npm run migrate
npm run startWe use multi-file-swagger to make our swagger files more manageable.
After making changes to the .yaml files in ./src/interface/, update the swagger.json file like so:
npm run build:openapiNote: We will likely want to move to swagger 3.0 at some point, and once we do, we will be able to use the common api snippets library to factor out common Mojaloop snippets. Keep track of #352 - Update to OpenAPI v3
We use audit-ci along with npm audit to check dependencies for node vulnerabilities, and keep track of resolved dependencies with an audit-ci.jsonc file.
To start a new resolution process, run:
npm run audit:fixYou can then check to see if the CI will pass based on the current dependencies with:
npm run audit:checkThe audit-ci.jsonc contains any audit-exceptions that cannot be fixed to ensure that CircleCI will build correctly.