Marlowe Smart Contracts - Complex Observations - Introduction to Smart Rules

I was reviewing the Marlowe paper, mostly focusing on the integration part.

Basically how to have external real time events trigger the Marlowe Smart Contracts. It’s nice to have native support for the Blockchain events, but this would cover a very small percentage of the desired Use Cases along the vision being “a financial DSL to fundamentally reinvent wall street” (Tweet from Charles).

Marlowe is using the terms “Observation” which is based on a set of “Observables”, that will decide once such a Smart Contract should be triggered.

It also suggests that these “Observables” will be provided by trusted Oracles to Marlowe contracts.

I believe this is very “grey” explanation at the moment and technically has a lot of questions & issues.

A - First of all we should allow for complex Observations, which means our Observation would be described following a Complex Event Pattern (see “Complex Event Processing” to understand capability), having time-windows, logical expression of events occurrences or non-occurrences, event queries, etc.
B - We should also allow each party who transacts / participates within a Marlowe contract to freely decide on whichever Oracles they trust and nominate to the contract along with an agreement on the consensus approach for these “duplicate” events from various sources. Individual Observables should be allowed to come from various Oracles and for the very same Observable we should allow multiple Oracles to provide the event feed.
C - We should not push down real time event streams (the state of all the Observables) to the Blockchain simply for performance & efficiency reasons, it simply does’t belong there.

The above constraints simply do not fit with the described integration approach having an Oracle feeding everything we need to the Marlowe contract.

Take a dummy example, “Trigger contract ABC once latest on the 5th working day of each month, but anytime following the 1st working day whenever the USD/EUR exchange rate is below X and Google share price is above Y and ADA/BTC is within range Z and … “ We need a trust layer for such rules, we can’t just say & rely on Oracle ABC to tell us once such an Observations has happened. Oracles might even be specific to certain event types and not support all we need.

I believe we need an extra layer (let’s call it Smart Rules layer) on top of the Cardano Computational Layer (CCL), which would consent on such events and trigger the corresponding Smart Contracts. Basically the observation would happen within the Smart Rules layer (not in a single appointed trusted Oracle, neither in the CCL Smart Contract Layer, but in a mediating layer between).

So what would be defined within a Smart Rule?

Within a Smart Rule parties would agree on the Complex Event Pattern, on a set of external Event Providers / Oracles, on the various Event Consenting Mechanisms, the Smart Contracts to trigger, Governance Policies to manage its lifecycle and provide fuel to temporary cover costs. The Smart Rule would pay a set of the decentralized nodes for being included in their high performance rule engine, operate the consensus protocol, allow the nodes to pay & subscribe to the event streams via the Oracles / Event Providers and pay for the Smart Contract execution.

You would use high performance decentralized Apache Flink / Apache Spark / Apache Storm like technology for the Smart Rules Layer. Apply principles of Complex Event Processing. Enrich with various Consensus Algorithms. Provide a Blockchain backbone as a shared persistence layer.

As a summary:

Smart Contracts define “What?” Logic to execute, but we need Smart Rules to mediate “When?”, under which special circumstances must such an execution take place. These circumstances should depend on state beyond the Blockchain, on external real time complex events.

Real Time Financial Market Events, IoT Sensor Events, Sports Events, News Events, DateTime Scheduler Events, etc. should be all a basis for building complex event patterns that would trigger Smart Contracts with the same security guarantees and other qualities we have for the Blockchain. We would not rely the Observation on a single Oracle, but rather rely on a set of redundant Oracles to provide the event streams for the Observables, without exposing to them any details about the Observation or the Marlowe contract(s) to be executed. This is a completely different strategy.

Please let me know what you think? Maybe there is another sufficient integration approach for Marlowe I just didn’t clearly get on a first read. Nevertheless I have the feeling there is a need for a Smart Rules concept & layer.

See some Event Processing Capabilities below being an indicative example from Tibco Business Events & StreamBase commercial products comparing “Event Patterns”, “State Machines / Rules” and “Continuous Queries”. The Observation feature of Marlowe should allow for such mature definitions if the goal is to reinvent The Wall Street.

10 Likes

