Most of you are probably familiar with Cryptocurrency (think Bitcoin, Ethereum etc.) and its mythical powers. However, it is safe to say that a smaller subset would be familiar with the technology that makes cryptocurrencies work and exist in their current form.
In this two-part series, we will be specifically looking into the Ethereum Blockchain, its smart contracts feature, and interacting with that feature in an Uno Platform cross-platform class library. Finally we’ll learn about consuming the Uno Platform library in a cross-platform demo application that works on Windows, iOS, Android, and MacOS environments.
By the time you’ve finished both of these articles, you’ll understand the processes involved in building an app like this, as well as the code that resides behind the scenes to make it happen and build your own cross-platform app that utilizes these functionalities. We’ll share the code in the next article, but for now, let’s get you started with the basics.
Over the course of both of these articles, we’ll uncover:
- The scope and direction of the app we’ll be building
- More information on the Ethereum blockchain, tools and features with relevant links for further research
- More technical information with accompanying code on building a blockchain network utilizing Ethereum smart contracts
- Accompanying code on building Uno platform cross-targeted libraries that exposes what we’ve learned about smart contract functionalities to client applications
- More technical information plus sample code that showcases the consumption of the previously created Uno Platform libraries in a cross-platform application targeting Windows (UWP), MacOS, Android, iOS and Web Assembly.
At the end of the tutorial the demo application will look like this:
Figure 4: Pharmacy Tab
In order for you to get started more efficiently, here are the resources that we’ve used to build the app so that you can follow along.
- Windows 10
- Solidity Programming Language
- Visual Studio Code
- Visual Studio 2019
- Blockchain Development Kit for Ethereum
Below is a diagram that outlines exactly how the app will work. On the left, you’ll see the flow of our app, and then to the right you’ll see how Uno Platform helps to ensure the cross-platform functionality of that app.
The basics of blockchain and the Ethereum ecosystem
Let’s start by setting the stage and review the basics of the Ethereum ecosystem. The information below will help to give us a foundation for the development of our app.
This can be explained as a collection of records which are linked/interconnected to each other by utilizing cryptography.
This is a blockchain characterized by having an open policy as it pertains to people joining, accessing and adding nodes/records/information to the blockchain network.
Applications or Programs of the digital persuasion that exist and run on a blockchain network as opposed to running on a single computing device and are outside the control of a single authority.
This is a distributed public blockchain network that has the additional feature of building, deploying and executing of programmed/coded decentralized application. Ethereum makes it extremely hard, and some would say close to impossible for information shared via it between connected parties to be altered or manipulated due to a collection of processes and protocols adopted by the blockchain to guide how interaction between connected parties and information executed.
This is the actual digital currency we are more aware of, trade with others and buy with fiat currency. It has the added property of powering the Ethereum network by serving as the currency accepted for settling/paying transaction fees and computational services.
Transaction Fees & Computational services
These are tasks executed in the network and they range from the familiar sending of Ethers to deploying of decentralized applications on the network. Because this has computational overhead, computational resources are needed to execute this and requires payment in the form of Ether. A loose analogy in a centralized network would be transaction fees/bank charges that accompany the sending of money between bank accounts.
Non-Fungible Tokens (NFT)
This is an encapsulation/representation of an entity/data that is stored on a digital record/ledger (Blockchain) that is characterized by the property of uniqueness. This simply put implies a given NFT is not interchangeable with another. To further explain the principle, the 1 Ether in my wallet is the same as the 1 Ether in your wallet but is just owned by different people. However, if a real estate agency represents apartments in a building complex as digital tokens in their blockchain, although one or more apartments are similar, they are unique and can only be leased/bought once per instance in time.
With that out of the way we can now focus on the core of objectives, building and deploying applications to the Ethereum blockchain.
Smart contracts and their role in Ethereum
Smart contracts are reusable programs deployed the Ethereum Virtual Machine (EVM) Storage that allows connected parties to make requests to execute code snippets (member functions) with varies parameters. More information on smart contracts can be found in the Smart Contracts section in Ethereum’s webpage. A combination of a smart contract and a front-end user interface results in a decentralized application.
These are a collection of tools (Truffle, Truffle Teams, Ganache, Drizzle) made to aid in the development, testing and deploying of smart contracts in the Ethereum blockchain. With Truffle, you can create a project where you will write your smart contracts, compile them, write tests and run tests and debug your smart contracts. With Ganache, you can deploy your smart contracts in a personal test blockchain to test and simulate how they would behave in the real network.
Getting started with app development
For this series we will be using the Truffle and Ganache to write, test and deploy the Drug shipment smart contracts and we will be using the Uno Platform to create the Cross targeted libraries and the Cross platform application. Illustrated below, is the interaction between user types in the example Drug shipment we will be looking at in the next article.
The images below show the different tabs in Ganache’s desktop client and the Code structure of a Truffle Project. A Ganache CLI version is also available.
In this article we looked at the tools we’ll need to build our app, and have provided you with the resources you’ll need to understand the basics of the technology.
In the next article, we’ll bring it all home by showing you exactly how to build the app, and take you step-by-step through the process that we followed. When it’s all done you’ll be able to use what you’ve learned to build your own app to suit your needs that works on multiple platforms so your entire audience can make use of your hard work!