cryptodailytrading.com

Blockchain in the Supply Chain: Applications, Benefits, and Prospects Going Forward

  • Vera Thornpike
    📚 WikiCoin

    The applications of Blockchain extend well beyond cryptocurrency. Find out how blockchain is integrated in supply chain management: benefits, use cases, early adopters.


Blockchain in the Supply Chain: Applications, Benefits, and Prospects Going Forward
You may also like:
Contents
Today, management of the supply chain is a very challenging task: depending on the companies and products handled, the chain can include over 100 stages, numerous geographical spots, a lot of payments and invoices, as well as hundreds of people involved. The whole process of a product going through a supply chain can last for months. The logistics industry lacks transparency and efficiency, and this is where blockchain comes in handy. How does it change the rules of the game, and will blockchain replace the current state of things?

What is a supply chain?

To put it simply, a supply chain is a network of all organizations, specialists, resources, and activities involved in the process of production and sale of a product. Logistics is only a part of this complex network. Supply chain management is the control over the flow of services and goods from the moment of handling raw materials and to the point of selling and consumption. Smart execution of supply chain management can:

  • boost sales and increase revenues;

  • optimize expenses;


  • improve quality;

  • contribute to production, distribution, and sales.

Of course, the supply chain sphere is not devoid of drawbacks:

Supply chain industry has a lot of problems to deal with
Main weak points of supply chain industry

A few decades ago, control over logistics was way easier due to the fact that all products were traded locally. Today, companies go international, so managing transportation, production and communication has become challenging.

What’s the role of blockchain in it?

Although blockchain is mostly known to drive cryptocurrency, this technology has a lot of spheres of application. A distributed ledger can be efficiently used in contracts and agreements, exchange, payments, tracking, and so son. Every transaction stays recorded in a block over multiple copies of the ledger and distributed over numerous computers, or nodes. The data stays totally transparent, and storage is secure because blocks are linked to one another. There is no central authority, and blockchain is very flexible. It can boost the efficiency of the supply chain and make it more scalable. Besides, a blockchain may have a chain of commands built in.

👉MUST READ WikiCoin: What is Blockchain Technology and How it Works
WikiCoin: What is Blockchain Technology and How it Works


Still not clear? Let’s consider the following example:

“Let’s say you visit a pharmacy and need to buy rare expensive medicine. When checking out the package, you see “Store the drug in a dry cold place below 15 °C, failure to do so will make the product not fit to use.” Okay, the pharmacist took care of it, but how do you know that the same conditions were met during transportation and that the distributor was careful about it, too? You don’t know whether you can trust and buy the product. What if the drug has lost its properties because of mishandling?

In such cases, blockchain could be of much help. There might be a microchip sensor (IOT chip) in the package of medication to keep track of the conditions right from the moment of dispatch from the factory, and to the moment you take it in your hands. This data is regularly renewed and submitted to the blockchain ledger.

You can simply use your smartphone to check out the details and verify the drug was stored in a proper environment. With the help of IOT coupled with the blockchain, you don’t have to rely on the pharmacist and distributors only – all essential information is at your fingertips.

Application of blockchain in supply chain and logistics
Blockchain can be applied at any stage of the supply chain

Other examples include blockchain being integrated into the diamond trading sphere (chips are attached to diamonds to prove their history and origin) and food supply chain (here, blockchain proves that products are fresh and stored in compliance with standards).

Therefore, blockchain proves to be useful at all stages of supply chain management.

Problems of SCM addressed by blockchain

When it comes to supply chains, blockchain brings about a lot of benefits. It solves all major problems in the following ways:

  1. It enables direct communication without a myriad of third parties. All relationships can be managed in a complex ecosystem.

  2. Blockchain makes data and interaction totally transparent. The problem of trust to third parties is solved.

  3. This is a move to digitalization, which means a lot of questions can be solved without personal meetings.

  4. Blockchain is the key to data decentralization and integrity.

  5. Blockchain plays the role of data repository with real-time synchronization among all nodes involved.

  6. The risk of fraud and counterfeits is significantly reduced.

  7. Blockchain allows cutting on auditing costs.

👉MUST READ 10 Most Influential People in Blockchain- Popular Crypto Names 2018
10 Most Influential People in Blockchain- Popular Crypto Names 2018

Benefits of blockchain in supply chain management

