International Journal of Advances in Electronics and Computer Science, ISSN(p): 2394-2835 Volume-6, Issue-5, May-2019 http://iraj.in APPLING BLOCK-CHAIN FOR BIKE SHARING SMART CONTRACT

1IUON-CHANG LIN, 2YUNG-CHEN CHOU, 3TZU-CHUN LIAO

1,3Department of Management Information Systems, National Chung Hsing University, 250 Kuo-Kuang Road, Taichung, Taiwan 1Department of Photonics and Communication Engineering, Asia University, Taichung, Taiwan 2Department of Computer Science and Information Engineering, Asia University, 50 Lioufeng RD., Wufeng, Taichung 41354, Taiwan E-mail: [email protected]

Abstract - People's awareness of environment has risen in recent years, more and more energy saving and carbon reduction policy were popularized and got attention by the government, people were also gradually changing their habits and customs to rejoin the concept of green life style. Bike rental service combine sightseeing with exercise, is always a popular public transport. In Taiwan, Youbike is a well-known brand of public bike rental service, however, in China, they have another type of bike rental service, which is a fully station-less bicycle-sharing system. Except to find out the difference between the two type of bike rental service and each of their problems, this research also wants to solve current bike rental service encountered difficulties by using blockchain technology and smart contract, and to make a feasible solution for the realization of bicycle sharing economy.

Keywords - Blockchain, Smart Contract, Sharing Economy, Bike Rental

I. INTRODUCTION Denmark, Germany and France, America also have their own bike sharing system. But compared with Bicycle rental service has been in place for years, now China’s bike sharing markets, Europe and the United the trend of sharing economy also goes viral on States seems not so strong as China, some operators bicycle market. Bicycle rental service can be divided were quit due to operating loss and lack of funds. into two types, one is fixed stations mode, like common bicycle rental service, the other is station-less Problems in bike sharing bicycle-sharing system, which is more innovative way China’s bike sharing systems are both station-less, and to rent a bike. other countries are still using fixed Stations mode to Compared to traditional bicycle rental service, provide bicycle rental service, but gradually imitate station-less bicycle-sharing system is more convenient China, come up with station-less bicycle-sharing because it doesn’t need to go to a specific location to system. On the other hand, from the bicycle rental rent or return a bike. But it still caused some problem, payment point of view, people in China use mobile like people might illegal parking when they couldn’t payment, and Europe and the United States area use find a legal place to park their bike, or if there doesn’t credit card to pay. have enough bikes on the road, it will harder to find a Whether it is fixed stations mode or station-less mode, bike than fixed station mode because it’s too both of them have pros and cons individually. It will dispersed. face some challenges no matter it comes from the In order to solve problem like we just talk about it, this process of rent and return, or method of payment. Now. paper wants to offer a method that can popularize the This paper will discuss to fixed stations mode and concept of bike sharing by using smart contract, makes station-less mode about their own advantages and more and more people willing to provide their bike to disadvantages, summarized four problems in these each other, and achieve the real Bike Sharing two types of bike sharing system. Economy. Fixed stations mode: II. RELATED WORKS Fixed stations mode is the most common method in bicycle rental service markets, develop earlier than In Taiwan, Youbike is the most common and most station-less mode. Companies use this method are popular brand in bicycle rental service, and oBike, Youbike- Taiwan, - New York, Capital which was came from Singapore, also provided Bikeshare- Washington, - UK, bicycle rental service in Taiwan since 2017. In foreign Velib- Paris, MBS- Melbourne, Ddareungi- Seoul, countries, China became a vigorous development area Greenolution- Delhi. in bike sharing, representative company such as , Advantages include: and . In Europe and the United 1. Easy in management and vehicle scheduling. States, Netherlands is first tried on bike sharing, which 2. The quality of the bikes is more consistent. is also renowned for bicycle kingdom. There are 3. Vehicles are less likely to be stolen. others brand of bicycle rental service in Spain, UK, 4. Won't cause chaos in illegal parking.

Appling Block-Chain for Bike Sharing Smart Contract