That’s really fantastic, thanks for joining the party - but your critique is purely premature speculation, and based on? And your credentials are? When Marlowe is rolled out, you will see that the engineers, cryptographers, 3rd party audits & academic peer-review have made your contentions mute. Thanks for stopping by!

1 Like

link to the paper Marlowe: financial contracts on blockchain

Here is my profile: https://de.linkedin.com/in/berci/de

I have been working with IBM Hyperledger Blockchain for the last 2 years.

Please send yours.

Did you even get what I described as a potential problem or lack of detail in the Marlowe paper?

Would be nice to have constructive & professional feedback to let me better understand how the integration will happen.

Thanks

7 Likes

I see that you are specifically asking for more detail on the concept of “observation” which in the paper has only 2 concrete implementations:

  1. Random number and
  2. Time (expressed as number of blocks)

Given the wide scope of the paper perhaps the reduced detail on how external observations will be made is intentional. :slightly_smiling_face:

Hopefully, there are more papers in the works to detail how the various ‘external observations’ will be made.

Any information about Marlow, afak is that Marlow is in infancy stages of development, it’s not completed yet
To draw conclusion now is quit unnecessary in my opinion, they may be still discussing about it in those moments as we do not have all the features capabilities of Marlow to test, I think is more prudent to wait until the first version is out

They are top expert of their fields, little confidence in their capabilities should be given

1 Like

I have a lot of confidence in the Marlowe team, but their focus is on the DSL part and not on the real world data Blockchain integration side. Advanced integration is something they somewhat rightly take as an assumption and use it within the paper by simply relying on and referring to Trusted Oracles.

I am raising the issue that you can´t just assume that complex Observations will be managed by Trusted Oracles, especially when you have multiple, different Observables and special complex event patterns when an Observation should happen and trigger a Smart Contract. The Observation simply can´t happen in a single trusted Oracle, neither may it happen on the Blockchain, so it has to happen somewhere between in a designated layer, I was presenting as a Smart Rules layer. Now the effort & complexity to develop this layer is enormous and far beyond the Marlowe DSL itself.

Eventually this integration issue is not Marlowe or Cardano specific, but is a challenge to all the other Blockchains out there. There are a few initiatives to solve the issue for the Ethereum ecosystem, being for instance “Chainlink”, but I was just wondering how the Cardano ecosystem will deal with it.

The entire Marlowe DSL value proposition completeley depends on whether we are able to integrate with real time external data and handle complex Observations.

I would really like to see some notion that there is focus in this area at IOHK or there is an expectation that a 3rd Party will deliver such capabilities to the Cardano Ecosystem. I do not currently see this on the Cardano Roadmap, which suggests it´s either not in focus or is out of scope. Would be nice to know which one :slight_smile:

Thanks

9 Likes

You raise some good points thank you!

1 Like

Impressive, thanks…you may want to consider joining the Cardano Developers group on Telegram - https://t.me/CardanoDevelopersOfficial

2 Likes

Bercinho - I think you are correct to not assume anything. As much as I $upport this project and respect their scholarship we shouldn’t treat the IOHK team as if they are deities - organizations and their people are not infallible. Your input here is meaningful as far as I’m concerned . Nonetheless, Event rules and triggers… I’m also very interested in how this will be managed and in particular the tools set for capturing the event patterns, associating triggers (and notifications when relevant) within our smart contracts. A store/index of events comes to mind and a way to persist multiple custom rules seems necessary. As you rightfully inferred, real-time event driven use-cases are broad and dynamic - business models are constantly evolving and therefore rules and event triggers need to be adaptable to that reality. Thanks for your thoughtful contribution!

7 Likes

Very much appreciate your comments here. It does seem to to me that the Event Processing Capabilities will grow in an organic fashion with each new source of data and each new demand placed upon an Oracle. Have seen a few startups in this space of connecting real live events with the blockchain and seems maybe this does not need to be the domain of Cardano to provide the Smart Rules. It will be interesting to see where the “Smart Rules” layer ends up living.

If you’re following Marlow, you might enjoy the the real world implementation of escrow contracts as described at https://whitepaper.localethereum.com/ The Marlow paper makes reference to escrow examples and the LocalEthereum paper describes how they have implemented escrow in practice. I would really love for someone more knowledgable than I to compare and contrast the ideas of the Marlow paper with the actual usage in a working product.

2 Likes