As you can see, blockchain is a perfect replacement to banks, messengers, business management software, and logistics solutions. This is a versatile technology that renders the whole gamut of advantages:

  • Dynamic changes and compliance with ever-changing demands and rules.

  • Digitization of the supply chain ecosystem. The technology-focused approach reduces operational time and the risk of human mistakes.

  • Stronger, more efficient collaboration between all participants of the supply chain network.

  • Security, integrity, and reliability of data.

Therefore, a distributed ledger automates processes across the entire chain, and optimizes time and expenses. As a result, participants enjoy an accelerated delivery process and streamlined flow of services and goods.

Benefits of blockchain in supply chain
Key benefits of blockchain in supply chain network

SCM projects that use blockchain

Blockchain is being slowly integrated into the infrastructure of both new ICOs and old, well-established companies. Let’s find out who is among the first to reap its benefits.

In the food industry, Walmart was one of the pioneers: it uses blockchain to track the pork pieces that it exports from China. Blockchain shows where the meat came from when it was processed and stored. Nestle, Unilever, Dole and Tyson jumped on the train to use blockchain for the same task.

De Beers, a diamond trading company, uses blockchain to track the stones from the moment they’re found to the moment they’re sold to buyers. That helps trader to avoid conflicts and guarantees customers they purchase genuine stones.

Tomcar, an Australian vehicle producer, pays its suppliers in Bitcoin. Therefore, it avoids paying extra taxes, dealing with traditional banks, and waiting for eternity to have payments processed. Blockchain does this job for them.

Other projects using blockchain for supply chain management are:

  • Blockshipping;

  • DAV network;

  • Modum;

  • Cloud Logistics;

  • VeChain;

  • Ambrosus;

  • WaBi;

  • Provenance.

Bottom Line

Supply chain management has grown into an enormous global system that includes a lot of manufacturers, distribution patterns, contracts, relationships, and organizations. Add to that a short product life cycle, globalization, and rising demands, and you will realize that the SCM sphere is in dire need of improvements. With blockchain, we can create the most dynamic and flexible supply chain ecosystem possible. It will improve the quality of the services and data involved.

Join our Telegram channel to get news even faster!
👓 Recommended articles

How to Learn Solidity and Start Blockchain Programming

  • Eric Croix
    📚 WikiCoin

    If making an Ethereum-based dApp or creating an ERC20 standard token sounds compelling to you, than you need to learn the language called Solidity. In our tutorial we provide you with the foundation of coding smart contracts


How to Learn Solidity and Start Blockchain Programming
You may also like:
Contents

Blockchain programming has become one of the best paying and challenging software spheres during the recent decade. Although blockchains are language-agnostic and many of the existing languages, like C++ and JavaScript (JS), are used by blockchain engineers, there are some tasks that couldn’t be conveniently realized by existing languages, which opened up the demand for new, crypto-specific options. One such language is Solidity.

Solidity was born as a core part of the Ethereum ecosystem. It absorbed C++, JavaScript, and Python. It has many contemporary features like libraries and inheritance. Solidity is designed to write programs that interact with Ethereum accounts, which are called smart contracts. Smart contracts are executed on Ethereum Virtual Machine (EVM), enabling users utilizing them perform tasks like crowdfunding, blind auctions, voting, and many others in a decentralized manner. The most famous killer-app of smart contracts was decentralized funding in ICOs, which started the bull rally on the crypto markets in 2017.

👉MUST READ No Dice: Ethereum Loses dApps Race to EOS and Tron
No Dice: Ethereum Loses dApps Race to EOS and Tron

Whether you are an experienced developer or just starting out in crypto, it’s a good idea to start learning Solidity because smart contracts have become a crucial part of the blockchain ecosystem. Aside from being actively implemented by dApps, they are being actively integrated into infrastructure-layer blockchains and even in Bitcoin via providers like RSK. By knowing how to build smart contracts you will make your blockchain career more sustainable and be able to produce better quality solutions. Let’s not pull it off any longer and get our hands dirty with coding!

Understanding the basics of a smart contract

A smart contract account consists of three sections: balance, storage, and code. The balance represents how much Ethereum a smart contract has. Storage holds data like strings and arrays that are specific to an application. The code section has the raw machine code that is compiled from what we write in Solidity.

Unlike user accounts, smart contract accounts are not external to the respective networks. In other words, you can use your wallet with various networks like Kovan and Ropsten, but you can’t do this with a smart contract. Smart contracts are internal.

Each smart contract has a source, which is stored on an author’s device and instances, which are stored on the blockchain. In order to create an instance (account) of a smart contract, we need to deploy it to the network. It very much resembles the relationship between classes and instances in traditional object-oriented programming (OOP) and languages representing it (JS, Ruby). To give you a more visual representation, let’s create a class ‘Bike’ and add an instance of it.

