API Overview
The DRM platform provides an easy-to-use and expressive API for interacting with our services. The API uses gRPC for the transport mechanism, but you will mostly interact with it through one of our SDKs, which are designed to guide and support your usage, or Command-Line Interface (CLI).
While not RESTful, we attempt to follow some of the REST concepts. Our API is oriented around the idea of objects. For instance, transfers
and accounts
are two types of objects, and each of those objects has certain operations that take place on them.
At its core, the DRM platform operates on a set of standard protobuf messages. This means that all objects and requests in the system adhere to a standardized format, making it easier for you to work with and understand.
SDKs
DRM currently offers three fully-featured SDKs for its API:
- Rust
- NodeJS
- Dart
Each is built on the same gRPC API definitions. If your favorite language is not represented, don't despair; you can still use the raw gRPC API. The SDKs provide a thin extension layer over the generated protobuf messages that helps with signing and reduces boilerplate code.
Authentication & Authorization
The DRM API uses elliptic curve-based signing to authenticate each request. Two typical signature schemes are supported: ED25519 and NIST-P256. Each request is wrapped in a protobuf message type called RequestEnvelope
, which contains the request itself and its signature. It ensures that secrets (private keys) remain with the user and aren't transported across the internet.
Each request is authorized using the RBAC (Role-Based Access Control) system. The Roles and Role Bindings pages provide more details about the RBAC system.
Observations
One distinctive part of DRM's API is getting an event stream of many objects in the system. For instance, you can observe transfers on specific accounts to get notified of every transfer. Observations use gRPC's stream functionality, which allows for a long-running HTTP/2 connection that delivers periodic messages.
Many of the ledger's most valuable properties come from observations. Observations are essential:
- to build an FX service
- to run real-time AML checks
- to build any other event-sourced application
SDK Setup
You must first initialize the DRM SDK, and while this process varies for each language, it always includes two key steps:
- Connect to the ledger.
- Add the signer.
- CLI
- TypeScript
- Dart
- Rust