In this story, I will briefly describe what I’ve learned about Cardano wallet integration over the last few months. Cardano aims to build on the shortcomings of first and second-generation blockchains like Bitcoin and Ethereum. Scalability and transaction speed using a proof of stake consensus algorithm are among the top goals.
The old days
Since 2008 blockchain has traveled a long and rather rocky road. On 3 January 2009, Satoshi Nakamoto mined the first bitcoin block and thus opened financial transactions to be the first domain with the potential for the blockchain revolution. Then, in 2013 young and talented bitcoin contributor, Vitalik Buterin launched Ethereum. Vitalik designed it to be a blockchain platform far more versatile than Bitcoin. Ethereum introduced smart contracts that apart from financial transactions also allowed its users to use blockchain to execute custom programs.
Ethereum seemed to unbind the true potential of blockchain. With raised blockchain popularity and a late 2017 price surge, some crucial flaws of Bitcoin and Ethereum were exposed. Most of them revolved around problems with performance and scalability. That and also crazy stories about blockchain hacks and scams resulted in some very bad press. The price of crypto went back to the mid-2017 level and it looked like a premature end to a promising revolution.
A New Hope
Despite all the bad news, the blockchain community stayed faithful. Just like the world wide web needed a few years to transition from a niche university project to the Internet as we know it, blockchain was bound to encounter maturity problems like these. It would take a lot of work to overcome them but businesses and open source contributors alike were looking to face the blockchain demons. Some of them focused on improving existing blockchains and others decided to start anew and build new blockchain solutions from scratch.
One such business was a Japanese startup Emurgo. They came up with a concept of Cardano — a third-generation blockchain with a strong desire to fix the mistakes of its predecessors.
Cardano in a nutshell
Cardano is a public and open-source blockchain developed by cooperating companies — Emurgo and IOHK. It is still in development, with a layer that handles cryptocurrency transfers already completed and live in both main and test networks. A smart contract layer (Goguen release) will go live in 2020 according to IOHK. More information can be found in an official Cardano roadmap.
Due to the smart contract layer not being finished yet, the only real-life application for Cardano is financial transactions, at least for now. Not surprisingly, Cardano’s cryptocurrency, ADA, has been released. At the time of writing this story, it trades for around five cents. That’s not very impressive, however, ADA trade volume over the last 24 hours is a staggering $188 million, up from $54 million in previous months.
This means that Cardano’s latest release Shelley, released in November 2019 really moved the market. Despite Cardano being in its early days, many investors believe it can succeed. It has been that way in the beginning, too. During its initial coin offering, Cardano raised $62 million reaching 100% of its target. As this increases, integrating a Cardano wallet will be more important.
Rather than attempting to start another revolution, Cardano just tries to learn from Ethereum’s shortcomings and create a platform that on a high level is very similar, but better. One of its elements is however very unique. I’m talking about Ouroboros, the algorithm responsible for Cardano’s consensus. It is the first-ever provably secure proof of stake protocol. Designing such a solution and putting it in the heart of a new blockchain is certainly an admirable feat. It also solves one of the biggest sins of Ethereum — network maintenance costs.
In Ethereum’s proof of work consensus, each node competes to solve a resource-consuming cryptographic puzzle and the block reward. As a result, a lot of network computing power goes to waste to solve the puzzle. According to a 2015 study, submitting one transaction to Etherum required the same amount of electricity as powering 1.57 American households for a day.
Proof of stake algorithms don’t use as much computing power and instead reach consensus on nodes betting their cryptocurrency on blocks that may go to the blockchain. This means that in order to get most of the mining rewards, rather than using computing power, you need to own ADA cryptocurrency and use it for staking.
How to benefit from Cardano
You may wonder why Cardano is so popular if it doesn’t even have smart contracts yet as Ethereum and Stellar do. Surely it can’t just be a fancy consensus algorithm and introducing yet another custom smart contract language in Plutus. The reason is simple: money. First-generation (Bitcoin) and second-generation (Ethereum) blockchains provided few ways to incentivize users and developers to contribute to the network.
It was all about hoping to raise the value of a cryptocurrency one invested in and contributing computing power to gain mining rewards — which in time becomes less and less profitable, currently in order to make mining profit in Ethereum you need an expensive dedicated setup. On the other hand, ways to make money on ADA seem easier and more consistent.
In proof of stake, cryptocurrency can be committed to Cardano’s settlement layer to take part in staking. Once that happens, it will be automatically used by the Ourobouros algorithm as a stake against a block that is to be added to the blockchain. Once the block is indeed added, a reward for mining it — or, to use Cardano terminology — minting it is distributed among stakers proportionally to the amount staked. As in real life, the rich get richer.
There’s one caveat, though. You can’t stake alone — in order to commit your coins to work for you, you need to be a part of a staking pool. Setting it up requires some technical understanding of Cardano but fear not! There are many staking pools that are more than happy to stake your coins for you — usually, all you need to do is keep ADA in a staking wallet and select a staking pool that you want to delegate funds to. In practice, this means that all the ADA you store in a hot wallet will generate interest for you.
How to start developing in Cardano
Recently, I developed a Cardano wallet application. The road to getting tools I needed was rather rocky, so I’d like to document some hints if you’re planning a similar implementation. Hopefully it will make your experience a little simpler.
Cardano Developer Forums
The Cardano community is lively. There is a general-purpose forum that also has a developer’s subsection. Developers from Emurgo and IOHK visit that forum frequently and are usually able to answer even the most technical questions about Cardano wallet integration. Cardano code and tools are available on GitHub, so apart from the forum, it’s also possible to try to reach out to devs by creating a GitHub issue in a specific project. I, however, had mixed results with that and would recommend the forum as the first point of contact.
Byron test net
Cardano developers release on a separate test net. This is particularly convenient since it allows a developer to pick an environment with a desirable set of features to test with an application. Currently, it’s best to test your applications on the Byron test net as it’s the easiest one to set up. Anyway, all the test net information is available on a dedicated website, https://testnet.iohkdev.io/en/, along with standard tools like a faucet and a block explorer.
Integrating a Cardano wallet with a test net node
In most of the more developed blockchains, integrating with a node is very easy. Usually, there are some libraries for both Python and Node.JS that act as a proxy and take advantage of a publicly available node connected to a test net. In Cardano, this is a little harder. Those are the options you have:
- Build a vanilla Cardano Node — https://github.com/input-output-hk/cardano-sl — from the source. Instructions to do that can be frustrating and haven’t worked in my environment (Ubuntu)
- Use js-chain-libs, https://github.com/input-output-hk/js-chain-libs, for Shelley and Cardano-wasm, https://www.npmjs.com/package/cardano-wallet, for Byron. Please note that these require a node provider, so you need to either use some public test net Cardano node (at the time of writing this article such node is not available) or set it up on your own locally. Still, if you prefer to call methods rather than hitting REST API, it’s worth checking those out.
- Tangata-manu, https://github.com/Emurgo/tangata-manu, periodically imports ledger data into a PostgreSQL database. If you are happy to integrate with Cardano using a relational database, this is the way to go. It was not an option in my project so I haven’t explored that option but supposedly it works.
- Install a Daedalus wallet, https://daedaluswallet.io/#download. Once started, it will also set up a fully working Cardano Node for you to interact with via REST API. It is particularly convenient since both test net and main net version of Daedalus are easy to install and use. One rather major caveat is that every time Daedalus is started, it starts a node service on a random port so configuring your app to be able to hit it requires manual work.
Daedalus / Yoroi Cardano wallets
Daedalus is an advanced wallet, which IOHK developed. They’ve designed it for continuous development and for it to support features as they arise in future Cardano releases. Installing Daedalus is very easy and using its functions is probably the easiest way to create some accounts, get your hand on free ADA using a faucet and use these accounts to interact with your application.
Please do note that Cardano is still in development so it is likely that once time passes, more developer tools will be available. If you think some information I provided is not complete or not up to date — write a comment and I will include it in the story!