42 International Journal of Advances in Electronics and Computer Science, ISSN(p): 2394-2835 Volume-6, Issue-5, May-2019 http://iraj.in 5. Rent is cheaper. reduce cost of vehicle scheduling. Disadvantages include:  How to solve the problem of bike quality 1. Needs to return bike at specific location. which were providing by public. 2. Situation of no place to park may happens. 3. Usually have complicated procedure on III. SMART CONTRACT BIKE SHARING operating machine before you rent a bike. SYSTEM 4. Costs fund and needs additional field to build stations. There are four kind of problems in bike sharing. 1. User violation problem Station-less mode: 2. Bike rental problem Present by China's bike sharing company- "ofo", 3. Vehicle scheduling problem which is an innovative bicycle rental operation mode 4. Bike quality problem and popular in China. Combined with the concept of In User violation problem, it contains users hide the sharing economy, bicycle operators around the world bike in their private area, users park the bike in an have begun to use this kind of bike rental type in inappropriate place, users damage the bike, users steal recent years. Companies use this method are ofo, the bike, users put their own lock on the bike or users Mobike and Bluegogo- China, oBike- Singapore, call break the traffic rules. a bike- Germany, Donkey Republic- Copenhagen, In Bike rental problem, people may not able to find a Urbee- Amsterdam, Dropbyke- Barcelona. bike easily if the number of bikes are not enough, or Advantages include: bikes were parked in a remote area. As you can see, 1. High convenience, can return bike in although station-less mode is convenient to user who anywhere. wants to return bikes, but it might also bring 2. Solve the problem of no place to park. inconvenience to next user who wants to rent bikes. 3. Easy to register and rent in apps through the In Vehicle scheduling problem, because station-less mobile phone. mode doesn’t have bike stations to limit the range of 4. Saving the land cost and equipment cost for riding distance, users can ride bikes to anywhere they building stations. want. It’s possible that bikes will be parked in some Disadvantages include: remote and low renting rate area, so this will lead to 1. Hard to manage, high cost in vehicle vehicle scheduling problem, how to reduce the cost of scheduling. vehicle scheduling will be an important issue. 2. The quality of the bike will be uneven if bikes In Bike quality problem, because the current bike were providing by public. sharing companies offer their own bikes and make 3. People might hold or hide the bike for his/her bikes by themselves, the quality of the bikes is own purpose. consistent. But if we want to implement the concept of 4. If the number of bicycles are not enough, it sharing economy by using public’s bikes as rental will hard to find a bike. tools, then it will be a problem when we are facing different types, different age or different condition of We can see from the above comparison that fixed bikes. Therefore, how to design the rental process and stations mode and station-less mode have relatively formulate a fair charge method will be a big challenge advantages and disadvantages, and the reason that for operators. caused station-less mode’s problems were often came To fix those four problems, this paper brings forward from human nature. Station-less mode solves fixed an idea which combines Blockchain technology and stations mode’s parking problem, but cause another Smart Contract, hoping it will become an useful illegal parking problem. Although station-less mode solution by applying this system. makes users more convenient in bike returning, but it Smart Contract Bike Sharing System is applied in also brings inconvenience to next user if the bike was station-less mode, the idea is allowing users to provide parked too far, reduce the chance of bicycle rental. In their own bike, and make a customized smart contract addition to cause the cost of vehicle scheduling through Ethereum platform. After signing a contract, problems, it may also violate the purpose of sharing bike’s using permission will shift from lender to economy. Therefore, combined with these two mode borrower, completing the rental service and achieving characteristics, we can sum up some several dilemmas the real concept of bike sharing economy. which are current bike sharing economy has Anyone can put on his/her own bike and lending to encountered: others by using smart contract, or renting from others.  How to solve illegal parking problem, and Users can formulate different rules or conditions, like stop others inappropriate behavior such as rent amount and limit of rental time, or other damage the bike. regulations.  How to solve the problem of can’t find a bike This type of bike rental service is different from base on station-less mode. current operating mode, because source of bikes will  How to prevent user parking too far and be offer by public instead of providing by bike

Appling Block-Chain for Bike Sharing Smart Contract

43 International Journal of Advances in Electronics and Computer Science, ISSN(p): 2394-2835 Volume-6, Issue-5, May-2019 http://iraj.in companies or operators. Besides that, the object who users don’t have to worry about their bikes will hard to we rent from are now no longer company or enterprise, find back, and it also solve the vehicle scheduling but from public, becoming a peer to peer rental mode. problem because bikes will only being rented in Figure 1 shows the concept of Smart Contract Bike specific range, make sure it has enough bikes in this Sharing System. area, reduce the cost of transporting bikes. Figure 2 shows the functions of Smart Contract Bike Sharing System.

Figure 2: functions of Smart Contract Bike Sharing System

Combine with features and functions in last section,

