Skip to content
by Unity Nodes
NEAR Protocol

Chain Signatures Workshop + Q&A - Mike Purvis

about 15:40 long

Nothing is loaded from YouTube until you press play, and then without tracking cookies.

About this video

Join NEAR's community: Website: near.org Reddit:   / nearprotocol   Discord: near.chat Medium:   / nearprotocol   Blog: near.org/blog Twitter:   / nearprotocol   GitHub: github.com/near github.com/nearprotocol Dev Docs: docs.near.org Create a wallet: wallet.near.org/create Apps on NEAR: awesomenear.com Learn to Build On NEAR: near.university Grants & Funding: near.org/grants #Blockchain #FutureisNEAR #NEAR #nearprotocol #nft #dao

Transcript

2,822 words

Captions as YouTube publishes them, usually machine-generated, so product and people names can be misheard.

  1. 0:06

    um I think to conserve as much energy as possible um we're going to shorten this just for tonight because we're all jet lagged it's going to be chain Siggy it's much faster uh just much easier okay we're going talk about chain sigy um and this is going to be a little bit of a recap in case you didn't see the previous thing I did earlier today um but this is much more focused at like how do you actually

  2. 0:31

    build and like what kind of stuff did I run into that maybe will be helpful so a teeny bit of refresher but this is going to be really useful so ultimately what we want to do in this hackathon is send something to this sign message which is on a smart contract right so there's a smart contract um that all the examples are pointing to so that will be really easy to find and essentially we're going

  3. 0:56

    to be sending something here with a certain um derivation and remember this is basically the same thing as like a ledger where you can have one Ledger that has like you know more than million trillions I think it's at least trillions um of different different like accounts to it so the really cool thing here is that you can also do this straight from your account if you want to you can have a key on like mike. near

  4. 1:20

    and you can call this sign or if you want to you can also have a smart contract call that sign method and this is the uh chain signatures tldr so you start here with your account and as we know accounts Al also can have a smart contract on it we're going to be calling sign with these uh these three things basically and then here is where the magic happens and it is live on testet so you once you hit sign you don't have to do anything you're just

  5. 1:51

    going to chill and it's all going to happen and you'll be determining which one of these you want so and also notice here that we have two different Bitcoin addresses so um you're not limited to just like okay mike. near can only have one Bitcoin address that's not how it is um and then key derivation okay so this is more of a primer of like how I was completely wrong in thinking about

  6. 2:14

    this entire project and then how I kind of like figured it out partially at least so key derivation uh I think usually we're talking about like okay I have metamask you have your seed phrase and then that's going to get to a private key and there's a public key and I think for many of us that's like kind of the whole world that's how it's been for like a really long time uh NPCs are going to be different where it's it's

  7. 2:39

    actually like not exactly that same kind of idea and this this is the part of the docs where you can learn more about the specifics of this but the main thing to take away from this is like you don't you can kind of throw out the idea that like you have to have a private key in order to sign something and get a signature um so that's like like something to break in your brain um if you haven't kind of had that realization

  8. 3:04

    yet so these individual signatures from the from the um multi-party computation they kind of like add up so the way I was saying it before is like I just imagin in my head like here's a signature from one of the MPC Rel layers second signature third signature you squash all those together and you actually get a signature you don't get a private key you get a signature um and there's more about this in the docs uh this is like called

  9. 3:37

    additive key derivation um and as we can see that this is like this is the part of the docs where we talk about how this is all happening okay now this is my understanding and um there's a lot of people here who are understand this better than me so feel free to chime in but the basic idea is this we we know that the MPC on testet has a public key like if all of them were to combine basically it would be like they could

  10. 4:08

    sign a message that looked like because it is coming from a certain public key right now this public key is like totally public in the sense that it should also be like implemented on like the client so we're not like this isn't like a you don't have to query anything like all the examples will have the public key like hardcoded in there that's supposed to be how it is so you need to know the public key you need to know like your own account which is very easy because you'll usually just like log in with your near account and it's going to it's going to know your mic.

  11. 4:41

    near or whatever and then a unique uh derivation path uh this one I would I would follow the examples um so don't get too caught up in like am I doing the derivation path right um I would just say like follow the examples and you'll be gravy so with these ingredients essentially you can like figure out like okay what is my public key for my Bitcoin account that like is going to

  12. 5:14

    get signed not by me actually but it's going to get signed by this like a bunch of like relays this multi-party computation okay is it is this follow are we good are we kind of following here awesome so so once you send to that sign method the MPC is like looking at everything that happens on the blockchain it's saying okay what happened what happened what happened aha someone called sign who called sign and so it's going to be able to know you know this right it already knows its own

  13. 5:48

    public key and then when when you call sign you also send in the derivation path so it knows all these things and it says Okay so this person is asking me to sign like their Bitcoin address from mike. near blah blah blah right magical mathematics come in and it signs it squashes it into a signature and then afterwards it is basically going to like lob you what not the private key remember not the private key it's lobbing you the actual like signature okay now little bit

  14. 6:28

    of like I had to reread this um but this is this is pretty important and actually chat GPT will sort of get confused a little bit because chat gbt is going going to assume that you're not giving it a hashed message um anyway I'll I'll I'll talk about all this so like this is sort of pseudo code but like let's say um this is a message that I can actually send to a blockchain who am I going to pay Erica how much I gonna pay eight

  15. 6:54

    Bitcoin um memo happy birthday yeah so you take this bad boy you like squash it up turn it into like hash right it's put it sort of meaningless it's gobbley go uh and then we're going to like send this and try to get this thing signed right so then the signed hash is going to be also something that doesn't make any sense but the these are the two ingredients that you actually are going to be yes the MPC signs this not you and

  16. 7:27

    see not you chat GPT because it is is going to get confused it's going say wait a second actually you're doing this wrong what you need to do no no like so don't listen when it when it says that so be very explicit when if you're using chat gbt here so we're gonna man let uh send it jet lag uh so these are the two things right so we're going to basically like take these guys and then we're going to be like okay you know throw into a ball and then be like

  17. 7:56

    okay Bitcoin RPC take those and so this is what you like send am I am I kind of on track here okay cool so this is sort of like the workflow to have in your head because this is sort of a new way of doing things you know most of the time in web 3 you're just like using the same functions from some library and you don't really get to know like kind of what's Happening behind the scenes so this is sort of what's Happening behind the scenes now I mentioned this in my

  18. 8:22

    previous talk but I think it's really really cool um it was like you're saying like like the goal is to like stretch the idea and like let's really play with this thing right like what what can we do so I think one interesting thing is to like have a contract call the sign method um as mentioned before like all near accounts like can have a smart contract if you want it to right so this is like mike. testet and there's a

  19. 8:48

    perfect little cubby hole where you can just slide a smart contract in there you don't have to but you can and if you slide a smart contract in there then that guy can call the signed method so either you can call a signed method or your smart contract can call a signed method and either case it's coming from you right now this makes it really interesting because then your smart contract on mic. testnet like can have any kind of custom logic like um and we'll get you an example that Kendall

  20. 9:20

    came up with um that I just realized how it works or the idea today um let's talk about some cool examples so this one uh is near multi-chain and this is going to be in the link Tree by the way so you don't have to memorize this um this one is going to have a few different ways to interact with this um so great example right here mint base and I believe there's a there's also a after this there's going to be a mint Bas demonstration uh in

  21. 9:51

    Korean which is awesome uh if you don't know mint base is just a really really innovating at a crazy Breakneck Pace in all kinds of ways and yeah they have a a a demo on testnet that works where you use chain signatures and you actually interact with openc nfts it's like amazing um I was I I've been trying to build like these examples and I'm like you know having trouble and they're like oh hey we have this thing like talking

  22. 10:15

    to open seed you guys want to like use it and it's like yes please so this is just an incredible example as well um this is a third example that I'm going to show uh down here it says decentralized front end approach so what this means um and this is also something we used to call boss so if you're kind of confused all you know boss decentralized front end all this kind of stuff um basically it means like you know one of the cool

  23. 10:41

    things about blockchain is that you can say all right I want to send like $10,000 to this one smart contract but like man I don't trust it I don't trust it well you can find the source code you can compile it yourself and you can be like yes this is the exact same thing um as what I'm sending it to right so you have this you have this like Assurance like okay the smart contract is exactly this code and it's not going to like take all my money or whatever um but for the longest time we forgot that like

  24. 11:12

    when you're pressing that button to send $10,000 like that is just completely like trust right so the cool thing about decentralized front ends is you can actually go on the chain and be like okay so here's the button code and what is it doing okay yeah this is fine so you have a combination of like the button that you're pressing and the smart contract that it's talking to are

  25. 11:36

    both verifiable like you can totally like make sure that everything's fine super cool um so this example is another way that we can interact with uh chain signatures oh sorry chain Siggy uh here is a animated gif showing essentially like yeah an ethereum contract contct associated with Matt Locker's account and then it'll say okay cool you actually do have a balance who do you want to send it to this is ether scan um

  26. 12:10

    yeah you yeah you get the idea really neat so this is an example that um we have in the link tree as well which we're going to share and then now here is where I will attempt to talk about this which I'm just now kind of realizing is amazing so this is think of this as like you know don't have to think about like for a hackathon just think about this as like a fun little smart contract that you deploy to mic. testet right but this is going to have like all kinds of like

  27. 12:39

    logic saying like I want to derive an address on bitcoin but then I'm only going to let this person access it and then I can swap aoo and give it to someone else which is a really interesting way of using this um so I'll kind of walk through this step by step so here's a seller um who says we're going to deposit some uh yeah we're we're going to basically connect to a BTC account um a buyer is like okay I'm also going to be participating in this and let's say that

  28. 13:14

    like this person is like okay here's a BTC account that is controlled Again by the smart contract using logic and I'm talking about this isn't like crazy this is like 15 lines of rust or something it's not hard at all um so the contract is the one that controls the derivation this time so essentially we have okay two people are like all right we got this ordinal I have it do you want it yeah I

  29. 13:39

    want it and then boom like essentially there's a whole bunch of lines here maybe the most important one is like toward the end the buyer actually receives control of of the not just the ordinal like the actual account itself really really really cool so I think this would be like a really fun hackathon thing if if I were if I were hacking personally um and then we're going to see more about this right after but the

  30. 14:04

    chain abstraction demo again using a open C uh from from mint base and chain chain signatures and here's one part so this actually the read me for the mint base thing is worth checking out but this is one part that just shows like you literally just follow directions run this and it's just going to say okay now give me your openc like nft slug your and then it's going to you know use change signatures

  31. 14:31

    to talk to that very cool okay don't know where to start you know maybe I'm talking a lot about like Concepts and whatnot so the brass tax is like I would start there link tree SL chain signatures um if we can get it to be chain Siggy you know that that'd be fine we don't have to um so if you want to do the decentralized front end approach then like kind of like the second one um and if you want to do uh just regular JavaScript please then this

  32. 15:01

    top one is the is the uh the one from pagota that I was mentioning and then of course here I know I give a little trophy to to the mbased one as well which is also like regular JavaScript and yes I I think that's about it I would say that like if you want to get on uh some some test n seoa this is like actually a really great link here and developer docs are over there telegram group and a bunch of us are here to help sweet well let's give a round of applause for

  33. 15:40

    Mike