 Welcome everybody. My name is Lars Brunius. I'm the Director of Education at IOHK and in this short video I want to show how to use the command line tool Mellet to compile, deploy and test smart contracts on the Yale Testnet. There are a few tools you need to have installed on your machine. First of all Git in order to clone the repository, then NPM, the JavaScript package manager and finally Node.js of version at least 10.5.0. To get started we first have to clone the repository from GitHub and then install the tool. The repository is at input-outward-hk-slash-mellet, so let's clone it. We simply copy the repository address, then switch to a terminal window and git clone this address. This will be very fast and it will create a folder called Mellet. We change into this folder and now install the tool with NPM install. This will take a while because it also has to install some dependencies, so we have to wait a couple of seconds until everything is built. Okay, now we can see whether everything installed correctly. So I am on a Linux machine, so I started with .slash-mellet. If you're on Windows there will be the option to use mallet.bat and as parameters I simply do minus minus help and I get a help message about basic usage. Having successfully installed mallet we now want to run it. We do that with mallet and then as argument the network we want to connect to. In our case we want to connect to the Yeller testnet and we can specify that by simply typing Yeller. Let's do that and we are inside mallet and connected to the testnet. This is a Node.js rappel environment, so JavaScript works. For example, if we type 3 plus 4 we get 7. You can list all available commands with list commands and you can get help with help. This directs you to the repository from which we clone the tool and there is help available to all the commands. So one of the commands is list accounts and if we try that we see that at the moment there are no accounts. So let's create one. Do that with new account. It takes one optional parameter, the password. So let's use Yeller as password and the return value will be the account address. So let's assign that to a variable so that we easily can refer to it later. There is our account. If we do list accounts now you see the newly created account and we can select our newly created account as the default one. Now the next step after we have created the account is to get some funds to the account. We can check the balance. If I don't give an argument then it refers to the selected account. So that's our x now and we see at the moment we have balance 0. So let's fix that. Build into mallet is access to the faucet. So with request funds we can request funds and it might take a couple of seconds. So I just try to get balance. It's still 0. Now we have a lot of funds. Now that we have created an account with some balance on it we can compile and deploy our first smart contract. By the way if ever you run out of balance on your account you can simply request more from the faucet. So I have prepared a very simple smart contract called counter that holds the integer value x the counter which is initialized to zero in the constructor. Then there are two functions ink x and get x. Get x simply gets the value of the counter and ink x takes an argument a which gets added to the counter. So let's try to compile and deploy this. So we start mallet again connecting to the yellow testnet. We can try to compile the contract with yellow compile and the argument that expects is the file name of the contract. Let's see. Okay that looks good. We will need the bytecode. So let's grab that and assign it to variable c. Now in order to deploy it we must select an account. So select we will select the account that we created previously and we can simply get that because there's only one right now so if we list accounts we will get a list of length one. So we grab the only element select that account and now with yellow create contract you can deploy the contract. It takes a couple of parameters. The gas that we are willing to use let's choose one million and the value in this case we can use zero and most importantly the code which is the bytecode we got from compilation before. So I save that under c. So again you see I have to enter the password for the account and it is deployed. Now we need the contract address so we can look at the receipt that is. So let's save that under counter. Okay so we have deployed the contract. Now that we have deployed the contract let's test it. So we call a function with yellow contract call and first we must specify which contract to call. I save that address under the name counter so I can use that now and again we must specify the gas. Let's again choose one million and we must specify the function we want to call. So let's first check whether the counter value is really zero right now. So that's the function get x without arguments. Again I need my password. Okay now to see whether everything worked let's get the receipt first to click. We have to wait a bit. That is so the status is zero so that's good. It means everything went fine. You also get return data which is RLP encoded and in order to better be able to read that we can use an RLP decoder. So let's just import that. So we require the RLP library and now we can use RLP decode, get receipt, return data and it's zero as it should be. So now let's try to increment our counter. So do another contract call same contract same gas but now we use function ink x which takes an int so the name is ink x of int and in this case we need this argument a which says how much we should increment the counter. So that's called arcs and it takes a list of ints. So in this case we only need one int. So let's increment the counter by 42 my password see that worked. Yes status is zero so that's good and now let's try to get the new value of the counter. So again I call get x and let's use the code from before to decode this not done yet so just wait until it's included in the blockchain that is 2a and that's of course hexadecimal so 2 times 16 is 32 plus a which is 10 32 plus 10 is 42 so everything seems to work. So we have seen how to install how to run it then create an account get funds onto that account how to compile a smart contract from Solidity into bytecode how to deploy such bytecode and finally how to call functions on deployed contracts and check their results.