recommended fixups
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
---
|
||||
title: 'Vision to Reality 4: Revving the Engine'
|
||||
date: 2026-08-05
|
||||
description: This article covers recent improvements to the XO stack and draws up a short roadmap.
|
||||
description: Realization of the XO vision, part 4 covering recent improvements to the XO stack and a short roadmap.
|
||||
author: Jonathan Silverblood
|
||||
tags: [templates, engine, technical audience]
|
||||
---
|
||||
@@ -68,45 +68,42 @@ In preparation for the Blaze hackathon we are planning to release additional art
|
||||
|
||||
### Token Support
|
||||
|
||||
Currently, the XO engine is capable of working with tokens only in a very limited capacity. For example, while it is possible to define token balance estimations in templates, they are currently not being used.
|
||||
Currently, the XO engine is only capable of working with tokens in a very limited capacity. For example, while it is possible to define token balance estimations in templates, they are currently not being used.
|
||||
|
||||
Full token support is a target goal and is one of the key area for improvement leading up to the hackathon, with explicit support for token genesis, token minting, coin selection, balance estimation and much more.
|
||||
|
||||
|
||||
### Improved naming
|
||||
### Improved Naming
|
||||
|
||||
In the templates today, the words `locking script` and `locking bytecode` are mixed and the result is vagueness and inconsistency.
|
||||
In templates today, the words `locking script` and `locking bytecode` are mixed and the result is vagueness and inconsistency.
|
||||
|
||||
All uses that directly refer to actual underlying bytecode will be renamed to either `lockingBytecode` or `unlockingBytecode`. Similarly all references to `lockingScript` or `unlockingScript` will refer to named and documented entities that uses `lockingBytecode` or `unlockingBytecode` respectively in their definitions.
|
||||
All uses that directly refer to actual underlying bytecode will be renamed to either `lockingBytecode` or `unlockingBytecode`. Similarly, all references to `lockingScript` or `unlockingScript` will refer to named and documented entities that uses `lockingBytecode` or `unlockingBytecode` respectively in their definitions.
|
||||
|
||||
As a result, we will also introduce an `unlockingScripts` section similar to the `lockingScripts`. Here unlocking scripts can be described properly with names, descriptions and other metadata.
|
||||
|
||||
### Default Outputs Instead of Inheritance
|
||||
|
||||
### Default outputs instead of inheritance
|
||||
|
||||
One of the many goals of the XO stack is to ensure that no funds are lost. To this end, we previously added data to locking scripts that allowed the engine to classify and handle unknown transactions, when those transactions have outputs to monitored lockingscripts in the engine.
|
||||
One of the many goals of the XO stack is to ensure that no funds are lost. To this end, we previously added data to locking scripts that allowed the engine to classify and handle unknown transactions, when those transactions have outputs to monitored locking scripts in the engine.
|
||||
|
||||
Previously, any output to a known locking script that lacked classification by the engine, would inherit properties of the locking script and become an implicit default output.
|
||||
|
||||
Going forward, we are making this explicit by adding a reference to an explicit default output in lockingscripts and moving all related functionality to this definition.
|
||||
Going forward, we are making this explicit by adding a reference to an explicit default output in locking scripts and moving all related functionality to this definition.
|
||||
|
||||
This has two big impacts. First, it makes it more explicit that a template is responsible for handling default outputs on locking scripts. Second, it encourages template authors to provide explicit names and descriptions for the default locking script and for any uncoordinated outputs that spends to it.
|
||||
This has two big impacts. First, it makes it more explicit that a template is responsible for handling default outputs on locking scripts. Second, it encourages template authors to provide explicit names and descriptions for the default locking script and for any uncoordinated outputs that spend to it.
|
||||
|
||||
### Events
|
||||
|
||||
Currently users of the XO stack have to poll for data when they need it. Going forward, we will implement proper event emission so that your application can know when new data is available. This will include all blockchain triggered changes, but also information on when the engine starts and completes state synchronization, when wallet balance estimations are updated and much more.
|
||||
Currently, users of the XO stack have to poll for data when they need it. Going forward, we will implement proper event emission so that applications can know when new data is available. This will include all blockchain triggered changes, but also information on when the engine starts and completes state synchronization, when wallet balance estimations are updated and much more.
|
||||
|
||||
|
||||
### Improved documentation
|
||||
### Improved Documentation
|
||||
|
||||
While we are still doing early alpha releases and breaking changes are still to be expected, we will make a concentrated effort to improve the technical package documentation ahead of the BCH Blaze hackathon.
|
||||
|
||||
This includes tutorials on how to get started, better structure on the available documentation and more practical examples.
|
||||
|
||||
## Recent Changes
|
||||
|
||||
## Recent changes
|
||||
|
||||
A lot has happened since our last article and we've been hard at work making template, engine and tooling updates, as well as presenting at BCH Bliss.
|
||||
A lot has happened since our last article and we have been hard at work making template, engine and tooling updates, as well as presenting at the [BCH Bliss](https://www.bliss.cash) conference.
|
||||
|
||||
Here is a short summary of what has improved:
|
||||
|
||||
@@ -121,39 +118,35 @@ Here is a short summary of what has improved:
|
||||
- implemented a large number of new primitive data types
|
||||
- various quality-of-life and developer experience improvements
|
||||
|
||||
|
||||
### Derivation
|
||||
|
||||
Under the hood, a lot has changed with regards to how XO derives cryptographic keys. Previously, we used a scheme that was a variation of BIP44 but that was **not** BIP44 compliant.
|
||||
Under the hood, a lot has changed with regards to how XO derives cryptographic keys. Previously, we used a scheme that was a variation of [BIP 44](https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki) but that was **not** BIP44 compliant.
|
||||
|
||||
The new derivation paths are shorter and simpler and are instead based on BIP43:
|
||||
The new derivation paths are shorter and simpler and are instead based on [BIP 43](https://github.com/bitcoin/bips/blob/master/bip-0043.mediawiki):
|
||||
|
||||
> m/XO'/ACCOUNT_OR_TEMPLATE'/USE_CASE'/INDEX
|
||||
> `m/XO'/ACCOUNT_OR_TEMPLATE'/USE_CASE'/INDEX`
|
||||
|
||||
Where `XO = 2415` and each template has their own hardened keyspace. Keys are further separated within each keyspace by a hardened `USE_CASE`.
|
||||
Where `XO = 2415` and each template has its own hardened keyspace. Keys are further separated within each keyspace by a hardened `USE_CASE`.
|
||||
|
||||
This setup isolates keys that a template author might be able to influence from keys created by other templates, or used by the engine in various ways.
|
||||
This setup isolates keys that a template author might be able to influence from keys associated with other templates, or used by the engine in various ways.
|
||||
|
||||
For account-wide usage, the `ACCOUNT_OR_TEMPLATE` is set to 0, allowing for a non-templated keyspace, which also has hardened `USE_CASE` isolation.
|
||||
|
||||
|
||||
### Reservations
|
||||
|
||||
When preparing to take action, the engine reserves resources that will be used by the action. This part of the code has been improved with better error reporting, more clear naming and it is now possible for applications to reserve resources manually.
|
||||
When preparing to take action, the engine reserves resources that will be used by the action. This part of the code has been improved with better error reporting and more clear naming, and it is now possible for applications to reserve resources manually.
|
||||
|
||||
Technically, the reservation has changed from being a boolean, to being `reservedBy` with a reference. Requesting a reservation for an already reserved resource returns an error.
|
||||
|
||||
|
||||
### Expirations
|
||||
|
||||
Participation in invitations now come with expiration dates, so that reserved resources can be restored when actions are not completed within expected timeframes.
|
||||
|
||||
Note that the expiration dates are indicative rather than enforced, and serve only to prevent permanent reservation of resources. If an action is attempted after an expiration has happened and the resources are still available, the action will still succeed.
|
||||
|
||||
Note that the expiration dates are advisory rather than enforced, and serve only to prevent permanent reservation of resources. If an action is attempted after an expiration has happened and the resources are still available, the action will still succeed.
|
||||
|
||||
### Intents
|
||||
|
||||
We have added a concept of reuseable intents which defines the preconditions to creating resources in the engine.
|
||||
We have added a concept of reuseable intents which define the preconditions to creating resources in the engine.
|
||||
|
||||
This allowed some work to be specified upfront with the new `generate:` keyword, rather than being inferred by the engine after a requirement has been encountered.
|
||||
|
||||
@@ -168,13 +161,11 @@ For example, here is an intent to create a P2PKH change output:
|
||||
|
||||
Further, this reconciles all differences between starting actions and follow-up actions, and serves as the framework for creating various structures such as locking scripts, outputs and other data.
|
||||
|
||||
|
||||
### State
|
||||
|
||||
We have moved all state representations to only exist in outputs or locking scripts, rather than being defined in requirements in some places.
|
||||
|
||||
Note that we are further planning to move the inherited output handling for uncoordinated outputs from the locking scripts into a referenced `defaultOutput`, which will fully move **all** templated state representation to exist only in outputs (as originally intended).
|
||||
We have moved all state representations to only exist in outputs or locking scripts, whereas some were defined in requirements previously.
|
||||
|
||||
Note that we are further planning to move the inherited output handling for uncoordinated outputs from the locking scripts into a referenced `defaultOutput`, which will fully move **all** templated state representation to exist only in outputs as originally intended.
|
||||
|
||||
### Slots
|
||||
|
||||
@@ -182,14 +173,12 @@ Templates can now specify a minimum and maximum number of instances each role re
|
||||
|
||||
This removes the need for fixed roles and allows for arbitrary and fungible role takers, such as pledgers in fundraising campaigns or signers in multisig wallets.
|
||||
|
||||
|
||||
### Coin Selection
|
||||
|
||||
Before automated coin selection, applications had to provide their inputs manually and the engine was only able to unlock inputs from the same template.
|
||||
|
||||
With the initial implementation of naive coin selection, the engine can now pick coins that are selectable from any template to satisfy requirements for satoshis when performing an action.
|
||||
|
||||
|
||||
### Change
|
||||
|
||||
In previous versions of the engine, change was not handled automatically and instead implementations had to provide the change output by hand.
|
||||
@@ -215,12 +204,11 @@ defaults:
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
The engine follows a strict order when choosing what change policy to apply, allowing for fine-grained control by the application:
|
||||
|
||||
- `override` policy if manually provided by the application.
|
||||
- `default` policy in the template linked to the spent input.
|
||||
- `fallback` policy previously configured by the application.
|
||||
- `override` policy if manually provided by the application
|
||||
- `default` policy in the template linked to the spent input
|
||||
- `fallback` policy previously configured by the application
|
||||
|
||||
*If no change policy is available, the engine will refuse to take action when change is required.*
|
||||
|
||||
@@ -228,33 +216,27 @@ With this policy framework in place, a privacy focused wallet can guarantee that
|
||||
|
||||
At the same time, if a wallet does not have strict change requirements they can set a `fallback` policy instead, and will then use `default` policies from the templates they are spending from when available.
|
||||
|
||||
Currently, the engine only supports the template `default` and engine `fallback` policies, the manual `override` policy will be supported soon.
|
||||
|
||||
|
||||
Currently, the engine only supports the template `default` and engine `fallback` policies. The manual `override` policy will be supported soon.
|
||||
|
||||
### Primitives
|
||||
|
||||
A number of new primitives have been added, and all primitives are validated on construction, including new run-time validation.
|
||||
|
||||
|
||||
**New primitive: Satoshis**
|
||||
|
||||
In various places in our code we used to have **bigints** for satoshi values, but this has been changed in favour of a dedicated `satoshis` primitive, which additionally also validates that the amount falls in reasonable ranges representable by the **CashVM**.
|
||||
|
||||
In various places in XO code, we used to have **bigints** for satoshi values, but this has been changed in favor of a dedicated `satoshis` primitive which additionally validates that the amount falls in reasonable ranges representable by the **CashVM**.
|
||||
|
||||
**New primitive: Transaction Hash**
|
||||
|
||||
We used to represent transaction hashes as strings, but this has been changed in favour of a dedicated `transaction hash` primitive.
|
||||
|
||||
This change makes it less likely that another string is used in a place where we should be using a transaction hash and the primitive further validates the length and format of transaction hashes.
|
||||
We used to represent transaction hashes as strings, but this has been changed in favor of a dedicated `transaction hash` primitive.
|
||||
|
||||
This change makes it less likely that another string is used in a place where we should be using a transaction hash, and the primitive further validates the length and format of transaction hashes.
|
||||
|
||||
**New primitive: Extended Public Keys**
|
||||
|
||||
Previously we used to have a single public key for each participant in an invitation, which resulted in key re-use and potential for adversaries to control what data to sign with a key, risking cryptographic information leak.
|
||||
|
||||
By adding an `extended public key` primitive and using that in our invitations, each update to an invitation now signs with a unique key. This reduces possible attack surface by removing key re-use in invitations.
|
||||
|
||||
By adding an `extended public key` primitive and using that in invitations, each update to an invitation now signs with a unique key. This reduces possible attack surface by removing key re-use in invitations.
|
||||
|
||||
**New primitive: Timestamps**
|
||||
|
||||
@@ -267,7 +249,6 @@ By adding an `timestamp` primitive we can extend support for end-user presentati
|
||||
description: 'Last seen: <myTimestamp.iso8601>',
|
||||
```
|
||||
|
||||
|
||||
## Other improvements
|
||||
|
||||
### Passing Identifiers
|
||||
@@ -281,40 +262,34 @@ const { invitationIdentifier } = await engine.createInvitation();
|
||||
await engine.signInvitiation(invitationIdentifier);
|
||||
```
|
||||
|
||||
### Isolated database per-seed.
|
||||
### Isolated Database Per-Seed.
|
||||
|
||||
To avoid conflicts when using the same application loaded with different seeds, we have added database isolation on a per-seed basis.
|
||||
To avoid conflicts when using the same application loaded with multiple seeds, we have added database isolation on a per-seed basis.
|
||||
|
||||
This also makes it possible to run multiple instances of the engine with different seeds, allowing multiple accounts within the same application.
|
||||
|
||||
|
||||
### Improved invitation handling
|
||||
### Improved Invitation Handling
|
||||
|
||||
Invitations can now be easily shared with import and export functionality, creating a flexible starting point for building transport protocols and standards for sending invitations between different wallets.
|
||||
|
||||
To prevent possible leakage of cryptographic entropy, each step of an invitation is now signed by a unique key, rather than a shared key per-invitation.
|
||||
|
||||
After executing an action from an invitation, the resulting `data` or `transaction` data structures are now returned to the caller.
|
||||
After executing an action from an invitation, the resulting `data` or `transaction` data structures are returned to the caller.
|
||||
|
||||
|
||||
### Template validation
|
||||
### Template Validation
|
||||
|
||||
We have improved validation prior to importing templates with both syntax and range checks, and ensured that all errors are properly reported with actionable error messages.
|
||||
|
||||
|
||||
### Applicaton state
|
||||
### Applicaton State
|
||||
|
||||
In additional to templated state, we have added support for engine and application state.
|
||||
|
||||
This is used by the engine to remember things like how to create default receiving addresses, and can be used by applications to store things like wallet settings.
|
||||
|
||||
|
||||
### Rigorous testing
|
||||
### Rigorous Testing
|
||||
|
||||
Many parts of the XO stack have significantly improved their automated testing for additional quality assurance.
|
||||
|
||||
|
||||
### P2PKH
|
||||
|
||||
P2PKH is the current industry standard for wallets. We have continued to improve the P2PKH template with better documentation, more human language and more explicit handling.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user