Haskell and Cryptocurrency Course in Barbados

Two graduates share their experience of IOHK's functional programming course

7 April 2018 Lars Brünjes 7 mins read

Haskell and Cryptocurrency Course in Barbados

The IOHK Haskell and Cryptocurrency course in Barbados brought together students and professionals who were interested in learning the Haskell programming language. The course ran for eight weeks at the University of West Indies. Barbados was the second time the programme was offered, after a successful inaugural course held in Athens last year. The goal of the course is to extend the computer science training of participants and introduce them to Haskell, an elegant functional programming language, in the context of the cryptocurrency industry. Haskell is the language used in the Cardano cryptocurrency, and it was chosen because of the security benefits it offers.

The course was designed and taught by Haskell and functional programming experts, including myself, and Dr. Andres Löh of Well Typed and Dr. Marcin Szamotulski, Haskell Developer at IOHK. Visiting lecturers included Prof. Philip Wadler, one of the creators of Haskell, and IOHK Area Leader in Programming Languages, and Cardano SL developer, Darryl McAdams. The instructors aimed to strike a balance between theory and practice, teaching the students both theoretical background of functional programming in Haskell in particular (Lambda Calculus, System F, Category Theory, etc), but also introducing them to popular libraries and important techniques for solving real-world problems (networking, parsing, resource handling, and more). At the end of each course, students are given the opportunity to apply for positions at IOHK and continue their professional career in Haskell.

Here are the stories of two students who attended the IOHK Haskell and Cryptocurrency course in Barbados:

Jordan Millar - Jordan is currently a chemist with an M.Sc. in organic chemistry from Oxford University.

Upon hearing that IOHK was offering a free Haskell and Cryptocurrency course in Barbados I decided it would be foolish to not enroll. The stars aligned for me as Barbados is a stone’s throw away from Trinidad and Tobago, my home, and I was acutely aware of IOHK’s approach to cryptocurrency.

My programming experience prior to this course was limited; I predominantly had written scripts in Python over the last two years. Only a few weeks prior to the course, I had become interested in Haskell through a functional programmer I happened to meet.

Learning in Barbados
Haskell students in class

IOHK piqued my curiosity because at the time, they were the only company in the cryptocurrency space driven by research. This resonated with me as I had first-hand experience with research and development, albeit in a different field. I work in organic chemistry, and am currently working with a cleaning product manufacturer on their formulations. I appreciate the importance of developing a model, trying to break it yourself, and then having people smarter than you also trying to break it. In particular, if these networks are destined to hold hundreds of billions of dollars, you cannot afford to construct these networks in the ad hoc manner we have often seen before. With this in mind, I set off to Barbados to learn more about Haskell and IOHK’s methodology.

The course was a whirlwind tour of Haskell starting with data types all the way to type families and everything in between. We charged through a series of topics and on a weekly basis were given a problem sheet to complete. Dr. Lars Brünjes and Dr. Marcin Szamotulski were exceptional teachers. They delivered the content effectively and gave additional clarification when required.

The course was challenging, especially because I had missed the first week due to logistical issues. That being said, I came to find that Haskell is an elegant and concise programming language. IOHK flew Philip Wadler to Barbados to give a couple of lectures! What stood out to me the most was his demonstration of the Curry-Howard correspondence. It was fascinating to see the link between mathematical proofs and programs. IOHK’s Darryl McAdams also visited us in Barbados and took us through compilers in Haskell. The elegance of Haskell really shone here in my opinion as she effortlessly created a simply typed programming language during class.

It wasn’t all work and no play; IOHK sponsored many dinners and outings while we were in Barbados. This rounded off the course nicely as everybody had time to socialize outside of the classroom. To top it off, Charles Hoskinson took time out of his incredibly busy schedule to come and see us in Barbados. Having only seen Charles in YouTube videos, it was a privilege to hear him share his future plans and vision for IOHK in person. If you thought his conviction transmitted effectively through his interviews online, wait until you hear him in person.

All in all, it was a great experience. To anybody reading this, I highly recommend enrolling in this course if you get the chance to!