Bike class & instance

Bike class & instance

Source: Image by U.Today

What we will be writing is a contract definition, which will then run through a compiler that will produce two files: bytecode and application binary interface (ABI). Bytecode is what will be actually fed to the EVM and ABI is a layer between bytecode and regular JavaScript code that allows building a user interface (UI).

👉MUST READ Blockchain Programming: How Many Programming Languages Do You Need for Blockchain?
Blockchain Programming: How Many Programming Languages Do You Need for Blockchain?

Choosing an IDE & version of Solidity

Before we start, we need a proper integrated development environment (IDE). In other terms, we need a convenient terminal with the necessary tools to write our code in. For the purposes of this tutorial, we will pick Remix, an IDE created by the Ethereum foundation that allows writing, testing, debugging, launching smart contracts and many more. You can use it either straight in the browser or download it locally if you would like.

Once you launch Remix, you will be presented with the code editor in the center, the file manager on the left, and a compiler on the right.

Initial Remix window

Initial Remix window

Source: Image by U.Today

There will be some pre-written code – we won’t need that. To create out first-ever smart contract let’s press on the little plus icon in the top-left corner of the terminal and give it a name.

Creating a new project in Remix

Creating a new project in Remix

Source: Image by U.Today

As we have the blank .sol document now, we should specify the version of Solidity that the compiler will run. At the time of this tutorial, the latest version is 0.5.7. If you are not sure which version to use, you can specify a range of versions.

2 types of specifying the version of Solidity

2 types of specifying the version of Solidity

Source: Image by U.Today

Lastly, let’s give our smart contract a name, followed by a parenthesis.

Smart contract naming

Smart contract naming

Source: Image by U.Today

Writing your first smart contract

Once we have our canvas ready, it’s time to define the basic building blocks – variables. While experienced software engineers will have no issues understanding this concept, we will briefly introduce it to beginners. Variables are placeholders for chunks of information that are later referenced by a program that runs them.

👉MUST READ Blockchain Developer Salaries. Top Job Offers of Blockchain Companies
Blockchain Developer Salaries. Top Job Offers of Blockchain Companies

Let’s create a couple of variables: a string (a sequence of symbols) and an integer (a number). In Ethereum’s case, variables are stored in the blockchain along with the rest of parts of contracts and can, therefore, be accessed and updated from anywhere. Another key characteristic of Solidity variables is that you can make them private by writing ‘private’ next to the variables. Finally, for the integers, Solidity has two types: signed (can be positive & negative) and unsigned (can only be positive). To specify an unsigned variable, we should just put ‘u’ before it.

A private string and an integer

A private string and an integer

Source: Image by U.Today

Once we have the ‘name’ variable, we need to write out the methods of setting and getting it. This looks like a JS function. Remember that Solidity is statically typed, so we have to define variable types. Now any value we put in the ‘setName’ will define the ‘name’ string. For the getter, we will use ‘getName’ and specify what variable we expect to see. Now, it’s time to do the same for the ‘age’ variable. The method is constructed similarly to the ‘getName’.

Name/age setters and getters

Name/age setters and getters

Source: Image by U.Today

Let’s test our little chunk of code. Go to the ‘Run’ tab of the compiler and press ‘Deploy’ under your contract’s name. At the very bottom of the compiler, you will now see the ‘Deployed Contracts’ section that has our methods available. In order to pass a name to the ‘newName’ value, we need to make sure that our string is written in JSON, otherwise, the ‘getName’ will return nothing. For the ‘setAge’ just put your age without quotes. As you see, we can now set and receive the ‘name’ and the ‘age’ variables through our smart contract.

Compiler, with a name and an age

Compiler, with a name and an age

Source: Image by U.Today

Defining Wei and Gas

One of the most remarkable features of smart contrasts is that to deploy them to the Ethereum network you will need to initiate a transaction, which costs some amount of money that is paid in Ether. It’s crucial to understand how the fees are utilized in the system, as they will be deducted each time you interact with EVM.

What’s Wei?

Let us assume that reading this far into our tutorial you have used Bitcoin at least once. You probably made a small transaction that was way less than 1 BTC. In that case, you used Satoshis, which are something like pennies for a dollar. Wei is like a Satoshi – it’s the smallest part of 1 Ether. If we think of it in programming terms, it’s the lowest unsigned integer in the network. While interacting with the network, you will mostly encounter Gwei, which refers to Gigawei and equals 1 billion Wei.

