Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Azure confidential ledger provides server-side programming capabilities to run custom logic inside the ledger. By using these capabilities, you can extend the functionality of the ledger by writing custom code that runs in a confidential environment and interacts with the ledger's data.
You can create user defined functions (UDFs) and user defined endpoints (UDEs) to perform various operations with different levels of customization. UDFs and UDEs were previously called simple user defined functions and advanced user defined functions, respectively. After you define UDFs and UDEs, you can invoke them from the Azure confidential ledger clients to run directly inside the ledger engine.
UDFs and UDEs
Azure confidential ledger offers two server-side programming features:
User defined functions (UDFs): UDFs are simple custom functions that you define and execute inside the ledger. They allow you to perform simple operations by using the JavaScript API and can be integrated with the existing ledger write API. For more information, see User defined functions in Azure confidential ledger.
User defined endpoints (UDEs): UDEs are custom endpoints that you define and expose on a ledger application. Use these endpoints to expose more sophisticated APIs with customizable parameters, data formats, and authentication mechanisms. For more information, see User defined endpoints in Azure confidential ledger.
Here's a comparison of the main features and capabilities of UDFs and UDEs:
| Capability | UDFs | UDEs |
|---|---|---|
| Run custom business logic | Yes | Yes |
| Customization of runtime arguments / parameters | Yes | Yes |
| Expose new API / endpoints | No | Yes |
| Run individual functions | Yes | No |
| Run hooks before / after a ledger entry write operation | Yes | No |
| Creation and update of custom code | Yes (granular update/delete of each function) | Yes (single application bundle update for all endpoints) |
| Custom JavaScript runtime options | Yes (per each execution) | Yes (globally) |
| Execution on backup nodes | No | Yes |
| Support multiple data formats for input and output | No | Yes |
| Custom authentication and authorization | No | Yes |
| Target scenarios | Execution of simple custom logic and integration with the ledger API | Advanced use cases requiring custom APIs and control over advanced JavaScript parameters |
Switching between UDFs and UDEs
UDFs and UDEs are mutually exclusive features. You can't create or run UDFs if UDEs are defined, and vice versa. Use the following steps to switch between the two features.
Important
Switching between UDFs and UDEs is a destructive operation. All existing UDFs or UDEs are deleted when switching to the other feature. Back up any important data before you proceed.
From UDFs to UDEs
To switch from UDFs to UDEs, delete all existing UDFs:
List all UDFs stored in the ledger using the
GET /app/userDefinedFunctionsAPI.Delete each UDF, one by one, using the
DELETE /app/userDefinedFunctions/{functionId}API.
From UDEs to UDFs
To switch from UDEs to UDFs, define UDEs with empty modules and endpoints definitions.
Create a new application bundle with the following structure:
{ "metadata": { "endpoints": {} }, "modules": [] }Deploy the application bundle with the request body defined in step 1 using the
PUT /app/userDefinedEndpointsAPI.
Next steps
To get started with server-side programming in Azure confidential ledger, see the following articles:
- User defined functions in Azure confidential ledger
- User defined endpoints in Azure confidential ledger