Rob Cohen - Rob divides his time between his information security consulting firm Callidus Security and serving in the cyber security field in the US military. He graduated from Columbia University in 2015 with a BA in Computer Science and Mathematics.

I was fortunate to be invited to attend IOHK's eight-week course, "Haskell and Cryptocurrency" in Barbados in early 2018. Prior to the course, my only experience with functional programming had been in a Compilers course I had taken in college and some toy projects I had built as experiments. As a result I knew this course would be challenging, and it turned out to be exactly the kind of deep-dive crash course on Haskell and functional programming that I was hoping for. This course was demanding, requiring dedication in the classroom and diligence in applying those concepts in our assigned homeworks and group projects.

Fishing in Barbados
Haskell students going fishing

The course covered a variety of topics, from the basics of IO and higher-order functions, to lambda calculus, optics, free monads, GADTS and Generic Programming concepts (and much more). Beyond the theory, what I found most rewarding in the course was working with my fellow classmates on our group projects. One project my team worked on involved building the early stages of a working Bitcoin client in Haskell! Working on larger-scale projects like that really helped Haskell come alive for me. Furthermore, guest lectures by Phil Wadler and Darryl McAdams from IOHK's Plutus team were pleasant surprises as well.

This course was not easy; there were times where I really felt my mettle was challenged. However, I stuck with it and pushed through. Now I not only have a deeper understanding and appreciation of the theoretical underpinnings of Haskell, but I came out as a developer with a stronger constitution as well. I am grateful to Lars and Marcin (the course instructor and teacher assistant) for all their hard work on the course. They put a tremendous amount of effort into the course materials and it showed. There were frequently times where their diagrams and explanations were better than Haskell's own official documentation!

The highlight of the course was the opportunity to work closely with such incredible developers from all around the world. My classmates hailed from Japan, Ireland, Argentina, Poland, Germany, Sweden, the USA, and the Caribbean. It was truly remarkable to have so many people from all over the world working together in one room trying to figure out how to learn Haskell. To my fellow classmates, I am deeply grateful for your support and camaraderie during the course. I salute you all for your dedication and hard work. I also look forward to our (spearfishing) reunion someday!

I can safely say that I've been bitten by the Haskell bug, and I look forward to being a member of the Haskell/functional programming community for years to come. I highly recommend this course to anyone who is interested in learning about Haskell and functional programming.

How Cardano can help development in Africa

We are taking the first steps on our journey in the continent and invite you to join us

10 March 2018 John O'Connor 7 mins read

How Cardano can help development in Africa - Input Output

How Cardano can help development in Africa

Five years ago, I was with a friend when she received a distressing call from her home in East Africa. Without permission, someone had been collecting the rent on a small commercial premises she owned in the capital. My friend had inherited the property five months previously from her father, but had only recently discovered that the property had tenants. The rent collector in question turned out to be a neighbour of the property and the previous owner. Upon learning that her father had passed away, he’d elected to take advantage of the confusion and collect the rent for himself. In the court case that followed, my friend provided a fund transfer receipt she had found in her father’s office. Expecting that to be the end of it, she was shocked when the neighbour still claimed the plot to be his, on the basis of his name being registered with the utilities company. The problem for the court was that when there is no reliable record of ownership what should it do? When friends in London ask me if the UK government will ever adopt blockchain technology, I have to stop and think. Blockchain can reduce cost and increase efficiency in almost any industry that involves record keeping. However in countries with entrenched processes and institutions that reliably (if expensively) maintain records, efficiency may not always provide sufficient motivation for governments to switch. The UK Land Registry is such an example. Founded in 1862, this institution has 4,486 employees and over 150 years of expertise and cultural history, which allows me to access a record of ownership history for any property at a cost of £7. This reliable legal title acts as a catalyst for economic growth. Landowners can use property as collateral to borrow money, perhaps to expand their businesses. If they choose to sell their property, the purchaser can pay with the confidence that they are truly purchasing the legal title.

