Introducing Embark 4 - A powerful engine to build DApps by Iuri Matias (Devcon4)
Devcon·Wed, Oct 9, 2019, 12:00 AM
Visit the https://archive.devcon.org/ to gain access to the entire library of Devcon talks with the ease of filtering, playlists, personalized suggestions, decentralized access on IPFS and more. https://archive.devcon.org/archive/watch/4/introducing-embark-4-a-powerful-engine-to-build-dapps Iuri Matias, Lead Developer of the Embark Framework, introduces the new version of the framework and how it can be used to easily build the next generation of DApps and Decentralized Services-----Abstract (for submission): The Embark Team has been hard at work these past months working on the next version of Embark which allows to create in minutes DApps that would otherwise take hours if not days, easily allow the developer to find bugs & security issues, a powerful development "command center" and create easily not just classic DApps but other types of Decentralized Services as well on top of Ethereum. Speaker(s): Iuri Matias Skill level: Intermediate Track: Developer Infrastructure Keywords: dapps Follow us: https://twitter.com/efdevcon, https://twitter.com/ethereum Learn more about devcon: https://www.devcon.org/ Learn more about ethereum: https://ethereum.org/ Devcon is the Ethereum conference for developers, researchers, thinkers, and makers. Devcon 4 was held in Prague, Czech Republic on Oct 30 - Nov 2, 2018. Devcon is organized and presented by the Ethereum Foundation, with the support of our sponsors. To find out more, please visit https://ethereum.foundation/
Transcript
hello I'm a Murie I'm the lead developer of the BART framework bye bye status we're trying to do a framework that makes it as easy as possible to develop disatrous applications and I do mean the central application in a true sense of the word so the apps that really use the entire decentralized stack that is currently available and I'm we're really excited to to talk today about in part four and we also have a few other surprises first though we'll just do a quick detour for embark three and what happened this year for those of you that might not be familiar yet would win a mark so this year back in May status announced that it was supporting embark and the team has grown a lot to learn Alex seven seven members full-time working on this and so first of all embark goes far beyond just the smart contracts it does support sylheti and other language like VIPRE and bamboo out of the box and you can even use them together if if you want to but it also supports swarm ipfs whisper and and recently ENS has more components in the stack and we can also add other technologies technologies through the plug-in API and we work with some other projects to include to add their projects between work so the first big difference of embark would would with other tools is that the contracts you describe the relationship between the contracts so it's a very complex and of the often spaghetti-like migrations all we have to do is really describe contracts are related to each other and what actions you might want to do once the contract is deployed and and other events and import will automatically figure out what is the best way to deploy those contracts to reflect the state that you just described and that's also effects if you change particular contract he will not deploy everything will deploy only what's actually needed to again reflect that particular configuration so stairs uses embark extensively internally for the Ford apps and smart contracts this is a more or less real example I am already for it modified a lot for the purposes of this presentation but the first thing is that there are environments so you there's this special default environment which is a sort of environment that applies to every other environment and then you can override in a specific environment and in particular configurations that you might need so in this case there is this mini-me token Factory which it's already deployed in robson so we we define it there so when we do when we deploy to Russian it will take the configuration of of default merge it with Robson and in that case will not try to redeploy mini token factory we'll just reuse that address then here you can see there's a mini-me token factory is being passed as a string with a dollar sign and that's a special this is a special directive that it doesn't work that this contract for this argument it needs the address of this of this contract so important with this knows that it first needs to deploy mini mini mini me token factory or guitar dress and only internally it should deploy this as TT token there's also other directives like deploy AF which will only deploy if a particular condition is true that can be something in JavaScript code or can be even as something in a contract and you can also do multiple actions want a contract deploys and there's other directives here which are not really going to because there's a lot of them there's things like after deploy and other directives so you can do a lot of different configurations with this type of thing and here's another example that you can also specify a URI for particular contract and this very useful if you want to quickly prototype something that and here's a contract from open sampling in this case give us you can specify a URL or even even a swarm URL or ipfs that comes configuration by the ratio okay questions we asked no sir okay all right so that counts by default we will take the accounts on offer connected note however you can specify there's a light wallet functionality which you can use to specify accounts and even set their balance so in this case we define here two accounts we use a private key not wanna use a mnemonic and there's two examples that are possible it preferably don't put your private key and source control it's a good idea and you can see there's a balance five eater which so if you're in a development chain or it's a hornet when a testimony we'll set that to five eater of course this won't work and may not but it's just for development and ens is is so ENS in and work is considered one another layer in the in the stack so which is the naming layer the NS right now seems to be the only working centralized naming system so it's only what that's actually supported embark will when you are in the velopment chain or in a private chain embark will automatically deploy and set up the NS contracts so you can use the use them in your application and this whole configuration might look like so in this case when this is enabled and we are in the development chain if I go to my job and resolve started at add that will that will resolve to the to that address that is defined and you can put the contract or contract that you just deploy as one of those addresses if your tab then is if you are having bar connected to an on chain like Rob Stan or main then it will just use the NS contracts that are already there it will not not try to to redeploy them or it that test so there's a lot functional in the test they are they are quite flexible in the sense that you can use the same contract configuration that we say within before if if you don't want it in one of the very very pure unit tests you can also do that just import the contract objects and deploy deploy them in before each or before all they're quite fast they they try there's like little tricks that the framework tries to do it like if you have any mark instance you will actually connect it and instance and we use a lot of the code that's already running like might we use the compiler or might even we use the node that you already have which is much faster than putting a VM on the spot it will display Gaskell's and he also supports code coverage out of the box and there's a lot of functionality in producing bark which we cannot really cover it here but for instance there's full support for for web pack so it makes it very easy to do production builds of your diaper or so you can have very small file sizes which is really handy when uploading to to switch form for instance supports already IP 1102 there's many templates ready to use such as which one is like a react Templar or or when you want to do like a statue snap there's also plug-in for that and it can very easily so create private change so if I would other developers you want to develop on the same chain that's also pretty simple to do and there's there's a plug-in API that allows you also to extend and completely change the functionality if you want to in fact in work itself is entirely plug-in based so everything in it is is implemented as a plugin so if you wanna add some other technology or completely change you you can actually quite easily so now embark for so the team has been working hard in this the last last few more and there's this there's this feature in the embark tree which is a transaction logger and what what is what is the dates and still the huts is when you do a transaction in your tab say of developing it will show in the logs what contracts you're calling what mattered what parameters and all they had all that all that information in import for now it will also show why if a transaction failed we will show you why and exactly what line caused that to fail we'll also show you the the variables values and so I can easily see why we we also including in work for a debugger so if you type you can either type debug in the transaction or you can or if you just type debug then it will debug the last filling transaction so you can easily you can quickly see okay what are the values of the variables you can UNIX previous and other other commands we also including experimental DAP generator and the idea of this is that you can you can give him work a contract and he will attempt to generate a react app that works for that for that contract which is can be quite handy for for prototyping and which we want a level deeper and a for certain for particular cases you can also just specify like a model and it will create the it will create entire the contract and the DAP based on the own the configuration that you date so in the case of this of this command for instance because that's picture ipfs it knows that it has to put the functionality to upload and display pictures they should go to my PFS and the ash that Scott's return needs to be in the in the smart contract now embark as since version 2 I believe this dashboards and just be very clear this is not going away because we got very typically very good feedback on this however we introducing now cockpits and this is this is essentially a complimentary but it launches it launches a UI that you can you can access to interact with would embark so it kind of takes that dashboard and puts it as a web UI so you have the same things that you had in the console from the services you can see the deploy contract but it's obviously much more interactive so for example the in the console oh yeah we also have like light team dark team depending on your preference I prefer the dark so the console for instance you have also suggest an 8 it tries to recognize what you're doing and give it a proper suggestion so if you're using web 3 it kind of gives you a documentation on the spots of what each of the suggestions are if you're typing a contract address you will give information like where that contract is deployed what is the type of the object it also has a blockchain Explorer so I it has pretty much typically everything you would expect to have from accounts block transactions and the contracts as well the contract that you have just deployed it has a editor and again this is complimentary don't you can still use say more vehicles or or forgot for ready max so and when you when you open a contract file you can immediately you can interact with it and in the ins IDE you can see here in the sidebar there's also other the screenshot might be missing there's also grass a gas price estimator which is useful for connecting to a more public network so I can see how fast the transactions can actually go and for what price I will serve the details in case you need a bi or the bytecode to copy/paste ads we also have the same transaction loader that are shown on the console been in here here you can actually see what were the transactions done to that contract and you can actually filter them if you want to can filter by advanced and you can also debug them and in the case of debugger so it will show you the contract I will join the contract global variables you'll show the solidity variables as well as the the local variables to that function and you can step through it step in breakpoints the whole thing and there's also a browser preview that that you can use for more quick prototyping so a good algorithm of a good workflow in this would be for example that type I press the set value I seen a transaction in the set 1 and maybe it broke I press debug go to debug and I can then debug the contract and see and see what went wrong and we also introducing this a deployment tool so the idea here is that we from speaking to many of our users we realized that a lot of people actually prefer to deploy directly with what would madam ask typically with a browser idea with a browser app ID and then deploy to a madam ask because sometimes they don't feel very comfortable deployment from the command line and because in the case of more advanced tools like embark it does not it can do a lot of deployments and and when to point the minute people need to have the confidence of what's actually happening so here instead in this with this option in work will tell you what is the intended deploy order and then you can actually deploy semi manually one by one and each time you deploy contract manually you can interact with that see where everything is okay and then you can move to the to the next contract so you can get more info in the in the barque where in the embark website status as I am it will it's now available as alpha it's the one alpha stage so be careful and we all we also intended to make it available as a pure web application if you're interested in that you can go to the embark website and sign up in the m'ling list and you will get an invite and I just want to thank them for the embark team and all our contributors that made all of this all of this possible and thank you debugger like the visual debugger are you using are you leveraging remix for that yep we're using remix reusing most of that library from remix yes so remix it's being basically refactoring into an API that you can use an embark is leverage and leveraging that so it has a pretty much the same functionality as remix I thinks hi so I understood that you provide like a testing framework for off train code doesn't work for mmm solidity contracts to and as an alternative do you integrate truffle or I mean the whole suite you know truffle drizzle and and what's it called ganache thank you can you be the first question yeah you you in your presentation you show you showed I mean apparently you can write tests with embark right what are you test exactly do you test the smart contract code or you test the off train code so that's my first question and if it works for both and if not do you for for testing smart contract code do you integrate truffle right so it's a smart contracts it doesn't mean focus its actual support solidity tests truffle is like a different framework and it does what Moore's a sub it does like it specifically just for the smart contracts well this does the smart contract so it is what do you you were describing like truffle does but it also focuses on the other other component and drizzle I assume that's independent of truffle so in that case which it should should work get one right here okay so when you are showing the configuration we are showing some kind of hooks in this javascript object like on deploy and the string representing the code that it's gonna be evaluated my question is why don't you just use anonymous function with you know some arguments and like here you're doing like angular one style like with this funny syntax so I took I took like a real configuration and then I said okay what's missing here that could be educational and I added I I didn't really talk about anything about you know that type of starter gold if anything probably confuse people more and it was already a big config file so to answer your question for educational purposes that's the test answers hi as a long time truffle and embark user I've been waiting anxiously to see which framework actually which JavaScript kind of version of the blockchain some ganache or whatever embark powers up is going to support default event reading like when they happen in contracts without having to subscribe to them so are there any plans to have can't to have events tracked by default from your smart contracts and shown in the block Explorer so you mean actual in facility the events you don't mean like just the transactions no not just actual events from the code without having to subscribe individually I'll think about it because I feel there's some downsides to it but I know they're this is coming in the next version of ganache right and I really hope you guys beat them to it yeah yeah that's exactly what this thing yeah cuz we do have the logger that you can see the state so doing that it looks fairly trivial unless some misunderstanding song but yeah we would so I didn't show really the the the Explorer for the contracts and you can you can choose your contract a candy and yeah you can interact with it but adding this we could also add this state to it so I think it's a good good suggestion so you support en su support ipfs are you going to support APNs we actually do support Alpena's I didn't mention it but we do support you
Automatic transcript — names and jargon may be misspelled.