Skip to content
by Unity Nodes
NEAR DevHub

Friday Night with Frol

about 1:31:22 long

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

About this video

All replays on YouTube & clips on TikTok (  / neardevhub  )

YouTube:    / @neardevhub   Twitch:   / neardevhub   X: x.com/neardevhub

Transcript

8,487 words

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

  1. 0:24

    oh what you want want want want hey what you want what want you want want

  2. 1:29

    you want like hey hey oh

  3. 2:30

    hey hey m m you

  4. 3:31

    n n hello everybody seems like we are live and I didn't immediately notice that um today we are going to implement the to

  5. 4:40

    do app in for near I mean in near on near using here rest all your keywords uh and uh yeah I hope it will be interactive and um feel free to ask any questions in the chat uh on the platform you choose I think we are live on Twitch YouTube and uh Twitter uh I hope Joe will correct me if I'm wrong and uh beside that I think it's going to be um just interactive and U life experience so anything that can go wrong will go wrong be ready and I will go through all

  6. 5:22

    the hopefully best practices uh of building apps uh on near uh in Rust and a bit of Boss components um can I share the screen uh is it working share screen share screen amazing so well where should we start uh I believe we should start with the best portal for developers we have and that is dev. n.org and immediately after you land here you agreed with code that's amazing uh we can start from here

  7. 6:10

    um the amazing part is that you can build applications in JavaScript end to endend the front end and back end today Al I will focus on Rust experience but I someday I'll definitely come back to uh challenge someone to build it in uh GS and see how the flow Compares but overall I would say um it's not that big of a difference um for good or bad we'll learn more about it in in a moment so switching to rust um the very first thing you will notice if you are

  8. 6:46

    familiar with rust uh You' OB obviously know cargo if you're not cargo is our package manager uh and near is the extension to this man uh package manager and implement by devhub and that's where we should start so if we go to and search for card here uh we will find this GitHub page and actually today I'm I'm it's all live you know uh let's check the version okay it's too old we have to use the newer one so I'm here on Mac copying

  9. 7:30

    this thing that's simple nice no extra tooling is needed it's all one single binary to P amazing so that's our starting point what should we do we should start a new project uh hold on I want to do it from a different folder uh it's going to be experiments today so carer experiment carer new uh today is to do app contract that's what we want to build first um so it created a folder for us

  10. 8:12

    and we can start from here oops um not experience folder they're going to use that amazing thing tot recommend and what we have here is a fully preconfigured project for us uh on the left was filling out the repository L which we haven't created yet that is uh a good practice for any um uh contract on chain to provide the source code so that's the easiest way uh we'll come back to it in a moment so I I already know that will be under FR and uh it's going to be to do

  11. 9:04

    app contract or like near to app cool uh the rest is fine so this is here for um reproducible Builds on near uh and uh we'll come to it a bit later uh from the dependences we only care about uh here uh is dek cool so let's uh let's also uh jump a little bit back to to do apps to do apps there are plenty of them right has to be uh oh it's uh not what I'm looking for to do apps uh examples uh uh let's

  12. 9:54

    say I know in react cool let's see what they they're talking about so create creating a new project we are done uh getting in the folder uh and building it okay we are we're close we're close um what is to the app in essence so do we have a any screenshot here there are always plenty of to-do apps with this pre-standard UI no this one it's not beautiful does anyone remember the

  13. 10:57

    proper master beautifully styled the app I don't I'll find it bit later but in Ence what we need we need a a way to to input a new to-do we also want to be able to list all to-dos and each to-do has a a status uh if it's checked or like it it's done or not uh we want to be able to edit it so probably we will need some identifier for each to do so like ID uh we want to be able to also remove the uh item um in more complex uh apps you can

  14. 11:45

    also reorder stuff we'll see if we want to get there today uh what you can also do is uh yeah change the status obviously and maybe like uh General buttons for like checking all done and filtering by um that's uh that's Essence so let's uh let's have a to-do of to-dos uh so what we going to have uh add new too list all todos Mark too is done delete too um I nice and we will store all of this

  15. 12:45

    obviously on chain so for that so we we are solving the problem of two things one is the storage like where we will store the data otherwise and uh um also a problem of hosting and uh serving the data so we will publish one application One Source Code uh to the to near blockchain and we will basically uh have two problem solve for us so this is how it usually starts so we have our nearest Decay uh imported here and uh uh we have our contract with

  16. 13:31

    the um toos um let's say let's start with vector and and think a moment like just for a brief moment what it will mean for us this mean that if we will want to add new Todo we can just append it but if we want to remove we can find it and remove but then we will have a problem of uh changing the like the index of to-do I wonder if it's if it matters but that could be our ID um of to do so maybe it's not a good

  17. 14:18

    idea uh maybe um uh hash map is a better option so we would have to do ID and Todo uh and to-do ID will be so we could use U ID or something like that uh let's define to do ID but I would I would go with uh u64 I think it's fairly easy and we will just uh increment it as we go so the to2 ID um like uh next to id idea would be something that we want to keep in mind as well but this is the high level and as as we mentioned we want to have a struct of

  18. 15:16

    Todo to do is our um um what we have we have text uh and we have completed Styles it's it's nice nice it's nice uh do we want to keep anything else like removed so I generally do not like uh Boolean Flags so I would prefer um more descriptive num so now with to do status with pending or completed it's better than you know uh true and false um thing and we can always extend it uh what we

  19. 15:59

    also want we want to add near here to be able to cize it for this thing it's nice um helper that just does the thing amazing and um so this is our structures um we need what do we need need uh when when we initialize the contract I think we we want to have some default uh state so like let's uh let's go without it first let's go without this and uh we'll come back to come back to it later and the implementation back to the features we

  20. 16:48

    defined um cool there's a question there's a question uh why u64 not u64 with capital u I presume you are going to want to print the whole item along with the to-do ID good point uh we'll come to bit to to it later I think we will start this way initially uh but that's a good call that's a good call uh I want to uh we will we will see a bit of bad practices first uh in order to understand the best practices better um is an M always better to use than

  21. 17:35

    true or false in my opinion yes uh in in terms of memory it's exactly the same in terms of viability it's uh usually communicating the intent much more cleaner and you cannot suddenly assign you know visible to uh to false or uh and pass that value to status somehow uh unwillingly and wouldn't be able to catch the type mismatch error so I I usually prefer even for to-do ID I I would prefer we'll

  22. 18:09

    go we'll talk about it later um not a type alas but actually a proper type rapper uh let's um get to be get to that bit later amazing amazing questions uh um let's come let's get floting uh so to before we add the to do we need some new uh we need a Constructor we need to to to initialize our um struct or in also in our case let's say um contract State you can view the uh uh the contract as a um

  23. 18:59

    is a single ton like the object that you initialize once in the lifetime and virtually it will leave uh beyond the re reboots restarts of any computers out there so in contrast to the applications on your local computer where after a reboot of the machine you have a clean State and uh clean machine um in like you need to restart the application from scratch from and populated the memory with some data um and your struct would otherwise

  24. 19:34

    be blank in when we will upload it to the blockchain it will be initial initialized first and further um calls to the functions will operate as if they are uh as the application has never been stopped and it was not inter interrupted so it's it's beautiful it's actually simplifies the development a lot in my opinion so and what we actually do so add to do uh Tak some mul reference to self so we we initialize the new oh I I

  25. 20:19

    didn't cover this part hold on so new our Constructor just needs to return the new object of uh contract uh in a in testing local environment we can you know reinitialize it many times but in on in the blockchain environment it we only want to initialize it once and not overwrite it uh in in the future so we mark this method as in it and it will ensure that this method cannot be called multiple times so after the first

  26. 20:53

    um run of new function um it will actually also initialize uh we'll make sure that the self is recorded in the local storage on your account here and um that state is what you will then resume from basically um whenever you run any other function so let's I I I'll cover all those um hopefully in in in details uh today so and the initial state is obviously empty hashmap and the

  27. 21:30

    next to-do ID will be zero um and to add the new to-do we need from the user we need the text and we also want to add it to ourselves so that's that's where the self is and we want to edit it so the self will be uh changed that's why we need to mark it as mutable and this already gives near uh attribute here a lot of uh context about what's going to happen um so let's construct a to-do object uh initially will be pending with the text and the to do and we insert

  28. 22:11

    it uh under the key of next too ID uh we insert the value of to-do and we do plus one um to our to do ID index uh it's a clever trick uh for those who are like I I think I skipped a few uh problems ahead we as I mentioned we could have went with the vector but then if we would Implement deletion we would constantly lose the or like shuffle all the items we don't want to do that so that's how we usually go uh

  29. 22:53

    you use the hashmap with IDs that monotonically increment all the time and then you can remove and create kind of gaps in your collection but it's totally fine forment uh least all todos uh nice so that's uh basically uh gives we want to return a vector a list of toos um from our storage so we don't modify the self so we don't need mute it's going to be a view method um getter if you will um and if you wish and the I actually want to

  30. 23:40

    return to do ID and to do uh but also it's bit ugly well it what what it will give us right it's uh it's going to return us a vector of look yeah that's that's a good um out completion this is ugly what's even more ugly is that we will receive it in in Json format which means that it will be even more confusing like this so I don't want to actually do that to me you and to the users in the first

  31. 24:38

    place so what we actually usually want we want to have to do ID right here um and for that we need so it's still a vector but this needs to be a stuct so it's going to be a something like to do but we'll think about it more a bit in in a moment and here we'll we'll want to have like items the items uh not about code just yet but let's uh let's implement the rest and come back to the clean so Mark to do as

  32. 25:26

    done uh I don't want to to do actually Mark to do or like better change uh to the status not helping uh to way change to do status uh it's to do ID and uh status to do stus uh if there is such uh to do so we getting 2 by ID and we are changing the Status to to status nice deltion remove by ID we need mutable here also it's mutable um edit to do we want to edit the text if they to do

  33. 26:34

    is in the list so this is a very nice pattern in Rust I really love this uh way of gating guarding basically the uh operations so only if there is a actual too you can edit it and you you like if let if there is if the return value from whatever is on the right is uh exist it sum not none so In Sum there is some value then uh we can do something with that value so then we assign the text to it nice nice nice

  34. 27:15

    nice why not just zero text instead of dirty um you can do that as well with just yeah turn the mapping I'm not a huge fan of uh making like keeping the ID outside of to do uh from because I'm like what I'm keeping in mind usually is how we will use it so for this like from Imagine That would be a JavaScript code there uh todu so let this be todu uh we want to do to uh on on on

  35. 28:03

    JavaScript side we would uh just basically go and return some list of uh to do map and here to do with to do to do ID and uh to do text kind of thing um that's why I personally like this way but we may also say okay we can do object. entries right over to do and map what we have to do ID and to do and kind of deal with this this way um good and bad the the additional benefit actually of this approach that you have

  36. 29:05

    a an order so you have the you have the an option to reorder opt the the things and it would be natural to express it this way if you uh go with the uh ID being a key in the map then it's you will need to have an extra separate thing for the order uh what the utility that helps you finish the text uh so it's yeah it's it's a some jgpt obviously like a pilot built into that uh it's um handy for small and obviously

  37. 29:47

    known pieces of code uh so yeah if if you are interested z. Dev is a website uh for the editor that I'm using check it out amazing thing build in Rust obviously and um has everything you need out of the box going faster faster so uh what's what's here so hashmap new uh it's it's time to fix the fix the problems fix the problems so uh let's let's fix the obvious problems with the the compiler H us and then

  38. 30:42

    meanwhile let's also write some tests so I think that would be uh more helpful for us uh the test would be um that uh we can um can add new to do and then the contract so it's a you you write your unit tests as if it's just a r Cod and that's a beut of nearest DEC R and GS as well that it structures everything around uh structs and classes and you don't need to uh um think about the any wrapping around it so the contract what if we uh so we ini

  39. 31:36

    initialize it and we want to add new to-do and the text would be uh write too app that's our first uh to-do item and uh hold on happen here and we want to be able to so and what we will return in get in return we will get in return at to do how come it should return to do ID and then uh uh better to say to do ID equals this uh Tod do ID and uh return to great so our our newly created to-do ID uh is uh new to-do ID

  40. 32:35

    this um and uh we want to be able to get it back um so let's check contract get to the text did it get to text is it did we implement we didn't how come um do we need a separate method for just want to do let's not do that let's not do that uh let's just uh then um list to do yeah it's a good uh first test we will see how we can use more advanced stuff in the moment or actually uh let's

  41. 33:27

    also and to doce um zero text is is this thing much difference between let some or unwrap or else Panic just whether you want to enter condition or close the F function so panic and W are pretty expensive operations like well comparatively uh ideally you you want to

  42. 34:28

    gracefully exit your applications both in blockchain world and outside of blockchain World um in uh in near when you crash when you panic uh you will um so for example here I guess uh not here but yeah we could have we could have panicked here but that would bring not a very useful error message so ideally we actually want to to return some information to the user like there are different options actually

  43. 35:20

    um uh it's not an STD but uh ideally we want to to do it gracefully um you can either ignore it like I did before like without this else brace uh then it's just silent if not nothing to edit okay uh but we can also communicate that there is some error and currently in ansd K there is this n uh abort uh or uh if you want to include some message Panic would be a better option to communicate that uh to do with the to do not

  44. 36:08

    found um you can you can treat it as exit in a way from from this particular function I think now that I'm thinking about it it's a bit confusing actually we probably should have a better way to have like return error kind of thing we actually were working on returning an result and help like handling the results properly that would be the best um actually direction to to implement it to to handle the um contract errors in a

  45. 36:42

    same way but for now uh it's still under implementation and their handling I would say is uh not that beautiful uh today so our first test is done this started using let some and is returned you know it was possible to De Construction in Cur conditions uh yeah let let uh let else is a is pretty interesting syntax indeed uh so we could so we could rewrite this guy into this is also yeah it communicates the intent very well when you have like clear like exit

  46. 37:50

    condition um so true I I I think I I prefer this way actually um when we have an explicit like an exit early exit basically uh here in the app cool thanks for sharing um so let's check what are we missing quite a few uh collections I okay uh serialize items yeah that's something we didn't do yet okay um it doesn't know about to do with ad true um not found in the scope yeah it's

  47. 38:55

    fine uh let's do to do is ID um how I would do to do with ID is I would do stru ID say here do ID text but I would actually to to do to do and uh apply the it was there but uh say is not visible here uh will this work okay let comp see let complain about oh yeah sure sure I did like I I

  48. 39:58

    put near but I didn't say that I actually wanted to implement additional serializer serializers uh should be um gson one Json and I I also want to keep Porsche uh that is the binary calization that is used actually I don't need here for for to to do with idea only return it um I think I need to do it this way uh can you explain a bit more but about cized versus B absolutely so

  49. 40:40

    the uh what we have here uh the when we store the contract on chain we need to be able to dump it and restore it um while the function is not like while the contract is not executed so for that we need to be able to serialize data from memory and serialize it back into memory so for that reason we need to be able to cize all the types that we want to uh store and we have several options we could cize it with Jason for example

  50. 41:18

    or um protuff or uh name it you name it I know CSV uh whatever but the but the problem is uh well we want it to be very efficient fast so we could choose we can say okay let's let's go with proove uh but then we quickly realized that protuff actually has uh potentially different um representations of the same data in memory to calized data which means that if you run the contract on different

  51. 42:01

    machines you may suddenly if due to some subtle changes or if you recompile your program for example that is even more uh triggering event actually it can change the order Fields it would be able to to distalize it but the problem is we need to arrive always to the exactly same bite output in the in the blockchain environment that's why we need some stable sterilization method for JavaScript for uh for

  52. 42:33

    protuff um an object of uh name um blood um CD world and the same object but with a Fields swapped from Json point of view it's exactly the same but for for the blockchain we need to be able to Hash the data as B and uh arrive to the same P so that's why we actually need uh borch uh and that's how we arrived to borch uh calization format in in the beginning of near Times where is the

  53. 43:23

    where is the B iio so this is website um so it's a near mention if you didn't know uh it's actually used in other blockchains nowadays as well because this property needs to be there uh for all of them it was surprising and it was so weird to even think about that we in 20 what it was 2018 2019 we need to build our own civilization format there has been a lot like B code um a a ton of different bite um calization formats binaryzation

  54. 44:05

    performance but uh yeah we had to do it uh but the nice part that it's fully integrated so for all these structs and the civilizations implemented um out of the box uh for as we can see the to-do requires borch and Json why do we need Json then right uh we need Json because we want to be able to uh communicate uh our inputs and outputs that was a bad example here and here as uh is Json so that's

  55. 44:47

    how we interact we we submit the requests to the function calls uh on here uh the the payload that we sent usually is J is Json but it actually doesn't need to be you can actually tweak and Aurora for example or contract uh prefers to use bytes as uh function call arguments and outputs um and it's totally fine from the protocal point of view it doesn't matter it's all bites but near SDK

  56. 45:21

    RS defaults to Json for Simplicity Simplicity simplicity uh so it's very easy to review the transactions on chain then so it's um it's fun uh I think we uh almost almost done almost done check items yeah obviously items is not going to work Ser doesn't need to be here Ser is a type minifier that supported underneath under the hood here um list list list we need to fix list um

  57. 46:22

    then we need to map over um to do ID and to- do and return to do I to- do with ID and that is to do ID and nice items obviously it's either either or rather uh uh no we we're not owning this not owning this then we need to clone CL and for in order to be able to clone it either yeah uh to do ID is a reference yeah obviously we need

  58. 47:24

    to convert that one and clone it it says like to do is not clonable again so by default rest doesn't Implement unnecessary um stuff so we need to be able to clone to do Drive clone but in order to to clone to do we need to clone the status so need to clone for status as well um okay only warnings are left don't recognize that the fact that it's po actually here huh why do you complain list this

  59. 48:34

    uh did I forgot I did this needs to be Pub this also needs to Pub to it's it's totally fine great so the the checks are passing so we can run tests and while it's running let me cover so this is the like structure layouts and the the functionality and we had a few comments already about various things but uh best practices so one thing is I recomend strongly recommend to have tests but also uh we like let's let's write this test so this is a small test

  60. 49:27

    right it's a just adding something and then checking exact the output but it's it could be daunting uh so uh I actually recommend using helpers there and one of the helpers is uh amazing uh insta crate so insta allows you to basically um not to write the expected output like you you only specify the input and then the input is used and stored in the as a snapshot the output is stored as a

  61. 50:07

    snapshot as a file and then um instad takes care of comparison of the outputs so we can say we want to uh assert the Json output is the same uh let's so back so how would what I what I mean is we still do the actions but here we just say hold on Insta and we don't need to to type it out uh let's see how that goes uh add new to do two uh insta obiously Ina does not unknown

  62. 51:14

    field text uh what's called ah obviously I have uh like in in Rust in Rust uh colle in Rust types I have nesting now so Todo do text yeah new to-do ID is not used that's fine uh insta is not there so cargo at Dev insta uh and I think we need to add chese on there nice so it's it enabled amazing and then we can run tests add new to do insta so this is the output let me make it

  63. 52:21

    bigger actually I should have changed the size of font probably earlier um so this is the like it's it's beautiful like look I I just ran the carg test and we are getting one test pass that the manual one but the the second one with insta failed failed because there was no previously um a a snapshot to compare with so we need to actually uh uh generate that snapshot first and approve it so let's uh let's run it so

  64. 53:09

    store the new snapshot that's what said and what it makes it creates a folder snapshots nice so this is the the file and I I don't need to manually now you know compare it and if if I for example break my code uh add new add new add new uh and I'm inserting not the text but instead of a text I would returner some uh nonsense then uh I run tests again uh hold on I didn't save the I didn't save the snapshot

  65. 54:16

    first why take some uh oh it was trying to run the the dock test as well um that doesn't make sense yeah we don't need to run do test just yet uh it's or maybe just let's remove a bu should be should just generate the file basically it already generated so what what it says what it says insta review

  66. 55:18

    so that's what we need to run actually and I'm just uh it asks me if this is the new thing is something that I want to accept or reject let's accept it and uh then the next test it just passes right uh if I change the code and it uh misbehaves so it does it it ignores the input uh when I when when you to-do is created it then it's it says like oh old snapshot and new snapshot this is a diff

  67. 55:58

    it's very easy to review and uh if it's something that is expected it's just a matter of you know approving the changes and that's all whereas uh if I if I use the old tag uh test let's see oops it just says like okay left and right does not match and how to update it I need to copy this value I need to go to the test I need to find the test I need to replace it in the test I need to recompile the test and only then I will

  68. 56:42

    uh the T will pass so and if if you have a huge output uh huge struct first of all you don't want to write it down this way it's just one line uh second of all you don't want to maintain it going forward that's superb um let's move on uh to another best practice to mention uh so the the problem with to-do ID and thanks uh Owen for pointing it out u64 is not something that you can so where

  69. 57:22

    do we use it where do we use to do we use it here in do with ID and we to do this ID we return it here and this is ciz Json so let me let me show what it actually does oh before that let's let's just uh yeah quickly finish the round with actually deploying it right we we we talk a lot about the code and we still didn't run it so creating random account uh generating neware saving it locally F test net am

  70. 57:57

    using visitor beautiful name beautiful um and uh let's let's now deploy it deploy where is deploy deploy yes to amusing visitor oops it says uh actually you know it's it's the the changes are not saved and the your contract uh cannot be reproduced and in order to fix that you you better commit the changes to get and then it would be all amazing um I'm not ready for that yet uh

  71. 58:38

    what are the what are my other options deploy I want to be no doer built okay uh words uh just complaining about it now one error near default yeah beautiful so it actually caught the the very first and common issue in the blockchain space is lack of inial initialization of your contract sometimes you may forget about the init function and there is like or or or you did did do have it but you didn't uh execute it and you you

  72. 59:24

    immediately jumped into add to do and we need some way to prevent that so you may Implement either implement the default uh implementation for the trait or say there is no default for your uh application state so derve uh nearest Decay uh Panic on default that's what we want to do to prevent accidental use before initialization of the contracts uh nice that was great catch of rust and near DK together uh we have the contract built there are some unused variables unused variables hold on

  73. 1:00:11

    that's uh that's broken another good catch of Ras compiler unused like you you should not underappreciate the uh uh warnings and linter um messages uh there is even a famous um article about the vulnerability that was pointed out like right in the face by clipy which is a lter in Rust and the team didn't fix it um before the disclosure of the vulnerability uh what is the name of the function you and what is the arguments so what's the arguments that this our

  74. 1:00:58

    function is having it's new no arguments so if no arguments we can use just you know empty object let's go with that uh we don't need to attach any tokens and 100 teras is fine it's going to be much lower than that but for our demo we don't need to worry about it anything that is unus used any gas that is unused even though it's prepaid at the beginning of the execution uh the anything that is not used will be returned back uh to you in a so you will

  75. 1:01:40

    not be charged for the full thing cool we have the um uh contract deployed um test n um and it's should uh so let's say what do we have in the plan so it it deployed the contract and executed new nothing unusual uh but uh if we go to the account uh we see contract this is the most beautiful part of it I really love this um contract methods and you see it's all pulled in through uh ABI schema uh from the contract

  76. 1:02:43

    definition so we have all visibility to the methods that is uh available from our uh application and I want to remind you we only upload the bosm file and this is the problem like you see uh there is no way to view the code I mean the source code the rcode uh unless you actually build it in a reproducible environment that's what I mentioned uh a few moments ago uh so let's see how to fix it how to fix uh so we we said like no Docker and

  77. 1:03:20

    we didn't see uh we couldn't see the source code on chain so for that another best practice is actually uh you know commit the changes upload the source code to get to GitHub and uh let's do that initial commit um and let's go the name to the app contract or near to the app contract right this one create new repo public yes create remote add Branch yes that's what I

  78. 1:04:24

    need M May using let check beautiful it's here now we can build can we H what did like an need and expected or GitHub XXX something is still oh I didn't save this file did I so how come is D car lock yeah I didn't save the file oh but yeah but it was edited hold on need to rec this part oh it's uh actually dependency

  79. 1:05:27

    um let's try now it fails because still the changes are not committed to the GitHub so let's say um fix it the link to the S code why not Implement default for contract instead of custom if you are not not passing any arcs um yeah you can do both it's fine I I find implementing default a bit more Rose even though it's totally to to totally fine way no strong preference when there's no

  80. 1:06:14

    arcs I would say that uh with like it it just makes things a bit easier if you just go always with a new method um it's explicit and uh Universal if you need parameters you get them if you don't you just leave it empty so um I usually go with not a default implementation but with a new method but it's important to have the default that panics then uh to uh ensure that's uh not

  81. 1:06:53

    causing any security vol ility problems um R and car deploy once again great um a lot of output but next problem is Docker I don't have Docker rang uh why do we need Docker so on in order to compile the rust source code to web assembly um you can do it on any platform with r tooling it's beautiful but the um the result VM file will be different on every machine uh due to path difference due to uh operating system change

  82. 1:07:39

    difference in tooling changes so what we did inside Kier um tooling is we scripted a lot of automation to build the contracts inside uh um uh IM uh Docker images that are uh Frozen and they are not being updated so you can always go back in time at any point in time on any machine today or tomorrow you can rebuild the same source code and get the same result and this that way basically confirm that

  83. 1:08:16

    the source code matches the vasm that is uploaded to chain and Source scan is a service that does exactly this in the background for every contract that is applauded to the chain they execute the step they extract the information from the contract because we encode the information about this image that is built um and a bit more of metadata based on that metadata you can you know download the code you run the code compilation step and compare that basm

  84. 1:08:48

    file is exactly bite to bite exactly the same as the one that is uploaded to the chain and integrating that into the near blocks is what allows us to um say that the source code exactly is the from The Trusted Source a bit of a detour and takes time but it's it it took a while to implement uh that we not miss any bits especially it's a tricky for factories and you need to include another contract uh inside

  85. 1:09:23

    the contract and that's and other contracts should also be reproducible so it's been a challenge and Kos to ol and the team and Andrew uh for implementing it and carer and Source scan and then the near blogs team to adopt it and provide this beautiful UI so amazing job guys through truly stoked on that um so we are compiling we compiling in the docker environment so it's uh it needs to you know compile it from

  86. 1:10:05

    scratch again should be ready pretty soon yay and we are ready to upload it uh since I'm uploading it exactly to the same account uh the state is already initialized so the the the the funny part uh the one you remember in the beginning I said that we can treat it as a contract object as a single ton that outlift anything in the universe uh that include that includes even the code update so when you when we will upload the new code the the old

  87. 1:10:45

    instance of uh of the data of this contract is still there and it could it can cause problems for people uh and the solution is to migrate state so you need to before you do any further execution after deployment after new deployment you also need to um migrate the old um value all state of the uh of the struct and all the downstream structs into the um into the new format in our case we didn't change anything on the uh structure level so we are good uh we

  88. 1:11:29

    don't we don't need to reinitialize it just deploy it and amazing it's there um so our to-do app is here right check so it will obviously take some time you can see that uh you don't we don't see it right just yet uh I'm not sure I actually didn't test it on test net uh maybe it will take a bit longer or if if at all to to have the reproducible buil available um but in theory we can we can say that it's it's going to be there uh so what what do we have we can add to do

  89. 1:12:20

    we can uh complete to do status edit list to do let's let's go with list Tod nice it's empty how else can we uh list it our to-do is from a beautiful near C near contract call function as readon uh this is the contract and we can distu it's you see it it also pulls in the uh available methods automatically for you it's yeah it it feels just right but it took quite quite some time to figure it out uh this ABI topic and stuff so list todos does not have

  90. 1:13:04

    any arguments to it so it's empty object as parameters and we say go beautiful empty empty to the list uh let's uh let's add in too how to add in too a contract call function as transaction on testnet uh we will be adding to this um this something that I would uh actually prefer to be also uh solved in CLI to present the schema of the parameters that we need to pass so we'll have to uh so actually what um uh near block

  91. 1:13:46

    already does it it's again huge kudos to the team implementing it so we know that it it expects to receive taxt as a string um let's test it uh um we need to test to the app uh connect to contract interesting okay uh let's try do I have any wallet put ex account create a password uh recover account recover account uh let me pull my Tes account

  92. 1:14:51

    credentials you can see my screen can you great let's do it from here then it's the first time and Trend here I'm loving it here uh right okay they ask me to sign what did we ask to sign cool yeah wow uh transactions add to do beautiful enhanced plan and to-do is executed no logs result is zero is our to-do ID is zero amazing wow so Smo uh best life screen sharing in my world in my life not this screen this

  93. 1:15:59

    screen two uh let's also add to do from the uh from the CI complet here text uh test to do app from CLI um Tas yeah we we're using very little so 100 teras is too much but uh I can't hold it uh so it's yeah it actually we could attach like one Tas it's super cheap uh in terms of near fees um and uh yeah and then uh let's check the list of contract call function read only view to do yes no parameters yes test net no

  94. 1:16:56

    boom wow so we're there we're almost there last thing that I want to talk about today is the um fact that it's it's not just you know on that website called uh test net. blogs. it's not only on my uh local machine uh was near CLI accessing it it's actually everywhere now so if we go to oh it's it's not Tes it why did I I should have go this no is okay this way uh sign

  95. 1:18:06

    in Ni connecting wallet easy and I can build a very simple uh UI right here to my contract um so what I want I want a list of to-dos todos is uh near. all or near VI and uh the account where I deployed it where did I deploy it I'm using I'm using I'm using visitor. testet that's my uh beautiful uh application name now I don't need any arguments to it so I can leave it this way and I just want to

  96. 1:19:01

    to map it so do the map uh to do render Le list of uh too. text uh actually what what I usually do first I do uh Json um what's called stringify it's that's my way to actually VI the data first to understand preview map is not a function uh let's uh let's first do what I just said I do usually and Jony

  97. 1:20:06

    do um true am using visitor this net contract name method name oh method name he I love JavaScript list to this beautiful so yeah and if uh if if uh toos is null then it's a loading otherwise this nice so what's left is only um say want to have input

  98. 1:21:13

    type check checkbox um value uh or actually I don't remember value checked or checked equal check something like this and I also want to do dot um to be displayed here input HTML check box type checkbox uh checked okay prob just just input type che check

  99. 1:22:17

    or it is this way what's going on h that's super weird um let's uh go more fun so work we have Umi UI Library I remember it was here

  100. 1:23:37

    you not this one no it's not the one that I'm looking for no way I was on this page just a few days ago um oh here it is okay beautiful uh check

  101. 1:24:41

    box Let's test th000 FRS so this is loading the library and this is the wrapper and then the check box is this one I care about this one I care about this one oops no way it stop working oh it's obviously yeah it's main net and we we are on sorry about that

  102. 1:25:42

    false track anyway something is wrong with with the checkbox that's that's totally unexpected um if something can go wrong it will go one anyway so at at least we have the list of to uh we didn't have time to go through the um full app with all the features but uh something that I want to mention in the closing of it uh I guess for today is uh um that the carg near car and near Decay

  103. 1:26:38

    and um um testing tooling is all there for for your help and uh it's fairly straightforward um application that you can build and once you upload it to the chain it's just there um you don't need to care about deployment or um managing like the load to your application um it's all distributed through the blockchain network and uh you can view it as a um serverless platform um and um and this way so for example we have

  104. 1:27:26

    the race of SLO uh project that is uh also storing the data on chain and the um number of PRS and what the reers that are um participating in the in the race are all available um as a like all from anywhere so it's uh it's actually great way to um on the functions probably it expects a bit more data as input um but that's uh something we can explore here box a to tooling is maturing as we speak

  105. 1:28:20

    uh so it's uh if anything can go wrong it will go wrong um the um so what's uh like Reapers interesting something is not plain to it's stopped dealing with me right the last moment in any way like what the data that we are showing right here with a leaderboard who owns uh how much loss points and uh for which period of time uh is all stored on chain and we have

  106. 1:29:21

    these uh SL points distributed to contributors or to open source so it's a it's a powerful tool um and uh fairly easy to to manage uh once you grasp it um that's uh I guess all for today thanks for uh staying with us and uh have a great lovely weekend uh enjoy and play with uh near with carer with rust uh with race of sloth and if you are not participating in r oober fest check it out thanks

  107. 1:30:07

    everybody bye for

  108. 1:31:22

    e e e