For many African countries however, this is not the case. Efforts to improve records have generally had limited impact. That is not to say there have not been successes. In a three-year programme, Rwanda led an effort to register titles of land ownership. It was effective, and by the time the scheme was complete, 81% of plots had been issued titles, driving investment and economic growth. Embracing the high mobile penetration rate, the ledger was linked to a telephone service, allowing the ownership of plots of land to be instantly queried in ongoing disputes. Yet without the institutional cultural history of accurate ledger keeping, there continued to be problems with keeping records up to date when land was sold or inherited. Enter blockchain.

A digital blockchain property register that identified land using GPS coordinates would allow property ownership to be verified and transferred at low cost. Rwanda has woken up to this, and as part of its digital transformation plan is looking to port its ledger onto the blockchain. There are similar noises in both Kenya and Ghana, as government officials begin to see that the technology might let them leapfrog the 150 years of development the UK Land registry has benefited from.

If the opportunities that are now arising for blockchain trials in sub-Saharan Africa are to be maximised, then they should be built on robust and open-source technology. Our aim with Cardano was to build a blockchain based on peer-reviewed academic research by some of the world’s foremost researchers and engineers. We chose to write it in Haskell, a formal programming language that allows mathematical guarantees of the correctness of code. These design decisions were made not because they were easy, but because they would give strong foundations to whatever applications were built on Cardano. We have started down this road, and now is the time to begin planning trial projects across countries in the African subcontinent. We aim to make Cardano the blockchain used to build land registries and much more.

This is a grand ambition and will not be accomplished in a day. Success will be achieved only if public authorities invest in creating the required legal and regulatory environments for these trials. Even after proving value, there will be implementation challenges in scaling a tech solution to run for millions or hundreds of millions of people. Governments, NGOs, and the private sector will need to work together to fulfill the promise of this technology.

IOHK must earn the right to sit at this table by building credibility through sustained investment of resources and attention. Our first inroads to Africa will therefore be with education. The core of Cardano is the Haskell engineering team, who turn our research into actual lines of code. We have run engineering schools in partnership with universities in Barbados and Greece, taking young graduates and intensively training them in Haskell. At the end of the course, some will be employed by IOHK as junior software developers, continuing their training and earning a competitive salary. Training is free, without obligation, and delivered by leading academics in the field. We have hired 70% of the students that have embarked on the scheme, with most of the remainder continuing on into further education. Education should not strip a country of their best and brightest, and the jobs that are offered are local, allowing hires to contribute to a global project from their own country. This year we will offer our first course in Africa, probably in Ethiopia, and expect the first cohort of Ethiopian developers to be contributing to Cardano code by the end of the year.

