DAPPCON 2019: Taking Back the Web with Embark - Jarrad Hope (Status)

DappCon 2019 · August 2019 · 17:42

Jarrad Hope of Status presents Embark at DappCon 2019, a development framework for building decentralized applications on Ethereum. He frames the tool as part of a broader effort to take back the web from centralized platforms, covering how developers can deploy smart contracts and integrate decentralized storage and messaging into their dapps.

Speakers

Topics

From DappCon 2019, hosted by Dappcon Berlin.

Transcript

all right cool thanks for coming down my name is Jared I'm from the status Network you might be familiar with us from doing a sort of super application with a primary focus on decentralized messaging but we actually work on the entire web three stack so we work on like ethnicities our theme 2.0 clients we have the application of course we have a hardware wallet in a debit card form factor called key card and today I'm talking to you about our DAP developer tooling embark so basically embark is the olden one DAP development framework to build truly decentralized applications it's actually

brought to you by URI who is the second largest contributor to remix in many ways embark is a spiritual successor to Enix you can also download it at NPM Stahl G embarked but you can also use it locally in your own project for project versioning and go check out the docs as well so DAP development is actually really really hard I'm sure if you've had a chance to work on that actually how many people have used them back for show hands ok cool so so basically if you've done any DAP development before you realize that setting up an environment is quite difficult getting all the services running making sure

that your contracts actually deploy to your blockchain work it comes quite tedious and we what we really want to do is reduce that friction down so you can just focus on what you're trying to do or they're having to worry about setting up your environment or do anything else we really want to tighten the loop to iteration so you can just constantly focus on your code and don't have to worry about anything else but there's also another philosophy behind embark we try to stay true to the web 3 vision because the app development is so hard today a lot of the DAPs that are coming out essentially web two point five right they're still using some kind of server-side architecture they're not

really truly decentralized so we try to stay true to the the Holy Trinity as foreseen by web 3 which is distributed consensus which you find in your blockchain messaging which you know is kind of like a whisper and decentralized file storage is where you want to be hosting your your application interfaces so before I get into embark I just want to let you know what can you actually do with it we actually generate a bunch of other depths that you might not be familiar with and they've all been built with embark the latest one that we've done is a fear to crypto exchange it is entirely

decentralized that means once it's deployed it can't be shut down and there's no intermediaries this is called the teller Network it'll basically allows you to find peer-to-peer ATMs using your friends family and that sort of thing status contributors actually also having a meritocracy in which your it's kind of like a locking game to to give other people kudos reward them for good behavior and things that you think they've done really well in the sense that you can't actually withdraw unless you've already contributed to other people as well we Andy crypto wanderer has also just finished his amazing

curation market it's like a DAP store but it's on a token bonding curve and again it's it's currently it has actually hosted on a on a web server but you could deploy it to ipfs just as easily no problem and of course we have a if we have any major decisions that we want to do within status we do this by quadratic voting so we have a voting DAP for that as well and all of this was built really easily with with embark so let's get started there's pretty much three major ways that you want to get started with embark and creating your new DAP basically type in embark new and then your dad name if you want to use this specific template or something that's different from the default

framework that's pretty easy all you need to do is put a point to a github repository and if you're using or git repository and if you're using github then you can use a shorthand syntax like that including the the branch that you want to use yeah if you don't care about making like a full-fledged app and you're only focusing on contracts just hit up contracts only and if you're new and you have no ideas at the moment type in embark demo and it'll create like a demo adapt for you to just run and see how it works so once you run that you CD into your DAP directory and you have one command that pretty much automates everything that you possibly need just

type in embark run and you'll see this fear knots if you're not a command line junkie don't worry I got something really good for you but here you'll see that it sets up all your services whether it's Geth ipfs a web server whisper you name it it all comes up it then runs your tests and deploys all of your contracts to the locally running blockchain and then you're given this console in this console you can pretty much type in any command that you want if you want to interact with your contracts you can if you want to type in help you see a bunch of other stuff including access to like the web 3 object and all our look fancy stuff and if you're a command line junkie then you

can just move to your vim or whatever you like to code in and just happily be on your way but there's actually a lot more to embark on that so if you're working in a team or you just prefer a web interface then you want to be running what's called cockpit and this allows you to collaborate if you put it onto like a VPS with your team to work on your DAP this is essentially the same screen as the the command line version so you can see your web services at the top there you have your embark sort of console you can also switch over see the blockchain outputs and below there you can see the deployed contracts as well so let's get together and see what it's

like to actually develop a DAP with embark the first thing you want to do is head over to the web based IDE right and this is what you'll be presented with so on on the left here you will see the file structure this is basically all your resources your contracts that can figurations everything you possibly need in the middle is your your main code editor and on the right-hand side you have your real-time refreshing iframe for for viewing adapt and this becomes really really easy to start coding in because anytime you change your source assets it's an automatically refreshed the tests that you've written are automatically run and the contracts are

redeployed every time you modify modify them so it all happens really seamlessly and it's it's yeah that's pretty much it click ok so if you want to make a decentralized reddit scan that QR code and you'll be given one of our tutorials on how to build our reddit without any infrastructure aside from running on these decentralized protocols and here we've just tried to submit our first reddit post unfortunately we've seen some kind of transaction reversion uh-oh we now they need to fix this thankfully embark comes with a debugger and this allows us to to inspect the transaction

