Developing a DAPP – KittyChain Shop

What is DApp?

DApp is an abbreviation for decentralized application.

A DApp has its backend code running on a decentralized peer-to-peer network. Contrast this with an app where the backend code is running on centralized servers.

A DApp can have frontend code and user interfaces written in any language that can make calls to its backend. Furthermore, its frontend can be hosted on decentralized storage such as Swarm or IPFS.

The Project Description

In this project, we shall use Ganache (https://truffleframework.com/ganache) to develop the KittyChain Shop DApp.

Ganache is a personal blockchain for Ethereum development you can use to deploy contracts, develop your applications, and run tests. It is available as both a desktop application as well as a command-line tool (formerly known as the TestRPC). Ganache is available for Windows, Mac, and Linux.

Truffle is a world-class development environment, testing framework and asset pipeline for blockchains using the Ethereum Virtual Machine (EVM), aiming to make life as a developer easier.

The KittyChain DApp is an adoption tracking system for a pet shop

Steps to build the Dapp

  1. Setting up the development environment
  2. Creating a Truffle project using a Truffle Box
  3. Writing the smart contract
  4. Compiling and migrating the smart contract
  5. Testing the smart contract
  6. Creating a user interface to interact with the smart contract
  7. Interacting with the dApp in a browser

Step 1  Setting up the development environment

Install the following:

  1. Node.js
  2. Git
  3. Truffle 

Having installed the aforementioned packages, we shall proceed to install Ganache. You can download Ganache by navigating to http://truffleframework.com/ganache and clicking the “Download” button.

Step 2  Creating a Truffle project using a Truffle Box

Truffle initializes in the current directory, so first create a directory in your development folder of choice and then move inside it.

mkdir pet-shop-tutorial

cd pet-shop-tutorial

Now you have created a Truffle Box called pet-shop, which includes the basic project structure as well as code for the user interface.

Next, use the truffle unbox command to unpack this Truffle Box.

truffle unbox pet-shop

The Output

Directory structure

The default Truffle directory structure contains the following folders and files:

  • contracts/: Contains the Solidity source files for our smart contracts. There is an important contract in here called Migrations.sol, which we’ll discuss later.
  • migrations/: Truffle uses a migration system to handle smart contract deployments. Migration is an additional special smart contract that keeps track of changes.
  • test/: Contains both JavaScript and Solidity tests for our smart contracts.
  • truffle.js: Truffle configuration file.

Step 3  Writing the smart contract

We’ll shall write the smart contract that will act as the back-end logic and storage.

Create a new file named Adoption.sol in the contracts/ directory. To save time, please download the file from:

http://javascript-tutor.net/blockchain/download/contracts/Adoption.sol

Adoption.sol

pragma solidity ^0.4.24;
 contract Adoption { 
    //array of 16 addresses, 20 bytes 
    address[16] public adopters; 
 // Adopting a pet 
    function adopt(uint petId) public returns (uint) { 
    require(petId >= 0 && petId <= 15); 
 adopters[petId] = msg.sender; 
   return petId; 
    }
 // Retrieving the adopters 
    function getAdopters() public view returns (address[16]) { 
       return adopters; 
    } 
 } 

Step 4 Compiling and migrating the smart contract

Now that we have the smart contract, we shall proceed to compile and migrate it.

Truffle has a built-in developer console known as Truffle Develop, which generates a development blockchain that we can use to test and deploy the smart contract. It also has the ability to run Truffle commands directly from the console. 

We need to compile the smart contract written in Solidity to bytecode for the Ethereum Virtual Machine (EVM) to execute. Think of it as translating our human-readable Solidity into something the EVM understands. In a terminal, make sure you are in the root of the directory that contains the DApp and type:

truffle compile

The output


Compiling ./contracts/Migrations.sol...
Compiling ./contracts/Adoption.sol...
Writing artifacts to ./build/contracts

Now that we’ve successfully compiled our contracts, it’s time to migrate them to the blockchain! Migration is the deployment script meant to alter the state of the application’s contracts, moving it from one state to the next. For the first migration, you might just be deploying new code, but over time, other migrations might move data around or replace a contract with a new one.

By the way, there is one JavaScript file already in the migrations/ directory: 1_initial_migration.js. This file handles deploying the Migrations.sol contract to observe subsequent smart contract migrations, and ensures we don’t double-migrate unchanged contracts in the future. Now let’s create our own migration script.

Create a new file named 2_deploy_contracts.js in the migrations/directory.

To save time, download the file from the following link:

http://javascript-tutor.net/blockchain/download/contracts/2_deploy_contracts.js

Before we can migrate our contract to the blockchain, we need to have a blockchain running. For this tutorial, we’re going to use Ganache, a personal blockchain for Ethereum development you can use to deploy contracts, develop applications, and run tests. If you haven’t already, download Ganache and double click the icon to launch the application. This will generate a blockchain running locally on port 7545.

Launch Ganache and you get the following output:

Now back in your VS Code terminal, enter the following command:

truffle migrate

You can see the migrations being executed in order, followed by the blockchain address of each deployed contract.

In Ganache, note that the state of the blockchain has changed. The blockchain now shows that the current block, previously 0, is now 4. In addition, while the first account originally had 100 ether, it is now lower at 99.94, due to the transaction costs of migration. 

Step 5 Testing the smart contract

Truffle is very flexible when it comes to smart contract testing, in that tests can be written either in JavaScript or Solidity. In this tutorial, we’ll be writing our tests in Solidity.

Create a new file named TestAdoption.sol in the test/ directory. To save time, download a copy of the file from the following link:

http://javascript-tutor.net/blockchain/download/test/TestAdoption.sol

We start the contract off with 3 imports:

  • Assert.sol: Gives us various assertions to use in our tests. In testing, an assertion checks for things like equality, inequality or emptiness to return a pass/fail from our test. Here’s a full list of the assertions included with Truffle.
  • DeployedAddresses.sol: When running tests, Truffle will deploy a fresh instance of the contract being tested to the blockchain. This smart contract gets the address of the deployed contract.
  • Adoption.sol: The smart contract we want to test.

To run the test, enter the following command

Truffle test

The output is as follows:

Step 6 Creating a user interface to interact with the smart contract

Now that we’ve created the smart contract, deployed it to our local test blockchain and confirmed we can interact with it via the console, it’s time to create a UI so that the user can interact with the  pet shop!

Included with the pet-shop Truffle Box is the code for the app’s frontend. It is the JavaScript file app.js within the src/ directory. You can download the app.js file from the following link:

http://javascript-tutor.net/blockchain/download/src/js/app.js

We need to instantiate web3 to create the UI. The global App object is to manage our application, load in the pets data in init() and then call the function initWeb3(). The web3 JavaScript library interacts with the Ethereum blockchain. It can retrieve user accounts, send transactions, interact with smart contracts, and more.

First, we check if there’s a web3 instance already active. (Ethereum browsers like Mist or Chrome with the MetaMask extension will inject their own web3 instances.) If an injected web3 instance is present, we get its provider and use it to create our web3 object.

If no injected web3 instance is present, we create our web3 object based on our local provider. (Here we fallback on http://localhost:7545 that points to Ganache.)

Instantiating the contract

We need to instantiate our smart contract so web3 knows where to find it and how it works. Truffle has a library to help with this called truffle-contract. It keeps information about the contract in sync with migrations, so you don’t need to change the contract’s deployed address manually.

First, we retrieve the artifact file for our smart contract. Artifacts are information about our contract such as its deployed address and Application Binary Interface (ABI). The ABI is a JavaScript object defining how to interact with the contract including its variables, functions and parameters.

Once we have the artifacts in our callback, we pass them to TruffleContract(). This creates an instance of the contract we can interact with. With our contract instantiated, we set its web3 provider using the App.web3Provider value we stored earlier when setting up web3.

We then call the app’s markAdopted() function in case any pets are already adopted from a previous visit. We’ve encapsulated this in a separate function since we’ll need to update the UI any time we make a change to the smart contract data.

Getting The Adopted Pets and Updating The UI

We shall access the deployed Adoption contract, then call getAdopters() on that instance.

We first declare the variable adoptionInstance outside of the smart contract calls so we can access the instance after initially retrieving it.

Using call() allows us to read data from the blockchain without having to send a full transaction, meaning we won’t have to spend any ether.

After calling getAdopters(), we then loop through all of them, checking to see if an address is stored for each pet. Since the array contains address types, Ethereum initializes the array with 16 empty addresses. This is why we check for an empty address string rather than null or other false value.

Once a petId with a corresponding address is found, we disable its adopt button and change the button text to “Success“, so the user gets some feedback. Any errors are logged to the console.

Handling the adopt() Function

We use web3 to get the user’s accounts. In the callback after an error check, we select the first account.

From there, we get the deployed contract as we did above and store the instance in adoptionInstance. This time though, we’re going to send a transaction instead of a call. Transactions require a “from” address and have an associated cost. This cost, paid in ether, is called gas. The gas cost is the fee for performing computation and/or storing data in a smart contract. We send the transaction by executing the adopt() function with both the pet’s ID and an object containing the account address, which we stored earlier in account.

The result of sending a transaction is the transaction object. If there are no errors, we proceed to call our markAdopted() function to sync the UI with our newly stored data.

Step 7 Interacting with the DApp in a browser

The easiest way to interact with our DApp in a browser is through MetaMask, a browser extension for both Chrome and Firefox.

Install MetaMask in your browser.

Once installed, you’ll see the MetaMask fox icon next to your address bar. Click the icon and you’ll see this screen appear:

At the initial MetaMask screen, click Import Existing DEN.

In the box marked Wallet Seed, enter the mnemonic that is displayed in Ganache.

Enter a password below that and click OK.

Now we need to connect MetaMask to the blockchain created by Ganache. Click the menu that shows “Main Network” and select Custom RPC.

In the box titled “New RPC URL” enter http://127.0.0.1:7545 and click Save.

The network name at the top will switch to say “Private Network”.

Each account created by Ganache is given 100 ether. You’ll notice it’s slightly less on the first account because some gas was used when the contract itself was deployed and when the tests were run. (Make sure you are running Ganache as well.)

Installing and configuring lite-server

We can now start a local web server and use the DApp. We’re using the lite-server library to serve our static files. This shipped with the pet-shop Truffle Box, but let’s take a look at how it works.

Let’s examine  bs-config.json 

{
 "port": 3000, 
  "server": { 
 "baseDir": ["./src", "./build/contracts"], 
 "open": false 
  }, 
 "browser": ["chrome"] 
 } 

This tells lite-server which files to include in our base directory. We add the ./src directory for our website files and ./build/contracts directory for the contract artifacts.

I added “browser”: [“chrome”]

So that the UI opens in the Chrome browser.

We’ve also added a dev command to the scripts object in the package.json file in the project’s root directory. The scripts object allows us to alias console commands to a single npm command. 

To launch the app, enter the command in the VS Code Console.

npm run dev

Kittychain Shop

Pet Shop UI

Metamask appears after clicking adopt.

Transactions are shown on Metamask.

And also on Ganache.

References

Blockchain-Based P2P Lending – The Qidax Model

Traditional P2P lending models are facing many issues. For example, the cost of onboarding customers remains high, so investors are wary of this kind of investment model. Besides that, this area is heavily regulated by the securities commission in most countries. While a handful of P2P companies have been approved to operate their businesses, many more P2P operators who failed to obtain a license are facing the nightmare of shutting down

Traditional P2P lending cannot allow borrowers and investors to directly match financing but rather needs to be handled as a credit intermediary through the P2P lending platform. The financing cost is increased because of the need to pay the agency fee. Other issues include the limited scalability of P2P lending services on an international scale. This is due to the aforementioned problems of loan repayment guarantees, as well as to regulatory issues (rules and regulations vary from country to country). There is also work to be done on accelerating the process of granting loans and so on.

Although P2P lending platforms are supposed to be operating in a decentralized manner, they are still largely operating in a centralized model. Data is usually stored and maintained on a central database, which might lead to human errors and manipulation of data. 

On the contrary, data stored on a blockchain are stored on the decentralised and distributed network, where every stakeholder has access to a copy of the same ledger. Furthermore, data on the blockchain is immutable, so no party can alter and manipulate the stored data. These characteristics of the blockchain will greatly enhance data security, increase transparency and instill trust amongst stakeholders. Therefore, blockchain is the perfect solution to solve the woes of current P2P lending models. Indeed, a dozen companies have started to deploy blockchain-based P2P lending platforms.

Blockchain-based P2P businesses are broadly divided into two models, the hybrid model and the pure cryptocurrency model. The hybrid model involves using cryptocurrency and fiat money while the pure cryptocurrency model uses only cryptocurrencies.

The Hybrid P2P Lending Model

This model uses a combination of fiat currency and cryptocurrency to provide P2P lending services. Let us examine a few companies that implement this model.

1. SALT

SALT (Secure Automated Lending Technology) is a leader in the blockchain-based P2P lending industry. SALT’s model allows borrowers to use their crypto assets as collateral to secure loans from an extensive network of lenders on the platform. It means SALT does not bother to check the credit score of borrowers but grant eligibility based on the amount of crypto assets they are willing to put up as collateral. The main advantage for SALT borrowers is the ability to borrow fiat money against the security of their crypto assets, which is considered more practical to ordinary people than the pure cryptocurrency lending model. 

To sign up as a member of SALT, a borrower needs to purchase SALT tokens, the cryptocurrency of the SALT platform. SALT is minted using an ERC20 smart contract. After signing up, borrowers have to deposit a certain amount of crypto assets (cryptocurrency) as collateral into the platform’s unique, multi-signature wallet address created by SALT’s Secure Automated Lending Technology. After the terms of the loan are agreed and approved, the lender will make a deposit in fiat money into the borrower’s bank account. The borrower will be obligated to make repayments in fiat money or stable coins (currently accepting USDC, TUSD, and PAX) on a regular basis before the 15th of the month. In the event of a default, his or her crypto assets will be transferred to the lender. 

In order for an asset to be qualified as collateral on the SALT Platform, it must meet certain eligibility requirements. First and foremost, it must be a blockchain asset. This means that the ownership of the asset must be recorded on a public or permission blockchain. Digital assets will be onboarded based off community demand.

Examples of the current eligible collateral include Bitcoin (BTC), Bitcoin Cash (BCH), Ether (ETH), Litecoin (LTE), Dogecoin (DOGE), Dash (DASH), TruUSD (TUSD), USD Coin (USDC), Paxos Standard Token (PAX), and PAX Gold (PXG).

2. Nexo

The Nexo P2P model is somewhat similar to the SALT model. It also possesses a cryptocurrency known as the Nexo. According to the Nexo website, the NEXO Token is the world’s first US SEC-compliant asset-backed token and is backed by the underlying assets of Nexo’s loan portfolio. It can be used for discounted interest rates and loan repayments, as well as collateral. One incentive for holding the NEXO token is that it pays dividends to holders. Thirty percent of the profits generated from Nexo loans go to a dividend pool that is then distributed to NEXO holders. Currently, dividend payments are being made in Ethereum (ETH), but there’s a good chance that this will expand to other cryptocurrencies in the future.

The loan approval process is fully automated. A credit line becomes instantly available to the borrower once the application is approved and there is no credit check. The borrower can spend money instantly with a card or withdraw money to a bank account. Spending on the credit line will incur an APR from 5.9% of what the borrower uses. Some advantages of NEXO compared to SALT is there is no minimum repayment, no hidden fees, and the interest is debited from the available limit. Besides that, the borrower can make repayments at any time. On top of that, the Nexo website states that it is the only insured account that lets you borrow instantly in 45+ fiat currencies and earn daily interest on your idle assets. Furthermore, NEXO makes its loans available worldwide. Anyone who holds cryptocurrency can take advantage of a Nexo loan. And since the loans are fully collateralized there’s no need for borrowers to worry about credit history or approvals.

Though the use cases for Nexo loans will be somewhat limited since they’re collateral-backed, the use of cryptocurrencies as collateral makes for an attractive alternative for those who hold cryptocurrencies and don’t want to sell yet and give up future gains, but still need fiat currency for immediate use.

At the moment, more than twenty cryptocurrencies including BTC, ETH, NEXO, XRP, TRON and more can be accepted as the collateral. Any loans taken can be repaid using cryptocurrency, fiat currency, or the Nexo token. They have made it as easy as possible to repay any loans. In contrast, SALT only accepts loan repayment in fiat currency, which is an inconvenience for the borrowers.

Pure Cryptocurrency P2P Lending Model

1. ETHlend

ETHlend is a decentralized cryptocurrency credit platform and the world’s first crypto lending marketplace. Unlike SALT and Nexo, it operates exclusively through Ethereum smart contracts. ETHlend also has a token known as the LEND token. It is the native ERC20 token of the ETHLend platform. Its token can be stored in any Ethereum wallet in a similar way as other ERC20 tokens.

The lending process at ETHlend is quite simple. When creating a smart contract, ETHLend requires borrowers to send ERC-20 tokens as collateral for ETH loans in the event of a borrower’s default. Currently ETH, BTC, LEND and more than 150 ERC20 tokens are accepted as collateral. There is no limit in the loan value, as the amount you can borrow depends on the value of your collateral. Borrowers can borrow up to 50% of their collateral value and up to 55% if LEND is used as collateral. This means the borrower needs to send to the smart contract 200% of the value of the loan in crypto assets. To become a lender, you will need to register on the platform and send to your in-app wallet some Ether and any of the currencies accepted in order to fund a loan or create a loan offer. The accepted currencies are ETH, LEND, DAI and TUSD. This also means borrowers will receive the aforementioned cryptocurrencies as loans.

The borrower needs to repay the loan in accordance with the contract, plus interest on the loan, and send them to a smart contract. The lender receives their ETH and interest from the smart contract, and the pledged tokens are unlocked and sent back to the borrower. In the event that the borrower cannot repay the loan, the lender will get the payments plus a liquidation fee from the collateral.

2. Elix

Elix is an Ethereum-based platform for lending, crowdfunding, and payments. The Elix team primarily focused on mobile platforms and usability in order to attract as large a user base as possible from the start. I will not discuss the payment and crowdfunding component of this platform, but rather concentrate only on its P2P lending component.

The uniqueness of this system lies in the fact that Elix offers a peer-to-peer lending program based on mutual incentives for the lender and the borrower. In Elix, both the lender and the borrower are incentivized by the system to meet the terms of the loan. When applying for a loan, participants can choose a mining period in order to receive system rewards in the form of a new token, “Token P”.

If the borrower pays the loan on time, the reward is divided between the lender receiving 65% and the borrower who receives 35%. If the borrower has late payments, the lender receives 100% of this fee. Token P will have a fixed maximum supply that the team expects to achieve in only a few decades.

The Qidax P2P Lending Model

After reviewing the aforementioned P2P lending models, I think the best model that suits a blockchain-based P2P lending conceptual model is the Nexo model. As it is a hybrid of the fiat and cryptocurrency model, this platform needs to work with a licensed P2P operator. I propose the following model:

Using a combination of BTC, ETH, USDT, and QP as collateral

The proposed P2P lending platform will accept BTC, ETH , USDT and Token X (the hypothetical cryptocurrency) as collateral. Any loans taken can be repaid using fiat currency, BTC, ETH , USDT and QP with a certain interest. Loans given to borrowers should be fiat currency. The crypto assets should be stored in a secure wallet. In the event of default, the crypto assets (USDT, ETH, BTC, and QP) will be transferred to the lender.

The loan approval process should be fully automated with no credit checks. The credit line should become instantly available to the borrower once the application is approved. Repayment should be flexible too. I propose that we use a wallet for borrowers to access the credit line offered by the P2P Lending platform and receive the funds once the loan is approved. Besides that, the borrower can repay the loan using the same wallet. Lenders can also access potential borrowers’ information using the wallet and deposit fiat money to be used as loans. It means we need to integrate the wallet to the P2P lending platform via an API.

I propose that 30% of the profit generated from P2P lending to be deposited into a dividend pool and distributed to QP holders. This way it incentivizes people to buy and hold QP.

References

Initial Exchange Offering(IEO) Explained

After the craze of ICOs subsided, two new crypto crowdfunding methods emerged, namely the Security Token Offering (STO) and the Initial Exchange Offering (IEO). Among the two, IEO is more popular as STO poses a higher barrier of entry, is more expensive, and is subjected to more stringent regulations by the securities commission.

In a recent article, Reuters reported that IEOs have raised $1.5 billion so far in 2019, compared with just $836 million raised from ICOs. A dozen of amazingly successful cases of IEOs have driven more project owners to embark on their own IEO journeys. Famous IEO cases include the sale of the BitT Torrent (BTT) token on the Binance Launchpad, raising $7 million in just the first 14 minutes of the sale opening. Veriblock did even better, raising $7 million in April through an IEO on the Bittrex exchange in just 10 seconds. A truly amazing feat! It is safe to say that IEO has taken over ICO as the preferred choice of fundraising in the cryptocurrency industry.

What is IEO?

According to Binance, an Initial Exchange Offering (IEO) is a fundraising campaign that is administered by a Crypto Exchange Platform.  An IEO allows investors to purchase a new cryptocurrency (or token) while raising funds for its crypto project. 

Though ICOs and IEOs both raise funds through token sales, the way they sell tokens is different. For ICOs, the project team themselves conduct the fundraising campaign. Meanwhile, IEO fundraising is conducted on a crypto Exchange platform, where the users of the Exchange can buy tokens with funds directly from their own exchange wallet. 

Advantages and disadvantages of IEO

Advantages

INCREASED INVESTOR CONFIDENCE

Investors are more confident in investing in IEO tokens as the project has to undergo stringent KYC/AML checks by the Exchange platform that handles the IEO projects. The Exchange platform will also evaluate the business model of the project and also audit its technical infrastructure, including its blockchain system and smart contracts. Therefore, many scam projects will be filtered and eliminated. The Exchange platform acts as a trusted third party that can reduce considerable risk in crypto investment.

WIN-WIN FOR THE PROJECT OWNER AND THE EXCHANGE

For the project owner, it is a cheaper and easier way to raise the necessary funds for the project, while not embarking on long marketing campaigns and roadshows. The token is also listed on the Exchange immediately after the IEO campaign.

For the Exchange, conducting an IEO means more revenue for them. An Exchange that hosts an IEO will typically charge a fee for the campaign and get a cut from the token sales. They also get fees when the token starts trading on their exchange.

Disadvantages of IEO

AMBIGUOUS REGULATIONS AND RESTRICTIONS

Many countries still ban or restrict fundraising activity in the cryptocurrency industry while some countries impose stringent regulations on crypto activities. Therefore, it is still uncertain whether IEO will be fully accepted and recognised as the legal way of fundraising in the crypto industry.

ALL INVESTORS SUBJECTED TO STRINGENT AML/KYC

While a stringent KYC/AML check for the project can increase investor confidence, some individuals may be reluctant to expose their identities, so going through a stringent AML/KYC procedure may deter these people from investing in the IEO project.

LIMITED NUMBER OF TOKENS

There have been many complaints from investors that not everyone manages to purchase tokens during IEOs as the number of tokens available for sale is usually limited.

BOTTING CONCERNS

Using bots for trading and investing is ubiquitous nowadays. In the crypto space, there are concerns about bots that can be programmed to participate in IEOs and beat out human investors. In such a scenario, all parties lose out.

How to Conduct an IEO?

Although an IEO is a promising method for fundraising, especially for startups that don’t have the resources and expertise to do an IPO, it is by no means an easy feat. The project owner needs to plan and make the necessary preparations before embarking on the IEO initiative. The following are suggested steps that a project has to follow before going IEO.

DESIGN THE BUSINESS MODEL

Before embarking on an IEO campaign, the founding members of the project must have a clear vision of what their business wants to achieve. They also have to design a business model and draw up plans to attain the vision.

ASSEMBLE A FORMIDABLE TEAM

In this internet era where information is readily available, potential investors and Exchanges will know instantly the background of the project team members. If the project team comprises mostly inexperienced people, it will seriously affect the confidence of the investors and the Exchanges. Therefore, the project owner needs to assemble a formidable team that comprises experts in business, legal, technology, marketing, and other related disciplines. As most IEO projects are blockchain-based, it is a must to hire blockchain experts.

PREPARING THE WHITEPAPER AND OTHER DOCUMENTS

The whitepaper is a document that comprises a thorough description of the project, distribution of tokens, business model, tokenomics and more. It also includes information about the project team which usually comprises the board members, the marketing team, the technical team, the legal team, and the advisers.

Writing the whitepaper is a very important step in the IEO campaign. It is an important document that showcases the project. Whether the investors will be impressed and looking forward to investing in the project depends on how well the paper is written.

Besides the whitepaper, the project team should also prepare a one-pager, website, pitch decks, social media pages and more. These are the components that contain the primary source of knowledge about the project for potential investors and Exchanges to evaluate the IEO project.

DEVELOP THE TOKEN

The token is an integral part of the IEO project. Without a native token, what can you sell to the investors? Therefore, it is crucial to design the token from day 1, and start developing it as soon as possible.

Most tokens for IEO projects are ERC20 tokens. The ERC20 standard is chosen because it can be easily designed and deployed to the Ethereum main net. However, if you want a customized token and your team has the expertise and programming skill, you can develop a different protocol from the Ethereum main net, or even develop your own blockchain system.

To mint the ERC20 token, the blockchain developers need to write a robust smart contract and have it tested and also audited by a trusted third party contract auditor to ensure the contract is secure and free of bugs. The audited token can then be deployed to the Ethereum main net or a private network.

MARKETING

The project team needs to carry out an aggressive marketing campaign for its IEO initiative in order to broadcast the news to as many investors as possible. The marketing campaign can be conducted through websites, blogs, as well as social media platforms such as Facebook, Twitter, WhatsApp, WeChat and more. They can also organise events and conferences to promote their token but they need to check whether these activities can be conducted in certain countries. For example, you cannot do so in Malaysia and China.

ENGAGE A CRYPTO EXCHANGE

The project team also needs to sign an agreement with a crypto Exchange to start their IEO campaign. They need to conduct due diligence in searching for a trusted Exchange before deciding to engage one. A good guide is to look for Exchanges that rank within the top 50 on Coinmarketcap. Besides, they need to analyze reviews of the Exchanges on various crypto platforms. IEO fees may also be another concern, as a top rank Exchange may charge an extremely high fee. Therefore, there is always a trade-off between the fee and the reputation of the Exchange.

Final Note

IEO has replaced ICO as the new trend in fundraising in the crypto industry. Investors who are still thinking of the good old days of ICO should start changing their mindset and focus on investing in IEO projects instead. On the other hand, startups or enterprises who wish to raise funds in the crypto industry must realize that ICO is already dead and IEO is the way to go. Lastly, more exchanges should create IEO launchpads to assist projects that wish to raise funds through IEO, as this is an untapped niche with immense potential. 

References

Building Blockchain for Business

Blockchain is the underlying technology for Bitcoin, Ethereum, and other cryptocurrencies. However, cryptocurrency is far from the only application of blockchain for businesses. One of the most popular business applications of blockchain is fundraising, especially for startups. Apart from conventional ways of funding, blockchain enables alternative methods of fundraising such as ICO or STO.

In the past few years, many companies have raised an incredible amount of money via ICO. Some of the biggest and most successful ICO projects include NEO, Ethereum, Spectrecoin, and Lisk. More info about ICO can be found on the Investopedia website.

That said, I am not going to discuss ICO in this article. Instead, we shall explore blockchain applications in businesses. Though we can use blockchain for all kinds of business applications, whether or not blockchain is suitable for a particular business depends on the nature of the business, the business model, the requirements, and many other factors.

Before implementing blockchain, the C-level management team of a business organization should conduct a feasibility study to determine whether it is necessary and plausible to adopt blockchain technology. You should ask the following questions:

  • Can blockchain add value to the current business?
  • Can blockchain increase the organization’s competitiveness?
  • Do you need to deal with many trustless parties?
  • Do you need a decentralized and distributed database system?
  • Can blockchain improve workflow efficiency?
  • Can blockchain increase revenue and profit?
  • Do you have enough financial resources to implement blockchain?
  • Can blockchain technology integrate with existing systems?
  • Do you have enough talents to manage the blockchain system?

Once you’ve decided that implementing blockchain would benefit your company, you need to carry out the following steps:

  1. Identify a suitable use case.
  2. Assemble your team.
  3. Design the blockchain architecture.

Identify a suitable use case

To embark on a blockchain project, you need to identify the most suitable use case for your business. The best way is to examine use cases in an industry that is similar to your business. Generally, there are three areas in which blockchains can perform very well.

Data Authentication & Verification

This includes immutable storage, digital signatures, and encryption. Data in almost any format can be stored in the blockchain. Blockchains can create public-private key pairs and also be used for generating and verifying digital signatures. Therefore, it can be used for data authentication & verification.

One of the best usages is counterfeiting prevention. For example, Luxtag, a Malaysia-based blockchain company, has patented an anti-counterfeit technology. This technology enables businesses and their customers to protect the authenticity and ownership of their valuable assets by providing digitized certificates using blockchain technology. They have rolled out their first product, known as e-Scroll, for a consortium of Malaysian public universities to verify and validate certificates using a blockchain-powered web application.

Another area related to authentication and verification is data provenance. One of the most successful companies in this area is Everledger. This company has built the Diamond Time-Lapse Protocol, a traceability initiative built on a blockchain-based platform for the diamond and jewelry industry. The system is to ensure that there is transparency along the entire diamond’s lifetime journey, instilling consumer confidence and driving industry growth.

Another application is supply chain management. The most notable is the initiative by Walmart using blockchain technology to ensure food safety. Walmart has been working with IBM on a food safety blockchain solution requiring all suppliers of leafy green vegetables for Sam’s and Walmart to upload their data to the blockchain by September 2019. By placing a supply chain on the blockchain, it makes the process more traceable, transparent and fully digital.

Watch the following video about food safety:

Other business applications could be medical records management, insurance, KYC management for banks, and more.

Digital Asset Management

Any asset that can be digitized is considered a digital asset. Digital assets include ebooks, digital art, images, video, music, journals, newspapers, audio books, online training courses, recipes, and more. With the invention of blockchain technology, digital assets also include crypto assets. Crypto assets can be cryptocurrencies like Bitcoin, Ethereum, and other altcoins, or the tokenized version of a real-world asset such as gold, silver, oil, land titles, property, paintings, etc.

Currently, most digital assets are traded over the Internet via the centralized e-commerce marketplace. However, digital assets can be traded more efficiently over the decentralized peer-to-peer blockchain platforms.

Some real world use cases for digital assets management in blockchain include:

  • AlphaPoint. Provides enterprise-grade software that enables institutions to convert assets to securities tokens and trade those assets on an exchange.
  • Polymath. Enables trillions of dollars of securities to migrate to the blockchain.
  • Harbor. Offers a digital securities platform for compliant fundraising, investor management, and liquidity.
  • Powerledger. Provides a platform for peer-to-peer energy trading.

Smart Contracts

A smart contract is a programmable contract that enables auto execution of a contract the moment it fulfills certain terms and conditions. It is akin to a vending machine – you get your product by inserting some coins or banknotes.

According to Investopedia, smart contracts are:

“self-executing contracts with the terms of the agreement between buyer and seller being directly written into lines of code. The code and the agreements contained therein exist across a distributed, decentralized blockchain network. Smart contracts permit trusted transactions and agreements to be carried out among disparate, anonymous parties without the need for a central authority, legal system, or external enforcement mechanism. They render transactions traceable, transparent, and irreversible.”

Almost any blockchain business application involves the use of a smart contract. A famous use case is Cryptokitties. A smart contract is executed when a user acquires a unique virtual kitty from the Cryptokitties collectible marketplace via a bidding process. The highest bidder gets to own the digital asset. Other dapp transactions also make use of smart contracts.

Blockchain-powered supply chain management makes use of smart contracts to handle transactions between manufacturer, suppliers, wholesalers, and retailers.

In the insurance industry, the client who wishes to buy insurance can provide personal information including sensitive data like medical records via a smart contract to the insurance company. In the health care industry, a patient can get faster and more accurate diagnoses and treatment via a smart contract that allows them to share medical records.

Assemble your Team

After conceptualizing a business use case that is suitable for your business, you need to assemble your team to kick-start the blockchain project. Getting the right people in your team is crucial to success. Your team should comprise people with business skills and also people with technical skills. People with business skills should be able to see the overall picture of your business model and know how to execute it. They must also have good interpersonal skills, strategic thinking, good networks, and financial knowledge. The people with business skills should be assigned the posts of CEO, CFO, marketing manager, business development manager, and so on.

People with good IT skill in general and blockchain in particular are equally important. The CTO must have many years of experience in the IT and software industry and have a good grasp of blockchain. He or she must be assisted by a technical lead who has good practical experience in setting up the blockchain platform, know how to program the smart contract, sound knowledge of programming languages including Solidity, JavaScript, Goland, C++, Java, Python, and so on.

In addition, if you plan to raise funds via ICO, you need to employ a compliance officer, preferably a lawyer who understands the guidelines provided by the security commission and the central bank.

Designing the Blockchain Architecture

You need to decide whether to build the blockchain network from scratch, or use a third party blockchain solution like Azure blockchain, Oracle, or AWS blockchain. The former is time-consuming, whereas the latter could be up in as little as 30 minutes.

Each of the the aforementioned enterprise blockchains offer their own functionalities and features as well as cost advantages. Both AWS and Azure offers solutions for Ethereum, Hyperledger Fabric, Corda, and Quorum, while Oracle only caters for Hyperledger Fabric. We can compare their features in the following table:

Courtesy of 101 Blockchains


The cost of setting up Azure Blockchain Workbench is roughly $400-$500 depending on your region and usage. The main costs are three VMs and one app service. Two VMs are for the default blockchain network, and one VM is for the microservices on Workbench. For AWS Blockchain pricing, refer to: https://aws.amazon.com/managed-blockchain/pricing/

References

Storing Data on Blockchain

Though we are experiencing crypto winter at the moment, with major coins devalued more than 80% in 2018, the underlying blockchain technology is still exciting. The blockchain provides a democratized trust, distributed and validation protocol that has already disrupted banking and financial services and is on the verge of overhauling other industries like healthcare, supply chain, HR and more.

Despite the hype and its promising future, blockchain still has its shortcomings, the issue of data storage is one of them. The transactions based on the POW consensus for bitcoin, Ethereum, and other cryptocurrencies are extremely slow and therefore not suitable for storage of large data. For example, the deployment of dApp Cryptokitties nearly crippled the Ethereum network

The main problem of storing data on a blockchain is the limitation of the amount of data we can store because of its protocol and the high transaction costs. As a matter of fact, a block in blockchain can store data from a few kilobytes to maybe a few megabytes. For example, the block size of the Bitcoin is only 1Mb. The block size limitation has a serious impact on the scalability of most cryptocurrencies and the bitcoin community is debating whether to increase the block size.

Another issue is the high cost of the transactions. Why is storing data on the blockchain so expensive? It is because the data has to be stored by every full node on the blockchain network. When storing data on the blockchain, we do pay the base price for the transaction itself plus an amount per byte we want to store. If smart contracts are involved, we also pay for the execution time of the smart contract. This is why even storing kilobytes of data on the blockchain can cost you a fortune.

Therefore, it is not viable to store large data files like images and videos on the blockchain. Is there a possible solution to solve the storage issue? Yes, there are quite a few solutions but the most promising one is IPFS.

What is IPFS?

IPFS or Interplanetary File System is an innovative open-source project created by the developers at Protocol Labs. It is a peer-to-peer filesharing system that aims to change the way information is distributed across a wide area network. IPFS has innovated some communication protocols and distributed systems and combine them to produce a unique file-sharing system.

The current HTTP client-server protocol is location-based addressing which faces some serious drawbacks. First of all, location-based addressing consumes a huge amount of bandwidth, and thus costs us a lot of money and time. On top of that, HTTP downloads a file from a single server at a time, which can be slow if the file is big. In addition, it faces single-point of failure. If the webserver is down or being hacked, you will encounter 404 Not Found error. Besides that, it also allows for powerful entities like the governments to block access to certain locations.

On the other hand, IPFS is a content-based addressing system. It is a decentralized way of storing files, similar to BitTorrent. In the IPFS network, every node stores a collection of hashed files. The user can refer to the files by their hashes. The process of storing a file on IPFS is by uploading the file to IPFS, store the file in the working directory, generate a hash for the file and his file will be available on the IPFS network. A user who wants to retrieve any of those files simply needs to call the hash of the file he or she wants. IPFS then search all the nodes in the network and deliver the file to the user when it is found.

IPFS will overcome the aforementioned HTTP weaknesses. As files are stored on the decentralized IPFS network, if a node is down, the files are still available on other nodes, therefore there is no single point of failure. Data transfer will be cheaper and faster as you can get the files from the nearest node. On top of that, it is almost impossible for the powerful entities to block access to the files as the network is decentralized.

The following figure shows the difference between the centralized client-server protocol(HTTP) and the peer-to-peer IPFS protocol.


 [Source: https://www.maxcdn.com/one/visual-glossary/interplanetary-file-system/]

Blockchain and IPFS

IPFS is the perfect match for the blockchain. As I have mentioned, the blockchain is inefficient in storing large amounts of data in a block because all the hashes need to be calculated and verified to preserve the integrity of the blockchain. Therefore, instead of storing data on the blockchain, we simply store the hash of the IPFS file. In this way, we only need to store a small amount of data that is required on the blockchain but get to enjoy the file storage and decentralized peer-to-peer properties of IPFS.

One of the real-world use cases of blockchain and IPFS is Nebulis. It is a new project exploring the concept of a distributed DNS that supposedly never fails under an overwhelming access request. Nebulis uses the Ethereum blockchain and the Interplanetary Filesystem (IPFS), a distributed alternative to HTTP, to register and resolve domain names. We shall see more integration of Blockchain and IPFS in the future.

References