My excitement about Cardano’s potential to solve development issues has only grown since starting this role a few weeks ago. I have heard from some amazing companies who want to use Cardano to do incredible things. From increasing biodiversity in Kenya to making a decentralised app to connect participants in the informal South African rental market, the possibilities for Cardano are truly endless. And with this unbounded opportunity comes risk. The risk of being swept up in the grand mission and not understanding local needs and wants. Facebook’s [misguided entrance to India](https://www.theguardian.com/technology/2016/may/12/facebook-free-basics-india-zuckerberg "The inside story of Facebook’s biggest setback, The Guardian") with their basics product should provide a cautionary tale to any tech company that believes their technology can make a social impact. So we need to learn, and will work with local partners to discover requirements before suggesting solutions. We are ready to take the first small steps on this journey. So humbly, I use this blog post as an open invitation to get in touch, because certainly, we will need your help.

If you are based or work in Africa and would like to help, please submit your details through this form. We are looking to partner with governments, the private sector, and NGOs who are interested in using Cardano. We are also looking for community volunteers to help organise events and meetups.

Artwork,
Creative Commons
Mike Beeple

Cardano 1.1.0 software update

A major package of improvements and fixes is ready for users

7 March 2018 Duncan Coutts 4 mins read

Cardano 1

Cardano 1.1.0 software update

The software update today is the first major release for Cardano since the mainnet was launched at the end of September and it consists of a great deal of work from the development team. The release contains a few new features that are aimed at improving the user experience. And it also contains a set of important fixes for many of the bugs that were identified since the last release, Cardano SL 1.0.3. Here is Charles Hoskinson, CEO of IOHK, with a video update about this release, and below we outline the most significant changes delivered. Users will notice the changes take effect tomorrow.

The team has been working hard to address the issues some users have experienced with Daedalus and this update contains fixes for some of the problems.

With this release, Daedalus will detect when the time on a user's machine is out of sync with the global time and will display an error message asking the user to fix the issue. Before this feature was added when there was a time difference of 20 seconds or more, the Cardano node was unable to connect to the network and validate the blockchain, and Daedalus would be held on the loading screen with the "Connecting to network" message. This feature will eliminate the problem of users being held on the loading screen because of the time difference issue.

Several other instances of the user being stuck on the "Connecting to network" screen were fixed. Many issues that can lead to this have been partially or completely fixed. Problem areas include node shutdown, networking and block retrieval mechanisms.

A new "Support request" feature enables users to report a problem directly from Daedalus. This will automatically include log files along with the problem report. By always including log files, this feature will help the development team to investigate and solve the problems that users are experiencing. This feature is accessible from the main user interface and from the loading screen when there is a delay while connecting to the network or when blockchain syncing stops.

Blockchain retrieval performance and reliability has been gradually improved, in particular bugs have been fixed that caused significant slowdown in syncing to the network after reaching 99.9%, and caused occasional network disconnections. Handling of whether Daedalus is connected or disconnected is improved, and a lost internet connection is now detected and brings the user to the loading screen to indicate that wallet is not currently operational.

In addition to individual fixes, importantly, this major release is the first time-based release containing significant new code, and represents an improvement in our development process. All previous releases of Cardano were scope-based, i.e. the goal was to deliver a particular scope and often the release was repeatedly postponed because of inaccurate estimations on having the scope ready for release.

There is much debate among software developers on which release process is preferable. As was outlined in our previous blog post, the Cardano team has chosen time-based releases. We had a significant backlog of work to resolve to be able to release our development branch to the mainnet – a substantial amount of testing had to be performed because of large amount of new code. But with the release of 1.1.0, we have made a major step forward.

There will be two more time-based releases in the next couple of months containing more improvements, fixes and new features for Cardano. New features for the Shelley phase of development will begin to be released in Q2 and continue through Q3. For more information see the Cardano Roadmap.

Artwork,
Creative Commons
Mike Beeple

Kaleidoscope – a cryptographic protocol for securely playing poker

Bernardo David presents the research paper at Financial Cryptography 2018

1 March 2018 Bernardo David 5 mins read

Kaleidoscope – a cryptographic protocol

Poker is arguably one of the most popular card games in the world, both in casinos and on the internet. Online poker has become increasingly popular after a boom in the early 2000s, fueling a growing market with revenues estimated in the tens of billions of dollars. However, the current model of online gambling forces users to blindly trust the online casinos, who could easily rig games or suffer attacks from disgruntled employees who aim to make easy money. In fact, this state of affairs not only represents a threat but has resulted in real-world attacks. A clear alternative to using online casinos consists of using cryptographic protocols for securely playing poker over a network without trusting any third party. In fact, constructing such protocols has been a research topic since the early days of modern cryptography. Shamir, Rivest and Adleman proposed the first candidate protocol to this end only a few years after publishing the famous RSA public key encryption scheme. Their seminal effort initiated a long line of research that has produced countless results over the years. However, no cryptographic poker protocol has ever been adopted for real applications, mainly due to the following issues:

1 - Security: The security guarantees of existing poker protocols are not clearly defined, so it is hard to understand the level of security that these protocols actually provide and how reliable they are.

2 - Efficiency: Most of the existing poker protocols rely on costly cryptographic techniques that incur high computational and communication overheads, which in the real world result in boring games with long delays.

3 - Financial considerations: Previous poker protocols could not ensure that winners received their financial rewards, even though classic cryptographic techniques could ensure that a game of poker was played honestly (i.e. without allowing players to cheat or learn each other’s private data).

In a recent paper to be presented at the Financial Cryptography 2018 conference, we construct Kaleidoscope, the first cryptographic poker protocol to address all three issues above. Kaleidoscope is the first protocol to be proven secure according to a comprehensive security model that formally and clearly captures all the properties and guarantees commonly required from a poker protocol. Moreover, Kaleidoscope employs blockchain techniques to ensure that winners receive their rewards and that cheaters are financially penalized. Even though it is mathematically proven to achieve security while providing financial rewards and penalty enforcements, Kaleidoscope achieves very high efficiency in comparison to existing solutions (which have not been formally proven secure).

The first step in designing Kaleidoscope was formally defining the security guarantees that a poker protocol should achieve. Since such formal definitions are missing from current literature, we provide the first security definitions for poker in the so-called simulation paradigm, which is the gold standard for cryptographic protocol security. Our security definitions take into consideration all phases of a poker game, modeling the security guarantees obtained for each of them and the conditions under which they hold. Namely, we model security against very powerful adversaries who can attack all but one player. This worst case scenario also captures the case where many players in a game collude in order to cheat against one single player.

With a proper formal model in place, we developed Kaleidoscope, a highly efficient protocol that can be proven to realize our security definitions. Our protocol builds on cutting-edge zero knowledge proofs of shuffle correctness and is carefully crafted to achieve the best possible efficiency in terms of computation and communication. In fact, as shown in an upcoming work, Kaleidoscope achieves high security guarantees while requiring three times less computation and eight times less communication than the best previous protocols (without formal security guarantees).

Another important feature of Kaleidoscope is that it ensures that winners will receive their rewards, and that cheaters will be financially penalized as well as kicked out of the game. The basic idea is that, before a game starts all players send to a smart contract the funds they will be using for betting and an amount of "collateral" funds. At the end of the game, the smart contract ensures that the betting funds are distributed to the players according to the outcome of the game and that the collateral funds are returned. In case a player is caught cheating (which is ensured by our protocol), the smart contract confiscates the cheater’s collateral funds and distributes those among the honest players as compensation. Moreover, we show that the communication with the smart contract and the on-chain storage requirements are minimal.

Although Kaleidoscope successfully addresses the three issues described above in the context of poker protocols, it can only be used to play poker games. There is a false common sense notion that poker protocols can be used for playing any other card games, which would actually lead to serious security issues. However, in the case of Kaleidoscope we were able to extend our formal security model, protocol and proofs to general card games. In doing so, we have obtained Royale, a protocol that can be securely used to play any card game with the same efficiency as Kaleidoscope. We will be describing Royale’s features and techniques in an upcoming series of videos and blog posts.

Cardano’s goals for Africa and the developing world

Charles Hoskinson addresses packed crowd at LSE

24 February 2018 Jane Wild 6 mins read

Cardano’s goals for Africa and the developing world - Input Output

The London School of Economics has a long history of links to Africa. Founded in 1895 four years before the outbreak of the Boer War, the school launched into the debates of the era. Some of the first leaders of newly independent African nations studied at LSE and its progressive and anti-imperialist stance saw the school play a part in the anti-apartheid movement. With that history, the university was an apt location for Charles Hoskinson to introduce Cardano’s next steps - for its technology to serve the developing world, starting with Africa. The talk, organised by the Cardano Foundation and the LSE blockchain association at the school’s Saw Swee Hock Centre, was twice oversubscribed.

Before the doors opened on Tuesday evening there was a buzz of anticipation in the long queue of hundreds of people, mostly in their twenties and thirties.

To the packed crowd, Charles set out the vision for Cardano that will begin to unfold in Africa this year.

"You have to go to talk to people in the countries you want to help. The only way you are going to the change the world is you have to go there. You’re not going to be the one doing it, you have to be humble enough to let the people there do it."

Using a model already tested during the past year with pilot courses in Athens and Barbados, IOHK will bring skills to the region. Training in the programming language Haskell, in which Cardano is built, will be provided to budding developers. At the end of the course they will either be hired to contribute to Cardano, or will plough their talents back into the local economy. As an example of IOHK’s approach, the Barbados course was held in association with the University of the West Indies and was the first time that Haskell was taught in the country. The classes were even attended by Professor Philip Wadler, one of the creators of Haskell, who is helping to develop Cardano.

Charles Hoskinson with Michael Parsons
Charles Hoskinson with Michael Parsons,
Chairman of the Cardano Foundation

"The next class will probably be done in Ethiopia, we are already in negotiations to do that," Charles said. "You have to create a base of people in the country who have an incentive to care and actually understand how the tech works."

Just as important will be to engage local government and explore opportunities for working together. Pilot schemes using Cardano could test potential applications, for example relating to land registry, identity, or voting.

The key to enabling blockchain use in Africa is to run successful trial projects, showcasing blockchain technology as a cheaper and more efficient method of doing things. "A proof of concept can show why it’s faster and better. It can show it can be rolled out, show people can make a lot money from it, then everyone says ‘me too’, and competition drives a tsunami wave of people in, including my blockchain competitors," Charles said.

There was a powerful case for blockchain in Africa, he argued. Blockchain technology has great potential to unlock the wealth of countries through the tokenisation of natural resources, labour or property. "Tokens aren’t just good for CryptoKitties, it turns out you can do real things with these platforms, so let’s go try that."

"If you count the locked up liquidity in these countries it’s in the trillions of dollars. It’s a great paradox that there’s tremendous potential value in places and if only it could be accessed and given to the people in some fair way then poverty would melt away and these would become some of the wealthiest countries."

It would not be easy, but blockchain adoption would inevitably take place, Charles said. Local politicians would have to receive a financial incentive to support the technology, perhaps through a pre-mine. Then there are other hurdles to cross in Africa, such as patchy internet coverage that hampers connectivity to the blockchain. To address this, IOHK is exploring satellite coverage and estimates the cost at $50 to $100 million. Trusted hardware offers a second solution, by allowing offline, offchain transactions through Bluetooth that can register on the blockchain when connectivity is regained.

Another hurdle is to provide points where local currency can be cashed in or out. To this end, IOHK is looking at how a network of ATM terminals could be installed at affordable cost and which can operate off grid. And finally, a longheld aim of cryptocurrency has been to develop a value stable currency, which is pegged to fiat such as the dollar, and offers businesses stability and protection against the price volatility of cryptocurrency. Charles announced that IOHK was starting a research agenda into value stable currencies, and although there would be "no silver bullet", he promised a series of experiments and hard work on the subject.

"So that’s what Cardano is doing for the developing world," said Charles. "We have a moral obligation to try and explore this tech and get it to as many people as possible."

The talk was followed by a wide-ranging question and answer session, with questions on everything from the future of blockchain in China, to transaction fees on Cardano, to establishing regulated cryptocurrency businesses.

The audience had a mix of backgrounds, from serious Cardano fans who had watched hours of videos online, to the cryptocurrency curious.

Timo, 27, is a student from Salzburg at Regent’s Business School in London. Having been interested in cryptocurrency for more than a year, he says he’d watched Charles’s Ted talk, seen his interviews and and then bought Ada. "The project is very serious compared to others, it’s evident from the team, the web presence and the many interviews Charles has given."

Charles speaking at LSE
Charles Hoskinson speaking at LSE

"Blockchain is the most revolutionary technology since the internet," said his friend, Thomas, 23, from Antwerp, who first learnt about cryptocurrency last year from his father during a marathon three-hour, late evening conversation. "That sparked my interest, and I then came across Charles’s videos and found him a brilliant mind. I like the approach that Cardano is taking to tackling the problems blockchain is having right now - it’s also academic and involves people from universities, there is objective option there."

Others were there to find out more about cryptocurrency. Ana, 24, is a postgraduate student of law at LSE who came along to the talk. She is interested in writing her dissertation about smart contracts because she sees blockchain as an newly emerging discipline within law. "I want to understand more about blockchain," she said. "The legal aspect is very interesting and there are a lot of issues to tackle. For example, is it legitimate to have contracts that self-execute, if you don’t have a court or a judge involved?"

More information is coming soon on IOHK and Africa strategy, and will be outlined by the Director of African Operations, John O’Connor.