👉MUST READ Vitalik Buterin Suggests Wallet Users Should Pay Higher Fees to Fund Devs
Vitalik Buterin Suggests Wallet Users Should Pay Higher Fees to Fund Devs

What’s Gas?

Gas is an essential part of the mechanism of smart contract execution. It has two values for each transaction: Gas consumed and its price. It’s worth mentioning that a user initiating a transaction defines these values. However, if the set value of Gas won’t be enough to process a specific operation, then the Gas will be consumed, but the transaction will fail. Moreover, if the price for Gas will be set too low for the network at a given time, the transaction will not be processed by the nodes, eventually making it unsuccessful. There are several services to check optimal values for your transactions, one of them being ethgasstation.info. To get a better understanding of Gas and why it costs any money, let’s code some of it by ourselves.

Get back to your Remix window and initiate a new file. In our example, we will call it ‘Gas’ and create a contract with the same name. Bear in mind that the more data we will require to store on the blockchain, the more Gas we will need. That being said, for the purpose of this tutorial we will create a cheap contract; the more you will add to it, the higher the fee will be.

There will be a function that returns an integer that is a sum of two inputs. To make it as lightweight as possible, we will specify that our contract will store nothing on the blockchain, and for that we will put ‘pure’ next to the function.

Cheap contract

Cheap contract

Source: Image by U.Today

Now you can deploy it in the compiler and input any two numbers to get the integer ‘c’. To check the price of our transaction we should take a look at the terminal located beneath the code section. There is a transaction cost and an execution cost. The first one refers to how much data a transaction has. The second one refers to how much of EVM’s power was required by the transaction.

Cheap contract’s cost

Cheap contract’s cost

Source: Image by U.Today

This is an extremely basic transaction that costs almost nothing for the network. In writing meaningful smart contracts you will add more details, which will increase their weight and therefore transaction fees.  

Creating & deploying your own ERC20 token

Let’s face it, the majority of the blockchain developers that are just starting out are eager to play big and create their own blockchains and tokens. While this is an extremely difficult topic that attracted some of the best software engineers from other spheres, building a basic ERC20 token isn’t rocket science.

First, we need to create another file in Remix and uploading the ERC20 interface, which is the following:

ERC20 standard

ERC20 standard

Source: Image by U.Today

The ‘totalSupply’ function lets us see how many tokens we have in total. The ‘balanceOf’ function is used to get amounts of tokens on specific addresses. The ‘transfer’ function allows users performing transactions between each other. The ‘transferFrom’, ‘allowance’ and ‘approve’ functions are there to allow people to let some other users initiate transactions on their behalf. Events are the logging tools for the ledger.

In addition to the interface itself, we will need a separate .sol file for our new token. Here we will import the ERC20 interface and specify our token’s symbol, name, and decimals.

uToday token

uToday token

Source: Image by U.Today

Before we compile it, we need to specify constraints.

  • Let’s start with the total supply – it’s a constant integer variable that we will make private. The total supply of our tokens will be 1 million, we also write a function to return this value.

  • Second, we need to store our token somewhere. For this, we will need to outline the mapping that will return a balance for any address specified.

  • Third, there should be a function for token transfers, which will essentially have an address of a receiver and an amount of token transferred. This function should also be able to check whether or not a sender has enough tokens on their balance, which can be realized through a simple if/then statement. In addition, we will set conditionals for ‘_value’ in a way that blocks users from sending transactions with 0 tokens as this would only flood the network with junk.

  • Fourth, we should create the mapping for the remainder functions, which is a mapping of mapping to an integer.

  • Then we will specify a few checkers in the ‘approve’ and ‘allowance’ functions and put conditions for the ‘transferFrom’.

  • Finally, not all the tokens will be available on the market. Some of the tokens are usually left out for teams, foundations, advisors and other purposes. Hence, it’s essential that we make it clear how many tokens will be circulating. As we created the tokens, the circulating supply equals our balance.

uToday token constraints

uToday token constraints

Source: Image by U.Today

The code is ready, so let’s test it. Proceed to the ‘Run’ tab of the compiler and deploy our token contract. You will see that we have our token data along with the total supply, balances, and allowances. Congratulations, you deserve a pat on the back!

