<<

Article Crypto Hash Algorithm-Based Technology for Managing Decentralized in Oil and Gas Industry

Lukman Adewale Ajao 1,*, James Agajo 1, Emmanuel Adewale Adedokun 2 and Loveth Karngong 1

1 Department of Computer , Federal University of Technology, Minna 920001, Nigeria 2 Department of Computer Engineering, Ahamadu Bello University, Zaria 810241, Nigeria * Correspondence: [email protected]; Tel.: +234-70-3735-9128

 Received: 16 June 2019; Accepted: 1 August 2019; Published: 8 August 2019 

Abstract: This research work proposes a method for the securing and monitoring of petroleum product distribution records in a decentralized ledger database using blockchain technology. The aim of using this technique is to secure the transaction of distributed ledgers in a database and to protect records from tampering, fraudulent activity, and corruption by the chain participants. The blockchain technology approach offers an efficient security measure and novel advantages, such as in the transaction existence and distribution ledger management between the depot, transporter, and retailing filling station. Others advantages are transparency, immunity to fraud, insusceptibility to tampering, and maintaining record order. The technique adopted for this secure database is crypto hash algorithm-1 (SHA-1)-based public permissioned blockchain and telematics, while this telematics approach is an embedded system integrated into an in-vehicle model for remote tracking of geolocation (using Global Positioning System (GPS)), monitoring, and far-off acquisition in a real-time. The scope of the data in the secure distributed ledger database (using blockchain) developed are identification (ID) of the tanker operator, Depot name, Source station ID, Destination station ID, Petroleum product volume, Transporter ID, and Geographic automobiles location. This system proved to be efficient, secure, and easy to maintain as it does not permit any individual for records tampering, but supports agreement of ~75% of participants in the chain to make changes.

Keywords: blockchain; database; petroleum product; security; telematics

1. Introduction In the last decades, oil and gas (petroleum product) have been sources of revenue, liveliness, and industries for the national economy and its development [1]. Nigeria is recognized as one of the highest ranked petroleum product exporting countries in the Organization of the Petroleum Exporting Countries (OPEC) eleven [2]. However, the distribution process of this product in Nigeria has been a great challenge over the years and generally caused fluctuation in the country’s economy. These challenges are fuel scarcity, oil and gas hijacking, inflation in price, and many others. The disruption in the supply of this inflammable resource in Nigeria has been a habitual problem as its distribution has a multitude of problems. Aminu et al. proposed petroleum products (oil and gas), aside from other occupation practices in the marketing , are generally an imperative source of energy globally, and represent a major part of the economies of most developed nations, including USA, UAE, Saudi Arabia, and so on [3]. One of the reasons for this product scarcity in the nation was due to the transaction’s susceptibility to corruption, fraud, and lack of transparency among the parties

J 2019, 2, 300–325; doi:10.3390/j2030021 www.mdpi.com/journal/j J 2019, 2 301

J 2019, 2, x 2 of 26 involved in the supply chain and distribution process [4]. Fraud, corruption, and mismanagement inmismanagement the distribution in process the distribution is traced back process to the usualis traced application back to ofthe manual usual transaction,application centralizedof manual distributedtransaction, ledgers, centralized and pipelinedistributed network ledgers, distribution and pipeline vandalism network [5 distri]. bution vandalism [5]. AlthoughAlthough the the earlier earlier transaction transaction record record is known is know asn a pictographicas a pictographic tablet tablet (3200 BC)(3200 ledger, BC) ledger, a record a ofrecord transactions of transactions used for keepingused for information keeping informat by anyion business by any organization business organization in the earlier in century the earlier [6,7]. Thecentury later advanced[6,7]. The technology later advanced of keeping technology records in of worksheet keeping isrecords known asin computerizedworksheet is spreadsheet. known as Thiscomputerized digitized ledger spreadsheet. was designed This digitized as a centralized ledger wa ledgers designed that exposes as a centralized its vulnerability ledger to that tampering exposes andits vulnerability susceptibility to to tampering corruption and and susceptibility fraud. Others to issues corruption are central and controlfraud. andOthers mishandling, issues are whichcentral ledcontrol to the and emergence mishandling, of the which crypto-blockchain led to the emergenc technologye of the proposed crypto-blockchain in this research technology for decentralized proposed ledgerin this systemresearch management. for decentralized ledger system management. BlockchainBlockchain isis thethe technologytechnology behindbehind bitcoinbitcoin [[8]8] andand hashas advancedadvanced revolutionaryrevolutionary servicesservices withwith thethe ability ability toto influenceinfluence financialfinancial transactionstransactions andand renderrender advantagesadvantages ofof transparency,transparency, accurateaccurate tracing,tracing, permanentpermanent ledger, ledger, cost cost reduction, reduction, and and record record management management [9 ].[9]. This This blockchain blockchain technology technology provides provides a solutiona solution to the to digitalthe digital confidence confidence of record-keeping of record-keeping and information and information management management with a timestamped, with a transparent,timestamped, and transparent, decentralized and distributed decentralized database distributed block database [10]. block [10]. BlockchainBlockchain isis aa networknetwork ofof databasesdatabases thatthat spreadspread acrossacross multiplemultiple entities,entities, whichwhich areare keptkept inin sequencesequence and and are are not not peculiar peculiar to ato single a single source source of control of control [11,12 ].[11,12]. It gives It access gives toaccess information to information update, butupdate, the historical but the historical data stored data cannotstored cannot be changed be changed or modified or modified without without a broad a broad agreement agreement from from the partakersthe partakers of the of network. the network. This means This means that an that administrator an administrator from a singlefrom a unit single of the unit distributed of the distributed network cannotnetwork be allowedcannot be to tamperallowed or to modify tamper the or stored modify data the held stored on a data blockchain held on without a blockchain agreement without from otheragreement participants from other in the participants network. Some in the of thenetwork. major advantagesSome of the of major blockchain advantages include of distributed, blockchain eincludefficiency, distributed, immutability, efficiency, security, immutability, transparency, security, and resilience transparency, [13]. and resilience [13]. TheThe blockchain blockchain technology technology has has been been widely widely adopted adopted as a security as a security countermeasure countermeasure against against ofInternet Things of (IoT) Things and (IoT) software-defined and software-defined network ne (SDN)twork (SDN) securities securities challenges challenges and cyberattacks and cyberattacks [14]. Detection[14]. Detection of fraudulent of fraudulent rules is proposedrules is byproposed Ferra et by al. forFerra security et al. contest for security and as acontest countermeasure and as a againstcountermeasure man-in-the-middle against man-in-the-middle attack (MITMA) overattack the (MITMA) SDN using over a blockchain the SDN technologyusing a blockchain [15], as illustratedtechnology in [15], Figure as 1illustrated. A lightweight in Figure 1. A lightweight technique cryptography with Open-Flow technique rules with based Open-Flow on the software-definedrules based on the networks software-defined and leveraged networks on blockchain and leveraged technology on blockchain is utilized technology to achieve is utilized accurate to detectionachieve accurate of fraudulent detection attempts of fraudulent in the attempts system. in The theresult system. of The the result BLOOSTER of the BLOOSTER system proposed system demonstratesproposed demonstrates adequate adequate detection detection of tampering of tamp andering fraudulent and fraudulent within within short detectionshort detection time ratetime ofrate 100%. of 100%. The The blockchain blockchain technology technology demonstrates demonstrates the the possibility possibility and and improvement improvement (including(including immutability,immutability, security, security, and and transparency) transparency) over over the the traditional traditional centralized centralized ledger-based ledger-based database database as inas thein the banking banking industry, industry, national national population population data data management, management, election election voting vo systemting system management, management, and e-businessand e-business transaction. transaction.

(a) (b)

FigureFigure 1.1. ((aa)) ThreatThreat modelmodel inin aa networknetwork andand ((bb)) proposedproposed secured secured blockchain blockchain architecture architecture [ 15[15].].

TheThe authorsauthors contributionscontributions inin thisthis researchresearch areare centeredcentered onon thethe cryptocrypto hashhash blockchain-basedblockchain-based databasedatabase developmentdevelopment for securing the decentralized decentralized ledger ledger of of petroleum petroleum distribution distribution records records and and to tosafeguard safeguard data data transaction transaction regarding regarding oil oil and and gas gas products products within the supplysupply chain;chain; also,also, thethe development of an embedded in-vehicle automated tracking system using a global positioning system (GPS) approach for tracking the movement and geographical location of automobile conveyance, as well as volume level of petroleum product in an automobile is inclusive monitored

J 2019, 2 302 development of an embedded in-vehicle automated tracking system using a global positioning system (GPS) approach for tracking the movement and geographical location of automobile conveyance, as well as volume level of petroleum product in an automobile is inclusive monitored using pairs of ultrasonic sensors in case of leakages, tampering, or other theft activities. The GPS transmission–receiver and its component are integrated and embedded in a strategic location of the automobile conveyance. Consequently, all information acquired is dynamically sent to the crypto-database for update, storage, and safeguarding using a miner algorithm as a distributed ledger principle.

2. Blockchain and Informatics Technology Investigation Kogias et al. discussed a methodical survey of decentralized digital () and its limitations as the first implementation of blockchain technology [16,17]. This work discussed how to enhance the performance of Bitcoin security with consistency through collective signing. It was proposed to achieve a high level of secretive consensus and safeguard in open affiliation. The ByzCoin technique utilizes communication trees to augment transaction commitment and by ensuring safety and liveness against deceitful faults; it also provided near-optimal tolerance for the group of membership. Therefore, optimizing the tree-structured communication of Bitcoin further reduces the latency to less than 30 s, which achieved a throughput greater than Paypal’s performance with an authorization latency of 15–20 s. Although, this technology (ByzCoin) has a limitation of malicious that can hypothetically exclude nodes from the consensus process. A Uniform Commercial Code (UCC) is proposed by Chima and Hill, (2007) to improve on the problems in the petroleum industry. This industry is involved in a global supply chain product that includes local and international transportation, inventory, ordering, import/export, visibility and control, and information technology. In this supply chain, a company is connected to its upstream suppliers and downstream distributors as materials, data, and capital flow through the supply chain [18]. Kshetri (2017) evaluates the roles of blockchain technology and whether it strengthens the Internet of Things security architecture. It underlies the mechanisms associated with the blockchain-based IoT security and how blockchain-based resolutions could be implemented in many facets of the IoT ecosystem [19]. Medical record (MedRec) based on blockchain technology is developed as a prototype for securing electronic health archives and medical research data. This system secures logs and provides easy access to their medical data and treatment diary. Using a blockchain technology approach safeguards some sensitive medical records and information and it renders some security services such as authentication, confidentiality, and accountability [20]. The MedRec technology, thus, facilitates the emergence of data , delivering big data to empower scholars while appealing patients and providers in the choice to release . The utilization and development of radio frequency identification (RFID)-based blockchain technology was studied and the merits and disadvantages of using RFID with blockchain technology in creating an agri-food supply chain traceability system were analyzed by Tian (2016). According to this work, food safety has posed serious challenges on the Nation as a result of traditional agri-food logistics pattern that are no longer matches the demands of the market was described. Therefore, this contest called for the urgent attention in building or developed agri-food supply chain traceability system based blockchain technology. This system can enhance the traceability with trusted information in the entire agri-food supply chain with a consistent guarantee of food safety by gathering, transferring, and allocating reliable data of agri-food to the various production, processing, warehousing, disbursement, and marketing links [21]. Telematics as a French ellipsis (telecommunication and informatics) is utilized as a wireless network technology and communication technique for location tracking, monitoring, and surveillance [22,23]. All the information acquired through this telematics system is remotely transmitted to the crypto hash decentralized database and is dynamically updated with permission of ~75% of the participants J 2019, 2 303

