Please describe your proposed solution.
Context
- Marlowe is a brand new language and runtime for developing financial smart contracts.
- Marlowe contracts are built by combining a small number of building blocks that describe making a payment, waiting for a certain condition and other similar types of concepts.
- Oracles is a whole category of tools that share the goal of injecting information onto the blockchain so that it can be used as part of on-chain validations (aka: contracts)
- Decentralized oracles is a subset of the above that incorporates the desired feature of ensuring a higher level of assurance of the information by combining independent sources from independent parties.
- Charli3 is the more notable decentralized Oracle protocol in the Cardano ecosystem. There's also Orcfax which is still in development, as far as we know.
- Marlowe currently has a mechanism to inject information feeds from external sources into contract actions, but it requires a high degree of trust from the participants of the contract.
Technical Plan
Build a new off-chain component on top of the current Marlowe backend (the Marlowe Runtime) that integrates Marlowe contracts with feeds from Charli3.
We'll also integrate with COOP compatible feeds (eg: Orcfax) if there's any active Oracle in the network by the time we reach development.
This new component will be in charge of executing the following business logic:
- Watch the blockchain in search for Marlowe contracts; introspect the internal logic and select only the instances that show a requirement for one of these oracles.
- Watch the blockchain in search for compatible Oracle feeds and keep track of the corresponding reference inputs.
- Upon finding a match between contract and feed, construct a particular transaction that will map the source data from the Oracle into a Marlowe action that can resolve a condition within the logic of the contract.
Build a new on-chain validator that will participate in the transaction that activates the condition of the Marlowe contract. To avoid any kind of trust requirements on the off-chain component, this on-chain validator will execute the following checks:
- Ensure the presence of the reference input from the corresponding oracle and any corresponding authentication token.
- Ensure the presence of an output to the Marlowe contract with the required redeemer (aka IChoice action)
- Ensure that the data from the oracle’s reference input matches the data in the outgoing Marlowe redeemer.
- Ensure that the corresponding Marlowe “role” token is present in the inputs and passed back to itself.
Lastly, combine both off-chain and on-chain components into a package for easy provisioning and execution by 3rd-party teams.
How does your proposed solution address the challenge and what benefits will this bring to the Cardano ecosystem?
An out-of-the-box integration of Marlowe with decentralized Oracles will simplify the development of a wide range of new types of contracts running on Cardano.
Decentralized Oracles have huge untapped potential, by enabling new ways of consuming its features we promote their usage and increase their visibility across the Cardano ecosystem.
How do you intend to measure the success of your project?
We’ll measure the success of the project by level of engagement and usage of our new integration mechanism:
- Common activity metrics in the open-source Github repository, such as: number of issues, contributors, traffic, etc;
- On-chain activity metrics of transactions that involve our integration, such as: number of Marlowe contracts including our integration, number of transactions consuming oracle feeds.
- Level of engagement from developers through TxPipe existing communication channels, such as: our Discord server, our Twitter announcements and tech support ticketing system.
Please describe your plans to share the outputs and results of your project?
Being an open-source project, the outputs will be available to any developer in the ecosystem at every step of the development process:
- Latest version of the source-code will be available in the Github repository.
- Source code changes will be applied through a pull-request process.
- Alpha and Beta versions will be released at every milestone.
Upon reaching the end of the development process, we’ll provide:
- A LTS release version of the off-chain component available to download in many formats (binary, Docker image, etc)
- A CLI (command line interface) binary to serve as entry point for developers
- A documentation website with instructions for usage and deployment
- A collection with examples of contracts consuming oracle feeds
After a reasonable (1-3 months) period after the end of development, we’ll provide:
- A report describing on-chain activity of the integration
- A report describing dev community engagement with the project