without ever leaving our environment and make it super super easy so this is pretty much what it looks like we'll go up to the top right and we'll hit the debugger I'm sorry the logger now the logger will basically show you every call and every send transaction that's happened to that contract whether you've done that in the interface or by the command line or just interacting with your DAP now you'll see there's next to the d reddit creates a method that was called we see debug so we can now hit that and see what's actually gone wrong but before I do just one it also points out that it's super easy to filter this log

whether it's by functions in your contract events or even the current status of those transactions so we hit debug and immediately it's taken us to the the violating line and it's highlighted in blue here and we know that I require has some kind of issue on the on the left-hand side on my left-hand side there's the state as it currently is in both the Global's and in the local function super easy to inspect you can then basically step through your code and see how what the flow is like or jump back rewind you know until do all this sort of debugging things here you can see we've actually got equals to 0

of the ipfs hash length that's obviously wrong so we can basically modify that what will then happen is as soon as we hit save it'll redeploy it run the tests and like we can try again and it works no problems this hole happens super super quickly dead easy okay so you might be thinking we'll hold on I don't I haven't written my user interface yet I've only just got my contracts going I want to be focusing on that so basically what you can do is you can access your contracts in multiple different ways first you can do it by the user interface it generates the entire UI off your ABI super easy to call type in

parameters that sort of thing you can also access it directly from the command line interface whether it's on the website or by command line embarque also includes a full blockchain Explorer that has deep linking it has pretty much everything that you could possibly need so so here is your overview of your accounts the blocks the recent blocks the transactions that sort of thing and you can pretty much inspect anything that you want here's a couple of screenshots on that account so here you see your particular accounts and the transactions that are following nuts you can inspect in transactions yeah

oh sorry blocks with the little transactions in it and the transactions as well also embark comes with built in ethereum name service supports so you don't need to actually deal with ens in any major way it'll automatically deploy a local instance for you on the chain you need it and you can it's just super easy using a Bock jeaious to like look up or any particular hash or string and if you're in development mode it's also super easy to to register ENS names in your deployment scripts or however you want to configure your environment so as I've been mentioning a couple of times

every time you're like working your tests are being run in the background and you can see the if there's violations or not embark all obviously warn you if that's the case but it also comes with a code coverage utility so with code coverage you can essentially be assured that at least your tests are cut running through all of your code and that way if you if you realize that there's some parts of your code that need to be run or at least accessed during those tests you'll become aware of them it'll also show you the the various violations as well embark also does the document generate the generation for you so if you do like to

document your code I highly recommend you should it'll do so it'll also generate graphs of all all the interactions between between your contracts as well now embark comes with a whole suite of different plugins but the most important ones doing just security obviously when you're deploying smart contracts they might be unpublished on the blockchain for life hopefully and you might not have access the same access control to them as you would in a normal web application so it's super critical that we try to make these as safety critical as possible so embargo basically allows you to run over a whole suite of static analysis and

security tools to ensure that your code doesn't actually have any like major vulnerabilities that are kind of well-known so there's three major point plugins at the moment or one Vaughn trail bits myth X and a flint as well another thing is embark obviously makes it super easy to deploy since part of that iteration cycle is deploying your contracts every time but if you're ready to go main net you can have your separate maintenance but you can also selectively deploy your contracts from within the user interface at any time at the same time I embark makes it super

easy to publish two FS can by flattening all your source code and putting it on to as a scan for you depending on whatever address which is super nice if you if you need some sort of social proof or validation in your deployed contracts yeah and we've done a lot of work in terms of documentation for embark so if you're new committed apps you should switch come over to our Doc's we have a whole bunch of tutorials are really easy to get started building gaps and if you're a seasoned pro like it was plenty of references as well if you need to look anything up and one other thing is embark is essentially changing for the future

because we were actually the reason we created embark and building it is because we want to see an ecosystem of decentralized applications out there but we recognize that this is quite hard to do so what we want to do is set up a coordinations with a different community fund and basically create mini dowels around very goal specific gaps so you can imagine us coordinating community initiatives getting people together to build out certain ways of taking back to web so I mentioned decentralize read it that's basically one of the first things that we're going to do but we can think about creating alternatives to other

famous web properties and really start bringing users over into this decentralized infrastructure this is a mission that I'd love to invite you on you're more than welcome to and I hope you'll see here more of that and contribute to it in in the future so you might have noticed that I've kind of glossed all over the code because I am presenting it on the behalf of these wonderful people there's a whole bunch of other things that I haven't even scratched the surface of but I'm running out of time but essentially everything is entirely scriptable embark is highly modular so it's super flexible for any kind of project that you need and if you want to contribute

there's the github repository I don't want to say a massive thank you to all the guys that have been involved in building it out so I guess I just want to take this time now to see if anyone had any particular questions or if there's any sort of feature requests or any community initiative ideas anyone at all oh yeah I think that's on over there the mechanisms that were being implemented in the in the in their status is there any restriction that we could use that these kind of mekinese

are not rooted out of the status platform because what I could see is there are a lot of really nice implementations but I could see them being stolen or being used and in other platforms with already Network effects is there any way to protect about that I mean so this is so the question you're asking whether this is locked in to the sort of status network or platform I mean this is entirely open source you can download it you can run it yourself like this is for you we don't host this we don't want to host this so yeah you can totally do it with their view however you want it's just a tool yeah and a slide from that like it uses any kind of EVM compatible blockchain so we're building this for aetherium

obviously but of course you can use it with any other blockchain that you want yeah it's just it's literally DAP development framework that's all cool all right cool thank you very much