To make our token actually function on the network, we need to deploy the smart contract (note that this is different from deploying it for testing in Remix). For the sake of this tutorial, we will use Remix and Metamask, but there other ways of doing so. Metamask is a simple but efficient Ethereum wallet program with a nice UI that integrates as an extension to some of the most popular browsers. In our case, we will use Opera. Firstly, go to metamask.io and download the extension. Once it’s done, you will see a fox icon in the top right of your browser.

Downloading Metamask & location of the icon

Downloading Metamask & location of the icon

Source: Image by U.Today

Press on the icon and proceed through the offered instructions to create a wallet. Do not forget to store the secret phrase! When you have your wallet, press on the Metamask icon and change the network to ‘Ropsten’ because we don’t want to mess with Ethereum’s mainnet.

Changing Metamask to Ropsten

Changing Metamask to Ropsten

Source: Image by U.Today

The last step is to generate some Ether (unfortunately, you won’t be able to use these for any real purchases, but they are necessary for testing). Head over to faucet.metamask.io and request 1 Ether.

Now you are all set. Return to your Remix window and change the environment to ‘Injected Web3’ in the compiler. Take a look at the account tab too – your address should be the same as that of what you generated with Metamask. Select the smart contract you want to deploy, which is your token contract and not the ERC20 interface and press on the respective button. A Metamask window will pop up with a transaction, its details, and options to interact with it. Submit the transaction, and our token will come into life.

Metamask popup

Metamask popup

Source: Image by U.Today

You can now play around with all the functions we specified earlier. Let’s look at our contract from another side to verify that it works properly. Like any other blockchain, Ethereum has multiple block explorers which serve the essential purpose of monitoring what’s happening on the network. In our case, we will stick to etherscan, though there is a handful of other great alternatives. Note that if you just go to etherscan, you will see the Main network. As we need to see the Ropsten network, you will need to put ‘ropsten.’ before the website’s address. Search for your address and you will see two transactions – one is for free Ether you received, and another is for deploying the contract.

User’s address in Etherscan

User’s address in Etherscan

Source: Image by U.Today

To find the address of your contract, press on the TxHash and navigate to the ‘To’ field. Here you can check your smart contract’s transactions, code, and events. At this point, we need to verify and publish our contract. Go to the ‘Code’ section and click on the ‘Verify and Publish’ link. Here you will need to again specify the name of your token, the version of the compiler (in our case the latest version of Solidity we used was 0.5.7, so we will stick to the related compiler version). Now you should copy the token’s smart contract code along with the ERC20 interface code from your Remix window to etherscan and press ‘Verify and Publish’ at the bottom of the screen.

Verifying the smart contract

Verifying the smart contract

Source: Image by U.Today

It’s time to go back to your contract’s address. The code in the ‘Code’ tab will now be verified. In addition, you will now have two more tabs: ‘Read contract’ & ‘Write contract’. In the reading section, we can check the functionality of our token. Input your (not the contract’s) address into ‘balanceOf’ field to see how many tokens you have; it should show 1 million that we hard coded as the total supply and gave it circulating to our wallet. That means that our token is now correctly working on the testnet.

Receiving the balance

Receiving the balance

Source: Image by U.Today

Summary

If you are looking to start a career in the crypto industry, you need to understand that despite its relative simplicity in basics, blockchain has incredible deepness to it. Since 2017 blockchains have evolved significantly and their use cases went beyond just financial transactions. With the advent of Ethereum, a whole new layer of networks appeared that hosts various dApps and blockchain-based solutions. The tool behind this evolution was a smart contract, and if you want to make your experience more valuable and future-proof, you should know how one works.

👉MUST READ Top 16 Ethereum Wallets 2019
Top 16 Ethereum Wallets 2019

While you can code smart contracts using other languages, Solidity is a better fit for such a purpose. Moreover, if you want to become an Ethereum developer, or create an ICO/ERC20 token for your project, this is your go-to choice. If you had some experience with C++ or JavaScript, coding on Solidity should be relatively easy. You will have to understand some differences between the client-server and decentralized models of launching software, though. Thanks to Ethereum Foundation and some third-party organizations, developers are presented with a set of convenient tools like Remix and Etherscan to code and deploy smart contracts.

We hope that our tutorial helped you with getting around the majority of Solidity’s concepts to be able to start your blockchain journey. Remember that you can always check with the latest documentation on Solidity. We wish you good luck and will be happy to use some of your dApps someday!

https://www.freepik.com/free-photo/working-from-bed_789592.htm
Only the most important posts per day. Infographics, analytics, reviews & summaries. Join our Telegram channel!
👓 Recommended articles