Secure smart contracts with the Plutus ebook
Q&A with the IOHK Education team authors
31 July 2019 6 mins read
The IOHK education team this month released the first edition of their new Plutus ebook: Plutus: Writing reliable smart contracts. Available on Amazon and LeanPub, it's a comprehensive introductory guide to Plutus, IOHK's Haskell-based smart contract language. Haskell is a functional programming language, which means it's easier to test and less prone to human error, so anything written in Haskell -- and by extension Plutus -- is more likely to be reliable and secure. Plutus can also be used for both on and off-chain code, simplifying the development experience and eliminating errors commonly introduced in the transition between languages on and off-chain.
The new Plutus ebook covers everything from how smart contracts interact with the blockchain down to working code examples with line-by-line explanations. I spoke to Lars Brünjes and Polina Vinogradova, the main authors of the book, for more details about the book and the future plans of the education team.
Please introduce yourselves!
Lars: I am the director of education at IOHK, which means I run all our educational activities, such as Haskell courses, community videos, workshops, hackathons, books, and internal training. It's a deeply rewarding role: education is an extremely important part of our mission to bring financial services to the three billion people who don't have them. Teaching Haskell to bright young women in Ethiopia and running a Marlowe workshop in Mongolia have been unforgettable experiences for me, and I feel like I'm making a difference.
Polina: I'm a formal methods software developer at IOHK. I've worked on the formal specifications of the Cardano ledger and the wallet, but I've been doing a lot of education things recently as well. I was the teaching assistant for the Haskell course in Ethiopia, and I'm looking forward to being part of other initiatives. IOHK takes education very seriously, and I've personally reaped the benefits of that when taking internal training courses this year -- I learned a lot about testing and formal specification, and could immediately apply it to my work.
What have you been up to recently?
Polina: As the co-instructor on the Haskell course in Ethiopia, I wrote and delivered several of the lectures. It was a unique experience, and it felt like I was really helping people to change their lives. After that, I took an IOHK internal training course and taught on Marlowe workshops in Mongolia and Israel. I've been writing the Plutus ebook with Lars as well. Last year, I worked on formal methods tasks, the Shelley ledger and the wallet, but because of all the traveling and writing, I haven't had much time to work on those this year.
Lars: I've helped set up the three-month Haskell course for Ethiopian and Ugandan women in Addis Ababa, run a Marlowe workshop in Ulaanbaatar, Mongolia (and rode a camel and fell off a horse in the process) and another workshop in Tel Aviv, Israel. I've been working on the ebook with Polina, as well as developing IOHK's education strategy and working on our incentives research stream, writing Haskell simulations to illustrate and support our theoretical results.
What was the inspiration for the ebook?
Lars: The idea was to make it easier for people interested in writing high-assurance smart contracts to get started with Plutus. We tried to strike a balance between theory and practice, between background information and working code examples, to give interested readers the foundations to get started quickly. At IOHK we already know Plutus is great and we hope the book will help convince everyone else!
Polina: Besides a comprehensive step-by-step explanation of how to write Plutus smart contracts, the book also provides an overview of how accounting works in Cardano, what the benefits, goals, and challenges of smart contracts are, and where smart contracts fit into the Cardano architecture. We wrote -- and will be continuously improving and maintaining -- this book to give readers the tools not only to write the contracts but to come up with creative ways of using them.
Who is the ebook for and what will they learn from it?
Lars: The book is aimed at software developers generally and smart contract developers in particular. Plutus is basically Haskell, so familiarity with Haskell or a willingness to learn the language is important. Plutus has been created as a safer and more secure way of creating smart contracts. So everybody dreaming of writing correct and reliable smart contracts is definitely in the target audience and should have a look at Plutus!
Polina: This is not just a book for developers with Haskell experience. It's also a good read for anyone interested in alternatives to relying on third parties, such as banks or the legal system, to make sure a contract is being adhered to. Plutus offers such an alternative, where trust is instead placed on high assurance, tested and documented code. If this sounds too good to be true, check out the details in the book!
What is your favorite part of the ebook?
Lars: Hard to say -- I think the best aspect is the balance between the book's parts: theory and foundations on the one hand, easy-to-follow code examples on the other.
Polina: I would have to agree about the balance: the book includes both high-level explanations of how smart contracts work on the blockchain, as well as concrete examples of how to develop the code, with explanations at each line.
What's the next step for someone who's read the ebook?
Polina: I would suggest that if the reader feels confident about their Plutus skills, they need to think big -- what problem could this technology be used to solve? Perhaps there is some new functionality they wish was available as part of the Cardano system, and they could work on that? For example, the book mentions two Plutus use cases: introducing special kinds of (non-fungible) tokens onto the blockchain, and a custom policy for signing off on spending -- ideas like these.
Lars: I firmly believe that to learn something you have to actually use it and -- ideally -- teach it. So the next step should be to use Plutus, to work on an exciting project and implement a couple of smart contracts yourself. Then go one step further and try to explain Plutus to others, at a meetup, for example.
What other education initiatives are going on at IOHK?
Lars and Polina: We are preparing the next Plutus and Marlowe workshops, as well as the next Haskell course and working on turning that into a MOOC. We're already thinking about the next book, and how to expand our department to be able to deliver more educational content worldwide.
Kuva symphony update: more events and a 3D blockchain transaction tracker
Kuva discusses Symphony project updates
16 July 2019 5 mins read
Symphony is an experience unlike any other. We’ve talked about it as an interactive, audio-visual exploration of the Bitcoin blockchain, but it’s becoming much more. Not just because we’re not stopping with Bitcoin – soon, Ethereum, then any blockchain thereafter – but because we’re continually optimizing and upgrading the experience, allowing the user to dive deeper into the blockchain through mixed-reality encounters. Part of what we wanted to create is a better way to absorb information. People aren’t sponges. Abstract concepts don’t always stick, and unfamiliarity breaks the narrative thread we need to engage with an idea. But when we can create that experience visually, interactively, we’re able to ground the abstract into an unforgettable experience that is, ultimately, fun: a living story.
Kuva is an interactive design and creative technology studio based in Bristol, UK. We’re a collection of artists, technologists, and engineers working with companies to blend art and technology into online and physical experiences. We’ve worked with IOHK on Symphony since the launch of the award-winning Symphony website in January 2018.
Our first gallery installation for Symphony was this year, in April, at the Arnolfini in Bristol and, soon after, we were in Miami for the IOHK summit. Since then, the teams at Kuva and IOHK have gone down slightly different paths, exploring different ways to expand the experience. You can learn more about IOHK’s work in this blog post. Here, I’ll go through what Kuva has been up to, and what the future holds for Symphony.
We have a global tour planned for Symphony to introduce the blockchain to more people. For the most part, the blockchain is known in uncertain terms (the cryptocurrency market has led to a few erroneous perceptions, which we’d love to correct). Elsewhere, it’s barely known at all. If it’s going to underpin the future – which we believe it is – then we have a responsibility to start education as soon as possible. And at Kuva, we believe the best way to educate is through experiential storytelling.
This starts with our virtual reality (VR) and augmented reality (AR) projects. These experiences, which are demonstrated in this video, are designed as educational pieces that use different approaches (such as our AR posters) to explain how the blockchain works. We take some of the most complex components underpinning blockchains and break them down into easy-to-digest, understandable elements. We want to show the usefulness of blockchains and, by extension, cryptocurrencies, by illustrating them in ways people can relate to.
But the blockchain doesn’t start and end with Bitcoin. We’re also working on bringing an Ethereum chapter to these events, to demonstrate the evolution of cryptocurrencies and the technology as a whole. We’ll be able to explain and illustrate smart contracts, and show how blockchains can be used for more than financial transactions. Then, in the future, we’ll start looking at Cardano as a third-generation blockchain: how it’s different, and what it’s capable of achieving over others.
The most exciting update is about our mobile app, soon to be available on Android, and later on iOS. This contains a data visualization of the Bitcoin mempool in 3D and augmented reality, to show you the congestion and health of the Bitcoin blockchain at any time.
Using the app, you’ll be able to see whether it’s a good time to send a transaction. Visually, the busier the mempool is – ie, the more red lines it has swirling about it – the busier the network is, which means a higher fee. The average fee is precisely detailed in the app.
Like our other VR and AR work, we’ll soon be creating the same experience for the Ethereum and Cardano blockchains, to help users evaluate and compare fees and network traffic. We want users to have consistently up-to-date information about how best to use their cryptocurrencies – bridging the gap between interest and understanding starts with clear, interactive representations of key concepts and components.
We’re really excited about this app. It’ll not only be an easy way to grasp what’s happening on a blockchain at any moment, but a functional tool that provides transaction data in real-time. The app is already available on Android and an augmented reality iOS version will be released this summer. We’ll also soon be announcing updates for our world tour – so stay tuned, and get ready to discover the blockchain anew.
To find out more about the world tour, or to see how you can play a part, contact Kuva today.
Smart contract hackathon and meetup in Tel Aviv
Plutus, Marlowe, and the future of smart contracts in Israel
9 July 2019 3 mins read
I was in Tel Aviv a few weeks ago with IOHK CEO Charles Hoskinson for a workshop and meetup with the Israeli developer community. Israel has a long and glowing history with blockchain technology: zero-knowledge proofs were co-invented by an Israeli-American computer scientist, and the region is home to several innovative blockchain projects already. It seemed only natural that we should meet and engage with this vibrant community of developers to discuss the future of blockchain, cryptocurrency, and the powerful potential of smart contracts. The first part of the event was a technical workshop covering Plutus and Marlowe, IOHK’s smart contract platforms, including talks from several members of the IOHK team: Manuel Chakravarty, language architect, Lars Brünjes, director of education, Polina Vinogradova, a formal methods software engineer, and Alexander Nemish, a functional compilers engineer. The morning began with some theory about the design and implementation of IOHK’s smart contract approach, and after lunch it was time for a hands-on workshop and Q&A.
The attendees themselves were from a range of backgrounds, with developers, businesspeople, and blockchain enthusiasts in the mix. We’ve had lots of positive feedback since the event with one attendee, a crypto enthusiast and early adopter, describing it as ‘an impressive and informative event that was organized with a lot of respect for the local crypto-developers community.’
It was a busy day, and the evening saw us transition straight into a broader industry-wide meetup with almost a hundred attendees. Special guests from local blockchain companies were in attendance, including the CEO of Tel Aviv-based blockchain company COTI, Shahaf Bar-Geffen, as well as guests from Algoz and Endor. After Charles’ keynote about current Cardano developments, there were panel discussions about business in a smart contract-driven economy and how blockchain innovations are set to put Israel at the forefront of that market.
I’ve wanted to run an IOHK event in Israel for a long time, and it wouldn’t have been possible without the hard work of IOHK’s head of events Kerry de Jong and her team, as well as our partners for the event MarketAcross. Israel is an area full of talent and potential, and I’m pleased to be able to say that we’ve finally taken our first steps to get involved with the Israeli developer community. I’m looking forward to having more meetups in the country, and hope that IOHK will one day have a continuous presence there to make the most of this innovative, blossoming region.
Announcing the release of Symphony 2.0
Experience the blockchain like never before
5 July 2019 5 mins read
The Symphony project began with a question: how do we represent blockchain technology in a way that is stimulating, entertaining, and audio-visually engaging for a wider audience, technical and non-technical. In other words, how do we explain the abstract and give form to the formless. It’s been over a year since we answered that question, and we’re still working to make Symphony the most interactive and immersive blockchain experience available. What began as a way to visualize the blockchain has evolved into a way to experience the blockchain: an immersive journey accessible through your device’s browser.
The result is Symphony 2.0: a 3D explorer through which anyone can traverse the topographic history of the Bitcoin blockchain, from the first transaction to the most recent. Compared with the first version, Symphony 2.0 goes deeper in every way. It drills down into transaction data to create a live soundscape – each block has its own unique audio signature – using data-driven sound synthesis. It looks like this:
How it Works
As you can imagine, giving feeling to data isn’t easy. Creating a sound for each block was how I wanted to represent the uniqueness and permanence of the blockchain: once added, a block is there forever, making that same sound, containing those same transactions.
I used a technique called additive synthesis to generate sound on the fly, and utilized the parallel nature of graphics cards to synthesize a unique sound for each of the thousands of transactions that can make up a block. The sound signature that plays when you visit a block consists of each transaction producing eight sine waves (a fundamental pitch and seven harmonics). The fundamental pitch is determined by the transaction value, and the amount of randomness added to the harmonics partials is controlled by the fee-to-value ratio of the transaction.
With Symphony 2.0, the blockchain’s mempool – which stores unconfirmed transactions – is visualized as a gravitational swell, around which confirmed transactions spiral in concentric rings. Think of Saturn’s rings but, instead of particles of ice and rock, we have transactions, continuously adding to the size of the rings as they extend outwards. Then, undergirding each block are Merkle trees represented, unsurprisingly, as trees.
On top of each block, confirmed transactions are visualized as 3D hexagons. Their height corresponds to the transaction volume, and their width (note the rotund individuals to the right of the image above) corresponds to the health of the block. The result is an unprecedented imagining of the blockchain, with its representative parts synced and manifest, explorable block-by-block or through a flight-simulator mode.
Ways to Experience Symphony
Symphony 2.0 is now live. It can be accessed using any modern web browser, but is best experienced in Google Chrome. For laptop and mobile device users, it’s advised to select the Medium quality option and, for those with high-performance devices or dedicated graphics support, the High quality option. Performance optimizations will continue into the future.
Together with our friends at Kuva, a Bristol-based creative agency, we’ve also grown the project to include events and exhibition pieces. These events – one of which was held this year in Bristol – have included a number of exhibitions that showcase different parts of the project, including virtual reality (VR) and augmented reality (AR).
Using WebVR software, I built a VR experience based on the code for Symphony 2.0, which demonstrates the extensibility of the system. This will be exhibited at future events and, I hope, one day available for VR headsets at home.
We’re going on tour. We have the story, and now we need an audience. I’m also starting to build an Ethereum version using the same code base, which will feature explorable smart contracts, and, after that, Cardano. We know there are thousands of people out there who are only faintly familiar with blockchain technology and want to know more – and with Symphony 2.0, they’ll be able to cut through the confusion. A picture tells a thousand words, and an interactive audio-visual experience tells many more.
Symphony is a long-term project. It’s as much an adventure for us as our audience. We want to see how far we can take it – because blockchain technology is still developing, still growing, and the opportunity for education is only just beginning. The release of Symphony 2.0 marks a significant milestone for us, and we’re thrilled to be sharing it with you. There’s a lot of opportunity for Symphony, from optimizations and incorporation of other blockchains, to events and more ways to enjoy Symphony at home. So, stay tuned for more updates and, in the meantime, enjoy the world’s first interactive blockchain experience.
Experience Symphony 2.0