Great introduction to Daml by Andreas given as Guest Lecture on Daml at Rapperswil (Switzerland)
Nothing is loaded from YouTube until you press play, and then without tracking cookies.
About this video
๐ Get started with Daml: bit.ly/tryDaml ๐ Learn more about Daml Smart Contracts: bit.ly/learn_daml ๐ฎCheck out our blogs: bit.ly/daml-blog-engineering ๐ Become a Daml certified expert: bit.ly/daml-certification
Guest Lecture Functional Programming in Industry: Andreas Lochbihler speaking about Enterprise Haskell on Distributed Ledger Technology (#dlt)
#Smartcontract platforms promise to facilitate writing distributed applications that span multiple organizations, thus breaking down information silos. Still, they tend to suffer from scalability, authorization and privacy problems.
#Daml is a smart contract programming language whose distinguishing features are its built-in models of authorization and privacy, and is being used to implement a core part of the trade processing workflow at the Australian Stock Exchange, targeting 2021 deployment. Canton is a distributed Daml runtime that implements these models faithfully.
By partitioning the global state it solves both the privacy problems and the scaling bottlenecks of platforms such as Ethereum. The enhanced privacy together with a data erasure mechanism make it well-suited for building GDPR-compliant systems. Canton transports data through our so-called synchronization domains, which can be implemented by both (semi-)trusted parties and blockchains. Domains can be deployed at will to address scalability, operational or trust concerns. They can be federated to yield a virtual global ledger with no information silos, at no interoperability cost.
Daml abstracts the underlying implementation details so you can just focus on getting to market faster. Built in simulation tools and a strong type system mean that you can be sure that the application is doing exactly what you expect it to. Code written in Daml is also easier to maintain, so you can rapidly iterate on your application once itโs running.
๐ Please create a free account on project: DABL and deploy this smart contract
Transcript
14,953 wordsCaptions as YouTube publishes them, usually machine-generated, so names such as Daml and Canton can be misheard.
- 0:00
good afternoon everyone it's 10 past 3:00 welcome to this week's livestream for the lecture session of the course PL fm programming languages and formal methods as you know this is the last lecture session of this course every year as as I do every year I typically like to have a guest speaker this at the last week of the course and this week I'm really happy to have Andreas la vela
- 0:34
you to present this guest lecture so Andreas has been working at digital asset for about two and a half years and this is one of the companies that that really uses the technology that we have taken a look at in this course so typically functional programming for really impressive and complicated things so I'm really happy that Andreas is here and raised and I come from the same sort
- 1:05
of background we're all both of us are interested in functional programming formal verification particularly Andres is introduced is interested in security aspects of software and yeah I'm really happy that that he could be with us today Martin unfortunately is unwell today and therefore Andreas is very kindly offered to also fill in for him so he will be actually doing both parts of this lecture today so before I start I just like to mention that this lecture will
- 1:37
be recorded for for the people who can't make it firstly and also I would like to allow digital asset permission to use this video for their internal whatever marketing or tutorials this I'm not you don't have to share your video or share your name when asking questions and things like that but as always so we're doing this on ms team so that you can also speak up in the middle of the lecture if you want to answer a question and case you do have a question you can also write in the chat in teams this time
- 2:17
andreas will not be able to see these questions but I will relay them to him yeah does anyone have any questions regarding the technical or formal aspects of today's guest lecture you can write in the comments what else so regarding how this causal how today's lecture session will take place so andreas will talk about demo and then about Canton sometimes I'll talk a little bit about the examination and also round it off and just talk a little bit about the topics and I'd like to have a little bit of feedback from you
- 3:09
so around at around 4:30 we will start this formal conclusion of the course and it should take about 20 minutes 15 to 20 minutes yeah but yeah that's that's for later in case we need more time for this guest lecture andres is very kindly offered to prolong questions discussions and also some of the material at about 5:00 from about 5 o'clock at the exercise session from about 5 o'clock but don't worry in case you can't make it for that it will be recorded and available for you later
- 3:42
great I think I think I mentioned everything did I forget anything andreas no yeah it's a pleasure to be able to talk about what we've been working on and looking out in the past years so digital acid set out as a company to transform the well how business is done between industries and well our two main results of that are basically down and Canton that I'm going to talk to you about today the Titleist Enterprise Pascal and
- 4:29
distributed ledger technologies that Don will be about the enterprise version of Haskell and Canton will be how to actually run that on a distribution yeah please feel free to interrupt during the talk ask questions if I'm going too fast or too slow because I don't know what your background is so it would be a pity if this top just Ruffus by you because you got lost on page two so let's try to make this as interactive as possible
- 5:06
let's start with the first talk namely demo which is Enterprise Haskell and for that just a brief intro what are we actually looking at here so some of you might have heard of Bitcoin smart contracts maybe use them yourself already maybe run a big pie note if you want to and one of the big goals of this blockchain people is essentially to eliminate trust so bitcoins goal was to create trust less money what does that mean well money
- 5:48
in the sense of cash like unlike your bank account where you have to trust your bank that the bank correctly manages your funds money as in the form of cash well it's just the bank note the bill and you can go to a shop and the shop will accept it you don't have to reveal your identity and nobody will be able to track what you have spent for for your money basically and for big
- 6:22
point is is basically the same goal there they wanted to create this kind of bearer token money where you just have to present here is my cryptographic hash and everyone will happily accept umm the difference with normal money is there we don't have a central bank with Bitcoin so there's nobody that we have to trust with the monetary policy Dodson coded Indy algorithms behind big on now
- 6:53
John risen surround Bitcoin they were mostly backward managing this money theorem then went one step further and added a turing-complete programming language around the idea of running things on a blockchain so now we have trustless ether money and we have trustless and unstoppable contractor there is no individual party that could stop them they will just keep plowing on following their code as long as there
- 7:29
are still nodes running new theorem that work this trustless approach works nicely if you have purely trustless goods such as to bearer tokens but as soon as the data that you store on there has actually some connection to the real world this connection will always be rooted in the trust in some trust and it will never be unstoppable and that's where we're coming from so this is not
- 8:02
about the Bitcoin classic the classic Bitcoin let's eliminate all trust to see why this happens let's have a look at a classic example the smart car lock by Nick Szabo so the idea was well you want to buy a car but you don't have enough money so you go to the bank the bank will give you a credit and that credit allows you to buy the car and use it well provided you by the monthly
- 8:31
installments to your credit and that's essentially the collateral that the bank has if you stop doing so well then the car will get let you in and this is encoded as a smart contract right and the car just has to provide evidence in some form that you didn't pay and everything is fun now as compelling as this example is the problem with that is that well technically the instruction produced by the smart contract that the car should
- 9:08
now belong to the bank it's just a piece of data right this piece of data needs to be interpreted by the car or by whatever entity that takes hold of the car and actually led you in so we do have a root of trust which in this case is car manufacturer if the car manufacturer is software it doesn't accept the smart contracts output then the bank has no no way to block the car and that's why the whole thing is also
- 9:42
stoppable because well we can't exert pressure on or people can exert pressure on the car manufacturer to actually not follow it smart contract rule and then there's no Dakotas to law approach there so unlike the public blockchain setting for an enterprise world um our seas is a digital tap a thing is that well the benefit of a smart contract platform is not in illuminated trust but in actually securely managing multi-party workflows so this is a different setting in the
- 10:22
mind um what does it mean well and this will be the running example for the first half we're considering that Martin uses an enthusiast bike yard um needs to get his bike repaired so we're looking at a workflow where Martin wants to get its bike repaired and of course marketing ones to pay to bike shop for the repair and so we also involves a bank for dealing with the money track so we have several parties
- 10:54
here the green boxes and they have a joint work flow now that joint working flow operates on some shared state that involves Martin's bank account that involves the contract between the bike shop and Martin that involves the bike shops bank account and possibly a lot more stuff and we can imagine that being stored in a shared database or what we called the virtual global ledger and Martin and the bag and the bag hope
- 11:27
they can advance this workflow by writing to the database and it will be notified by the database about updates today global shared state now that's the mental model no chuckling huh so shared database which look well alleged that sounds good but of course there are a number of issues we want to look out or I want to take care of first of all we need to be properly deal with authorization the reason for that is
- 11:58
well Martin just doesn't want the bike shop to fiddle with its bank account other than for paying gimbals conversely the bike shop doesn't want the bag to have a say in where the day will have a contract or not then we also need confidentiality and privacy so maybe Martin doesn't want to tell the bank what he spends his money on conversely the bike shop doesn't want to have Martin learn their balance on your account and basically yeah we need
- 12:46
access control here both for the data and maybe also for who's actually involved in a particular update the first thing is we want to have some sort of a transactionality so you want to have on the one hand side well you want to do atomic transactions say if I want to exchange Swiss francs into euros well then I have to give give Swiss banks to essentially whoever is interested in getting Swiss francs uh
- 13:25
and get euros are back and that should that that transfer of both monies that should be atomic so either both happen or none of them in particular I can't end up with having handed out to Swiss friends and not having received euros that would be about deal for me and conversely my counterparty doesn't want it to end up in the Simeon situation where they have handed out the euros
- 13:57
then something in the implementation went wrong and I end up with both for his friends and euros that would be great right but just to make it yet part is compositional whole team so we want to have small building blocks like transfer of money and then want to compose them into larger pieces where can do these atomic swaths are composed of two individual transfers that will help us modularly decompose things and
- 14:29
edward mass and finally we want the whole thing to shape to to scale which we capture which global composer compositionality um the problem if we just have a single shared database is unexpectedly everything has to go through that single shared database now maybe the bike shop also wants to do business with and dress and so we have another session set up and of course ideally we use the same shape database on a shade which look ledger but well if
- 15:09
that runs on a centralized instance we can't scale that to a worldwide said so that's something we'll look into now and this talk today pard one Dan'l will take care of the three first challenges from a programming language perspective just by offering the right programming primitives um you get that and then you need an implementation for the whole thing Unitas part two where I'll talk
- 15:43
about cat I said please feel free to interrupt me ask any questions whatever you like right so what is demo well devil is basically Haskell with a few changes that we've made so some of them are just syntactic and you'll see that in a minute when we'll do an interactive development and some are semantics the most important changes essentially we've given up the lazy evaluation regime of Haskell and everything evaluates strictly the
- 16:27
motivation for that is basically to make it simpler to predict when things are actually evaluated and also simpler to implement as a distribution system and while strolling with this core part of Haskell we've then added a few primitives for talking about smart contracts added the authorization rules that we need to track access in a distribution setting and adage depart oh you only need to know you only learn
- 17:04
what you need to know so just needham need to know person if you're interested in wanted tried out yourself visit our web page de Montcalm where can download the sdk there's also web ID if you want to try it out there and if you have questions we've just opened up the forum on this Castille done welcome but we also have a slack channel if you prefer talking their response times i'd say are
- 17:36
similar on both songs now this is just a programming language and you don't need some storage layer on which you actually run this thing and in the simplest case you would just pick a sequel database and run that in a centrally operated system if you just want to do download on your own because you think this is a fantastic great language to express workflows you can do so but you can also run it on things that support some sort of distribution
- 18:05
like typology fabric as a block pain or the VM Birkin cord which does Byzantine fault-tolerant replication we've also got an integration with Korda and many more to come so where is the whole thing actually used well we've got a partner Accenture who has helped us build a lot of things um and few examples so the Australian Stock Exchange has decided to renovate they're clearing and settlement
- 18:53
system and that's gonna be written in double Hong Kong exchange also is about to do to some other move the ISTA gives us essentially standards for how to deal with financial instruments so you see this is a lot of financial industry there the reason is just very simple to digitize money because nowadays most of the money anyway is done electronically so that's very easy to transfer um the other part where
- 19:34
demo powers well an edge over other people is healthcare because they're you want to be you want to be very careful about who's allowed to see what data and that's where the privacy and confidentiality confidentiality guarantees from demo make a difference why why not that's correct so there are there are use cases they're getting more and more so let's look a bit under the hood his talk is not a marketing talk so why did we pick Haskell because Haskell is not ready the
- 20:18
first choice if you go out and asked Oh what is your favorite programming language those who let those who know how school and know its benefits they love it but in industry they ask the difference questions like Oh what is the pool of available programmers and I mean you guys and girls you know Hospital Europe you're in that pool but that pool isn't big so that might be already
- 20:49
especially well that pool is not big if you're looking for cheap labor so that's a problem so why did we nevertheless pick ask well there were essentially three reasons one reason it has a very good type system tell expressive its strong and a good type system well are certain benefits as you might have noticed so there's two famous saying by Robin Milton or typesafe programs cannot go wrong and I'm aware that I'm using it
- 21:21
a bit of out of context but it is known well you can catch a lot of errors at compile time if you're very careful with touch that you're modeling and the other part is well we're basically describing the data that will store in this shared database using demo so if we have a strong type system now we can actually compile this into database data schemas if we don't then we need to come up with some an structured data representation
- 22:00
which has its own jobs but I mean there are many languages with strong static type system so that's not the only part another idea was okay well Haskell has a strong bias towards immutable data structures and given that a distributed ledges or a block china are all about immutable appending locks they just record updates to the site and then you can reconstruct the current state by looking at the past what has happened so if you have immutable data
- 22:32
structures that's very nice because then you don't have to make the portions that you accidentally modify them in your smart contractor and something that you might also have seen at lecture is essentially that you can track side effects in the type system so you can distinguish what is a pure expression and what are impure computations the key word here is a monad so you know once you're in a moaner well you can run it and that's the only way to get out of
- 23:05
the con Damona but for example either you can't get out of the io mono and so you can control places week and have side effects and where you can't and if you can eliminate side effects then you know well along with the immutability stuff we basically get eternity computation and in a distributed setting that is a very valuable property because but if I run the smart contract code and realize okay this evaluates to the
- 23:38
result 17 then I can send that they - um Farhad and Farhad then can just rerun the same program and it will also again evaluate to 17 so we don't have to ship oh and by the way this is the history of how I've evaluated it which reduces the amount of data and it reduces greatly the overheads incurred by own Farhad realized that job is actually 18 and now we have to start a reconciliation process to figure out who's actually right and that's actually you a costly factor in today's financial
- 24:27
assistance so we can avoid that by using Newton's - computation okay so the high-level part to make this a bit more interesting I thought let's move into a coding session and well since Martin is an enthusiastic cyclist his bike unfortunate down we now want to get it fixed fixing of course costs money and therefore let's first talk about money so what you see here is Visual Studio code the ID what we've basically written
- 25:13
a extension to your visual studio code you can get nice tamil a nice demo IDE out of that um damos syntax itself is fairly similar to classical set we have a module declaration at top at the very top we declare which language version that is there in for import statements will make them you use it them later and you can define data types just like you do in Haskell so this is simple enumeration
- 25:44
ant well we want to represent cash well worth money now in demo you can't have bearer tokens that's just getting back to the intro of the talk and we can't have that so money is always a contract between two parties and a party is just the unit of granularity at which we track authorization that is can be a legal entity but this could also be subdivisions in the legal entity or several legal entities are represented by a single party that's really up to
- 26:25
the one who knows but so we have essentially the issue in the owner so imagine you get a receipt from your bank saying yeah um you've got 200 francs so you would set the amount to 200 the currency to Swiss francs the owner of the money would then do you an key issue is to party so this is pure data and down here we have an example so scenarios we'll see that later are essentially way too young right small
- 27:05
programs that simulates a typical workflow that you can run through and you can inspire it and see how it works it's essentially a test that what that's worth of development there so okay this creates two hundred francs for Martin backed by Bank which we get by creating the party so parties must be explicitly created it's a good party come on onto the arrow to the left is the usual Pascal do Monod notation so here we're
- 27:38
living in deep scenario monnet which is one of the moments and pure is essentially the same thing as has notes which are syntactically what is different is in Haskell you would probably write curly braces here we've replaced our boiler with keyword and you would write double Kelvin to give the pipe in down a single Kelvin it's enough so that's what we started but this is just a piece of data right and we want
- 28:21
to make this into a smart contract and is basically done by not declaring late cash as type but cash as a template and that cash and we don't need we don't need the datatype up there because the template implicitly declares the data type that you see up there now what we can do with such a template is we can actually declare who may have obligations arising out of this of a contract that stores this particular amount of data our dessert called two signatories after Quantrill
- 29:14
when we just list them afterwards so the bank certainly has an obligation to tell what's the party because I mean the party could just show this as a proof of oh here's my proof that I own 200 francs and not other party made and do something and ask okay yeah please give me the more um we could also make the owner signatory because well as an owner you're obliged to pay a wealth tax so you don't want to bind unilaterally just giving you money but for simplicity
- 29:57
let's just say okay um we only have a single this year here as someone who's it worked conversely the owner should learn that it has money right and that is declared with the observer keyword um that takes list of parties technically we can also omit the injections please so we and that will tell them hold up everyone who well the owner can we'll be notified when such a template cache one can't a cache contract it's being
- 30:46
created on the ledger or when it's being spent and that will allow the owner to react to those kind of things and now of course one important thing well let's start let's see so here we have still created a cache down here but this is a cash value it's not yet a contract we haven't created that to create a contract we want to submit something and save the bank the bank want can't create a cache now what that
- 31:30
does is base beat um it creates a contract um we can actually run this part within Visual Studio and then we will see on the ride what is the current state of the lecture and here we see that well we have uncracked of type cash in the module bike shop with the fields sell out here so he sure is just aspiring owners to Marty we're having a currency of Swiss francs of two hundred
- 32:11
this is contract ID zero zero and Martin knows about it I'm Swiss bank knows about it so if we had a mitad it was over here only to Swiss back with no about in particular the bike shop doesn't know about it so so far there is something about it we could also try out what happens if Martin just wants to create the money out of thin air without getting anything and then we get an error here under right hand side says over here we have a transaction the bike shop you want to
- 32:55
create a cash with those values and up here it says rather this failed due to a missing authorization from back so we required the authorization of all the signatories to create that cause that ensures well I and the signatories are all those who can be obliged by contract legally and therefore they have to give their consent to enter that obligation and in that case it would be the bank and so far here we're saying Oh Martin is doing
- 33:33
that for it to create cash that means Martin hasn't gotten the consent of the bank and so we get an error and don't what happen we try to change it back to you back um we're good again right so that is how to create money now we also want to spend that money and this is what you can actually do with it so we can attach to this template which so if I was daga plus some authorization rules plus some visibility rules we can actually extend
- 34:21
out with people who can do things and this is called basically a choice so we can say okay you can transfer that money to someone else well and and what you is allowed to do that is done by a controller well control the owner should be allowed to spend on money and what do we do well what we do it in here and here you see the monads and facts again second since again dude blog we're saying oh please
- 35:21
do create well the same thing as and currently half the cash but update the new owner what choices implicitly do is they archives the currency so this doesn't create money out of thin air well we can give it a try so working Martin can now exercise is choice under cash and the choice we call transfer let's say for simplicity we only we have only one he wants to pay the bike shop
- 36:20
what doesn't work at the moment is while we get an error here about some type mismatch and what we currently see here is well exercise actually expects a contract idea of some type and we're providing a cash so we distinguish here between the data values which is what we have with cash and the contract IDs dad refer to these things on the on the ledger and this would be our 0 0 so the
- 36:53
submit actually returns or to create as a type returns the idea of the created contract and so as this is a do block we can also find it here put it here and as you've seen this compiled and now we've got a different contract here so here is the ID it's now one one the new owner is - bike shop and he owns 200 francs that whole thing is visible to Martine just wrist back and the bike shop so bike shop sees it because the bike
- 37:44
shop is Jonah the bank sees it because the bank is you sure and therefore signatory and Martin sees dad because Martin just knows that it exists because it has seen dad as part of this well Martin created that by surprise it we can now also look at the archived parts yeah absolutely I'm sorry before you try to create cash with Martin before you implemented the transfer yeah and I didn't get how you limited visibility to the bank all right
- 38:23
okay what I did was we started you can forget about the transfer what I did was well if we comment out the observer yeah then only the bank is this Bank is the only signatory Martin is mentioned in the data but I mean I can have a ledger contract with whomever I I think makes sense mentioning other people and they they don't immediately become aware of that that can be justified lateral
- 39:15
discussion with with quick a firehouse for example so just mentioning a party doesn't disclose that information to the party you you really have to that's where where we say okay this is data up here and then we extend that with things like signatory and observers and choices to actually make that into a smart contract platform okay I didn't see that you instantiation it them differently
- 39:45
okay I see below yeah okay yeah thanks for asking so back to where we were it's a Martin seized up because Martin has created a thing and if I click on show archived here then I see that guilt cache contract between Martin and bag is spiked through so this means it's it's it's archived um it is still on the ledger because ledger is append only but it contains a record of this money has
- 40:22
been spent I'm just the money now belongs to Martin questions so far I've received one question on the chat from someone so the question is it's got to do at the beginning of your talk isn't lazy evaluation one of the biggest advantages of Haskell example the ability to define potentially in finite data structures well I guess I guess he's asking why is it not there in demo so a problem with infinite daters well the question is do you want to have infinite data structures on a ledger
- 41:09
right I mean it's great to have them in memory but if you want to serialize them and ship them around in a distributed setting you need to have an encoding for them right and laziness doesn't give you such an encoding for free you would you would have to really dig you down and and implement the whole thing in in your intermediate language so it doesn't really fit the application units of
- 41:45
course if you need something like an infinite data structure you can implement it yourself because an infinite data structure at least if you talk about pure data structure is nothing but well you need some sort of laziness or or some Poisson generated pattern like you can't do a unit closure and you get lazy evaluation where you can actually control when things are evaluated the problem is this become
- 42:17
function closures so this becomes higher-order data and higher-order data is very hard to ship around so yeah that's that's a deliberate choice that we haven't incorporated up because it just doesn't fit the domain great thanks Andreas that's what the student says thank you you're welcome all right we're almost at five minutes to 4:00 and Farhad said this is a good time to have a break so I suggest we have what's
- 42:54
the usual thing ten minutes ten minutes yeah let's have a break now so it's a fifty three let's have a break till three past four right and then I'll I'll continue with the bike shop example we'll see a few more things that's probably gonna take us until Farhad reps the course up and in the exercise station I plan to talk about count so see you in ten minutes
- 52:28
okay everyone it's three past four let's continue with the guest lecture andreas are you there yeah now I'm perfect here you drink reminder where we started out we have to find a cash contract handwritten a few things in a scenario and Martin has transferred the money into the bike shop but of course that should only come as a result of a bike repair contract between the barge stop on bike owner so and a brag
- 53:14
briefly to find another template where we have a bike shop owner entering a contract with a bike owner where some such description and some prize and some payment where it's due and this is now actually the representation of a legal contract so legally a contract is always between two parties so we make those both parties signatories the bike shop and bike owner now of course we want to
- 53:44
create that essentially to a bike repair which Saudi boy is obviously the bike shop Martin brings its bike to the bike owner is Martin the description is whatever needs to be fixed let's say fix the brakes um price well for sake of simplicity let's just say this is these are very expensive brakes and we need a date when Martin is supposed to cater so we could say okay this is this year my 31st all accuse just say okay yeah
- 54:45
that's now creator so submit um well you can we put their mark in do we create a spike recap and it doesn't like something so that is a typo oh half black shot now I'm a bit confused now it says it doesn't have bard error well we can also do a simple
- 55:57
trick and copy-paste out from somewhere else and see what it up helps um could it be because the bike shop was alias because you're using it as the name of this anyway the point of the whole thing is so if Martin tries to create this contract unilaterally we get again into an authorization error that we see here on the right we don't have the authority of the bike shop right um if we prove
- 56:48
the bike shop here we get the is a matric problem that Martin hasn't agreed to that contract and this is actually also what happens in legal practice you need two steps to create a legal contract you need an offer and you need an acceptance and you actually have to model it the same way in a demo so we need to template for is modeling a bike proposal that has a proposer that's a
- 57:23
party and receiver also party and a proposal which is a bike repair data object where the signatory is obviously the proposer so he's going to be bound to to his proposal where and proposal will be sent you to receiver so that a receiver becomes a signatory and now we can actually write out this as a almost we can railroad creating the proposal so it's not creating a bike repair it's
- 58:07
creating a turbine with proposes to bike shop and receiver is Martin and the proposal mr. park attack and suddenly sam'l is happy again and we could compose and we get his proposal that we see here on the right as usual it's visible to Martin in the bike shop with the receiver mode and now we want that Martin has the ability to accept that so that comes as a choice that we've seen
- 58:59
so there's a choice except that will create a contract ID of a stop Ron Tom wrong template of course Martin should be able to accept that the repair contract and that will create a bikers their contract controller is receiver when we do well unsurprisingly really proposal what we have down there and so Martin can exercise and here we need to bind it again this is defy repair proposal engine obsessed shots
- 1:00:07
and if that happens now we end up with a correct your service bike repair and on that Martin could now get any payment that's it watching same things well not return anything but of course we can say okay um what a speedpaint and here we now see the composability us-backed as usual please interrupt me if needed so we can Marcin can choose what Molly equivalent so what cash uses and so we
- 1:01:07
can exercise so wait we need to controller that's obviously the bike owner can exercise the choice on the cash contract which we have written before the break maybe transferring with you owner equals the bike owner and in the end say oh we definitely felt what is wrong here again ah indentation so damn all all like Haskell is sensitive to indentation and here we have well inside the way of blocking
- 1:02:00
each indents stuff great so Martin cannot read not only submit a proposal except the bike repair but Martin can also pay the whole thing so on the contract sanding with cash and can pay its cash ID and now the money is again with the bike shop if we look at what has happened over time we will see that there was a bike repair contract that's now our account between Martin and quad shop so all obligations from that house will have disappeared because
- 1:03:02
Martin has hey we have two proposal that was an intermediate step to create that one and we have the two contracts off the cache the original one that was archived and the new one that's still active saying that the bike shop ass not mine now what we haven't done yet and this is a severe flaw is well supposed art Martin only earns 53 but a prize is 200 and now well if we don't know what the
- 1:03:45
outcome is the bike shop is 50 so we actually should have made sure that the money that is being used to settle the outstanding payment actually has the right amount of money that week start to do that well as you see this is a contract ID it just refers to a contract and this and and going from an IDE to a contract depends on ledger state right so we can't just say Oh cash dot amount so we could write something try to write
- 1:04:32
something like we want to assert up the amount that we're paying mr. price right that doesn't type because it will say oh the amount is not a record field of the cash because cash is a contract object so we need to go to the ledger and actually look at the contents and that is done by function fetch all I can say oh then we can check that cash is equal to demand and we might also want to
- 1:05:11
check that the currency is Swiss francs which we have implicitly assumed the boycott and if we do down again we're back into this land where we see oh this is some assertion has actually failed we came up to the fetch that is the partial transaction and here you see a text representation of all the transactions that have happened so far if we changed our back to 200 200 then we'll get back and the shop gets that of course you can
- 1:05:58
make this example into an even more and more elaborate example the way you can then say okay I'll give you a change or you just you just have to select money first or whatever we could do that but I guess you already you've already seen kind flavor of program so you can write um what you haven't seen is that you can actually do some sort of computation with this this was really just defining datatypes and moving them around between
- 1:06:31
people and getting you familiar with the authorization watching dollar questions so far well if not then that completes the first part I said if you want to find more about them Oh play with it Donald calm you'll find enough resources d question is now how do we actually run this in a distributive system and that's what Canton is about so what you've seen here with those scenarios that we run that is actually just an in-memory execution on
- 1:07:26
my laptop you can't connect that one to distributed system um Canton gives you the opportunity to do so so if you're looking for a bunch of resources you can go to Canton dot IO which contains are both the software so damla itself is open source Canton is well you can get the release for free but it's not yet open source there are plans to go open source as well but when update you on the web page you can find a demo that is
- 1:08:06
more focused on what you can actually do with it so there's a healthcare example it's also recording with it so you can have a look at it if you if you don't want to exploit yourself if you have questions about that go to the same forum or sectional as for double um same people are listening do I want to mention that I send Farhad a small exercise sheet for the end of well or if it is that gives you a few bins what you
- 1:08:38
can try out and play a bit with them all if you're interested in this talk and I guess I'll start before the break or before handing over to Fort Hood um this will be more of a high-level introduction what are the concepts that we've seen as code now in a more abstract setting and how does Canton work internal so just as a reminder where we're coming from so we're talking about smart contract platforms of essentially breaking the silos of where every party wants to keep
- 1:09:20
their own database into somewhere where we have a shared database or religion right we've seen that we need to deal with read and write authorization we haven't talked yet really about how to achieve scalability and one thing that we want to avoid is we want to avoid that would create even bigger silos which is what I hinted ad with global composability well if you if party a is member of several into part multi party
- 1:09:56
workflows of course party a doesn't want to have to connect to three different or ten different Ledger's but I'm the solution that we've seen so far with demo is basically disciplined and it feels like you're riding against a shared database and you get the read and authorization rules and what you can do do and now we need to have an implementation and the implementation basically replaces this idea of a shared database with something that you actually can run in a distributed
- 1:10:35
setting so we have those participant nodes which basically provide to the party in what we call the ledger API empty stare means to access this shared database so on a very primitive soil you can send write commands by similar to those submit things that we have seen in scenario on that moment and the participant will then engage in a synchronization protocol with a lot of participants and whatever components are
- 1:11:12
in this cloud and as a result well the participants will then inform the party oh this has happened here's a stream of updates since you've lost looked and a part the party can then update its own local view react to whatever happens of course this this should achieve certain goals we want to implement this abstraction faithfully and there are some similar some limitations to that so if you have
- 1:11:52
ever heard about distributed systems you've certainly heard about the cap theorem that can't achieve consistency availability in the presence of network partitioning so there are some know some fine print it up we also need some reasonable trust assumptions for the whole thing and this is where different synchronization protocols can provide different guarantees all we want to solve the composability and scalability issue
- 1:12:29
but before the break I'll just revisit the abstraction at a higher level than what we've seen in the code this is what we call the dam a ledger model that is described in more detail on the contents page of the documentation so we'll have hierarchical transaction that's basically what you have seen so we can look at those transactions and here we see dad oh we have a transaction dad has
- 1:13:01
several children which do the fetch which do exercise and as part of the exercise we have another sub singing called doing and create right so we can represent that visually as a train and the demo programs essentially are translated into these trees by the double runtime and these trees they have all the notes and labels on the actions what happens with data and of data has this read and write authorization to get the integrity and confidentiality properties like the signatory if theta
- 1:13:40
one specifies that his action needs the authorization of Alice and Bob because they're the controllers on the exercise then dad's on there and then there's essentially the signatory an observer story which tells us who may see who must be informed about certain actions happening on Bob data and that gives us the abstraction that we can then compose into a legislation so in this example we'll look at abstractly at three
- 1:14:16
parties Alice Bob or a bang and Carol bike shop owner and rather than looking at a complicated cash scene where we look at a token and you can imagine a token being just cash contract with well you won Frank so we fixed a currency and we fixed the amount and in the notation we'll use a dollar sign to mark two signatories and we underlined you observers so this is a reduced cash contract and I will
- 1:14:52
turn the thing of a ledger hours essentially a sequence of transactions that are submitted by a party so the bank they can create a token with itself a signatory and Alice Asti observer and from the global ledger states new so we started with oh no no contracts on the ledger and after this transaction we've got a single token contract and then Elly's could transfer the token to the bike
- 1:15:27
shop B by exercising D transferred choice on that contract that creates a new token as a result this input contract is being consumed and would create a new one so in terms of distributing legit this is an unspent transaction output model the same as is being used with VidCon in particular once some contract is a ledger it's immutable unlike any theory and where you can update the state but you can do it one way or the other
- 1:16:10
so that you are essentially interchangeable in terms of expressivity right so you see here who needs to resubmit stuff and so we can continue that ledger in a more complicated thing so suppose we have two tokens and this goes not towards the atomic swap two tokens issued by DN C to a and B respectively and we have an offer or proposal from a towards B to swap token C against a
- 1:16:48
token for D backed by D and such a swap would consist of two transfers one transfer one where a transfers to token to B and one where be trans just a token to a everything wrapped as a consequence of a big choice except which 70 the two things and as a result it would consume those three contracts and generate those new tokens with a new assignment and the guarantee here is that this pirate happens atomically what I said earlier we can't
- 1:17:30
end up with this part happening and that part not happening so it takes essentially a way to counterparty risk in those transactions because we can do the metonic right and then we can define what a valid ledger is once we have this structure and we've defined that as the intersection of two or three properties one property is well authorization and we flipped into that quite a bit it's
- 1:18:09
this signatories of servers and no signatories and controllers need to authorize what the consequences and authorization flows we haven't talked much about that but just as in to transfer choices right so we're creating here a new money a new cash contract as part of the transfer we certainly have to your authority of the owner because the owner is the controller of the choice but in order to create that we actually also need the authority of the
- 1:18:49
issuer because the issuer will be obliged to pay the new owner the amount that's being specified but this is fine because the issuer haskons has consented to the creation of this cash contract and therefore in place he consents to all the consequences that dish contract may have in particular it knows about Oh dearest is transfer and this transfer is fine because over I know that this spends your mount Foraker
- 1:19:22
for the current owner and just assigns it to a new owner so so I should be fine with that so the signatories flow into they implicitly authorized the immediate consequences right so this is well authorization we need things to be conformance to a model and this is basically what we specify here in demo conformance for example includes that this assertion was told that the money that's been used to pay the bike
- 1:19:56
repair is actually the money that was specified and your mouth and everything else and then there's consistency and consistency really means oh you can't spend your contract twice so why did we end up with right the tableview so those archive this archive cache contract I can't spend again we can actually tried it out so it could on the cache maybe do a transfer so if it tries
- 1:20:55
to do that once again we see that we get an error saying oh you're trying to exercise the choice on the consumer contract and what's previous becomes tuned by donor sub transact and that is basically preventing total spends are creating money out of thin air why have I written down I mean it's a nice tough time here anyway you know what I mean so that's that so in particular as a consequence we want to guarantee dad or need that the
- 1:21:36
rules on the ledger going to either if there is a valid ledger and I'm right I'm following the dumb old protocol then I can be sure that no rights will be taken away from me so no choices no obligations being imposed on me so I can't become signatory without having consented to it and neither can my counterparties removes their existing obligations without me agreement or not and after the abstraction that we get so
- 1:22:15
from the right authorization we can also get some sort of read authorization meaning the visibility that's what the observers are about plus the signatories and the actors that we the actors are essentially the controllers and so a transaction like that will be chopped up into many pieces for example the offer a contractor does you to swap like the bike repair contract is only visible to Alice and Bob but not a bank in India Ardis sub transactions and these sub
- 1:22:58
transactions green box on the left is only visible to see because C's involved here as a signature but Dee has known business was that and conversely de over here obviously sees that part but carol council we can also see that in our bike trip bike shop proposal so you will see that the bike repair is not visible to the bank even so there was dis one transaction that involves both the and the two signatories of the bike
- 1:23:35
repair culture right and this is I think a good time to stop after the Farhad wraps up the lecture I'll go into how that actually translates and is implemented in Canton but for her over to you thank you very much Andreas so um sorry for the interruption I just wanted to conclude this course from my point of view before the start of the next exercise session since some of you may not be able to attend it
- 1:24:24
so yeah thank you henge semester it's been it's been a bit of a strange semester I think all of you will agree with me lots of things have happened by the way can you see my my slides or the web page yeah great okay yeah so I just want to have a quick overview of the topics that we've just taken a look at over this over the three or four months yeah we started off with programming paradigms formal proof the sequent calculus then we've been down to
- 1:25:02
propositional calculus and first-order predicate calculus just getting getting a bit of our muscles working again then the lambda calculus and then we had a bit of a break because if the pandemic that just happened and then we had to switch to online lectures and then we started functional programming Spring Break programming yeah monads we talked about reasoning about programs when Isabelle Hall we took a look at quick check oh by the way I just wanted to
- 1:25:47
mention to you you may have seen andreas before so in my in my page but unreasoning about functional programs there's a video there and this is andreas so yeah you if you think that I've seen this person before you have yeah so he was the presenter of the video functional programming and proof proving in Isabelle Hall anyway so this is you may think that this this course was a bit of a mixed bag with many different things but actually these things are related because the community
- 1:26:21
behind it is they work on the same they explain to you things in distributed computing but it's from the point of view of someone who is really into programming languages so it's I hope that that that you've you've enjoyed this and yeah I would like you so I'll give you some time for this as well I'd like you to fill out this little feedback but yeah that that's gonna come let me show share my slides
- 1:26:54
for my conclusion quickly yeah so one thing is that people normally ask me about the exam now the exam is actually nothing that you should be worrying about what it about if you participated actively in the lecture and the exercise session as I told you before the exam is quite straightforward I've also given you a model exam on Moodle take a look at it you'll know talking about
- 1:27:30
typically people finish the exam way ahead of time yeah so I guess it's one of those exams where if you can do it you'll do it ahead of time if you can't you'll struggle yeah I think that's fair the exam will be in English just like the course and you may answer in English or German and it'll be closed book yeah and some final words from my side I hope that you enjoy taking this course as much as I enjoyed giving it well this this course changes from from semester
- 1:28:04
to semester but still we've just scratched the surface of this area of computer science so programming languages the intersection between programming languages formal verifications of engineering sometimes even distributed systems yeah it's very interesting I hope that I've succeeded in sparking your interest in this fascinating area of software engineering so each more is not possible in this
- 1:28:29
brief of time yeah I mean as rigorous and we both can probably testify to this is an area that you can spend spend here wasn't decades working in engaged here for the interest in this area please contact me for student Arbeit or bachelor pad and master studies and at the beginning of the course we talked about this this idea that all if all you have is a hammer everything looks like a nail so I hope that I leave you with a more complete toolbox to take
- 1:29:01
on your challenges as a software engineer later for myself I can claim that fluency in formal methods logic and functional programming has severely increased the simplicity and quality of my work as an engineer so this is something that I would would like to give the people who are leaving the HSR and I hope that the concepts you have seen here will be helpful to you in your future though as yes I'd like to leave
- 1:29:31
you with a quote it is not though this is from ewd extra so it's not the violin that shapes the violinist we are all shaped by the tools we train ourselves to use and this and in this respect programming languages have a devious influence and they shape our thinking habits so the claim is here that if we use more rigorous programming languages they will force us to think in a more rigorous and complete manner so I strongly advocate the use of such
- 1:30:04
programming languages or at least learning them so you can you can think in a certain way good I'd like to now ask all of you I'm gonna give you about five minutes to do this I would like to ask you I'm going to change my screen sharing again sorry about that I'd like to ask you to questionnaire just put it up right now you can go to Moodle and it's here this short three-minute caused feedback
- 1:30:43
and I'm not a big fan of so long drawn-out feedbacks as you know this course I pretty much try to keep it in tune to the interests of the students so I'd like I'd like to have some feedback on this of course this was a strange semester but still so they're just three very simple questions did you like the course yeah so yes mostly so so not really no what did you like what did you
- 1:31:10
not like and you have any additional remarks suggestions or recommendations to make this course better and if so just let me know I'm gonna give you five minutes to do this so it's 41 let's come back here at 46 and then I'll formally conclude the course so yeah 60 listen like to do it you to do it right now because yes then I have some feedback for next to next the next time I do it
- 1:36:00
so thank you very much for submitting it for participating in the feedback for those of you who will will not be able to take part at five o'clock for the continuation of Andreas's talk I'd like to thank you for your and to wish you Pleasant holidays with your friends good thank you very much I'll see you I guess next during the baritones for her of course you can always send me questions online see you bye bye
- 1:36:44
yeah and regarding the continuation of our course I guess we'll start again at five is that okay with you Andreas sure I mean it's also fine to start immediately as you what do you think makes more sense I think let's take a 10-minute break Oh give people time to step out a little I'm continuing the recording I don't want to pause it or anything so that I guess you can cut it later on because I'm a bit scared of
- 1:37:18
touching anything
- 1:49:41
hey it's 5 o'clock now I would say let's carry on the guest lecture Andres is that ok with you absolutely ok I won't come back thanks to donors you stayed around or who are going to listen in later so I stole far hurts as French her again so I hope you can see the slides again right I mentioned how do we implement this abstraction in a distributed setting well a trivial solution would be to find a trusted
- 1:50:22
third party to run the database then all problems would be gone well not all of them of course we precisely have to find a trusted third party and it extremely unlikely that we can find a party that everyone agrees to of course you can mitigate that by doing some kind of distributed replication Byzantine fault tolerant whatever um if you have a data breach on the central instance then that's a single point of failure so you
- 1:51:08
will leak all day to do and it's not ready composable because naturally we will have several trusted third party evolving and so we just end up with bigger silos that we wanted to eliminate in the first place so another alternative to implementing a distributed database is essentially state machine replication for those you have never heard about that is quick refresher so we assume that we
- 1:51:40
have an atomic inputs a common input sequence to all roughly close um so you can just consider this out a strain and all the greet on that so we have essentially an ordering service or a broadcast system and then we have deterministic machines they implement essentially the state machine and because they're just deterministic and they receive the inputs in the same order we know that the outputs are inconsistent so Dave will all first say
- 1:52:12
here's a duck then there's a teddy bear and then there's a ball of course some machines may lag behind others a bit so they may only end up paying with the teddy bear and not yet having reached a ball but anything is essentially the underlying principle of blockchain technology like Bitcoin like a serum like essentially everything else is did you do that time any problem with that is this only works if we have developed
- 1:52:42
shared globally replicated that's the reason why if you want to run your Bitcoin client you need several gigabytes of memory just to keep the past history you know so you have never interacted with the system just because that's part of the past history and everyone hostage crisis in three types of state that's not pretty scale so let's look for something else Tomic commit rather than distributed otter
- 1:53:15
so in order to prepare to run a protocol over counter you we prepared a transaction so this is what we have before the lecture and to swap off two tokens that's getting chopped up according to who needs to receive what so in this case for example the create token will be sent to Bob and Carol definitely because Carol is a signatory and BA person observer so we can compute done and well this box well is part of what is being sent but of course there's also bigger
- 1:53:54
thing that needs to be sent and that needs to be sent to Alice and Carol the exercise of that does the tech transfer and because ours and Carol are signatories and Alice is the controller of the choice and the green pockets implicitly includes garage the red box and similarly on the right this is symmetric and ender is the big blue box that is sent only to Alice and Bob because don't pair the stakeholders off
- 1:54:25
the offer contract and now this gets sent off and how this looks like in a thousand atomic commit protocol is basically here we have a message sequence shirt so Bob mister controller and therefore has to commit the whole thing and there's a prepare phase so Bob sends it to what we call a synchronization domain of distance essentially the ordering service and to commit coordinator that were using so
- 1:54:57
the ordering service is called the sequence or an to commit code coordinator is to mediator so the sequencer will assign a timestamp and a sequence of all assigned timestamps to all messages at a sequence that will ensure dad the recipients will receive messages in timestamp order i'm sequence will only assign every time stone box so it distributes the different packets into which this transaction was
- 1:55:28
baseplate does to two different recipients where suppliant stone at the mediator also can see at a mediator will just enter it into its records and then there comes the validation phase in the validation phase this is actually where you're a participant Bob as well check that this will not violate the validity of the ledger so this includes checking that whatever Bob wants to do is correct
- 1:56:07
with respect to the authorization rules it corresponds to what the Demel model program code prescribes and all the inputs of the transaction so said yet the contracts that are being used it are being fasted but does an exercise on they're all still active and none of them is our account and if all that works and so decisively Ghia integrity and authorization checks then they will reply yes I'm happy with such
- 1:56:40
transaction whereas otherwise if something's wrong they can respond with no and have to give the reason now all these messages are sent back to sequence and the sequence is simply forwards them to the mediator and a mediator just collects Terry's messages until it has received enough of them to come to a decision and this is then where we entered a commit or abort face the mediator will then decide whether the transaction should be committed or reported in case of a commit all the
- 1:57:19
participants will receive that commit with a timestamp and therefore know okay from this point in time onwards I'm supposed to consider this transaction as being committed and then they can carry out that on their local copies but if it's a roll back then don't know that this transaction will not have any facts they can release all so it's locking more stuff that they need internally to manage that and they can then pop and an outfit to the application oh by the way
- 1:57:51
this house failed sorry um where's the others in case of a success can outfit oh by the way this is a new ledger up so to update that might be relevant for you so in terms of atomic commit this is a classic two-phase commit with the first phase going until the mediator decides and a commit phase starting from when the media to decides to commit to us right so this was described for a single
- 1:58:23
domain where's the single sequencer and same BJT but notice that well what we do it need here is only the ordering or the sequencing or we only need to collect later on who needs to confirm and those kind of things but we don't need to store the actual contract data on the synchronization of that and that's why domains aren't becoming our new information silos as it would with a
- 1:58:55
shared database instead you can just create a new domain whenever you need and several participants can do joint from the action if they have a common domain so those three participants for example they could use this domain to run their workflow in one transaction and then later you say this participant wants to use and I repaired with that participant you can choose between those two domains um that provides us
- 1:59:32
essentially a way to mitigate the trust assumption on the domain namely well if you don't trust dr. main then you can just spawn other bilateral Derman and run your workflow there and it also provides the key to scalability because whatever happens on two different domains is conceptually unordered so you can run the processing up in parallel provided don't you have enough local
- 2:00:04
resources but that means you can do horizontal scaling and therefore we don't end up being locked in into some sequential bottleneck right ask you something absolutely so when you go back to the atomic commit protocol slide before when you talk about domains ah it's the synchronization domain so one of these domain circles contains the sequencer and the mediator exactly okay and the
- 2:00:38
reason why each of these nodes do not have to store the whole state like in the case of blockchain is that only the domains have to store this but the participants do not so could I think of a participant like a participants or all the data that they need okay right so there there is essentially this idea we have this ideas thanks to the signatories and the observers that we exactly know who needs to be informed about that change YouTube authorization
- 2:01:13
rules that ensures that well we can't compute who needs to be informed about that and only those people need to be informed about that now we still need to solve the conflict problem ah well if two people can currently submit something that both consumer contracts say then only one of them can win right otherwise we have a double spin problem and that's that's not good right so we need to define an order between those things and this is what to sequence
- 2:01:50
adults by assigning those time stops and well as you see Carol and Donald never have to talk to each other directly that means Carol doesn't need to know that Donald is involved and Donald doesn't need to know that Carol is involved and that's essentially one of the roles of the mediator to guarantee DS to ensure this privacy between unrelated parts of the transaction Thanks can I ask you another question of
- 2:02:28
course a or you said that this is how the double spending problem is solved but I could have two domains talking to the same two participants yeah and what happens then who wins which domain would win that's that here we say well you can do transaction and so suppose we have its transaction between these two participants that I'm showing then they could choose between these two domains right but technically a contract always resides only on one domain so if they
- 2:03:10
want to use it on another domain they they themselves have to provide a synchronization right and Canton has a synchronization protocol for that and then that just ensures that yeah you detect those conflicts right so basically well if the contract say resides on that domain but I want to use it in a transactional doubt domain but what happens is that you first have to lock that contract here and in order to
- 2:03:44
use it you have to provide and prove that you've blocked it and then the other participant if it concurrently tries to use it here will realize oh this contract has been locked and therefore depending on whether the lock was granted choice or a transaction was being sequenced food we detect that conflict okay got it so a contract also has to specify the domain on which it should be executed there's basically a
- 2:04:13
large well there are there are heuristics that automatically distributes things normally what you would do is you would partition or you would look at your workflow and then figure out which part of the workflow should be run over which domain for example you have domain did you use to manage your bike repair orders and you have another domain on which you manage your bank accounts right say because this is the bargain a
- 2:04:47
bank doesn't even need to be connected to you where you manage your bike repair orders um then you would just have a transaction that is out of sequence they were there but the parts that are visible to the bank they must be run on that domain and the point of why you do that is well you want as as he seen synchronizing between domains is somewhat of a costly process they want to run as much as possible on a single
- 2:05:17
domain so if you were to just do it randomly and flip a coin you would just end up with loads of cross domain synchronization so if you really build your work let's think about it okay these steps they go to this domain then we're done and that the next part of the workflow will be done on another and and that's that's that gives it clear clear so it's like pinning your programs two cores on your processor if you really want to have good performance you won't
- 2:05:52
how to dedicated core in the void context switches okay okay understand it now so the participants only store the information that's relevant to them and the domains are basically in charge of the execution the domains are really just in charge of sequencing and collecting these responses and issuing des verdict yes they importantly don't store the data yeah and that is the core
- 2:06:28
right so I said okay a contract resides on a domain but where the contract resides is essentially an agreement between the signatories right so we we basically have a consensus among say those two participants that this contract is currently residing there but it doesn't have to be stored on the domain it's just that those two are great yeah we use this domains or dealing with star contract and if you
- 2:07:01
want to use it somewhere else you need to involve that domain into the protocol okay thanks you're welcome right so what can be a domain well you can simply implement that on a sequel database and then you've got a very simple very efficient structure but of course if your database blows up then your domain becomes unavailable if you're worried about bugs in the databases or someone the domain administrator having access
- 2:07:42
to to the domain and therefore treating you unfairly you can go to whatever you what you always do when you need to distribute your trust you're up like had sex right so you could run a classic BFT protocol you could run a proof-of-work to improve the integrity constrains that we get from the sequencer and a mediator working correctly and this is what we've actually done so we in Canton we have an implementation gen runs on a database but we also have an implementation of
- 2:08:24
works with fabric and with etherium and they have classic truth of work so you get the sequencing guarantees by getting agreement there it's more expensive because you're doing more computation obviously um but and this goes to what I just told too far right or a reply to farmers Christian so our data that we actually ship over domain is encrypted so you don't have to provide the whole global state in particular the 200
- 2:09:02
francs that Martin plays for fixing the brakes they won't be visible to the sequence in northern they have just encrypted because that doesn't matter to them they don't need to check what contracts are being used it is all done on the participant sequences ready just for ordering and that gives us the strong privacy guarantees so there's no single point of date where where stuff is stored and of
- 2:09:34
course as I said every domain may be a ledger in its own right so a fabric ledger is a ledger and we just used our ask back end and then there are at least cross domain transactions that I talked told for the previous talked about on the previous slide to forest question and allow you to use a contract on one and that's created in one domain on another domain and if you think of oh these are different Ledger's like a
- 2:10:04
cerium versus fabric then we get an interoperability protocol between Ledger's of course that's not true interoperability protocol with the native assets that you keep on the ledger like the the Assyrian contracts with with the ether in there or the fat break contracts this is only interoperability between the demo parts on those Ledger's there might be eventually a possibility to do that the
- 2:10:42
dad would then certainly be a specific solution to the particular ledger that needs a custom integration right so what are actually to trust assumptions on the whole part well we allow arbitrary Byzantine participants so they can crash they can have bars they can maliciously Center wrong answer whatever they want and of course if you as a party communicate with a wrong participant you don't really get much guarantees the
- 2:11:25
because well you're completely dependent on that participant no you can check that oh it is actually behaves too according to the specification but you can't prevent it from misbehaving unless you run yourself of course communication between all components is encrypted so we use TLS and the implementation but basically these are secured channels there seemed to be a synchronous so messages may get delayed and the protocol has to cope with that the
- 2:12:00
domain has to satisfy higher trust assumption so we assume that it's honest that means it behaved it executes the protocol according to the specification but it's curious so we want to hide as much data from it as possible to not break our confidentiality promises and as explained on a previous slide you can do replication in order to mitigate that you could also run it in a trust and clave but you need a root of trust and
- 2:12:36
that's basically here and the responsibilities well the participant we've talked about that already the participants are responsible for ensuring no double spin so detecting all conflicts that doesn't have to be under the domain and for ensuring the integrity meaning the authorization rules are respected the contracts on the ledger and the transactions actually correspond to what was specified in the demo morally cetera cetera the mediator also has a plan dad and dad
- 2:13:17
it must make sure that everyone is actually sends an answer because you can't hide from D that from Donald that Carol is involved in the transaction and at the same time not trust a mediator to wait for Carol's answer because donal doesn't you know that this need to wait for carol songs right and that gives us participate wean the pada privacy between the participants and the sequence i said it just does anatomic
- 2:13:54
multicart of the encrypted data so it doesn't need to read so what does this actually look like in terms of confidentiality privacy and scalability so we already said dad alice and bob see the whole transaction for carol but she's only involved in left branch well she certainly sees the left branch as her ledger and she sees that this is embedded in a larger transaction that has some other parts there but by using myrtle trees these are just blinded hashes though they don't leak any
- 2:14:32
information that would be useful to carol the sequencer and mediator they see the structure of the transaction and who's involved like ours and bob and carol and donald but they don't see what is actually being talked about and that's important right so even so distraction may leak a lot like they could see oh this is this looks like a swap transaction between Alice and Bob the actual business details are hidden like how much Alice pays for something
- 2:15:09
and what she gets in return and that that is actually the sensitive sector party and for scalability well Eric the advice standard to the transaction is not involved at all of course it can monitored a network traffic and therefore in for something but from the protocols perspective Eric doesn't need to be involved so we only need to involve the people that are actually part of each other this goes back to the very beginning when we're we have built in these notions into our programming
- 2:15:44
which says should there always available signatories observers controllers and that gives us the scalability because participant as such you'd only do the processing nodes rather than fit up there's also an integrity theorem so this is programming languages and formal methods so the past half an hour was more about distributed system so not perfectly not a perfect fitted lecture title and first 90 minutes was about
- 2:16:16
programming language so there's also bit of formal methods in there namely we you can even state a theorem about the integrity that links the actual implementation in the counter protocol to distraction that we're trying to achieve with that all right so the theorem is essentially a safety property whenever you run the Canton protocol then there isn't a valid ledger where in particular the right or sorry authorization rules fault so the authorization works and all
- 2:16:57
parties that are honest and the party is basically honest if it's participant now it is almost like behaves according to the protocol and confirms all the checks that it needs to do well if you're such a party then your view on the ledger yeah you get from the annotations on the actions of the ledger that is actually what you are being served over the ledger API so you get everything that
- 2:17:26
you are supposed to okay and whenever there is something under view there's something in your view then you actually have a cryptographic evidence that this is pirate often as you like signed transactions and the like such that you can actually go to a third party and prove in a dispute to judge um look this is the proof that I have and therefore I have this right and now let's find a
- 2:17:58
solution to our dispute conversely if anyone has proved cryptographic proved of concerns that party um with respect to him in a double-action then actually this proof is valid in the sense that the action is part of the ledger so nobody can try to prove to you I try to make a case that you should you have an obligation if you haven't actually and well all the commits by that party are authentic and
- 2:18:38
that means that well if that party is to commit her and committees on the ledger then the party actually has requested that change and the party also believes has received the information down to commit are succeeded and we're still in the process of actually building a rigorous mathematical formal model of that we have pen and paper proof stuff but going from something like that to formal Isabel 3 is a long way but it's still going well and that brings me
- 2:19:20
actually to the end so um in conclusion what you've seen is Demmel and how to write contracts we had the bike shed at a bike shop example I'll send it the demo file to fire her after the lecture such that he can upload it in case you want to play with it because doing that from a video is terrible I've briefly told you through the legend model which is the abstraction in terms of ledger updates with the hierarchical transactions and the visibilities and no
- 2:19:57
no I've talked to you briefly through how Canton works as a distributed commit protocol that implements the our thing with these global composability properties if you wanted try it out yourself I mentioned already the webpages demo calm for the language can't and IO for the protocol you will also see some explanation how Canton works in a lot more detail and the high-level concepts are explained in the demo legend the nen
- 2:20:29
dosas exercise sheet unless you have questions so far any questions ok if not so far HUD has uploaded an exercise treat and what happens in this exercise sheet is we just ask you to play a bit around if you download the latest Canton released and there is an example in there with an exercise example number 6 and what that does I'll show you briefly in a minute so right that's there so
- 2:21:22
this is basically the count and release that I've just downloaded this afternoon and that has essentially a double model for sending messages from a sender to a receiver the sender can retract the message and a receiver can replied there's a small scenario with Alice and Bob sending messages back and forth and so you can very easily build a distributed messaging application with demo here running over a server so this
- 2:22:09
lacet operates what is called the global domain on Campton global that acts as one of those synchronization domains provides a sequencer and a mediator so you can connect to those and you start to send the data around and then there is essentially a replay file that describes how the whole thing fits together with detailed instructions of what you can do and just to show you how
- 2:22:46
that looks a bit so I can Storage Canton with the Canton configuration with some initialization script down take a bit because it's building up the connection to doubt remote domain synchronizes with it like then right I cannot a name under which I want to be found but that name is then being made into a unique name by adding some long suffix oh no no and now Canton is running in the background now you want to also use it front end so the letter API you can
- 2:23:46
access either our JSON API or yrg OPC building a full-fledged web UI for dad is a bit out of scope for an exercise so we're using double navigator which is a generic web UI for double contract so we can run dart in in one of the subfolders and then I'll have to go to this localhost on the board that's been specified that gives me that I can then log in as andreas and now I see essentially the templates that are half
- 2:24:46
available in particular there's a message template then I can essentially fill out so this is just a graphical UI to the scenario that we've we've seen so on what I can do here is I can take my username I could put a receiver in there probably nobody's currently running that so I'll just send myself I'll send myself message if I hit Send so this now goes to this domain I will see oh this I've sent out to and glass
- 2:25:22
sea star and I could manage on facts there it's a different you don't have a right so once you're there you can then go through further so we're basically down here you can then start to extend the demo model upload up to make it more convenient like having a contact and then create that you can also search for other people so let's see what kind of andreas we have I'll see it up oh yeah from a previous attempt I've logged in and so
- 2:26:16
they're currently two inverses also if you put the whole thing on wait navigate to us well well if you restart the whole thing your your contracts are your messages will be stored locally you know in a database file on your machine so that when you really learn it you won't be asked for you use it name anymore um you know messages look busy so that's an easy start if you want to play around with that and actually get some disagree
- 2:27:09
activation remark and very good that one is running again first about again my messages are still there alright and that completes my part of the lecture we're happy to ask questions to answer questions sorry or if you want to run around with it feel free to send me an email if you need part with anything okay also if you run into any problems I mean this is under active development we're happy to receive any kind of things back of you interested there will also
- 2:27:56
probably be a talk at zero in Hackett in almost three weeks fine if you sleep like bison breakfast wheel this you think is here and will be on bond unlike his lecture where Simon Meier will give a talk about them all and we might even have but it's a time gentlemen okay all right thanks for listening in what's a fun great first let me thank you andreas four very interesting lectures yeah after at least from my
- 2:28:37
point of view there's been so much of work around this and a lot of this was not released until I wouldn't say quite recently but yeah at least for me quite recently it was really nice to take a look at what's happening and you know it was great I mean if I had a course called distributed systems and formal methods this would be something that would be great to do to put in yeah for
- 2:29:01
maybe a couple of weeks even great interesting stuff does anyone have any questions I don't see anything on the chat but yeah it looks good I mean I'm I'm looking forward to playing around with it all right thank you very much again welcome I'm going to stop the recording now