Trailblazing Plutus on Cardano

Do repost and rate:

I excitedly opened the email from Lars Brunjes inviting me to the second cohort of the Plutus Pioneer Program. The giant red banner across the top reflects the difficulties that lay ahead. The happy welcome text below exclaimed the excitement within the community at the prospects before all of us. This was my own version of a letter from Hogwarts: I was going to be a wizard of sorts, if I could survive the challenges ahead.

I began following the Cardano blockchain and its development during the overwhelming pandemic boredom that most of us were subjected to. Cardano has interesting fundamentals that are very different from Bitcoin, or Ethereum, which are the nascent blockchain’s forebears. To be able to participate in some of the earliest learning of the smart contracts on this platform is a wonderful proposition to me.

My first step on this journey is to create a development environment that works for executing test code in a safe space that won’t interfere with the rest of my computing needs. The easiest answer is to spin up a virtual ubuntu server from my desktop. I started with Oracle’s VirtualBox, and Ubuntu 20.04 LTS server. This worked to a point, but I did run into an issue where I currently have to use a web browser on localhost to work with the system. A headless Linux server isn’t great for that, I will have to bind the webserver to one of the IP addresses. I am researching that issue, but in the mean time, I simply downloaded a copy of the Ubuntu 20.04 LTS desktop, and use that environment for now.

I chose the minimal install version of Ubuntu desktop, to save on system resources and avoid extra security issues. After all, I really only need the Plutus Playground environment, and a web browser. These are ultimately disposable environments, just meant to test code that will be changing regularly. It is important to keep the setup as lean as possible, because I will very likely be rebuilding the systems several times during this process.

After updates, I followed the instructions from the plutus-community documentation server for the Ubuntu installation. This first requires installing Nix, which I did with the single-user setup. The instructions include a great time saver in the form of IOG’s caches. This saves the time of building individual components from scratch. Again, very useful for this toss away environment, by saving the amount of time required to pull up a new instance.

After that is complete, a git pull is required. We will download the most recent development version of Plutus and the Plutus Playground Server. The documentation warns that this is a time consuming process, even with the caches. It did prove to take around 90 minutes or so to complete. My understanding is that if everything had to be built from scratch, it would take several hours more. Not great when you may need to wipe the whole thing and start over after a major update. I am glad those caches are available!

The last setup steps include the use of two shells. The first shell builds the server side, which again takes about an hour of time. The second shell builds the client in the form of an NPM web server. As mentioned previously, the NPM server is bound to localhost, so we launch the built in firefox web browser and browse to the client app.

After getting up and running, I am able to finally load the playground!

Plutus works by taking some of the best features of bitcoin (the UTxO framework and the decentralization that comes with it) and Ethereum (on chain visibility of the results of a script) and combines them, while avoiding the pitfalls and limitations of both. The (E)UTxO framework is a hallmark feature of the Cardano blockchain. The possibilities are many and varied when these features are taken into account. Lars' lecture points this out very well. I am learning quite a bit as I am following along.

The Week 1 lesson involves creating an auction. This does require another git clone. Make sure that you are in your plutus subdirectory, clone the repository, and then start the nix-shell. After your shell loads (should be fast now!) This will allow you to build the week’s homework. Go to the proper directory (plutus-pioneer-program/code/week01) and run cabal build. You’re in for another wait here, so grab some coffee, or maybe dinner. This failed and requested a cabal update. I performed that step. (took over an hour) and then tried cabal repl. Success, finally!

After compiling the homework code, I copied the roughly 400 lines of code into the editor, made a few changes from our lecture notes, and launched the auction.

The auction software lets me simulate with multiple wallets, with arbitrary amounts.

I then preload each transaction that I want to occur, and check the results.

Successful Transaction Screen in Plutus Playground

There were quite a few twists and turns as I have taken the first steps down this new learning path. I see a system that has a few serious usability issues, and lots of tooling that needs to be done. At the same time, I see a system that when completed, will offer a best in class option for smart contracts into the future of DeFi.

Regulation and Society adoption

Ждем новостей

Нет новых страниц

Следующая новость