in the chain agreement for any alteration. García et al. developed a service-oriented universal J 2019, 2, x 4 of 25 computingJ 2019, model2, x based on decentralized systems for public road transport monitoring. This system is4 of 25 J 2019, 2, x 4 of 25 highwayan intelligence-based, safety, transportation service-oriented system management, utility developed provide to improve real-time highway information safety, to transportationtravelers, and systemhighway management, safety, provide transportation real-time system information management, to travelers, provide and managereal-time information information about to travelers, public and managehighway information safety, transportation about public system transport management, systems [24]. provide real-time information to travelers, and transportmanage systems information [24]. about public transport systems [24]. manageAn autonomous information aboutvehicle public in real-time transport implementationsystems [24]. is developed for monitoring path- An autonomousAn autonomous vehicle invehicle real-time in implementationreal-time implementation is developed is for developed monitoring for path-following monitoring path- followingAn ofautonomous the vehicle vehicle using inspatial real-time dual implementationglobal positioning is developedsatellite (SDGPS). for monitoring The system path- of thefollowing vehicle using of the spatial vehicle dual using global spatial positioning dual satelliteglobal positioning (SDGPS). The satellite system (SDGPS). performance The issystem performancefollowing ofis satisfyingthe vehicle the using trajectory spatial tracking dual globalnecessities. positioning The block satellite diagram (SDGPS). for this Theproposed system satisfyingperformance the trajectory is satisfying tracking necessities.the trajectory The tracking block diagram necessities. for this The proposed block diagram method usingfor this spatial proposed methodperformance using spatialis satisfying dual GPSthe trajectoryis illustrated tracking [25], andnecessities. the model The in block the designdiagram is forexpressed this proposed as in dual GPSmethod is illustrated using spatial [25], and dual the GPS model is inillustrated the design [25], is expressed and the model as in Equation in the design (1) using is aexpressed standard as in Equationmethod (1) using using spatial a standard dual GPSbicycle is illustratedmodel [26,27]. [25], A and road the safety model notice in theand design driver isassistance expressed smart as in bicycleEquation model [ 26(1),27 using]. A a road standard safety bicycle notice model and driver [26,27]. assistance A road safety smart notice system and based driver on telematicsassistance smart systemEquation based (1) on using telematics a standard approach bicycle and model -o [26,27].riented A road system safety is noticedeveloped and driver to provide assistance real-time smart approachsystem and based server-oriented on telematics system approach is developed and server-o to provideriented real-time system information is developed assistance to provide to thereal-time informationsystem based assistance on telematics to the drivapproacher, speed and safety server-o information,riented system and datais developed about roads to provide with obstacles, real-time driver,information speed safety assistance information, to the and driv dataer, speed about safety roads information, with obstacles, and rainfall,data about or snowroads [with28]. Theobstacles, rainfall,information or snow assistance [28]. The to algorithm the driver, and speed model safety for information, these proposed and objectives data about are roads divided with into obstacles, two algorithmrainfall, and or model snow for[28]. these The proposedalgorithm objectivesand model are for divided these proposed into two objectives parts: ahighway-tra are divided ffiintoc two parts:rainfall, a highway-traffic or snow [28]. parameterThe algorithm framework and model and foroadr these surface proposed data model objectives for monitoring are divided speed into twovj parameterparts: framework a highway-traffic and road parameter surface data framework model for and monitoring road surface speed datavj modeland distance for monitoring at time t onspeed vj andparts: distance a highway-traffic at time t on the parameter road section framework j as expressed and road in Equationsurface data (2). model for monitoring speed vj the roadand section distance j as at expressed time t on inthe Equation road section (2). j as expressed in Equation (2). and distance at time t on the road section∝∝ j as expressed∝∝ in Equation∝ (2). ὑ − ∝−∝ ∝ѵ∝ ∝ ὑ − − ѵ = ∝ ∝ ∝ ∝ + ∝𝛿 (1) ὑ ∝ ѵ 𝑓 =− ∝ −∝ ∝ +∝ 𝛿 (1) ṙ 𝑓 ∝ ∝ ∝𝑟∝ ∝ =ṙ +𝑟 𝛿 (1)(1) 𝑓∝∝∝∝ ∝ ṙ 𝑟 where, where, y is the vehicle longitudinal velocity (m/s) where, y is the vehicle longitudinal velocity (m/s) where,r is the yaw rate (%) y r is the is vehicle the yaw longitudinal rate (%) velocity (m/s) 𝛿 y is the vehicle longitudinal velocity (m/s) r 𝛿the is wheelthe yaw steering rate (%) angle of the vehicle (rad) r isthe the wheel yaw rate steering (%) angle of the vehicle (rad) 𝐶∝𝑓𝛿 is thethe wheelfront wheels steering stiffness angle of when the vehicle curve (N/rad) (rad) δ 𝐶∝𝑓 theis the wheel front steering wheels angle stiffness of the vehiclewhen curve (rad) (N/rad) 𝐶 ∝𝑟𝐶∝ 𝑓 is isthe the rear front wheels wheels stiffness stiffness when when curve curve (N/rad) (N/rad) C f 𝐶∝𝑟 isis the the front rear wheels wheels sti stiffnessffness when when curve curve (N/rad) (N/rad) 𝑙 ∝ is the length between CoG to front axle (m) 𝐶∝𝑟C r 𝑙 is theisis therear the rear wheelslength wheels betweenstiffness stiffness CoGwhen when to curve front (N (N/rad)axle/rad) (m) ∝ 𝑙𝑟 𝑙 is isthe the length length between between CoG CoG to to rear front axle axle (m) (m) l f 𝑙𝑟 isis the the length length between between CoG CoG to front to rear axle axle (m) (m) m the mass of vehicle (kg) 𝑙𝑟l r m is theis the thelength mass length between of between vehicle CoG CoG (kg) to to rear rear axle axle (m)(m) 2 𝐼𝑧 m Inertiathe moment mass of around vehicle (kg) the Z-axis (kg/m ) 2 m 𝐼𝑧 the massInertia of momentvehicle (kg) around the Z-axis (kg/m ) 2 I Inertia moment around the Z-axis (kg/m 2) 𝐼𝑧 z Inertia moment around the Z-axis (kg/m )

2·₮ ·𝑣(𝑡) +𝛿·₮ 2. ₮ .𝑣 (𝑡) +𝛿.₮ 𝜇(𝑡) =[₮ + ₮ + ] (2)(2) ( ) [ () ()] (2) 𝜇 𝑡 =[₮ + ₮2.𝑔(+ ₮𝑓 (𝑡.𝑣) +𝜔(𝑡)+𝛿.₮(𝑡)) ][ () ()] 𝑔( 𝑓(𝑡) +𝜔(𝑡)) 𝜇(𝑡) =[₮ + ₮ + ] (2) 𝑔(𝑓 (𝑡) +𝜔(𝑡)) [()()] where, where,where, 𝜇(𝑡) the mean speed at time t on the road section j in (m/s) where,µ𝜇vj (t()𝑡) thethe mean mean speed speed at time at ttime on the t on road the section road jsection in (m/s) j in (m/s) ₮𝜇 (𝑡) is driver perception and response time (s) ₮ theis drivermeanis driver perceptionspeed perception at time and t response andon the response road time (s)section time (s) j in (m/s) 𝛿 the vehicle distance + gap between vehicle ₮ 𝛿δ is thedriverthe vehicle vehicle perception distance distance +andgap response+ between gap between vehicletime (s) vehicle g is the acceleration due to gravity rate, 9.8 (m/s) 𝛿 gg theis thevehicle is the acceleration acceleration distance due + gap to due gravity between to gravity rate, vehicle 9.8 rate, (m/s) 9.8 (m/s) 𝑓(𝑡) the frictional-road parameter at time period t on the road section j g f𝑓j((t)𝑡) is thethethe frictional-road acceleration frictional-road due parameter to parameter gravity at time rate, at period time 9.8 t(m/s)period on the roadt on sectionthe road j section j 𝜔(𝑡() ) the level of road section j link during collection period t (%) 𝑓 𝑡 ω 𝜔j(t()𝑡) thethe frictional-roadthe level level of road of road section parameter section j link duringj atlink time during collection period collection periodt on the t (%)periodroad section t (%) j t is collection time period (s) 𝜔(𝑡)t t theis collectionlevel is collection of road time sectiontime period period (s)j link (s) during collection period t (%) j number of road sections. t j j is numbercollection number ofroad time of road sections. period sections. (s) j number of road sections. 2.1.2.1. Blockchain Blockchain Technology Technology Types Types 2.1. Blockchain Technology Types 2.1.In InBlockchain general, general, Technologyafter after the the emergenceTypes emergence of of Bitcoin Bitcoin te technology,chnology, there there are are three three types types of of blockchain blockchain In general, after the emergence of Bitcoin technology, there are three types of blockchain technologies—public-basedtechnologies—public-based permissioned, permissioned, privat private-basede-based permissioned permissioned and and permissionless, permissionless, or or technologies—public-basedIn general, after the emergence permissioned, of Bitcoin privattechnology,e-based there permissioned are three typesand permissionless,of blockchain or consortiumconsortium or or federated federated blockchain blockchain [29]. [29]. technologies—public-basedconsortium or federated permissioned,blockchain [29]. privat e-based permissioned and permissionless, or 1. consortiumThe public or federatedpermissioned blockchain blockchain [29]. is a transparent and open permissioned-based 1. The1. publicThe public permissioned permissioned blockchain blockchain is a transparent is a transparent and open and permissioned-basedopen permissioned-based Litecoin Litecoin system, which allows anyone to update or review anything at a time required. This technology 1. system,The system,public which permissioned which allows allows anyone blockchainanyone to update to update is or a reviewtran orsparent review anything anythingand at open a time at permissioned-based a required. time required. This technology This Litecoin technology allows anybody to participate in managing the blockchain as public. It is also known as a system,allows which anybody allows toanyone participate to update in managing or review anythingthe blockchain at a time as required.public. It Thisis also technology known as a permissioned blockchain without any centralized authority required for the verification process allowspermissioned anybody to blockchain participate without in managing any centralized the blockchain authority as requiredpublic. Itfor is th alsoe verification known as process a as found in the , Litecoin, and Bitcoin technology [30]. This type of technology allows permissionedas found inblockchain the Ethereum, without Litecoin, any centralized and Bitcoin authority technology required [30]. forThis th typee verification of technology process allows complete node running, easy transaction, review, or audit the blockchain by any participant in as foundcomplete in the node Ethereum, running, Litecoin, easy transaction, and Bitcoin review, technology or audit [30]. the This blockchain type of technology by any participant allows in the Bitcoins/Litecoin (BTC/LTC) chain of blockchain explorer. completethe Bitcoins/Litecoin node running, easy (BTC/LTC) transaction, chain review, of blockchain or audit explorer. the blockchain by any participant in the Bitcoins/Litecoin (BTC/LTC) chain of blockchain explorer.

J 2019, 2 304

allows anybody to participate in managing the blockchain as public. It is also known as a permissioned blockchain without any centralized authority required for the verification process as found in the Ethereum, Litecoin, and Bitcoin technology [30]. This type of technology allows J 2019, 2complete, x node running, easy transaction, review, or audit the blockchain by any participant5 of 26 in the Bitcoins/Litecoin (BTC/LTC) chain of blockchain explorer. 2.2. PrivatePrivate blockchain blockchain is is an an advanced advanced Bitcoin Bitcoin technology technology that that is is managed managed centrally centrally by by an an individual individual oror organization organization for for adequate adequate security. security. This This pe permissioned-basedrmissioned-based blockchain blockchain does does not not allow allow negotiationnegotiation of of the the distributed distributed ne networktwork management management as as found found in in the the BankChain BankChain practices. practices. This This technologytechnology does does not not allow allow anyone anyone to to run run a a fu fullll node node and and start start mining and and does does not not grant grant transactionstransactions access access or or review/audit review/audit by by anyone anyone or or individual individual on on the blockchain. The The private private blockchainblockchain is is a apermissioned-based permissioned-based design design for for central central authority authority and and process process authentication. authentication. 3.3. TheThe Consortium Consortium or or Federated Federated Blockchain Blockchain eliminates eliminates the the sole sole autonomy autonomy in in the the private private blockchain blockchain byby making making suresure there there is moreis more than than one personone person in charge in charge of chain of management. chain management. Different authoritiesDifferent authoritiescome together come to together make decisions to make thatdecisions are good that for are the good network for the such network as a groupsuch as of a companies group of companiesor representatives or representatives of individuals of individuals involved. involved. It is also It known is also as known the hybrid as the blockchain hybrid blockchain because becauseit combines it combines both the both characteristics the characteristics of a public of a blockchainpublic blockchain and the and private the private blockchain. blockchain. The R3 Thecompanies R3 companies (New York(New City, York NY, City, USA) NY, and USA) Energy and Web Energy Foundation Web Foundation (EWF) are (EWF) open source are open and sourcescalable and blockchain scalable blockchain platforms. platforms.