Figure 1: Concept of Smart Contract Bike Sharing System there are three main services in Smart Contract Bike Sharing System, including register bike, rent bike and Smart Contract Bike Sharing System has designed return bike. four main functions corresponds to those four problems and will implement these functions on smart Register bike contract, showing this innovative way conceptually. This service is to let users who are willing to provide Four main functions contain deposit, membership their bikes to others, can register bikes information at point, mark the condition of bikes and limit the riding smart contract. It can record bikes ID, brand of bikes, range. bikes owner or age of bikes, and public in contract so  Deposit: other user who wants to rent this bike can get this info. Deposit is a basic common method in bike sharing, It can also formulate charging fee like deposit and rent, which is also important in Smart Contract Bike limit the riding range or others restriction. That is to Sharing System. Lender can get compensation through say, everything about bikes info and details in rental the deposit when the bike was damage or being stolen contract content have to fully presented in this service. by borrower. This function solves part of the user Figure 3 shows the concept of register bike service. violation problem.  Membership point: The mechanism of membership point can be seen on Mobike and oBike, the purpose of membership point is to administrate users, avoid making violations such as bad behavior while renting, or give incentives, encouraging users to supervise each other. This function solves part of the user violation problem.  Mark the condition of bikes: Because the sources of bikes are providing by public’s own bikes, bikes type will be diverse, the quality of bikes will be inconsistent. By using Smart Contract Bike Sharing System, users can individually formulate bike’s deposit and rent to their bikes through smart contract, and records the condition of bikes or number Figure 3: concept of register bike service of rents in blockchain. By doing this, Lender and borrower can take what they need, set the price base Rent bike on their bikes condition, people who wants to rent a After both lender and borrower confirming the comfortable new bike won’t accidentally rent an old contract content, reach an agreement and sign the bike, and people who doesn’t care about whether the contract, service of rent bike begins. In this step, bike is new or old can find a bike which price is lender and borrower have to check bike condition, reasonable to rent. inspect is there any broken in the bike. After checking  Limit the riding range bike, borrower will pay deposit which lender By using smart contract, users can formulate bikes formulate in contract in advance. Smart contract will available ride distance, and limit the range of rent. check its own status, when nodes in blockchain verify This function avoid bikes being rented too far away, so the payment of deposit and get consensus, bike's using

Appling Block-Chain for Bike Sharing Smart Contract

44 International Journal of Advances in Electronics and Computer Science, ISSN(p): 2394-2835 Volume-6, Issue-5, May-2019 http://iraj.in permission shift from lender to borrower, bike unlock IV. IMPLEMENTATION AND DISCUSSIONS and ready for ride. The deposit is just temporarily hold by smart contract, won’t directly transfer to lender. For In this section, we will implement and discuss about safety reasons, during this period, lender can’t the contract content and its functions in Smart intervene bike's using permission unless borrower Contract Bike Sharing System, the main framework is violate contract rules. Figure 4 shows the concept of divided into three parts- Bike registration function, rent bike service. Initialize contract and Contract main functions. The bike registration function will record in program codes for now, and hoping it can present by mobile APP interface in the future. Initialize contract and Contract main functions will use Ethereum Wallet to show the contract content. Figure 7 shows the framework of Smart Contract Bike Sharing System.

Figure 4: concept of rent bike service

Return bike

In step of return bike, when the borrower finishes Figure 7: The framework of Smart Contract Bike Sharing riding, smart contract will check its status again. After System borrower return the bike, smart contract will lock the bike and shift bike's using permission back to lender, Bike registration function calculating the rental cost then transfer the rent to The purpose of bike registration function is let users lender account. The deposit will refund to borrower register their bikes, and provide rental service to other through smart contract after next borrower confirm the users, this also makes borrowers clear about what bike bike is good, complete the performance of the contract they are going to rent. Bike info contains bike ID, bike and the rental service. Figure 5 shows the concept of owner, age of bike, deposit, rent pricing method and return bike service. riding range or other conditions. Figure 8 shows Bike registration function.

Figure 5: concept of return bike service

When next borrower finds problems such as bike lost or been damaged while he/she checking the bike, lender will be notify by this person and get deposit compensation from previous borrower through smart contract, smart contract will also send message to previous borrower. Figure 6 shows the concept of deposit compensation service.

Figure 8: Bike registration function

Initialize contract Before writing the contract functions, we have to declare the version of solidity we're going to use. In this contract, bikeRenting is the contract name, then we set some variable and declare status, including owner, currentRenter, expireTime and unitPrice.

Figure 6: concept of deposit compensation service Figure 9 shows Initialize contract.

Appling Block-Chain for Bike Sharing Smart Contract

45 International Journal of Advances in Electronics and Computer Science, ISSN(p): 2394-2835 Volume-6, Issue-5, May-2019 http://iraj.in is also want to rent this bike, if it’s true, then run function rent. Figure 11 shows function rent.

Figure 9: Initialize contract Figure 11: function rent

