#265 James Prestwich: Summa One – Cross-chain Financial Instruments and Contracts
12 Dec 2018 · 1:07:46
James Prestwich, CEO of Summa, joins Epicenter to discuss designing and implementing cross-chain financial instruments such as swaps, options, futures, and auctions. He details Summa's Dutch auction spanning Bitcoin and Ethereum, in which Ethereum NFTs were auctioned trustlessly to bidders on the Bitcoin network, and Riemann, a framework for deploying transaction scripts to UTXO-based chains. The conversation also covers the free-option problem in atomic swaps and the advantages of transaction predictability on UTXO-based chains compared with Ethereum smart contracts.
Speakers
Topics
Transcript
[Music] this episode of epicenter is brought to you by Microsoft Azure configure and deploy a consortium blockchain network in just a few clicks with pre-built configurations and enterprise grade infrastructure spend less time on blockchain scaffolding and more time building your application learn more visit akms / epicenter with me some yogurt who is the founder of summer and is talking
with us about trusting options and how to improve the smartphone track development on etherium with ideas that come from the UTX a word yeah so you know I actually met James first time about probably 2016 I think so I had actually given a talk blocking at Berkeley on storge which is a project he worked on in the past and so he actually saw my talk he reached out to me he's like oh wow this is like you know about one of the best like quick explainers of storage AFC and then you know invited him to come give even more in-depth talk on I bought in Berkeley and he gave this
like really cool talk about like you know how Bitcoin scripting and stuff works and they had at that time they were going to this process of actually moving store Jake from counterparty which is like built on Bitcoin and moving it over to aetherium so he was actually you know from very early on I knew he was like super into like the whole like relationship between likes different smart contracting paradigms and whatnot yes and he were trying to tell us all about how they recently did a first option reverse Dutch option auctioning of n FPS on etherium for Bitcoin on the Bitcoin network so that was super interesting yeah and so you know similar
they've been working on like all sorts of different costs cross-trained like contracts so you know obviously I you know working on cosmos I'm very interested in like you know cross change stuff as well but we focus more on like the side chains or side of things well Sumer is more on like the atomic swamps like you know trading Bitcoin for ether like atomically or you know let's say I'm selling something or like you know this holds and you crush a auction stuff that they're working on where it's like you know I can sell a crypto Kitty or ether or some ERC 20 on etherium for Bitcoin and so you know they've been using like a Dutch auction system which you know really obviously very familiar with so you know that was like very cool
like kind of we didn't get or we got a chance a little bit to like talk a little bit about the differences between like you know one of the benefits of like cross-chain dutch auction versus like a fully on aetherium Dutch auction which is cool and then you know just for full disclosure for all the listeners I know I actually my roommate or flatmate rather is actually Rachel who is a you know one of the lead engineers at Sumer so no I I'm quite familiar with suma and I said you know I do have a little bit of a you know indirect personal relationship with them so this has a forewarning I'm sorry welcome to epicenter and today we're here with James Prestwich who is the founder and
CEO of suma a you know according to their website a fairly young startup offering cross-chain financial services so welcome to the show James for you uh you know maybe introduce yourself a little bit tell us a little bit about what your background is and you know how did you first get involved in the blockchain space as you said my name is James fresh rich founder of Summa previously I worked with Shia on the ship BLS implementation a little bit as well as on Shias script and before that I was the co-founder and CEO at storage decentralized cloud storage system for about three years I
got involved in the blockchain space back in 2013 and had been working here full-time since 2014 I guess what really got me interested in it at first was like consensus aspect is that we can use proof of work and we can use blockchains to bring thousands of nodes to consensus on something I think we've spent the last four five years trying to figure out what that thing should be and it's so kind of an open question but you know it's fun so what got be interested in the decentralized out storage what's one of those things where the market for storage hardware is pretty fragmented
there's a few big manufacturers but it's all split up between consumers enterprises and data centers and when you look at the market for cloud storage there's really only two or three major players um I think we could do a lot better and trying to solve that problem is what got me interested in the first place I got involved in storage because I was living in rural Japan and had way too much free time to think about things like this so uh yeah I guess I kind of stumbled into it mostly speaking of rural Japan I actually saw on your LinkedIn that your you know youth your bachelor's was I in Japanese and then you just like sort of jumped right into like building
and decentralized storage market places and how do you like you know that that leap come in like how did you uh you know what was the relation there you know what my LinkedIn won't tell you is that I did a few years of Pewter science major as well before switching out Japanese is and still is a passion of mine I was expecting to take like two semesters of a language as an elective and ended up spending you know four years on it and then moving to Japan I think like what they have in common is that you have to be constantly learning and all of the problems are hard and interesting yeah learning a language is difficult learning the blockchain is
very similar you have to go into all of these intricacies in these special little rules that only apply in certain situations it's half memorization half investigation and the third half is just like spending the time right yeah for sure and so you spent three years at storage and then left what happened what made you leave you know I think a few of us were looking to leave for a while and we went through the whole token sale process we set the company up for success in the future and they're doing great and then we decided it was a bad time to move on and so from there you are you know you moved on to you
mentioned you were working with TIA a little bit especially working with them on like you know I know Tia was really their focus on like kind of like improving Bitcoin script and updating it until you were helping about a bit on that how do you you know get involved with that yes yeah I ran into a Graham Cohen at let's see it must have been scaling Bitcoin at Stanford end of 2017 and so we got talking about the kind of advantages and disadvantages of Bitcoin script and the Bitcoin like consensus mechanism design kept loosely in touch for a few months until it made sense to
work together while I was there we mostly worked on she is EOS signature implementation and on designing Chea script of course it's been you know almost a whole year since I left and their stove is like doing good work on Xie script it's very much a work in progress it's great ended most of the properties that I want out of a scripting language so very excited about it and finally at the beginning of this year you started your own project right summer with two co-founders Barbara and Matthew can you tell us a little bit about how you know the tool
and and what made you three set out and start some of what your vision is yeah Barbara in Matthew and I all work together at storage and so we already knew each other we had a lot of experience working together in high pressure situations and so around the beginning of the year it just all made sense we had all taken some time off and worked contracting on other things and around January February we got together and started looking to raise money to work on cross-chain financial contracts and you know that's how suma started what got you interested in
cross-training financial contracts in the first place yeah so towards the end of last year I had a little you know a lot of spare time to spend on learning about the interest C's of Bitcoin earning up watchings work in practice so all of the fiddly implementation details and the leftover bugs from Satoshi and one of the things that I spent a lot of time on was atomic swaps and back then I wrote a little blog post about how frustrating they are and how bad the user experience of atomic swaps is and I
thought it would be just a little one and done you know blog post complaining about stuff and you know it kind of got me thinking about it a lot more ease if you actually want to use these things how can you improve them how can we take them from something that's a like six hour synchronous protocol with a free option problem with liquidity trolling issues and turned into something that people could actually usefully use and so after that it was a I think I would like woke up one morning with a few ideas like two weeks later and started just writing it down very few people have worked on
these in practice almost no research has been done into how you extend the protocol or modify it so at this point we have four or five good variations on the atomic swap which I've talked about some in public but mostly just have notes on and we're building out software seeing what works seeing what people want to use and trying to what product out there people will use I see so I mean I know going through your blog your personal blog a few months ago you actually had a post talking about adopting one maybe even a year ago you had a post talking about why people should be less excited about a topic swaps what changed you know I spent a
bit of time on it and part of it was picking out a few ways to improve the atomic swap construction and part of it was realizing that people were just trying to use it to do the wrong thing it's really poorly suited to exchanges it's actually pretty well suited to options you know I mentioned the free option problem earlier in an atomic swap one of the participants has the choice to complete the trade or to cancel it and they had that choice for several hours so they decide what happens in that sense they have an option on the other coin right and so it's pretty hard to patch out this option but what you
can do is embrace it and use the atomic swap to do a cross chain option so it's not really that something's changed it's that my perspective on it whipped a little bit so essentially like you know what you saw what you originally saw as the bug in these atomic soft which you saw was like getting free options you decided to settle it like you know let's turn that into the feature let's make the Crossgate auctions itself with the product that we're selling yeah yep cool so maybe like could you explain to us a little bit about how that atomic swap works and like why this I call option situation exists yeah the atomic swap is a two-player game basically we want to
exchange my Bitcoin for your ether right and we want to do it at a rate that we decide between us say maybe 20 ether for one Bitcoin I don't follow price punch so I'm going to be way off but you know we want to agree on this rate and we want to do this trade with no third parties involved all on Shane so we can make it completely trust list right so what we're gonna do is I'm going to make a secret and tell you the hash of that secret and I'm going to make a Bitcoin contract that is payable to you if you learn that secret and otherwise it'll refund the coins to me after a certain
amount of time passes right so I'm going to pay Bitcoin into that contract you can see that I did this so you know that you'll get those coins if you learn the secret you're going to pay ether into the same contract so this time the ether is able to me if I tell you the secret now when you say same contract it's but it's a same pod like a similar design contract on a different chain right yeah it's the same terms but on a different chain mm-hmm so you're paying into an ether smart contract here the smart contract enforces basically the same terms but obviously it doesn't in
solidity on chain and ether which is completely different from Bitcoin script so you're going to pay into the same contract terms payable to me I tell you the secret refunds to you after certain amount of time and so at this point we've set up the atomic swap I can reveal the secret to take your either you can see that secret on chain and use it to get my Bitcoin so the free option comes in if I decide not to reveal the secret so because we do this on chain it takes what confirmation time anytime we want to change the site of this contract we have to wait a whole
block confirmation cycle an hour give or take so I have at least one hour where I get to choose whether or not to reveal the secret and that means I choose whether the trade happens or whether we both get a refund and so if the ether rate moves against me so if ether drops 50% in that hour I can choose just not to complete the trade and then you get stuck with the ether and I keep my Bitcoin so in this sense it works like an option - an option contract right I have the choice and you are just along for the ride so essentially what's happening here is like normally what I
get options contract with you I have to pray some sort of like premium on that right whoever has the choice pays a premium right and here I'm getting it for free yeah in the real world I would be paying you money and here I'm getting it for free I see that's not really a sustainable situation one of the other major concerns is once I have paid the initial Bitcoin into this contract my Bitcoin are locked up for some amount of time several hours probably five or six and you are supposed to send ether into this atomic swap contract but you could just walk away and so this is the
liquidity drilling problem is you can just cause me to lock up my Bitcoin for no reason and then I lose access to it six hours and you lose nothing and it costs me while a lot of annoyance and probably some money so there are a few ways to fix these things to liquidity trolling is pretty complex to get into but the free option problem you can add a premium payment and we can embrace the fact that this is an option if you've listened to previous episodes with Marley Grey and Matt Turner you know that Microsoft is committed to providing
enterprise-grade tools and infrastructure for blockchain developers well the azure blockchain workbench is perfect for organizations building consortium networks take the etherium proof of authority template for example it's ideal for permission networks where consensus participants are known and reputable etherium on Azure has on chain network governance that leverages parodies extensible proof Authority client each consortium member has the power to govern the network or delegate their consensus participants to a trusted operator and parodies webassembly support allows developers to write smart contracts in familiar languages like C C++ and rust as your blockchain workbench was created on the same principles that drive all production services in Azure so you know you're relying on secure redundant
infrastructure that can scale and with built-in services like authenticating api's off chain databases and secure key management services you can scaffold your infrastructure in just a few hours to learn more about Azure blockchain workbench and how Microsoft is advancing blockchain usability and enterprise check out akms slash epicenter and start building today we'd like to thank Microsoft Azure for their support of epicenter so III know I saw one of your talks at a conference a few months ago in SF I think and by the way those are my favorite talks because it does like right in the middle of a bunch of like ICO pitches and stuff and you had this like 15 minutes time slot you just like when in explain a bunch of technical
concepts and just got off the stake this is the most efficient technical talk I've ever seen but yeah so in that you actually talk about what you that top was actually you know you titled it better atomic swaps and so there you talked about like mechanisms where you can actually like play with the timeout and include some additional constraints that actually make this atomic swap process better so could you explain a little bit about what you know short gist of that talk that you did this gets pretty technical pretty quickly but on what I was talking about that day was a quick solution to the free option problem unfortunately it can't be used with every chain so this is basically like doing an atomic swap
inside out is saying that both of us must fund within an hour and then after that it's mandatory her book with us either of us can back out within that hour but it's mandatory after that and so this kind of gets rid of the liquidity trolling issue right because I have this period where if you don't fund I can just back out and get my money immediately and it gets rid of the free option problem because once an hour is passed there's no more optionality it just happens right the downside here is that it can only be used with certain chains at least one of them has to
support a specific transaction expert feature so that side of things you can basically only do with aetherium or other smart contract chains right now and so you might be able to do this improved atomic swap between aetherium and Bitcoin are aetherium and litecoin but you can't do it between bitcoin and litecoin and this is really interesting to me because I came up with this when I was really investigating the differences between all of the deployed block chains you might notice that the atomic swap that everybody uses is perfectly symmetrical right
we both pay into contracts with the same terms what is really interesting is that when we start making them asymmetrical when we use different terms on aetherium than we do on Bitcoin to do some really powerful things like patching out the liquidity problem I see and so you know you mentioned also earlier few minutes ago that like you know there's different ways you can create you can parameterize these atomic swaps in order to create sort of different financial instruments or derivatives and so you know we talked about you know we talked so far mostly about like options you know I've been
told that it's possible to also create things like futures or other sort of instruments so could you explain about you know you mentioned you had for like different like designs that you have and could you explain a little bit about how each of these work or what clock is what they are yeah so we worked on a bunch of things that are based on atomic contracts and we work on some things that are based on SPD proofs which we can talk about a bit later talking about atomic contracts we've covered a lot on options and we've covered some of just mandatory exchange you enter into a contract and then it must happen right
if we're willing to get away from just strict exchange of Bitcoin for a third we can actually use atomic contracts to pay Bitcoin for any smart contract call and ether so for example we can pay Bitcoin for ens domains or we can pay Bitcoin for NF T's one of the prototypes that we built is paying Bitcoin to issue new tokens from a new year C 20 contract so that anybody could pay Bitcoin to buy new fresh minted year C 20s the structure is really flexible and
generalizable that way almost anything you can influence in aetherium can be paid for with Bitcoin maybe to make this a little bit more concrete so you did this recently right so basically you actually had this contract that actually so would a number of NF keys on e theorem for a Bitcoin so how does it work exactly what actually happens to the bitcoins that I pay well we've actually done this two completely different ways now we've done minting using the atomic construction so we've talked a lot about options when we're talking about minting something fresh we usually call it a warrant it's the same as an option just
on fresh minted tokens instead of some ether that already exists the other thing that we did very recently was a cross chain auction on some entities and this doesn't use the atomic swap construction this uses something new that we came up with called stateless STV proofs I'm not sure where to start explaining these atomic swaps have to be pre-negotiated so me and Sonny have to agree on this exchange or this contract that might ring into and then we have to agree on that hash of a secret and two holds in how it all works
the real advantage of SPV proofs is that we don't have to agree on anything ahead of time if I'm selling ether I can just set my requirements and let someone come in and pay me this is gonna get real technical real fast but the basic way it works is I want to sell twenty ether I have an asking price of one Bitcoin anybody can come in and pay me a Bitcoin and submit a proof that they did so this proof comes in the form of a Bitcoin transaction that pays me a merkel proof of inclusion in a Bitcoin block header
or that transaction and then a bunch of headers that come after that that have a lot of work done on them so anybody can come in and show this proof to the smart contract and the smart contract will validate it which validates that bitcoin was paid to me and if the transaction and the proof and the header chain all check out the smart contract will distribute the ether or the tokens or whatever how do you make sure that this only happens once so how do I make sure that if I want to buy something off of you and I I don't run the risk that someone else has had the same idea previously and has already started doing
this because this is timely process right because you need you need a number of you to wait out a number of locks until you have the proper proof but I can come show you how do you make sure that several people don't do this at the same time the process does take time um getting six or seven Bitcoin headers takes an hour sometimes more it's worth noting that this is still strictly better than the atomic swap which takes like four hours in the happy case and longer in the sad case okay maybe a maybe we can back up a step the purpose of a blockchain the reason these things were invented it is to solve something called the double spend issue which is what if I send the same coins to two people how does the system resolve which
send happened and which spent didn't obviously they can't both be valid so how do we choose one the whole proof-of-work consensus mechanism and the blocks and the transactions are all about solving the double spend problem for digital money so as a result bitcoin is really really good at preventing devil spends it's literally you know the only thing it was designed to do so what we do is we make it so that everybody trying to pay me is also trying to double spend Bitcoin so when I list my ether for sale I will attach to it a tiny tiny little bit of Bitcoin right
now we use five hundred and fifty satoshis which is something like point three cents something like that so they'll attach to it a tiny amount of Bitcoin and say you can pay me but if you want to get my ether you have to pay me by spend these coins so the smart contract checks that those specific coins were spent in the transaction that's included in the proof that's included in the block that's included in the chain and so anybody can come in and make a bid they'll all use those coins to do it and Bitcoin will ensure that only one of those bids goes on chain yes I
understand now that like you know bitcoins you give so model make sure it's only one person can spend a certain amount of you know as one you did so and two transactions times from the same YouTube so they won't both make it onto the chain but given that now how do you apply that to baking pigs in an auction like you know not everyone's bidding with the same Bitcoin there everyone has their own Bitcoin that they're trying to bid with in Bitcoin we have inputs and we have outputs so unlike aetherium where you have an account with a balance in Bitcoin you just have a bunch of coins with serial numbers on them and you spend specific coins as your inputs and you get new specific coins with new
serial numbers as your outputs right and so what we do is each of the bidders takes the sellers small UTX oh that's an unspent transaction output it just means some coins that exist and haven't been spent yet they take the sellers utx oh and they add their own inputs to it so that there's more value right and then they take the sellers preferred output that one Bitcoin I want to be paid and they add their own other outputs to it and so each bitter submits a Bitcoin transaction with the sellers input and output and their own inputs and outputs
so in order for them to do this they look at the etherium contract they see the sellers input and output there and they extend that transaction you know they add more inputs and they add more outputs and they sign it and they that's it to the network so that works really simply for set Christ orders right if I just say I want one Bitcoin I can just say okay here's a transaction that pays me one Bitcoin add your own inputs add your own outputs what we've been doing recently is Dutch auctions so that's a falling price auction right and we do this as step wise it's not a continuous price unfortunately but I
think we can do that later so the way we do this is using another Bitcoin protocol feature which is time locks when I sign a transaction as the seller I can specify that it's not good until a specific time we can do this in unix time or we can do it in blocks and so if i'm the seller and i want to run a dutch auction I'll take this one input one output that are mine my like 500 Satoshi in and my one Bitcoin out and I'll sign that with no time lock and then I'll make another one that's 500 Satoshi in and 0.9 Bitcoin out and I'll add a time
lock for five blocks down the road so that won't be valid nobody can pay me that way for five blocks right and I'll make a third one with 500 N and 2.8 out and I'll say that's valid in ten blocks and I can make as many of these as I want so I can set up a falling price auction by saying one Bitcoin now or point nine and five blocks or point eight and ten blocks and so when you want to bid you see okay what's the latest valid transaction or the lowest priced valid transaction and I will if that's an acceptable price at
my own inputs add your own outputs and broadcast to the network I pay a price that depends on time and for that I actually get something on the etherium Network yeah is that correct yes so basically it's always the same thing that I get on the ithi reom network is that correct yeah so we're selling say 20 ether for one Bitcoin but after five blocks the price will fall to point nine you still get the twenty ether but you pay point nothing after five more blocks it'll fall to one date that point you paying point eight Bitcoin for twenty ether so the price will fall this way until
someone out there in the world wants to buy those ether for Bitcoin until it reaches some market clearing price right okay so how does it look from the other site how does the etherium smart contract now know that it can release the the ether so the appearing smart contract is just looking at priests and it's not following the Bitcoin chain like BTC relay does it's just looking at a specific splice so somebody needs to tell it about this transaction and about the merkel proof of inclusion about the headers the way we set it up that can be anybody right now we've been doing it
for auctions we're going to build it into the client pretty soon so that it'll just happen automatically so I will construct a proof I will submit it to the smart contract and the smart contract will check it so what it does to check in is it sees that it's a validly formatted Bitcoin transaction it checks that it's spending the sellers input so it knows that the seller is okay with this price it checks that the transaction is included in the blocks Merkle tree by validating a merkel proof of inclusion Bitcoin typically has 2,500 transactions in a block so that means 12 to 13 hashes in the merkel proof and so
it validates that the transactions included in a block and then it starts checking work so the nice thing about proof of work is you can check it so we take this block header and we check the hash of that block header and we compare it to the difficulty target and then we take another header and we verify that it is that it references the first one and that it has enough work on it so we hash it and compared to the work target and we repeat that for five more times so the goal here is that we get not 100% certainty but a very high degree of certainty that this transaction was included in Bitcoin in the Bitcoin main
chain exactly in the maintain because otherwise you could just use an anchor chain and try to build blocks on that that would be counteracted by the fact of the of the whack is that correct yeah is a work is expensive when we're making six Bitcoin block headers it takes a quite a bit of electricity a small mountain of a six and quite a bit of time so the pick coin main chain makes block headers at about about every 10 minutes right so if I have 10% of the Bitcoin hash rate and I want to make some fake headers I can only make one every hundred minutes and if I spend 10% of
the Bitcoin hash rate I'll get 10% of new bitcoins on the main chain but if I spend it on the fake headers I won't get any new bitcoins so we've never actually checked that this SPV proof is really included in the main chain what we check is that somebody's spent an awful lot of money building it what is the benefit of doing this like stateless model over for example using a BTC relay which like you know tries it's best to follow the bit like we like have the entire history of the Bitcoin header but quite better chain well I think there's a few different advantages one is that I can write stateless STV proofs
in about two days while writing reorg logic and solidity takes we or months one is it BTC relay relies on relators and historically real Ayres have failed to appear last time I looked BTC relay hadn't been operational in six months all those smart contracts are still there they probably still work but nobody has actually submitted a header to it recently UTC relay costs about the same as doing s PP crews in the long run I'm hoping to get some more analysis on this out the door soon but I don't have
a lot of free time to write at the moment because BTC relay has to store information about every header and stores information about transactions and proves we're in stateless SBB proofs are basically predicates they can just be evaluated immediately and then discarded and storage is probably the most expensive thing you can possibly do in solidity besides zero knowledge groups and so we save quite a bit of gas by not storing anything I guess for me the main advantage is that they stand alone they don't need to be included in a larger context like BTC relay or in a larger system you can look at an SPD proof you
can figure out how much work was put into it and you can decide your confidence level immediately with no other context but so doesn't this like set some sort of like limit on how valuable of an auction you can do because like you know let's say the cost of me creating lists of six blocks on Bitcoin is like you know a million dollars and then but I that means I can't like auction that like what crypto Kitty that went for like 1.8 million or whatever you heard to parameterize a little bit it's about five hundred thousand dollars right now to create a six block header chain fortunately that's not the only defense we have so
as I mentioned earlier how much of the Bitcoin hatchery do you have because if it's 10% it's going to take you ten hours to make a six-block header chain if it's 25% of the Bitcoin hash rate it's still gonna take you four hours right so unless you have you'll almost not pass rate to 51% attack Bitcoin it's going to take you a very long time to make a fake proof so any honest buyer will beat you to the punch because they will have the main Bitcoin chain making headers for them every 10 minutes and so it's not just a
dollar value here it's also a level of confidence that a dishonest party cannot make a false proof in a reasonable amount of time so let's say there's a system in which there's only a single buyer no one else is buying is idea that then the next step of secure fallback is that there will be a timeout so let's say you're trying to defend against up to someone with 10% of the hash rate for them to create a six block chain it'll take them you know 600 minutes and you can say okay this auction times out in 300 minutes and so that basically means you're kind of secure against someone with up to like you know ten at least 10% of the Patrick yep if you set your
auction to time out in three hours then you're secure against someone with up to like thirty percent of the hash rate there's a little bit of fiddling us here um because one of the things about timing out options is that they can that mechanism can prevent honest buyers from submitting real crews but the Bitcoin transaction that the seller created doesn't get invalidate it and so you can end up in a situation if you're not careful we're an honest buyer paid Bitcoin but the auction timed out before he is able to submit a proof and so there's a lot of like timing related
edge cases there which is why we haven't implemented time outs in this version right now the safest thing to do here is to have the seller cancel and this is something that can be done fairly trustless Lee if the seller spends their own UTX oh and nobody else can spend it and they've effectively cancelled the auction and can reclaim their meter I have a photo on question here so basically you said that creating a six a six block chain on Bitcoin right now is a half a million dollars and that that sits there sets an upper boundary to how much you can actually have in in an
auction but that's that's always assuming that there's just one option going on at any one time right so they see if you had if you use Bitcoin network as sort of an anchor if you had a lot of outgoing auctions at the same time this would no longer who it is is that correct there's actually a few different ways you can arrange this right now every auction gets its own proof and has its own confidence level as a result and the seller sets the amount of work that they want we don't use like a standardized six header thing the seller decides how much security it should have so in the future it's conceivable that we could be proving
many transactions many Bitcoin transactions for different options in a single aetherium transaction and there's a lot of different ways you can do that and a lot of different trade-offs there so I think we haven't sat down and mapped all those out yet but I'm confident there's something good there I can somewhat buy this model for something like Bitcoin right have you thought about how this like security model works for you know things like minority ash rate change and whatnot well you know it really doesn't for a few reasons
obviously with things like the verge or the vert poin 51 percent attacks it would be pretty trivial to create fake proofs just by renting hash rate so no in that sense it's pretty broken first small chains the other thing is that Bitcoin is actually the only chain that we can do this for in solidity we're going through each header in this proof and we're verifying the work that was done on Bitcoin uses sha-256 which the EVM conveniently has a precompiled contract for so it's actually really cheap to do sha-256 in the EVM but if you look at litecoin they use Eskridge z
cash uses equi hash D cred uses like 256 none of those can be done in the EVM efficiently so for all of these like minority hash rate chains I think it's not even an issue because we just can't do it anyway bitcoins really the only change that this can work with right now I guess uh if we really wanted to we could write zero knowledge proof of SPD proof for all of these other chains so I can make a zero knowledge proof that I know as you catch SPD proof that you got paid but that would be really painful for everybody involved I think I see
this all seems like you know a lot of very complicated schmuck like smart contracts you're writing stuff on like the etherium side of things or writing stuff on the Bitcoin side of things rachel has been you know always complain to me about like you know how complicated a lot of this stuff is and so you know I know that you guys have this other project called rhymin which is sort of a you know I guess the goal here was to make all this like you know in the etherium world you know there's a lot of tooling around like solidity and whatnot that makes it like you know not a pleasure but like at least two usable - like right like complex smart contracts and so is this sort of what like rhymin is or you know
could I just give us a brief rundown of what this rhymin project you guys have is sure um so this is something that we started back in March and it's basically a transaction construction library for Bitcoin and other similar chains right now it supports 20 odd chains including Bitcoin Bitcoin cash I need to update it for the new Bitcoin cash children but um it supports the cash deep red dirt coin mouna coin a rare coin Roesel coin and like 15 other points that I don't know
so the goal here is to make it extremely easy to build transactions we've talked so far about time locks and a little bit about the sake hash stuff as and I have like long 10 page blog posts about how these things work but the goal of griemann basically is if you know what you want your Bitcoin transaction to be you should be able to make it and get it on chain within ten minutes it's a toolbox for building Bitcoin transactions if you want to you know as the seller make this partial transaction and sign it and then the bitter needs to
come in parse bat look at it validate it and then add their own stuff to it no wallet is going to do that for you right now electrum won't do that Jack certainly won't and most well it does won't even know what you're talking about or what any of this stuff does so we went and wrote a whole library for just building Bitcoin transactions simply and quickly and we use it for everything we make now to speak since we built the tool we wanted to use I'm quite familiar with a project called Ivy which is something one of my friends
Dan Robinson wrote while he was working at chain that's what he was what he was doing there was he created like a higher-level language that you know declarative smart programming language that compiles to Bitcoin script so it basically makes it very easy to write like you know interesting financial contracts and have them compiled to Bitcoin script is that you know similar to what Ryman is doing or is it something a little bit different am I like are these complimentary things or are they like how do these two pieces fit together these are definitely complimentary things I've looked at and used Ivey a little bit and it's very good so this script is really just a
pretty small part of the transaction and legacy transactions it goes in as part of the input each input has what's called a script sake and for segue transactions it's in the witness so what the script does is it validates that you're allowed to spend those coins it's kind of a smart signature scheme so in aetherium you just use ECDSA digital signatures and you know one key one account in Bitcoin we can set up smart signatures with additional spending conditions on them so you can say this signature is valid only after next week
or in addition to having a signature you must also know the preimage of a hash so IV is intended to make it so that you can write more complex scripts more easily Riemann is intended to make it so that once you have the script you want you can just shove it into a transaction and put it on chain immediately it's really like two parts of the development set here I think so you know would it be like fair to almost like categorize it given that you know people are probably more familiar with it there government environment would it be fair to call ivy sort of like solidity and remain sort of like the web 3 library I
think that's a pretty fair analog um generally speaking everything in Bitcoin is going to be a bit smaller and tighter than stuff in aetherium so riemann has a lot fewer features just because bitcoin has fewer features but i think that's a pretty fair analogy is ivy is a language that compiles down to out the EBM byte code or I guess Ivy doesn't compile the EVM byte code yet I they compiles down the Bitcoin script and then Riemann helps you get that script on chain I see and so you know I guess kind of going on from there is you know kind of when we
started this episode we talked a little bit about how you were very interested in these like Bitcoin script style stuff and you know I follow you on twitter and you know we track a lot on like you know different telegram groups you know you you you often take a lot of issue with like how the EVM model works for smart contracting and you really like the more stateless and like you kick so modeled of like Bitcoin style systems so you know could you tell us a little bit of your pitch of like why you really are heavily favored this style of smart contracting definitely but before we get into this I I wouldn't describe myself as a partisan here I tend to lean more
towards Bitcoin style but we've spent this whole time talking about my system for connecting dick coin in aetherium and improving both of them so bitcoins design is around security in a lot of ways with the UT Excel model and with bitcoins transaction model and script we actually specify the exact change that we want to make and we provide a signature and other forms of cryptographic proof that were allowed to make that change in Bitcoin you know we say I'm spending these exact coins these ugx OHS and I'm creating these UT exomes and this
transaction is valid after this date and here is my signature and so what we do is we commit to an exact state change that we want and we know that we will get exactly that or nothing whereas in here IAM when we call a smart contract we really have no guarantees about what it'll do i think that aetherium developers have run into this repeatedly over the last few years I was around for the Dow I was around for the parity wallet double feature few years back - there have been a lot more big and small issues because when you sign
the mysterium transaction you cannot tell what it's going to do with your money you can have some pretty good guesses but you can't be sure in most cases and this opens up doors where people like miners and other users can interfere with your transactions for profit right if you're buying something in an on chain exchange like ether Delta the miners can get in ahead of you and interfere with your order or another user can pay more gas and get into the block ahead of you and interfere with your order and so because you don't know what your order is going to do you're gonna end up losing money that way
whereas in Bitcoin once I have signed this transaction it's all or nothing like it happens exactly as I want or it doesn't happen at all and I think it's a much stronger security property and it's really something that I rather prefer in my money you know I like my money to be fairly predictable and so this kind of goes back to that thing you were talking about earlier about like you know it's not that transactions in Bitcoin can't ever conflict right it's like you know for example I could have you know let's say there's a one of two multi-sig between me and my and we don't we both said the transaction trying to spend from the same multi-sig and we didn't realize the
other person also sent that transaction so it's we have a conflicting transaction but the difference is that only one of them will ever make it onto the chain while in aetherium both transactions will go onto the chain and it's up to like the smart contract to decide which one is valid and you know one of us will lose some gas even though we ended up doing nothing in Bitcoin conflicts are resolved at the mempool level so the result of for consensus happens and if your iam the result after consensus happens every conflict of etherium except for account nonces happens in a smart contract somewhere and so it's all happening on chain and
it's being executed on chain and it was resolved everybody involved pays gas and that's the best case for what happens in a conflict is everybody pays gas so in my opinion as well this is a Bitcoin mempool level conflict resolution is a better property for programmable money I completely understand so basically that basically what what you're getting is is that in an ethereal transaction you never know which state and the chance actually sent out is actually acting on right right right so do you think there's a way to ameliorate that without switching to utx Oh model so I think that people have done a lot of
research into smart contract patterns and best practices that minimize this so in solidity development we usually teach people something called CEI checks effects interactions which is that we make a bunch of require statements and then we change local state and then we call another contract and that minimizes the problem here because any failed conditions that cause a conflict and error out to get caught immediately there's been some like loose discussion of other like consensus layer resolutions to this so one of the ideas I've toyed with is having transactions
commit to the state that they want to act on unfortunately this really interferes with a lot of the nice features of aetherium the great thing about solidity contracts is that a bunch of users can interact very quickly and that they can all interact with the same state that causes a lot of problems but it also lets us have nice things like other and nice like all of these smart contracts that we use if each transaction commits to its starting stage and is invalid if that state changes what you get is basically a one write per block per contract kind of
thing where once somebody has gone to either Delta well now either Delta's state has changed and everybody else who is going to interact with it in that block can't anymore all of their transactions go away now and so I think it's really difficult to fix this issue without severely impacting imperium smart contracts utility especially there's like some trade-off going on here between like the security of you know how users interact with the system and you know they actually use a built like uh functionality of the contracts yeah and I totally agree there there's a trade-off there um you either get this
guarantee that you know exactly what will happen or you get to interact with other users in useful ways so generally speaking for my money I prefer to know exactly what's going to happen but at the same time it is obviously useful to interact with users in smart contracts on etherium so I don't see like one model winning out here I think we're going find a lot of different use cases for both models we're not going to end up with one dominant chain we're going to explore the trade-off space a little bit yeah and so you actually you know I saw another one of your blog posts where you
talk about how you can write you know declarative smart contracts in solidity using you know a series of require statements and so this is sort of like you know your proposal of how do you do more increase the security model it makes it kind of it makes it act a little bit more like the you pxo system so is this like something you use in your smart contracts right now or so it's not currently it's a little guess inefficient so to tell a little more context here we talked about checks affects interactions earlier you can think of declarative smart contracts as checks checks and also more chests typically the the core idea is that instead of having effects we just make
the user provide an end state and we check if that end state is valid given our current state so maybe if I want to have a multi seg wallet I make the user tell me what transaction they want to send to the network and I have the wallet check if it's valid and check if they're enough signatures on it the the goal here is that instead of having the smart contract programmatically decide what happens based on the current state you have the user decide what happens and have the smart contract check the users work and so this is a bit of a middle ground between the hardcore
Bitcoin all-or-nothing and the current state of aetherium words of free-for-all where anything goes the user can submit this transaction and know that the smart contract will invalidate it if they don't get exactly what they want out of it so just to you know maybe help some of the listeners visualize this paradigm that you suggested here it would be like in an IRC 20 instead of me saying a transaction saying send five you know wet from sunny to James it would instead be let's say the current state is I have ten weapon you have zero I send it a transaction saying
update state to five and five and the system will say well you know what's required to make this happen it's that that would be the result of the duct and the same amount from yours and adding the same rod to yours is this valid if so but it's executed so that's kind of like you know you're declaring the end state rather than saying the imperative version which is send something yeah and in the contract you're declaring what's allowed so specifically for that token you know you're gonna send in a new state and your new state is Sonny has five and James has five and the contracts going to check that the sum of our balances has not changed so James plus Sonny is still ten so we
didn't create a destroy any tokens here it's gonna check that you know you haven't approved someone else to move those tokens around and it's going to check your signature and that's all it needs to know we didn't create or destroy tokens you were authorized to move them so just write down what you said to do whereas a CRC 20 contract normally it's going to actually go in and adjust your balance minus ten and just my balance plus ten you know this just writes down what you say to write down assuming it passes all the checks thank you that was super interesting and certainly very interesting perspective
on smart contract design we're coming almost to an end and we skipped over one very crucial question early on namely what what's actually the business model of summer so we have a few candidates here right now what we're concerned with is not how we monetize so much as how we get users so as I mentioned earlier we ran an auction a few weeks back for 10nf cheese we ended up selling all of them for Bitcoin we got a tiny tiny amount of revenue from it in Bitcoin which is pretty cool but since then we've run one more option this time instead of selling
nfg s we sold ether our ether option closed at four or five percent below coin basis price for ether and so the people who bought ether from us got a pretty nice discount what we're gonna do is keep running auctions every two weeks for the next several months and then step it up to every week and then multiple times a week the goal here is that we get people actually using this stuff it's one thing to talk about atomic swaps it's a completely other thing to have a healthy market out there or as BV based swaps in order to have a business model you have to provide some
amount of utility to users right and so that's what we're focusing on first is what useful product can we make get out there build users build out a real marketplace and then the business model is going to be a natural result of that okay so the business and what did I say to be determined well it's it's flexible and so what's next for Summa so you know you have you guys have launched this cross chain option and you're better continuously launching cross train auctions what are some of the you know next steps are you going to be rolling out like some of the you know option systems or what's next for Summa for a little while we're going to be focusing
on liquidity we have this option market right now it's a very very early saved we don't have any tools for other people to list options and the smart contracts out there on chain but even if you figured out how to list an auction users wouldn't be able to see it in the app yet there's a really long technical roadmap for us and I think you know what's next is refining the app adding the tools so that other people can list options and keep focusing on adoption and usage we can circle back to more complex derivatives like forwards and
options you know once someone actually uses the the simple stuff so I agree that liquidity is everything one of that form like this so people need to be need to be sure that they can actually get a decent market price so currently are you enforcing this in some way so basically if no one turns after you talk to the opportunist elf or how do you currently handle this you know we haven't run into that problem yet so we let the previous auction close at a discount right we think that we will continue doing that for the next few options after we open it up to other sellers and have good tooling there we'll let everyone decide what to do for
themselves very cool well where that's our time for the show today so you know I follow our listeners I have really like you know suggest reading a lot of James's blog posts like there's something like the most like technical blog post but like you know very well written and so we'll definitely link that down in the show notes so we'd like to thank you James for joining us today and just great to having you on the podcast I've learned a lot about you know Bitcoin script and like atomic swabs and you know part of the world I never really touched and I always want to learn more so that was really cool thank you yeah thanks for having me if we if we ever have more time we should probably go over like into blockchain protocol
versus stateless that's PvE versus stateful SPV versus atomic but uh yeah it's been really fun yeah definitely yeah thank you James it's so much it thank you for joining us on this week's episode we release new episodes every week you can find and subscribe to the show on iTunes Spotify YouTube SoundCloud or wherever you listen to podcasts and if you have a Google home or Alexa device you can tell it to listen to the latest episode of the epicenter podcast go to epicenter TV slash subscribe for a full list of places where you can watch and listen while you're there be sure to sign up for the newsletter so you get new episodes in your inbox as they're released if you want to interact with us guests or other podcast listeners you
can follow us on Twitter and please leave us a review on iTunes helps people find the show and we're always happy to read them but thanks so much and we look forward to being back next week [Music] [Music]