2.2.2.2. Secure Secure Hashing Hashing Algorithm Algorithm (SHA-1) (SHA-1) TheThe most adoptedadopted securesecure algorithms algorithms associated associated with with the the blockchain blockchain technology technology are (SHA-1, are (SHA-1, SHA2, SHA2,and SHA-256) and SHA-256) encryption because because of their of unique their uniq qualityue quality of hash of function hash function that create that unique create unique outputs outputswhen given when di givenfferent different inputs inputs [31,32 ].[31,32]. The hashThe hash function function here here is a is unique a key created created to to identify identify a atransaction transaction that that atat thethe samesame timetime identifiesidentifies anan individualindividual inin thethe petroleumpetroleum supply chain. SHA SHA was was originallyoriginally designed designed by by the the United United States States National National Security Security Agency Agency (NSA) (NSA) and and United United States States Federal Federal InformationInformation Processing Processing Standard. Standard. This This algorithm algorithm is is efficient efficient in in verifying verifying file file and and message message integrity integrity duringduring transaction, transaction, data data identification, identification, and and pass passwordword verification. verification. SHA-1 SHA-1 has hasa message a message size of size <2 of64 bits,<264 512-bitbits, 512-bit block blocksize, 32-bit size, 32-bit word wordsize, and size, 160 and message 160 message digests digests [33]. [ 33]. BlockchainBlockchain technology technology is is a a combination combination of of blocks blocks in in its its architecture. architecture. Each Each block block is is made made up up of of datadata and and the the hash hash of of the the previous previous block, block, except except for for the the origin origin block block that that contains contains no no previous previous hashing hashing asas shown shown in in Figure Figure 22..

Genesis Block Data 132

Hash of Hash Previous Block Hash: 3Z5F Hash: 7AQ2 Hash: W85Y

7AQ2 Previous Hash: 0000 Previous Hash: 3Z5F Previous Hash:

(a) (b)

FigureFigure 2. 2. (a(a) )Hash Hash block block component. component. (b (b) )Blockchain Blockchain network. network.

BlockchainBlockchain technology technology functions functions are are reliable reliable for for use use in in a a hashing hashing crypto crypto method, method, which which helps helps createcreate an an adequate adequate and and strong strong hashing hashing code code and and convert convert it it from from a a bit bit of of fixed fixed size size data data to to strings strings of of character.character. Each Each transaction transaction proposed proposed in in a a blockchain blockchain are are hashed hashed together together before before shoving shoving in in a a block, block, andand the the hash hash pointers pointers connect connect each each block block to to the the next next block block for for holding holding of of previous previous hash hash data data as as it it is is undisputable.undisputable. Therefore, Therefore, any any changes changes in inthe the blockchain blockchain transaction transaction of ofhashing hashing function function will will result result in differentin different hash hash string string of ofcharacter character and and affect affect all all th thee involved involved blocks. blocks. The The efficient efficient practice practice of of this this technologytechnology (crypto-blockchain) (crypto-blockchain) in in the the transaction transaction is is that that any any changes changes propagated propagated by by less less than than 75% 75% of of participants in the chain will result in attack; otherwise, more than 75% from the chain must agree before any alteration. The generation of hash algorithm image using is shown in Figure 3.

J 2019, 2 305 participants in the chain will result in attack; otherwise, more than 75% from the chain must agree before any alteration. The generation of hash algorithm image using avalanche effect is shown in FigureJ 2019, 23, x. 6 of 26

Engr Ajao is from Futminna

Engr Ajao is farm Futminna

Engr Ajao is morf Futminna

Engr Ajao is move Futminna

Figure 3. Crypto hash function. 2.3. Problems Statement 2.3. Problems Statement Most developed and developing countries, including USA, UAE, Saudi Arabia, Iraq, and Nigeria, Most developed and developing countries, including USA, UAE, Saudi Arabia, Iraq, and among other African countries, are majorly dependent and have economies driven by oil and gas Nigeria, among other African countries, are majorly dependent and have economies driven by oil products, serving as the largest means of generating income. The distribution process of these oil and and gas products, serving as the largest means of generating income. The distribution process of these gas products is achieved through the pipeline network from refineries to the depot, to the marketer, oil and gas products is achieved through the pipeline network from refineries to the depot, to the and to the final consumers, which are threatened and vulnerable to different attacks, vandalism, marketer, and to the final consumers, which are threatened and vulnerable to different attacks, and materials expiration (corrosion). However, the road network is another means of conveying vandalism, and materials expiration (corrosion). However, the road network is another means of oil and gas products from one place to another over long distances, which in the past resulted in conveying oil and gas products from one place to another over long distances, which in the past serious hazards (accident), product diversification, automobile hijacking, and leakages [34]. Also, some resulted in serious hazards (accident), product diversification, automobile hijacking, and leakages developing countries, like ours (Nigeria), are still utilizing a centralized ledger or manual methods [34]. Also, some developing countries, like ours (Nigeria), are still utilizing a centralized ledger or for managing the records of oil and gas product distribution across the states, which is susceptible to manual methods for managing the records of oil and gas product distribution across the states, which fraud, record tampering, and solely autonomy. This shortcoming has become a serious challenge to is susceptible to fraud, record tampering, and solely autonomy. This shortcoming has become a the oil and gas industries as well as the governments of the nations. Therefore, this sabotage and threat serious challenge to the oil and gas industries as well as the governments of the nations. Therefore, requires maximum attention of the government and industries collaboration for adequate coordination, this sabotage and threat requires maximum attention of the government and industries collaboration planning, monitoring, and effective control to achieve maximum level of protection and reduces crisis for adequate coordination, planning, monitoring, and effective control to achieve maximum level of of fuel scarcity, hijacking, and many others threats. protection and reduces crisis of fuel scarcity, hijacking, and many others threats. 3. Materials and Methods 3. Materials and Methods The methods adopted in this research are two-fold: the development of secure hash-based blockchainThe methods technology adopted for the in safeguarding this research of are decentralized two-fold: the distributed development ledger of (petroleum secure hash-based products distributionblockchain technology data) using for consolidation the safeguarding of programmingof decentralized languages distributed and ledger an embedded (petroleum in-vehicle products geotrackingdistribution anddata) autoremote using consolidation monitoring systemof prog usingramming telematics languages technique. and an embedded in-vehicle geotrackingThe development and autoremote of a distributed monitoring database system and using web telematics application technique. for the management of petroleum productThe distribution development consists of a ofdistributed My Structured database Query and Language web application (MySQL), Personal for the Home management Page (PHP) of scriptingpetroleum language, product distribution JavaScript, andconsists cryptography of My Structured hashing Query (SHA-1). Language The secure (MySQL), blockchain Personal database Home forPage this (PHP) concept scripting was designed language, using JavaScript, the phpMyAdmin and cryptography graphical user hashing interface, (SHA-1). web application, The secure and publicblockchain permissioned database blockchain-basedfor this concept was hashing designed (SHA-1) using was the implemented phpMyAdmin with graphical PHP scripting user interface, language andweb JavaScript.application, The and design public ofperm permissionedissioned blockchain-based blockchain approach hashin isg (SHA-1) classified was into implemented four basic nodes, with whichPHP scripting are the regulator,language and petroleum JavaScript. depot, The filing design station, of permissioned and transporter blockchain nodes. approach These nodes is classified are the into four basic nodes, which are the regulator, petroleum depot, filing station, and transporter nodes. These nodes are the network members in a decentralized ledger network. The method proposed for crypto hash database functions of the decentralized petroleum products is illustrated in Figure 4. The blockchain nodes (users) and the graphic user interface were created using PHP scripting language, HTML scripting language, CSS scripting language, and JavaScript scripting language.

J 2019, 2 306

network members in a decentralized ledger network. The method proposed for crypto hash database functions of the decentralized petroleum products is illustrated in Figure4. The blockchain nodes (users) and the graphic user interface were created using PHP scripting language, HTML scripting J 2019language,, 2, x CSS scripting language, and JavaScript scripting language. 7 of 26

Start

Access Denied Get Registered First or Call for Help Initialized System No

Access Denied Station Registered Login As? Staff you are not our Manager Staff

Transporter

Can’t perform Yes Transaction, Please No Registered ? call for Help

Yes View Completed and View Transporter Uncompleted Status Initiate Transaction Transaction Status

Input Product Type, Quantity, Destination, Automobile ID and so on

Confirm Transaction Generate Transaction Completed Hash & Add to the Database

Real Data from the Fleet Database

End

FigureFigure 4. 4.A Acrypto-database crypto-database system system flow flow diagram. diagram.