Contract main functions The reason why it need function inUse to let the next Contract main functions can be divided into three parts, user confirm the bike's rental status is because the one is rent, another is inUse, the other is rentingFee. smart contract isn’t really smart enough to Function rent is to check rental conditions, function automatically do everything, it relies on outside to inUse is to check rental status, function rentingFee is trigger the contract and run functions. User who run to collect rent. inUse function has priority for rental services, because  function rent he/she pay the cost to check bike's rental status. In function rent, the smart contract will check the value of currentRenter whether it is 0x0 or not, which  Function rentingFee stands for nobody is renting this bike at present. When In function rentingFee, the smart contract will check it is determined that it has not been rented, smart whether the initiator of this transaction function is contract will check the value of unitPrice whether it is owner, if it’s true, then transfer borrower’s rent to more than 1 unit, which means the borrower has paid owner account, make sure only owner can access this enough money. At last, the smart contract will set fee. Figure 12 shows function rentingFee. rental time, leave the value of the due date plus rentable time, and change the value of currentRenter to the borrower, also record the borrower, time of current block and the amount of the transaction. Figure 10 shows function rent.

Figure 13: function rentingFee

Execution contract After deploying contract, we can watch this contract at CONTRACTS page in ethereum wallet. Left side of the screen is contract status, right side of the screen can pick functions you want to perform, including Rent, In Use and Renting Fee. Figure 13 shows the page info of bike Renting contract.

Figure 10: function rent

 function inUse In function inUse, the smart contract will check again if bike is renting at present, if the value of expireTime greater than the value of now, means expiration time is in the future, which shows the bike is in lease period, otherwise it is available for rent. In this case, the value of currentRenter will be 0x0, and the smart contract will check whether the person who calls this function Figure 13: the page info of bike Renting

Appling Block-Chain for Bike Sharing Smart Contract

46 International Journal of Advances in Electronics and Computer Science, ISSN(p): 2394-2835 Volume-6, Issue-5, May-2019 http://iraj.in When execute Rent function, “Execute from” stands V. CONCLUSIONS for borrower’s wallet address, because borrower might have more than one wallet account, borrower can Combining with station-less bike rental service, Smart choose which account he/she wants to transfer. “Send” Contract Bike Sharing System create an innovative stands for the amount of transfer, which is rental time, bike rental process through smart contract, offer an the higher the amount, the longer the rental time. opportunity and way to achieve the real bike sharing Figure 14 shows execute Rent function. economy. It tries to solve some critical problems including user violation problem, bike rental problem, vehicle scheduling problem and bike quality problem. By using smart contract, user can provide their own bike which may rarely use in daily life to others who wants to rent bike, this method is more conform to the concept of sharing economy than traditional bike rental services or station-less bicycle-sharing system, because this approach is no longer limited to the use of central operators or large enterprises to provide bike rental services, but each participant in the service is regarded as an operator, so that the general public have the opportunity to get substantial profit.

Figure 14: execute Rent function Besides, the advantage of this rental mode is the operator doesn’t need to consider too many bicycle When execute In Use function, first it can choose costs and operational management issues, it only whether or not to rent, then choose a wallet account to needs to construct IT platform and matchmaking with rent from “Execute from”, at last, enter the rent users, this also allows current business operators who amount. The purpose of In Use function is to let user are willing to use Smart Contract Bike Sharing System knows bike’s current using condition, helping trigger for bike rental service, can significantly reduce the smart contract to verify contract status, and let user cost of hardware and management maintenance issues. who run this function has priority for rental services. Figure 15 shows execute In Use function. REFERENCES

[1] Philipp Aeschbach, Xiaojing Zhang, Angelos Georghiou, "Balancing bike sharing systems through customer cooperation - a case study on London's Barclays Cycle Hire," Decision and Control (CDC), 2015 IEEE 54th Annual Conference. [2] Lian Yu, Wei-Tek Tsai, Guannan Li, Yafe Yao, Chenjian Hu, Enyan Deng, "Smart-Contract Execution with Concurrent Block Building," Service-Oriented System Engineering (SOSE), 2017 IEEE Symposium. [3] Konstantinos Christidis, Michael Devetsikiotis, "Blockchains and Smart Contracts for the Internet of Things," IEEE Access(Volume: 4). [4] Hiroki Watanabe, Shigeru Fujimura, Atsushi Nakadaira, Yasuhiko Miyazaki, Akihito Akutsu, Jay Kishigami, Figure 15: execute In Use function "Blockchain contract: Securing a blockchain applied to smart contracts," Consumer Electronics (ICCE), 2016 IEEE When execute Renting Fee function, “Execute from” International Conference. stands for lender’s deposits wallet account, and [5] Loi Luu, Duc-Hiep Chu, Hrishi Olickel, Prateek Saxena, Aquinas Hobor, "Making Smart Contracts Smarter," 2016 “Send” stands for how much money to deposit. Figure ACM SIGSAC Conference on Computer and Communications 16 shows execute Renting Fee function. Security. [6] Andreas Bogner, Mathieu Chanson, Arne Meeuw, "A Decentralised Sharing App running a Smart Contract on the Ethereum Blockchain," 6th International Conference on the Internet of Things.



Figure 16: execute Renting Fee function

Appling Block-Chain for Bike Sharing Smart Contract

47