Uses of Smart Contracts

This chapter contains some possible uses of smart contracts. The aim here is to inspire you to start writing your own smart contracts even if they begin life as basic versions of what might later become more sophisticated applications.

Financial uses of smart contracts

When smart contracts are used for financial purposes, it is useful to think of them as AI wallets. Cryptocurrency can be sent to them and distributed to other users based on the logic contained within the smart contract. One example of a financial use of a smart contract is in an auction. Users can participate in the auction and make bids. The smart contract stores the bids that are made, and when the auction is over, it allows:

  1. The owner of the smart contract to receive the highest bid as payment for the item.

  2. Unsuccessful bidders to withdraw the bids they made.

Smart contracts for voting

Smart contracts can be used for voting. In this case financial transactions are substituted for votes. Once cast, the votes can be traced back to when they were cast but the identity of the voter remains secret. At the end of the election, the smart contract can publish the results. However, because the blockchain is an immutable public ledger, anyone can also go back and check the votes themselves. In addition, because the smart contract is also immutable and held on every node, its vote counting code can also be inspected by anyone.

Smart contracts in gaming

Smart contracts can be used in the storing of statistics for tradable game entities such as a weapon or a hero. For example, they can record the history of the hero and level up the hero in respect to those achievements. The higher the level of the hero the more they can be traded for. The procedure held in the smart contract for levelling up the hero is transparent and so is the path the hero took to achieve their current level.

Smart contracts in delay repay schemes

Smart contracts can be used in delay repay schemes. For example, they can be automatically used to handle delay repayment if a plane or train is delayed. The smart contract’s owner can hold the amount paid for a ticket until a specific point in time, agreed by the customer, at which no refunds are possible. Meanwhile, the arrival times of vehicles is recorded digitally, and the smart contracts are automatically invoked with these timestamps. The smart contract checks the timestamps against the official timetables and pays compensation accordingly if any journey was late.