3.1.3.1. Blockchain Blockchain Transactions Transactions Architectu Architecturere for for Petroleum Petroleum Product Product Distribution Distribution AA transaction transaction is is a copycopy ofof transference transference of assetsof asse (digitalts (digital , currency, units units of inventory, of inventory, etc.) between etc.) betweentwo or two more or parties more parties in a chain. in a chain. To carry To carry out aout transaction a transaction in thisin this system, system, a tankera tanker fleet fleet drives drives to tothe the depot depot and and a a transaction transaction is is initiated initiated by by the the depot depot operator operator/administrator./administrator. AfterAfter thethe transactiontransaction is isinitiated, initiated, aa hashhash ofof thethe transactiontransaction isis generatedgenerated usingusing thethe SHA-1SHA-1 hashhash functionfunction (public(public key),key), whichwhich is isgenerated generated based based on on the the previous previous transactions. transactions This. transactionThis transaction detailis detail propagated is propagated to the participants to the participantsin the blockchain in the blockchain with generated with generated hash value hash of that value particular of that particular transaction transaction and it can and be decryptedit can be decryptedusing (private using key). (private The transactionkey). The transaction of oil and gas of productoil and gas architecture product isarchitecture presented inis Figurepresented5, which in Figurecomprises 5, which three comprises major components three major (the components source, third-party (the source, (transaction) third-party and (transaction) agent. and agent. The source (φ) in this contest refers to the refineries/depot, third-party is the automobile conveyance that is not trusted in the chain and is known as a transaction, and the agent/destination (β) refers to the retailers (Filling station or distributor). 1 illustrates the transaction process between the two parties (source A (φ) to different agent or destination B (β ) with many transaction queues in the chain for petroleum distribution using public-permission blockchain.

J 2019, 2 307 J 2019, 2, x 8 of 26

Transaction is represented as Encryption a block & key J 2019A, 2tanker, x is Truck A Hashing 8 of 25 loaded with fuel at depot The block is broadcast to every participant in the networks using Truck B 3 public key Truck C Transaction is represented as Encryption a block & key A tanker is Truck A Hashing loaded with fuel at depot The block is broadcast to every participant in the networks using Truck B J 2019, 2, x public key 8 of 25 J 2019, 2, x Decryption 3 8 of 25 Truck C Key 5 Truck A, B, Transaction is C & D Transaction is All the blocks are added to represented as represented as Encryption All the nodes in the networks Encryptionthe chaina block which & provides Fuel is delivered to a blockA tanker & is Truck A key A tanker is mustTruck approveA the indivisiblekey Hashing & transparent Filling station loadedHashing with fuel loaded with fuel transaction records transactions atDecryption depot The block is broadcast to every The block is broadcast to every at depot participant in the networks using FigureKey 5. BlockchainTruck B transactionparticipant model in the of networks the developed using system. Truck B Figure 5. Blockchain transaction model of3 the developed system.public key Truck C 3 public key 5 Truck A, B, Truck C ϕ C & D The source ( ) in this contestTable refers 1. Transaction toAll the the refineriesblocks activities are added/depot, in the to third-party blockchain.is the automobile conveyance that is not trusted in the chain and is knownthe chain as which a transaction, provides and the agent/destination (β) refers to All the Conveyancenodes in the networks Quantity Transaction Destination AreaFuel is deliveredRelation to between theS/N retailers must (Fillingapprove the station or distributor).indivisible Table1 & illustrates transparent the transaction processFilling station between the two ID (Liter) ID ID A→B transactionsϕ transaction recordsβn parties1 (sourceϏ A ( ) to different44,000 agent or destinationϏ B ( i ) withMinna many (M) transaction queuesϏ => in φ the→M chain Decryption , , for petroleumDecryption distribution using public-permission blockchain. 2 𝜛 Figure 5.33,000 Blockchain Key transactionϖ, model of the Lokojadeveloped (λ) system. ϖ, => φ→λ Key µ 5 3 µ 11,000 ,5 Bida (ϐ) µ, =>Truck φ→ϐ A, B, TableTable 1.1. TransactionTransaction activitiesactivities inin thethe blockchain.blockchain.Truck A, B, C & D 4 Ύ 33,000 Ύ,All the blocks are addedIlorin to C ( &ζ )D µ, => φ→ζ All the blocks are added to 5 ₤ All the nodes in44,000 the networks ₤,the chain which providesOkene (ρ) Fuel is deliveredµ, =>to φ→ρ All the nodes in the networksConveyance the chainQuantity which provides TransactionFuel is deliveredDestination to Area between must approve the indivisible & transparent Filling station must S/Napprove the indivisible & transparent Filling station ID transactions(Liter) ID transaction records ID A→B transactions transaction records The operation principle of this public-permissionedϏ blockchain used in this designed are divided 1 Ϗ 44,000Figure 5. Blockchain, transaction modelMinna of the developed(M) system. Ϗ,=> φ→M Figure 5. Blockchain transaction model of the developed system. into2 two parts 𝜛which are open33,000 ledger belief andϖ, decentralized Lokoja ledger ( λcoding.) ϖ, => φ→λ 3 µ 11,000 Table 1.µ Transaction activities inBida the blockchain. (ϐ) µ => φ→ϐ 1. Open LedgerTable Belief 1. Transaction (OLB): activitiesThis help in the every blockchain., participant in this network/chain to ,see and aware of 4 Ύ Conveyance33,000 QuantityΎ , Transaction IlorinDestination (ζ) Area µRelation, => between φ→ζ Conveyancetransaction Quantity andS/N its contentTransaction on the chainDestination and Area then validateRelation using between mining (public key). Here are S/N ID (Liter) ₤ ID ρID µ A=>→B →ρ 5ID ₤ (Liter) 44,000ID ID, OkeneA→B ( ) , φ the procedures.1 Ϗ 44,000 Ϗ, Minna (M) Ϗ,=> φ→M 1 Ϗ 44,000 Ϗ, Minna (M) Ϗ,=> φ→M 2 𝜛 33,000 ϖ, Lokoja (λ) ϖ, => φ→λ 2 𝜛i. The Theoperation oil33,000 and principle gas products ϖof, this arepublic-permissioned transportedLokoja (λ) between blockchainϖ points, => φ usedA→λ and in Bthis through designed the are third-party divided The operation principle3 µ of this public-permissioned11,000 µ, blockchain usedBida (ϐ in) this designedµ, => are φ→ϐ divided 3 µ 11,000 µ, Bida (ϐ) µ, => φ→ϐ into two (automobileparts which4 areconveyance). openΎ ledger belief33,000 and decentralizedΎ, ledgerIlorin coding. (ζ) µ, => φ→ζ 4 intoΎ two parts which33,000 are openΎ ledger, belief andIlorin decentralized(ζ) µ, ledger=> φ→ζ coding. 5 ₤ 44,000 ₤ Okene (ρ) µ => φ→ρ ₤ , , (Ϗ ) 5 1. ₤ii. Open The Ledger third-party44,000 Belief (OLB): (automobile, This help conveyance) everyOkene participant(ρ) is notµ in, thistrusted=> network/chain φ→ρ with 44,000 to see L and ,aware ofof 1. Opentransaction Ledger Belief Thefrom operation (OLB): point This principle A helpto ofpoint everythis public-permissioned B. participant The transaction in thisblockchain networkrelation used/ chaininbetween this designed to see two and are parties divided aware ofis The operationtransaction principle of and this public-permissionedits content on the blockchain chain and used then in this validate designed using are divided mining (public key). Here are transactionexpressed andinto as two its Ϗ contentparts which=> onφ →𝑀are the open chain and ledger attached and belief then and with validate decentralized link. using ledger mining coding. (public key). Here are into two parts whichthe procedures. are open ledger belief, and decentralized ledger coding. iii.the procedures. All transactions1. Open Ledger in the Belief chain (OLB): are This validated help every participant using a in public this network/chain key for toevery see and participant aware of 1. Open Ledger Belief (OLB): This help every participant in this network/chain to see and aware of i. agreement The oil and intransaction gas the products network. and its are content transported on the chain between and then points validate A using and mining B through (public the key). third-party Here are transaction and its content on the chain and then validate using mining (public key). Here are i. (automobileThe oil andthe co gasprocedures.nveyance). products are transported between points A and B through the third-party the 2.procedures. Decentralized ledger coding (DLC): This database helps govern the transaction in the ii. The(automobile third-partyi. conveyance). The (automobile oil and gas productsconveyance) are transported is not trusted between with points 44,000 A and L B(Ϗ through,) theof third-partytransaction i. The oil and gas products are transported between points A and B through the third-party chain/networkfrom point with A (automobiletoconsensus point B. co agreementnveyance).The transaction on the relation record betweenupdates twowithout parties central is expressed authority as or (automobile conveyance). third-partyϏ negotiation.ii.→𝑀 The third-party It has timestamp (automobile with conv eyance)unique is credentialsnot trusted with signature 44,000 L (Ϗ which,) ofmakes transaction all the ii. The ii.third-party,The (automobile third-party=> φ conveyance) and (automobile attached is withnot conveyance) trusted link. with is not44,000 trusted L (Ϗ with) of of transaction from point A to point B. The transaction relation, between two parties is expressed as transactiontransactioniii. Allfromfrom transactions point history point A to A inpoint to inthe point B.the chain The B.chain transaction Theimmutable. are transaction validated relation Th esebetween relation usingprocedures two betweena publicparties are is two key involved partiesfor every in is the expressed participant operation as Ϗ,=> φ→𝑀 and attached with link. expressedprinciple asagreement Ϗ, of DLC.=> φ→𝑀 in the and network. attached with link. iii. Alland transactions attached within the link. chain are validated using a public key for every participant iii. All transactions in the chain are validated using a public key for every participant agreement in the network. 2.agreement Decentralized in the network. ledger coding (DLC): This database helps govern the transaction in the 2. Decentralized ledger coding (DLC): This database helps govern the transaction in the 2. Decentralizedchain/network ledger coding with (DLC): consensus This database agreement helps governon the the record transaction updates in thewithout central authority or chain/network with consensus agreement on the record updates without central authority or chain/networkthird-party with consensus negotiation. agreement It hason the timestamp record updates with without unique central credentials authority signature or which makes all the third-party negotiation. It has timestamp with unique credentials signature which makes all the third-partytransaction negotiation. It history has timestamp in the with chain unique immutable. credentials signature These procedureswhich makes allare the involved in the operation transaction history in the chain immutable. These procedures are involved in the operation transaction history in the chain immutable. These procedures are involved in the operation principle of DLC.principle of DLC. principle of DLC.

J 2019, 2 308

iii. All transactions in the chain are validated using a public key for every participant agreement in the network. 2. Decentralized ledger coding (DLC): This database helps govern the transaction in the chain/network with consensus agreement on the record updates without central authority

or third-party negotiation.J 2019,It 2, hasx timestamp with unique credentials signature which makes all 9 of 25 the transaction history in the chain immutable. These procedures are involved in the operation principle of DLC. i. Broadcasting and publishing a copy of transaction to the network as follows, 𝜛, => J 2019, 2, x 9 of 26 φ→𝜆, µ, =>

i. Broadcasting and publishing a copy of transaction to the network as follows, $33,000 => i. Broadcasting and publishing a copy of transaction to the network as follows, 𝜛, => φ→𝜆ϕ , µλ, µ => =φ>→ϐ,ϕφ →ϐ,µ , µ,=>=> =φ> →𝜁,µφϕ→𝜁,µζ,, µ =>=> =φ→𝜌> ϕ.. ρ. → ,11,000 → ,44,000 →,12,000 → ii.ii. SynchronizeSynchronize the the copy copy toii. toensure ensure Synchronize that that transaction transaction the copy to gets ensure gets to to allthat all participants transaction participants gets in in the to the all chain/network. chain participants/network. in the chain/network. iii. Use a mining algorithm to validate the transaction by computing random hash number iii.iii. UseUse a mining a mining algorithm algorithm to to validate validate the the transaction transaction by by computing computing random random hash hash number generation as a special key used by every participant in the network. generationgeneration as asa special a special key key used used by byevery every participant participant in inthe the network. network. Furthermore, the use of this technology (blockchain) assists in securing the transaction of records Furthermore, the use of this technology (blockchain) assists in securing the transaction of records Furthermore, the use of(distributed this technology ledger(blockchain) database), avoi assistsding record in securing tampering the by transaction sole autonomy of records or fraudulent participant, (distributed ledger database),making avoiding immutable record tampering(difficult for by an sole individual autonomy participant or fraudulent to tamper participant, or modify), and rendering (distributed ledger database), avoiding record tampering by sole autonomy or fraudulent participant, making immutable (difficultsecurity. for an The individual transaction participant block diagram to oftamper blockchain or technologymodify), and is illustrated rendering in Figure 6. making immutable (difficult for an individual participant to tamper or modify), and rendering security. security. The transaction block diagram of blockchain technology is illustrated in Figure 6. The transaction block diagram of blockchain technology is illustrated in Figure6.

REQUEST A transaction is COMPLETION PROCESS required for REQUEST The transaction is completed Link message and stored on a public ledger A transaction is COMPLETION PROCESS required for The blockchain technology use to The transaction is completed Link secure the transactionmessage of products and stored on a public ledger ledger records in a distributed ledger database, to avoid record TRANSACTION The blockchain technology use to BL OCK ATTA CHME NT tampering by solely autonomy or This is broadcasted secure the transaction of products The new block is attached to fraudulent participant and make and published to the the existing blocks in the chain ledger records in a distributedIt Immutable for an individual chain participant ledger database, to avoid record TRANSACTION which is immutable participant and render security. awareness BL OCK ATTA CHME NT tampering by solely autonomy or This is broadcasted The new block is attached to fraudulent participant and make and published to the the existing blocks in the chain It Immutable for an individual chain participant which is immutable participant and render security. awareness

BLOCK VALIDATION All the transactions in the The participant in the chain chain are combined to create validates the transaction with block miner algorithm (cryptocurreccy) BLOCK VALIDATION Figure 6. Transaction blockAll diagram the transactions in blockchain. in the The participant in the chain chain are combined to create validates the transaction with block 3.2. Cryptominer algorithmHash Algorithm (cryptocurreccy) Functions

In this research, SHA-1 was used to implement the permissioned blockchain for securing the Figuredecentralized 6. TransactionTransaction database block of diagram distribution in blockchain. petroleum products. In cryptography, the Secure Hash Algorithm is a cryptographic hash function that takes an input and produces a 160-bit (20-byte) hash 3.2. Crypto Hash Algorithm Functions value known as a Message Digest (MD), which is rendered as hexadecimal number of 40 digits long (Cryptotrack and cryptotrack). The crypto-blockchain block architecture and secure hash algorithm In this research, SHA-1 was used to implement the permissioned blockchain for securing the In this research, SHA-1are was outlined. used to implement the permissioned blockchain for securing the decentralized databasedatabase of of distribution distribution petroleum petroleum products. prod Inucts. cryptography, In cryptography the Secure, the Hash Secure Algorithm Hash Cryptotrack: 6BD736F1C2DC0B566812B92B7C47EBA39BCD5222 Algorithmis a cryptographic is a cryptographic hash function hash that function takes an that input takes and an produces input and a 160-bit produces (20-byte) a 160-bit hash (20-byte) value known hash cryptotrack: 5AA13558D0CCA00C53EDD39427392545046DB597 valueas a Message known Digestas a Message (MD), whichDigest is(MD), rendered which as is hexadecimal rendered as numberhexadecimal of 40 number digits long of 40 (Cryptotrack digits long (Cryptotrackand cryptotrack). and Thecryptotrack). crypto-blockchain TheThe crypto-blockchaiprocesses block and architecture implementationn block and architecture of secure this se hashcure and hash algorithm secure algorithm hash are are outlined.algorithm highlighted here. are outlined. 1: Takes input text and splits it into an array of the characters’ ASCII codes. Cryptotrack: 6BD736F1C2DC0B566812B92B7C47EBA39BCD5222 2: Converts ASCII codes to binary. Cryptotrack:cryptotrack: 5AA13558D0CCA00C53EDD39427392545046DB5976BD736F1C2DC0B566812B92B7C47EBA39BCD52223: Pad zeros to the front of each bit until they are 8 bits long. cryptotrack: 5AA13558D0CCA00C53EDD39427392545046DB5974: Join them together and append them to one (1). 5: Pad the binary message with zeros until its length is 512 mod 448. The processes and implementation of this secure hash algorithm are highlighted here.

1: Takes input text and splits it into an array of the characters’ ASCII codes. 2: Converts ASCII codes to binary. 3: Pad zeros to the front of each bit until they are 8 bits long. 4: Join them together and append them to one (1). 5: Pad the binary message with zeros until its length is 512 mod 448. 6: Take binary 8-bit ASCII code array from step 3 and get its length in binary. 7: Pad with zeros until it is 64 characters. 8: Append to your previously created binary message from step 5.

J 2019, 2 309

The processes and implementation of this secure hash algorithm are highlighted here.

1: Takes input text and splits it into an array of the characters’ ASCII codes. 2: Converts ASCII codes to binary. 3: Pad zeros to the front of each bit until they are 8 bits long. 4: Join them together and append them to one (1). 5: Pad the binary message with zeros until its length is 512 mod 448. 6: Take binary 8-bit ASCII code array from step 3 and get its length in binary. 7: Pad with zeros until it is 64 characters. 8: Append to your previously created binary message from step 5. 9: Break the message into an array of chunks of 512 characters. 10: Break each chunk into subarray of sixteen 32-bit words. 11: Loop through each chunk array of sixteen 32-bit words and extend each array to 80 words using bitwise operations. 12: Initialize some variables. 13: Looping through each chunk: bitwise operations and variable reassignment. 14: Convert each of the five resulting variables to hexadecimal. 15: Append them together and the result is your hash value or message digest.

3.3. Crypto Hash Computation (SHA-1) In this type of cryptography hash computation, the modular exponentiation techniques were used [35,36]. This technique (modular exponentiation) computes the remainder of an integer base (b) exponent (e) of nth power, which is divided by a positive integer of modulus (m) as expressed in Equation (3). The crypto hash techniques perform computation randomly in an efficient computable deterministic as given in Equation (4). A given message of “Cryptotrack”, with a minor alteration made during transaction to “cryptotrack”. The proposed secure algorithm will completely generate an output different as expressed here, and the exchange key architecture of crypto hash function is depicted in Figure7. [SHA-1] (“Cryptotrack”) denotes 6BD736F1C2DC0B566812B92B7C47EBA39BCD5222 SHA-1(“cryptotrack”) means 5AA13558D0CCA00C53EDD39427392545046DB597

F(x) = Y (3)

c = bx mod p (4) where, F is SHA-1 function, x is transaction or message and Y is the output generated, c is the public key, b is the key generator, x is the private key parties (i or j, or ij), and p is the prime number. From the SHA-1 network, A, B, C, D, and E are 32 bits length; F is a nonlinear iteration function that varies when interchanged; Wt is the message word expanded for round t; Kt is the constant round of t,  32 representing an (xor) additional modulo 2 ; and <<

H m = H m (5) { 1} { 2}

Mt+1 = Ht+1 = h(Ht, Mt+1) (6)

Ht+1 = E(Ht, Mt+1)  Ht (7) J 2019, 2 310

The expansion of the message block Mt is split into 32 bits of 16 words {W0,W1,W2, ... ,W15} as expressed in Equation (8), the transformation of message input is divided into 32 bits of five words (A0,B0,C0,D0, and ) as given in Equation (9), and the feed forward of input key message Mt+1 32 is the sums modulo of 2 that are concatenated to form the variable chaining Ht+1 as expressed in Equation (10). The copies of each shift rotated message are given in Equation (10).

Wi = (Wi 16 Wi 14 Wi 8 Wi 3) < 1 f or 16 i 79 (8) − ⊕ − ⊕ − ⊕ −  ≤ ≤    Ai+1 = (Ai 5) + fi(Bi, Ci, Di) + Ei + Ki + Wi,      Bi+1 = Ai,    Step :=  C = B 2,  (9) i+1  i+1 i      Di+1 = Ci,     Ei+1 = Di.  JJ 2019,, 2,, xx 11 of 26 Ht+i = (A0 + A80), (B0 + B80), (C0 + C80), (D0 + D80), (E0 + E80) (10)

Ai+1 = (A1 + fi((Ai 1, Ai 2 2, Ai 3 2)) + Ai 4 2 + Ki + Wi (11)(11)(11) 𝐴 =(𝐴≪+ 𝑓 𝐴− ,,𝐴− ≫2, 𝐴− ≫2 + 𝐴− ≫2+ 𝐾 +𝑊 where, EE isisis thethe the blockblock block ,cipher, cipher, Htt isis Hthethet isinputinput the message,message, input message, Mt+1t+1 isis thetheM inputinputt+1 is key,key, the andand input Kii isis key, thethe predeterminedpredetermined and Ki is the constant.predetermined constant.

Figure 7. HashHash function function security and computation [37]. [37].

However, thethe user user authentication authentication nodes nodes permit permit a user aa to useruser register toto registerregister instead ofinsteadinstead storing ofof the storingstoring passwords thethe passwordsas plain text, as and plain subject text, itand through subject a one-wayit through hash a one-way function beforehash function being stored before in abeing database, stored which in a database,will be used which for the will user be authenticationused for the user login authenti password.cation The login user authenticationpassword. The procedure user authentication is depicted procedurein Figure8. is depicted in Figure 8.

User Password Registration Hashed Database

Password Hashes User Login Hashed Match?

Yes No

Login Login Success Failure

Figure 8. UserUser authentication authentication architecture. architecture.

3.4. Mining Algorithm and Pseudocode-Based Blockchain Mining in the framework of blockchain technology is the process of combining new transactions toto thethe publicpublic decentralizeddecentralized ledgerledger databasedatabase ofof thethe previousprevious oror existingexisting transactionstransactions inin thethe blockchainblockchain forfor recordingrecording andand validation.validation. ThisThis processprocess inin thethe chchain is important to set the history of transaction forfor thethe mathematicalmathematical computationcomputation (hashing),(hashing), soso thatthat itit cancan achieveachieve anan immuimmutable,table, tamper-resistanttamper-resistant consensus and secure any single node participant or third-partythird-party inin thethe network.network. Therefore,Therefore, thethe miningmining algorithm refers to the hashing or cryptographiccryptographic hash-functionhash-function thatthat isis usedused forfor authenticationauthentication oror in the chain mechanism. This algorithm is used to map arbitrary data size into an equivalent fixed size of hash. The pseudocode, flowchart, and architecture for the mining algorithm are depicted in Figures 9 and 10.

J 2019, 2 311

3.4. Mining Algorithm and Pseudocode-Based Blockchain Mining in the framework of blockchain technology is the process of combining new transactions to the public decentralized ledger database of the previous or existing transactions in the blockchain for recording and validation. This process in the chain is important to set the history of transaction for the mathematical computation (hashing), so that it can achieve an immutable, tamper-resistant consensus and secure any single node participant or third-party in the network. Therefore, the mining algorithm refers to the hashing or cryptographic hash-function that is used for authentication or digital signature in the chain mechanism. This algorithm is used to map arbitrary data size into an equivalent fixed size of hash. The pseudocode, flowchart, and architecture for the mining algorithm are depicted in Figures9 and 10. From the process of this mining algorithm, if anyone else is added to the transaction list in the chain from step 1 it will change the random number generated, and there is a tendency for the selection criterion to be met in another round as shown in Figure 11. JJ 20192019, 2, x 12 of 1226 of 26

Figure 9. Pseudocode for the mining algorithm. FigureFigure 9. 9. PseudocodePseudocode for the mining mining algorithm. algorithm.

Start Start

Step 1: Retrieve the hash of the previous Step 1: Retrieve the block from the network hash of the previous block from the network

Step 2: Gather a list of potential Step 3: compile the list of transactions known as a "block". potential transactions known as a ThisStep list2: Gatherof transactions a list of potentialcomes "block".Step This3: listcompile of transactions the list of fromtransactions the peer-to-peer known as abitcoin "block". comespotential from transactions the peer-to-peer known as a networkThis list of transactions comes bitcoin"block". network This list of transactions from the peer-to-peer bitcoin comes from the peer-to-peer network

No Step 4: Calculate the Step 4: If the hash is more hash for a block of No than the currently set potentialStep 4:transactions Calculate the Stepdifficulty 4: If the level?, hash Else is more withhash a random for numbera block of than the currently set potential transactions difficulty level?, Else with a random number Yes

Yes Step 5: Mined the block

Step 5: Mined the block

End

FigureFigureEnd 10. 10. MiningMining algorithm algorithm flow flow diagram. diagram.

From the process of this mining algorithm, if anyone else is added to the transaction list in the Figure 10. Mining algorithm flow diagram. chain from step 1 it will change the random number generated, and there is a tendency for the selection criterion to be met in another round as shown in Figure 11. From the process of this mining algorithm, if anyone else is added to the transaction list in the chain from step 1 it will change the random number generated, and there is a tendency for the selection criterion to be met in another round as shown in Figure 11.

J 2019, 2, x 13 of 26

J 2019, 2 312 J 2019, 2, x 13 of 26

J 2019, 2, x 13 of 26 Private Key Blockchain Blockchain Public Key NODE NODE Private Key Transaction Blockchain Blockchain Publicorder Key NODE NODE Private Key Blockchain NODE Blockchain Blockchain Transaction NODE Blockchain NODE orderPublic Key NODE NODE NODE Private Key Blockchain Blockchain Transaction order NODE NODE NODE Public Key BlockchainBlockchain Blockchain Blockchain Private Key NODE NODE NODE NODE Transaction NODE PublicorderPrivate Key Key Blockchain Blockchain NODE NODE TransactionPublic Key Blockchain Blockchain order NODE NODE NODE Transaction NODE order Figure 11. Mining algorithm architecture.

3.5. Cryptographic Algorithm for KeyFigure Management 11. MiningMining in algorithm Blockchain architecture. Technology Figure 11. Mining algorithm architecture. 3.5.The Cryptographic blockchain Algorithm protocol foris assign Key Managementing to a single-message in Blockchain Technology (transaction) as an interactive for the 3.5. Cryptographic Algorithm for Key Management in Blockchain Technology establishment3.5. Cryptographic of key creation/generation, Algorithm for Key Management signing in message Blockchain for Technology randomness of key and verification of The blockchain protocol is assigning to a single-message (transaction) as an interactive for the publicThe key blockchain as illustrated protocol in Figure is assign 12. Theing toalgori a single-messagethm for signature (transaction) is comp utedas an here interactive using digital for the establishmentThe blockchain of key creation protocol/generation, is assigning signingto a single-message message for (transaction) randomness as an of interactive key and verificationfor the signatureestablishment standard of key (DSS) creation/generation, technique based signing on SH messageA-1 [38–40]. for randomnessThe approach of keyfor anddigital verification signature of of publicestablishment key as illustrated of key creation/generation, in Figure 12. The signing algorithm message for for signature randomness is computed of key and hereverification using of digital creationpublicpublic keyand key asverification illustrated as illustrated is in depicted inFigure Figure in12. 12. Figure The The algorialgori 13, thethm algorithm forfor signature signature is outlined, is iscomp computed anduted herecomputation here using using digital for digital the signature standard (DSS) technique based on SHA-1 [38–40]. The approach for digital signature keysignature is signatureexpressed standard standard in Equations (DSS) (DSS) technique (12)technique and based(13). based onon SHA-1 [38–40].[38–40]. The The approach approach for fordigital digital signature signature creation and verification is depicted in Figure 13, the algorithm is outlined, and computation for the creationcreation and andverification verification is depictedis depicted in in Figure Figure 13,13, the algorithmalgorithm is is outlined, outlined, and and computation computation for the for the key is expressed in Equations (12) and (13). key iskey expressed is expressed in Equations in Equations (12) (12) and and (13). (13). Message Message

Message Message Message Message

Private Public Signature Key Key Private Public Create Signature Verify PrivateKey KeyPublic Create Signature Verify Key Key Create Verify

FigureFigure 12. 12. SignatureSignature creation creation and and verification. verification. Figure 12. Signature creation and verification.

M Figure 12. Signature creation and verification. M pqg pqg M M M pqg K K M qq K r r H H s s H(M)H(M) x r x x x H s H(M) (a) (a) x x Figure 13. Cont. (a)

J 2019, 2 313 J 2019, 2, x 14 of 26

pqg

H

M

r s

(b)

FigureFigure 13. 13. ((aa)) Verification Verification public; public; ( (b) Signing message.message.

1. Key generation procedure/Algorithm 1. Key generation procedure/Algorithm Step 1. Signing message Stepi. 1. SigningStart with message shared the global public key values (p, q, g) i.ii. StartSelect with about shared 160-bit the primeglobal number public (q)key values (p, q, g) ii. SelectSelect about a large 160-bit prime prime number number (p) with (q) 2ˆ (L-1) < p < 2ˆl, where L will be equal to iii. Select512 a to large 1024 bitsprime and number is a multiple (p) with of 64 such2^ (L-1) that < q p is < a 160-bit2^l, where prime L divisorwill be of equal p-1 to 512 to 1024 iii. iv. bitsSelect and is h, a then multiple find g= ofhˆ((p-1) 64 such/q) modthat p,q is where a 160-bit 11 iv.Step 2. SelectSelect h, athen private find key g=h^((p-1)/q) and compute mod the publicp, where keys 11 Stepi. 2. SelectSelect a private a random key private and compute key such that:the public x < q keys x i.ii. SelectCompute a random the public private key key such such that: that:y = gx

𝑆=𝐾{ℎ(𝑚) +𝑥𝑟}𝑚𝑜𝑑 𝑞 (12)

𝑍 = {1, 2, … , 𝑝 − 1} (13)

J 2019, 2, x 15 of 26

where, J 2019, 2 314 is prime number where 2 1 xq random prime or pseudorandom divisor of (p 1integer), where with 2159 0< 1 − xused to random generate or random pseudorandom or pseudo integer − random with 0 < integerx < q used with as 0 a

3.6. Implementation of (Telematics) anan In-VehicleIn-Vehicle TrackingTrackingSystem SystemPrototype Prototype The telematicstelematics system was developeddeveloped andand programmedprogrammed inin ArduinoArduino integratedintegrated developmentdevelopment environment (IDE) for monitoring the petroleum volume of automobilesautomobiles using some hardwarehardware components. The telematics method is shown in Figu Figurere 1414.. The The automobile automobile tracking tracking system prototype waswas designed andand integrated intointo thethe oil and gas tankerstankers for monitoring and tracking the geolocation of automobiles. The hardware system consists of GPS, which is capable of transmitting and receiving remote informationinformation through satellitesatellite and computecompute thethe geographicgeographic positionposition (longitude,(longitude, latitude and altitude) for the location-dependent.location-dependent. The ultrasonic sensor (HC-SR04, is a distance measuring sensor that capablecapable ofof providingproviding 22 cm–400cm–400 cmcm measurementmeasurement withwith accuracyaccuracy ofof aboutabout 3mm3mm ranging.ranging. The transmitter,transmitter, receiverreceiver andand controlcontrol circuitcircuit areare embeddedembedded withwith fourfour pinspins connectionconnection namely are power (VCC),(VCC), trigger (Trig), (Trig), Receive Receive (Echo) (Echo) and and ground ground (GND). (GND). It It is is manufactured manufactured by by Hc Hc Sr04 Sr04 company company in inChina. China. (Arduino (Arduino Uno Uno development development board board (ATmega (ATmega 328P, 328P, it is it an is an8-bit 8-bit reduced reduced instructional instructional set setcomputer computer manufactured manufactured by bythe the Microchip Microchip in inPado Padova,va, Italy) Italy) for for system system activities activities control and coordination. A lithium battery of 9v is used for the system powerpower usingusing DC–DCDC–DC converter.converter.

Start

Initialized Liquid Level, Sensor, GSM & GPS Module No

Compute GPS Coordinate & Liquid Level

Is data Transmit the acquired received & data to Admin (Server) Valid? Yes Update the Add data to map blockchain server

Stop

Figure 14. Hardware system flowflow diagram.

J 2019, 2, x 16 of 25

The HC-SR04 ultrasonic sensor has two phases for the transmit (Tx) and receiver (Rx), J 2019, 2 315 which both cover a distance of 4m. Each phase of the sensor uses the distance between itself and the petroleum product surface to calculate the liquid level in a tank as expressed in Equation (14).

(ȕ) ∗ () The HC-SR04 ultrasonic sensor has two phases for the signal transmit𝐷𝑖𝑠𝑡𝑎𝑛𝑐𝑒 (Tx) andɖ ( receiver)= (Rx), (14) which both cover a distance of 4 m. Each phase of the sensor uses the distance between itself and the The time of flight of the HC-SR04 sensor between the levels of the liquid to the receiver is petroleum product surface to calculate the liquid levelcomputed in a tank as as2ɖx. expressed Therefore, inthe Equation speed ( (14).

Speed o f sound (ȕ ) time delay (t) Distance (ã) = ∗ (14) )2 of the wave is expressed as in Equation (15), where changes in distance (ɖx) of the liquid level are calculated in Equations (16) and (17). The time of flight of the HC-SR04 sensor between the levels of the liquid to the receiver is computed2ɖ𝑥 ȕ= (15) as 2ãx. Therefore, the speed ( ) of the wave is expressed as in Equation (15), where changes in distanceɖ𝑡 ã ( x) of the liquid level are calculated in Equations (16) and (17). ȕɖ ɖ𝑥= (16) 2ãx = ȕ(15) ∫ ɖ𝑥= ∫ ɖ𝑡 (17) ãt The speed (u) of sound in air is ~340m/s, the instantaneous distance (dx) between the liquid level ãt ãx = and sensor with respect to time of flight (t) is calculated(16) as in Equation (16), the maximum height of 2tank is H and the volume of the liquid in the tank is v, which are expressed as in Equations (18–20), Z whereZ k is a constant of proportionality. ãx = ãt 340𝑚𝑠 ×(17) ɖ𝑡 𝑥= = 170𝑚/𝑠 (18) 2 2 The speed (u) of sound in air is ~340 m/s, the instantaneous distance (ãx) between the liquid level ɖ𝑙=h−ɖx (19) and sensor with respect to time of flight (t) is calculated as in Equation (16), the maximum height of tank is H and the volume of the liquid in the tank is v, which are expressed as in Equations (18)–(20),ʋ =kɖl (20) where k is a constant of proportionality. 4. Results and Discussion 340ms 1 ãt x = − × = 170m/s (18) 2 4.1. Development of Crypto Hash Decentralized Ledger ãl = h ãxThis section illustrates the implementation of the (19) developed crypto hash decentralized ledger −for managing the transaction of petroleum products distribution. The crypto-system was design for V = kãmanagingl transactions data that occur in oil and (20)gas distribution depot and the data received information from the tanker fleet while in transit to the destination is remotely transferred to the 4. Results and Discussion secure database and updated immediately. Table 2 contains detailed analysis of tracking information sent to the secure database during testing and some other related data. 4.1. Development of Crypto Hash Decentralized Ledger Figure 15 illustrates the results of the developed secure blockchain database for oil and gas distributions: (a) Homepage GUI, it is a login interface for transaction registration. (b) Users This section illustrates the implementation of theregistration developed page, crypto this is the hash registration decentralized page that ledger contained general information concerning third- for managing the transaction of petroleum productsparty distribution. in the transaction. The crypto-system (c) First layer login was interf designace, this is a login form for the transporter. (d) for managing transactions data that occur in oil andAdmin gas distributionsection for user depot confirmation, and the this data contai receivedns details information about new transaction and information from the tanker fleet while in transit to theauthentication. destination is(e) remotely Admin section transferred for managing to the transp secureorter geolocation, this stored a remote tracking information about the transaction for admin monitoring in a real-time. (f) GUI for new transaction database and updated immediately. Table2 contains detaileddetails, this analysis page stored of tracking all the transactio informationn records sent details to include crypto-hash code. the secure database during testing and some other related data. Figure 15 illustrates the results of the developed secure blockchain database for oil and gas distributions: (a) Homepage GUI, it is a login interface for transaction registration. (b) Users registration page, this is the registration page that contained general information concerning third-party in the transaction. (c) First layer login interface, this is a login form for the transporter. (d) Admin section for user confirmation, this contains details information about new transaction and authentication. (e) Admin section for managing transporter geolocation, this stored a remote tracking information about the transaction for admin monitoring in a real-time. (f) GUI for new transaction details, this page stored all the transaction records details include crypto-hash code. J 2019, 2 316 J 2019, 2, x 17 of 26

(a)

(b)

(c)

Figure 15. Cont.

J 2019, 2 317 J 2019, 2, x 18 of 26

(d)

(e)

(f)

FigureFigure 15. 15. Crypto-track blockchain blockchain database database login login interface interface and anddetail detail transaction transaction records. records. (a) (a)Homepage Homepage GUI; GUI; (b) ( bUsers) Users registration registration page; page; (c) First (c) layer First login layer interface; login interface; (d) Admin (d section) Admin for sectionuser forconfirmation; user confirmation; (e) Admin (e) section Admin for section managing for managingtransporter transporter geolocation; geolocation; (f) GUI for new (f) GUItransaction for new transactiondetails. details.

J 2019, 2 318

Table 2. Detailed analysis of tracking information sent to the secure database during testing.

Satellite Liquid Id Tanker_ID Time Date HDOP Speed Latitude Longitude Number Level 1 865210031078669 06:15:44 08/10/2018 5 2.19 66 0.35 9.531407 6.451446 2 865210031078669 06:16:17 08/10/2018 6 1.92 89 0.37 9.531438 6.451479 3 865210031078669 06:16:50 08/10/2018 5 1.98 89 0.59 9.531368 6.451441 4 865210031078669 06:17:23 08/10/2018 6 2.03 89 0.44 9.531471 6.451372 5 865210031078669 06:17:56 08/10/2018 5 1.6 97 1.19 9.531489 6.451346 6 865210031078669 07:55:25 08/10/2018 5 2.56 100 1.2 9.530928 6.451571 7 865210031078669 07:55:58 08/10/2018 4 9.51 100 1.81 9.531051 6.451568 8 865210031078669 07:56:32 08/10/2018 5 2.5 100 1.04 9.530858 6.451453 9 865210031078669 07:57:05 08/10/2018 8 2.5 100 1.5 9.530884 6.45146 10 865210031078669 07:57:38 08/10/2018 6 4.99 100 1.98 9.531068 6.451518 11 865210031078669 07:58:11 08/10/2018 5 4.94 100 2.85 9.530917 6.451497 12 865210031078669 07:58:44 08/10/2018 6 2.48 100 1.87 9.530988 6.45146 13 865210031078669 18:20:29 08/10/2018 9 0.81 48 0.2 9.531387 6.451231 14 865210031078669 18:21:02 08/10/2018 9 0.88 0 0.15 9.531398 6.451261 15 865210031078669 18:21:35 08/10/2018 10 0.82 0 1.11 9.53142 6.451247 16 865210031078669 18:22:08 08/10/2018 10 0.78 0 0.2 9.531483 6.451261 17 865210031078669 18:22:41 08/10/2018 9 0.87 0 0.74 9.531522 6.451264 18 865210031078669 18:23:14 08/10/2018 10 0.87 0 2.63 9.531484 6.451257 19 865210031078669 18:23:47 08/10/2018 10 0.98 0 2.57 9.531505 6.451173 20 865210031078669 18:24:20 08/10/2018 10 0.78 0 0.44 9.531486 6.451322 21 865210031078669 18:24:53 08/10/2018 9 0.85 0 0.61 9.531514 6.451376 22 865210031078669 18:25:26 08/10/2018 9 0.85 0 0.61 9.531542 6.451425 23 865210031078669 18:25:59 08/10/2018 5 1.82 0 14.26 9.531661 6.451532 24 865210031078669 18:26:32 08/10/2018 7 2.88 0 8.72 9.531518 6.451762 25 865210031078669 18:27:06 08/10/2018 0 99.99 0 14.93 9.531453 6.452001 26 865210031078669 18:27:40 08/10/2018 9 1.01 0 4.63 9.531857 6.451674 27 865210031078669 18:28:13 08/10/2018 8 0.9 0 0.24 9.531544 6.451401 28 865210031078669 00:37:47 09/12/2018 9 0.98 0 0.74 9.531361 6.451714 29 865210031078669 00:38:34 09/12/2018 9 0.85 0 0.11 9.531422 6.451569 30 865210031078669 00:39:21 09/12/2018 9 0.88 0 0.06 9.531407 6.451598 31 865210031078669 00:40:08 09/12/2018 9 0.8 0 0.33 9.53139 6.451566 32 865210031078669 00:40:55 09/12/2018 11 0.76 0 0.17 9.531413 6.451585 33 865210031078669 00:41:42 09/12/2018 9 0.99 0 0.48 9.531431 6.45158 34 865210031078669 00:42:29 09/12/2018 10 0.88 0 1 9.531427 6.4516 35 865210031078669 00:43:16 09/12/2018 10 0.92 0 0.63 9.531411 6.45163 36 865210031078669 00:44:03 09/12/2018 9 0.92 0 1.98 9.531393 6.451665

4.2. Encryption and Decryption Algorithm Testing and Results Using WAVE A Waveform Audio File Format (WAVE) is an application of Resource Interchange File Format (RIFF) that stores audio bit streams of signal in “chunks”. This application (WAVE) encodes the sound in Linear Pulse Code Modulation (LPCM). To test for the encryption and decryption processes of the proposed secure hash algorithm-based blockchain technology in the WAVE bitstream format is depicted in Figure 16. The application interface program was developed using C-Sharp, which is capable of converting the data stream into the audio signal wave and performing the encryption and decryption algorithms. The stream of Waveform Audio File Format (WAVE) file was used to encrypt and decrypt the data. MATLAB software (2015a, The MathWorks, Inc., Natick, MA, USA) is used to perform matrix manipulation for the encryption and decryption of sound files into and from image files. This method is known as data compression technique. The novel method uses encryption and decryption in ‘drum.wav’, which is a sound file in image formats such as PNG, TIF, and JPEG. The J 2019, 2 319 sound file is fetched and the values corresponding to the sample range are put in a matrix, which is arranged in a two-dimensional matrix having “double” as the data type. The “imwrite” function of MATLAB is used and defined in the matrix class as double, which inserts a graphic file havingJ 2019, 2, ax dynamic range from 0 to 1. 20 of 26

Figure 16. Graphic user interface of cryptography algorithm.

Encryption algorithm Phase 1: Encryption of algorithm Step 1: Generate the ASCII value of each plaintext. Step 2: Sum the ASCII value of all character. Step 3: Mod the value of 128 for the total number of keys consider as ASCII value. Step 4: Corresponding ASCII value is considered as a key. Step 5: Apply this expression in Equations (8) and (9) to generate cipher text.text. where, E is encryption, PP isis plaintextplaintext andand KK isis key.key.

𝐾=(𝐶 +𝐶 +⋯ 𝐶)%256 (21) K = (C1 + C2 + ... Cn)%256 (21) (22) E𝐸=(= (((P𝑃+𝐾+ K))%256%256)) (22) Step 6: The cipher text value is used to perform the transposition. Step 6: The cipher text value is used to perform the transposition. Phase 2: Encryption of auto key Phase 2: Encryption of auto key Step 7: Use the cipher text value of the substitution method as input of the auto text key Step 7: Use the cipher text value of the substitution method as input of the auto text key Step 8: Here we considered key value as 3. Step 8: Here we considered key value as 3. Step 9: Perform Auto text key to generate the final cipher text. Step 9: Perform Auto text key to generate the final cipher text. Decryption algorithm Decryption algorithm Decryption of wave cipher Decryption of wave cipher Step 1: Perform decryption process using the key value of 3. Step 1: Perform Rail Fence Cipher decryption process using the key value of 3. Step 2: Generate .wav cipher text by substitution. Step 2: Generate .wav cipher text by substitution. Step 3: Perform step2 as input value of the .wav cipher method. Step 3: Perform step2 as input value of the .wav cipher method. Step 4: Here the same encryption key used. Step 4: Here the same encryption key used. Step 5: Use this expression in Equation (10) Step 5: Use this expression in Equation (10) 𝐷=((𝑃−𝐾)%256) (23) D = ((P K)%256) (23) Step 6: Generate the ASCII character of the corre− sponding decimal value as your original text StepIt is interesting 6: Generate to the note ASCII that the character purpose of of the encrypti correspondingon is to distort decimal the value original as yoursignal original as illustrated text fromIt the is interestingbehavior of to notethe graph, that the where purpose more of encryptionnoise is introduced is to distort to the the original system. signal The asresult illustrated of the from(plaintext)t the behavior stream ofcharacter the graph, is converted where more into noisea .wav is audio introduced signal to as the shown system. in Figure The result 17, and of thefor hashing, a noise signal was introduced, which is added to the original plaintext as depicted in Figure 18. After encryption algorithm, the data is retrieved from the image file and compared with the original wave file to show the variation in encrypted string character as shown in Figure 19.

J 2019, 2 320

(plaintext)t stream character is converted into a .wav audio signal as shown in Figure 17, and for hashing, a noise signal was introduced, which is added to the original plaintext as depicted in Figure 18.

AfterJ 2019 encryption, 2, x algorithm, the data is retrieved from the image file and compared with the21 original of 26 waveJ 2019 file, 2, tox show the variation in encrypted string character as shown in Figure 19. 21 of 26

Figure 17. Encipher .wav audio signal. FigureFigure 17. 17.Encipher Encipher .wav.wav audio signal.

FigureFigure 18. 18.Noise Noise audioaudio signalsignal generation for for encoding encoding (). (salt). Figure 18. Noise audio signal generation for encoding (salt).

J 2019, 2, x 22 of 26 J 2019, 2 321 J 2019, 2, x 22 of 26

Figure 19. Encryption .wav audio generation signal. FigureFigure 19. 19.Encryption Encryption .wav audio generation generation signal. signal. 4.3.4.3. TestingTesting andand ResultsResults ofof ImplementedImplementedAutomobile Automobile Based Based Telematics Telematics 4.3. Testing and Results of Implemented Automobile Based Telematics TheThe automobileautomobile trackingtracking system-basedsystem-based telematicstelematics approachapproach forfor thethe petroleumpetroleum distributiondistribution isis The automobile tracking system-based telematics approach for the petroleum distribution is developed,developed, implemented, implemented, and and tested tested within within the Federalthe Federal University University of Technology, of Technology, Minna. Minna. This system This developed, implemented, and tested within the Federal University of Technology, Minna. This issystem configured is configured and connected and connected logically with logically the secure with hashthe secure blockchain hash databaseblockchain for database remote information for remote system is configured and connected logically with the secure hash blockchain database for remote storage.informationinformation The Googlestorage. storage. Maps The The Google resultGoogleof MapsMaps thetelematics-based result ofof thethe telematics-basedtelematics-based automobile trackingautomobile automobile system tracking tracking is illustrated system system is in is Figureillustratedillustrated 20, and in in Figure the Figure results 20, 20, and ofand automobile thethe resultsresults geolocation of automobile tracking geolocationgeolocation based tracking on tracking the longitude based based on on andthe the longitude latitude longitude are evaluatedandand latitude latitude by are comparing are evaluated evaluated the by by actual comparing comparing geolocation the actual results geolocation geolocation with the GPS-basedresults results with with telematics the the GPS-based GPS-based device telematics presentedtelematics indevice Tabledevice presented3 .presented in in Table Table 3. 3.

Figure 20. Google Maps geolocation tracking. FigureFigure 20.20. GoogleGoogle MapsMaps geolocationgeolocation tracking.tracking.

J 2019, 2, x 23 of 26 J 2019, 2 322

Table 3. Performance evaluation of geolocation tracking in FUTMinna.

ActualTable Coordinate 3. Performance Values evaluation of geolocation tracking GPS inCoordinate FUTMinna. Values Latitudinal Longitudinal Latitudinal Longitudinal No of Satellite Location (Address) Actual Coordinate Values GPS Coordinate Values Coordinate Coordinate Coordinate Coordinate Captured Latitudinal Longitudinal Latitudinal Longitudinal No of Satellite Location (Address) ICT Complex 6.451576Coordinate 9.531347Coordinate 6.451829Coordinate Coordinate 9.531222 Captured 4 Engineering Complex 6.449162 9.533510 6.449241 9.533539 8 ICT Complex 6.451576 9.531347 6.451829 9.531222 4 E-examEngineering Center Complex6.449688 6.449162 9.536088 9.533510 6.449667 6.449241 9.536154 9.533539 8 9 ITS CenterE-exam Center 6.452325 6.449688 9.535278 9.536088 6.452507 6.449667 9.535301 9.536154 9 5 Agric ComplexITS Center 6.451862 6.452325 9.533240 9.535278 6.451966 6.452507 9.533134 9.535301 5 7 Senate AgricBuilding Complex 6.452790 6.451862 9.534655 9.533240 6.452748 6.451966 9.527489.533134 7 6 Senate Building 6.452790 9.534655 6.452748 9.52748 6 4.4. Performance Evaluation Testing of the Crypto Hash System 4.4. Performance Evaluation Testing of the Crypto Hash System The crypto hash database system was developed and performance evaluation was carried out in theThe Mozilla crypto web hash developer database tool. system The was system developed performance and performance metrics was evaluation evaluated wasbase carried on the outspeed in theof the Mozilla web webapplication developer developed tool. The which system includes performance file type, metrics size, was time, evaluated and the base transfer on the speed speed as of theillustrated web application in Figure developed 21. The file which transmission includes rate file type,is a function size, time, of andthe type the transfer of file being speed transferred as illustrated in inthe Figure system, 21 .which The file generates transmission the rateresult is agiven function of the of theprimed type ofand file empty being transferredcache. The inempty the system, cache whichscenario generates occurs when the result the givenbrowser ofthe makes primed the andfirst emptyrequest cache. to the The page empty using cache a HTTP scenario request, occurs and when the thePrimed browser cache makes instance the first is when request the to browser the page has using a cached a HTTP version request, of and the the page. Primed In a cache Primed instance Cache is wheninstance, the the browser components has a cached are already version in ofthe the cache, page. thereby In a Primed decreasing Cache the instance, number the of components HTTP requests are alreadyand the weight in the cache, of the therebypage. The decreasing data files theconsider numbered in of this HTTP platform requests are andCSS, the HTML, weight JS, ofXHR the HTTP page. TheRequest, data and files images. considered in this platform are CSS, HTML, JS, XHR HTTP Request, and images.

Figure 21. Performance evaluation results of both backend and frontend system.

J 2019, 2 323

5. Conclusions This research work presents a novel secured decentralized ledger in a database that manages petroleum product distribution records using a secure hash algorithm-based blockchain. Also, a telematics approach for the geolocation tracking and monitoring of petroleum volume level was proposed, which is connected to the remote database and updated with real-time information dynamically. The implementation of this permissioned blockchain technique using SHA-1 computation techniques ensures hashing of every transaction generated based on the previous transaction and has proven efficiency, since it is not vulnerable to individual tampering of the record, but it gives access to any changes or updates when participants in the chain have over 75% agreement; otherwise permission is denied. The details of this transaction are stored on the distributed ledger where every participant in the chain can access the data or information transparently and provide security with immune to tampering. Further research can be focused on securing military information, banking systems, and ballot voting systems (BVS) using decentralized distributed ledger and crypto hashing blockchain technology for data management and unified security. Also, the future work will consider the analysis based on the quality of oil and gas product information acquired from molecular markers (fuel marker program).

Author Contributions: Investigation, L.A.A.; Methodology, L.A.A., J.A., and L.K.; Software, L.A.A. and L.K.; Supervision, J.A. and E.A.A.; Writing—original draft, L.A.A. and L.K.; Writing—review & editing, L.A.A., J.A., and E.A.A. Funding: This research received no external funding. Acknowledgments: The authors are grateful to the management of Federal University of Technology Minna Nigeria, School of Engineering, and Engineering Technology, Department of Computer Engineering, for their technical and financial support. Conflicts of Interest: The authors declare no conflicts of interest.

References

1. Nwoba, O.E.; Abah, E.O. Impact of crude oil revenue (cor) on economic growth in nigeria (1960–2010). IOSR J. Hum. Soc. Sci. 2017, 22, 85–99. 2. Özturkoglu, Ö.; Lawal, O. The integrated network model of pipeline, sea and road distribution of petroleum product. Int. J. Optim. Control Theor. Appl. 2016, 6, 151–165. [CrossRef] 3. Aminu, S.A.; Olawore, O.P. Empirical investigation of challenges of distribution of premium motor spirit (PMS) in federal capital territory (Fct), abuja and environs, Nigeria. Int. J. Manag. Sci. Humanit. 2014, 2, 17–59. 4. Ajao, L.A.; Adedokun, E.A.; Nwishieyi, C.P.; Adegboye, M.A.; Agajo, J.; Kolo, J.G. An anti-theft oil pipeline vandalism detection. Int. J. Eng. Sci. Appl. 2018, 2, 41–46. 5. Adegboye, M.A.; Fung, W.-K.; Karnik, A. Recent advances in pipeline monitoring and oil leakage detection technologies: principles and approaches. Sensors 2019, 19, 2548. [CrossRef][PubMed] 6. Basu, S.; Waymire, G.B. Record-keeping and human evolution. Account. Horiz. 2006, 20, 201–229. [CrossRef] 7. Bacina, M.; Partner, P.; Alderman, P. The Era of Digital Trust. Available online: https://www.legaler.com/.../ Blockchain-for-Lawyers-eBook.pdf (accessed on 10 December 2018). 8. Diego, R.; Giovanni, S. Beyond bitcoin: A critical look at blockchain-based systems. Cryptography 2017, 1, 15. 9. Lavanya, B.M. Blockchain technology beyond bitcoin: An overview. Int. J. Comput. Sci. Mob. Appl. 2018, 6, 76–80. 10. Ajao, L.A.; Agajo, J.; Olaniyi, O.M.; Jibril, I.Z.; Sebiotimo, A.E. A Secure Tracking Automobile System for Oil and Gas Distribution using Telematics and Blockchain Techniques. J. Electr. Comput. Eng. Innov. 2019, 7, 171–177. 11. Marr, B. A Very Brief History of Blockchain Technology Everyone Should Read; Forbes: New York, NY, USA, 2018. 12. Vestergaard, C. Better than a floppy the potential of distributed ledger technology for nuclear safeguards information management, innovative approaches to peace and security from the stanley foundation. Anal. Brief. 2018, 1, 1–8. J 2019, 2 324

13. Hardjono, T.; Lipton, A.; Pentland, A. Towards a Design for Interoperable Blockchain System; Springer: Berlin, Germany, 2018; pp. 1–27. 14. Derhab, A.; Guerroumi, M.; Maglaras, L.; Ferrag, M.A.; Mukherjee, M.; Khan, F.A. BLOSTER: Blockchain-based system for detection of fraudulent rules in software-defined networks. In Proceedings of the 6th International Symposium for ICS & SCADA Cyber Security Research 2019, Athens, Greece, 10–12 September 2019; pp. 1–3. 15. Ferrag, M.A.; Derdour, M.; Mukherjee, M.; Derhab, A.; Maglaras, L.; Janicke, H. Blockchain technologies for the internet of things: Research issues and challenges. IEEE Int. Things J. 2019, 6, 2188–2204. [CrossRef] 16. Kogias, E.K.; Jovanovic, P.; Gailly, N.; Khoffi, L.; Gasser, L.; Ford, B. Enhancing bitcoin security and performance with strong consistency via collective signing. In Proceedings of the 25th USENIX Security Symposium (USENIX Security 16), Austin, TX, USA, 10–12 August 2016; pp. 279–296. 17. Tschorsch, F.; Scheuermann, B. Bitcoin and beyond: A technical survey on decentralized digital currencies. IEEE Commun. Surv. Tutor. 2016, 18, 2084–2123. [CrossRef] 18. Chima, C.M.; Hills, D. Supply-chain management issues in the oil and gas industry. J. Bus. Econ. Res. 2007, 5, 27–36. [CrossRef] 19. Kshetri, N. Can blockchain strengthen the internet of things. IT Prof. 2017, 19, 68–72. [CrossRef] 20. Ekblaw, A.; Azaria, A.; Halamka, J.D.; Lippman, A. A case study for blockchain in healthcare: Medrec prototype for electronic health records and medical research data. Proc. IEEE Open Big Data Conf. 2016, 13, 1–13. 21. Tian, F. An agri-food supply chain traceability system for China based on RFID & blockchain technology, In Service Systems and Service Management (ICSSSM). In Proceedings of the 13th IEEE International Conference, Kunming, China, 24–26 June 2016; pp. 1–6. 22. Micheal, C. What is Telematics, Geotab Inc., 2018. Available online: https://www.geotab.com/blog/what-is- telematics/ (accessed on 8 January 2018). 23. Handel, P.; Skog, I.; Wahlstrom, J.; Bonawiede, F.; Welch, R.; Ohlsson, J.; Ohlsson, M. telematics: Opportunities and challenges with the smartphone solution. Int. Trans. Syst. Manag. IEEE 2014, 6, 57–70. [CrossRef] 24. García, C.R.; Quesada-Arencibia, A.; Cristóbal, T.; Padrón, G.; Alayón, F. Systematic development of intelligent systems for public road transport. Sensors 2016, 16, 1104. [CrossRef] 25. Winter, A.; Baldi, S. Real-Life implementation of a GPS-Based path-following system for an autonomous vehicle. Sensors 2018, 18, 3940. [CrossRef] 26. Awan, M. Compensation of Low Performance Steering System Using Torque Vectoring. Ph.D. Thesis, Cranfield University, Bedfordshire, UK, 2012. 27. Isermann, R. Diagnosis methods for electronic controlled vehicles. Veh. Syst. Dyn. 2001, 36, 77–117. [CrossRef] 28. Jang, J.A.; Kim, H.S.; Cho, H.B. Smart roadside system for driver assistance and safety warnings: Framework and applications. Sensors 2011, 11, 7420–7436. [CrossRef] 29. Khatwani, S. Different Types of in the Market and Why We Need Them. Available online: https://coinsutra.com/different-types-blockchains/ (accessed on 15 September 2018). 30. DataFlair Team, Blockchain Tutorial. 2018. Available online: https://data-flair.training/blogs/bitcoin-and- -technologies (accessed on 14 September 2018). 31. Kumar, S.; Gupta, P. A comparative analysis of sha and MD5 algorithm. Int. J. Comput. Sci. Inf. Technol. 2014, 5, 4492–4495. 32. Gligoroski, D.; Markovski, S.; Knapskog, S.J. A secure hash algorithm with only 8 folded sha-1 steps. Int. J. 194 Comput. Sci. Netw. Secur. 2006, 6, 194–205. 33. Manuel, S. Classification and generation of disturbance vectors for collision attacks against SHA-1. Des. Codes Cryptogr. 2011, 59, 247–263. [CrossRef] 34. White, B.; Kreuz, T.; Simons, S. Midstream. In Compression Machinery for Oil and Gas; Klaus, B., Rainer, K., Eds.; Gulf Professional Publishing: Houston, TX, USA, 2019; pp. 387–400. 35. Adrian, A.; Cendana, M.; Dian, S.; Permana, H. Diffie-Hellman Key Exchange Modification using Blowfish Algorithm to Prevent Logjam Attack. J. Telecommun. Electron. Comput. Eng. 2018, 10, 1–7. J 2019, 2 325

36. Oluwade, O.R.; Olaniyi, O.M.; Abdulsalam, Y.S.; Ajao, L.A. Entropy management technique in lightweight cryptographically secured smart home. In Proceedings of the 12th International Multi-Conference on ICT Applications (AICTTRA, 2018), Ile-Ife, Nigeria, 15 September 2018; pp. 258–265. 37. Hulsing, A. Digital signature schemes and the random oracle model. Technische Universiteit Eindhoven. Available online: https://www.win.tue.nl/applied_crypto/2016/20161115_ROM_Signatures.pdf (accessed on 23 September 2016). 38. Sene, I.; Ciss, A.A.; Niang, O. I2PA: An Efficient ABC for IoT. Cryptography 2019, 3, 16. [CrossRef] 39. Hülsing, A. Digital Signature Schemes and the Random Oracle Model. Available online: https://www.win. tue.nl/applied_crypto/2016/20161115_ROM_Signatures.pdf. (accessed on 23 September 2016). 40. Liu, J.K.; Baek, J.; Zhou, J.; Yang, Y.; Wong, J.W. Efficient online/offline identity-based signature for wireless sensor network. Int. J. Inf. Secur. 2010, 9, 287–296. [CrossRef]

© 2019 by the authors. Licensee MDPI, Basel, . This article is an article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (http://creativecommons.org/licenses/by/4.0/).