分散式環境中基於聲譽的信任度評估機制及其在智能合約之應用 - 政大學術集成
全文
(2) 誌謝詞. 首先我要誠摯的感謝指導教授左瑞麟老師,讓我學習到許多資訊安全領域的 知識,受益良多,其中在論文研究上左老師也總是細心且不厭其煩地與我討論並 且給予我許多寶貴的建議,以讓我能夠順利的完成我的碩士論文,僅此致最深之 謝忱,畢業永難忘懷。 在此我也要特別感謝蒞臨指導的口試委員:陳恭教授、黃仁俊教授、李榮三 教授以及許建隆教授給我的指導與建議,幫助我的論文研究能夠更加完整。. 政 治 大 承毅與逸修給予我在論文研究和生活上很多的幫助,也感謝實驗室同學兼戰友人 立. 在研究所的兩年中即將畫下句點,我要感謝實驗室的學長凱彬、明慶、人傑、. ‧ 國. 學. 和與我一起奮鬥,讓我在攻讀碩士的路途上並不孤單,感謝實驗室學弟子源給予 我在論文實作上非常大的幫助,感謝實驗室學妹勤文以及禾暘平時的幫忙與鼓勵。. ‧. 此外,再次感謝實驗室的所有人讓我在研究所的生涯擁有許多美好的回憶。. sit. y. Nat. 最後感謝我的家人,謝謝你們在這些年來給我的鼓勵與支持,使得我求學生. n. al. er. io. 涯無後顧之憂,得以順利完成碩士學業。. Ch. engchi. i n U. v. 詹琨泰 謹誌 國立政治大學 資訊科學系 中華民國 一零六 年 九 月. I.
(3) 摘要. 近年來區塊鏈技術及其相關應用成為熱門焦點,區塊鏈最大的特色包含去中 心化以及匿名性等特性,然而在這樣的分散式網路中我們很難判斷對方是否值得 信賴,在數位憑證中我們透過可信賴第三方擔任憑證中心為用戶簽發金鑰憑證以 此建立用戶之間的信賴關係,但在區塊鏈此種分散式網路中找到一個可信賴第三 方實屬不易,並且可能會與區塊鏈去中心化之特性背道而馳,因此本研究參考 PGP 信任網與小世界理論的概念,建立一套可適用於分散式環境中基於聲譽的信. 政 治 大. 任度評估機制,並將此機制結合智能合約實現一個信任度評估機制購物平台,目. 立. 的希望用戶與陌生人交易前,可透過此機制計算出信任度,提供用戶做為參考,. ‧ 國. 學. 幫助用戶更容易判斷陌生人是否可信,以降低受騙風險。. ‧. 關鍵字: 區塊鏈、去中心化、PGP、智能合約、小世界理論、信任度. n. er. io. sit. y. Nat. al. Ch. engchi. II. i n U. v.
(4) Abstract. In recent years, the blockchain technology and its relevant applications become hot spots. The greatest feature of the blockchain is the decentralization. Nonetheless, it is difficult for us to judge whether the other person get involved in the decentralized network is credible. Furthermore, it is difficult to find a reliable third party in such a point-to-point network. Consequently, this paper refers to the PGP web of trust and the small world problem to establish a set of. 政 治 大. reputation-based trust evaluation mechanism for decentralized environments,. 立. we combine this mechanism with a smart contract to achieve a trust evaluation. ‧ 國. 學. mechanism shopping platform, It is expected that achievements of the paper can facilitate people’s judgment regarding the reliability of strangers and reduce the. ‧. risks of being deceived.. sit. y. Nat. n. al. er. io. Keywords: Blockchain, Decentralized, PGP, Smart Contract, The Small World Problem, Trust Degree. Ch. engchi. III. i n U. v.
(5) Table of Contents Chapter 1 Introduction ................................................................................................... 1 1.1 Research Motivation ........................................................................................ 1 1.2 Research Purpose ............................................................................................. 2 1.3 Research Contribution ..................................................................................... 2 1.4 Organization ..................................................................................................... 3 Chapter 2 Background and Related Works .................................................................... 5 2.1 Digital Signatures............................................................................................. 5 2.1.1 The Generation and Verification of Digital Signatures ......................... 5 2.2 Digital Certificate............................................................................................. 7 2.2.1 Certificate Authority ............................................................................. 7. 政 治 大. 2.2.2 Scenario of Issuing a Digital Certificate ............................................... 8. 立. 2.3 Pretty Good Privacy (PGP) ............................................................................ 10. ‧ 國. 學. 2.3.1 Key Ring ............................................................................................. 11 2.3.1.1 Public Key Ring ....................................................................... 11. ‧. 2.3.1.2 Private Key Ring ...................................................................... 13 2.3.2 PGP Web of Trust ................................................................................ 13. Nat. io. sit. y. 2.3.2.1 Confirm the Public Key through User's Own Digital Signature .............................................................................................................. 14. er. 2.3.2.2 Confirm the Public Key through the Person that User Fully Trust ......................................................................................... 14. al. n. v i n C hPublic Key throughUthe Person that User 2.3.2.3 Confirm the engchi Marginally Trust....................................................................... 15. 2.4 Elliptic Curve Cryptography .......................................................................... 16 2.5 Blockchain ..................................................................................................... 17 2.6 Smart Contract ............................................................................................... 18 2.7 The Small World Problem .............................................................................. 20 2.8 Dijkstra Algorithm ......................................................................................... 21 2.9 Literatures Regarding the Calculation of Trust Degree ................................. 24 Chapter 3 Reputation-based Trust Evaluation Mechanism .......................................... 28 3.1 Records of Trust Degree ................................................................................ 28 3.2 Scenarios of Trust Evaluation ........................................................................ 30 3.2.1 Scenario 1: Direct Relationship .......................................................... 31 3.2.2 Scenario 2: Indirect Relationship ........................................................ 34 IV.
(6) 3.2.3 Scenario 3: No Indirect Relationship .................................................. 40 3.2.4 Scenario 4: New Seller........................................................................ 40 Chapter 4 System Implementation ............................................................................... 41 4.1 Implementation and Simulation Testing of Trust Evaluation Mechanism ..... 41 4.1.1 Implementation Environment ............................................................. 41 4.1.2 Simulation Testing .............................................................................. 41 4.2 The Shopping Platform Composed of Smart Contract and Trust Evaluation Mechanism ..................................................................................................... 46 4.2.1 Implementation Environment ............................................................. 46 4.2.2 System Architecture and Smart Contract ............................................ 46. 政 治 大. 4.2.3 Operation Interface and Process Flow ................................................ 51. 立. ‧ 國. 學. 4.3 Result and Discussion of Experiment ............................................................ 57 Chapter 5 Comparison of Trust Evaluation Mechanisms ............................................ 59 5.1 The Characteristics of Our Mechanism ......................................................... 59 5.2 Comparison Results ....................................................................................... 60. ‧. Chapter 6 Conclusion ................................................................................................... 62 References .................................................................................................................... 63. n. er. io. sit. y. Nat. al. Ch. engchi. V. i n U. v.
(7) List of Figures Figure 1. Public-Key Cryptography ...................................................................... 6 Figure 2. Digital Signature ...................................................................................... 6 Figure 3. Certificate Authority ............................................................................... 8 Figure 4. Alice's PGP Web of Trust ...................................................................... 16 Figure 5. Weighted Directed Graph ..................................................................... 21 Figure 6. Comparing the Path Distance (in Graph) ........................................... 22 Figure 7. Transaction Record Smart Contract ................................................... 30 Figure 8. User A's Network Relationship Graph ................................................ 35 Figure 9. Multiple Shortest Paths between Two Users ....................................... 37 Figure 10. After Filtering via the Trust Threshold ............................................. 38 Figure 11. Network Relationship Graph ............................................................. 39 Figure 12. Probabilities of Transactions .............................................................. 43. 政 治 大 Figure 13. Generating Users ................................................................................. 43 立 Figure 14. Users Data ............................................................................................ 44. ‧ 國. 學. Figure 15. Result of Trust Degree ........................................................................ 45 Figure 16. System Architecture ............................................................................ 47. ‧. Figure 17. Transaction Record Contract ............................................................. 48 Figure 18. User Information Contract ................................................................. 49 Figure 19. Purchase Record Contract ................................................................. 50 Figure 20. Auction Record Contract .................................................................... 50 Figure 21. Registration Page................................................................................. 51. er. io. sit. y. Nat. al. v. n. Figure 22. The Key Pairs and Contract Address that Generated by the Registration ................................................................................................ 52 Figure 23. Login Page ............................................................................................ 52 Figure 24. Auction Page ........................................................................................ 53. Ch. engchi. i n U. Figure 25. Trust Evaluation .................................................................................. 54 Figure 26. Purchase Page ...................................................................................... 55 Figure 27. Evaluation Page ................................................................................... 56 Figure 28. Transaction Records (Recorded in the Buyer's Purchase Contract) ..................................................................................................................... 56 Figure 29. Transaction Records (Recorded in the Seller's Auction Contract) . 57 Figure 30. Transaction Records (Recorded in the Transaction Record Contract) .................................................................................................... 57. VI.
(8) List of Tables Table 1. Symbol Table of the Key Ring ................................................................ 11 Table 2. Public Key Ring ....................................................................................... 11 Table 3. Private Key Ring ..................................................................................... 13 Table 4. Two-Dimensional Array .......................................................................... 21 Table 5. Find the Nearest Node from the Starting Node A ................................ 22 Table 6. Comparing the Path Distance (in Array) .............................................. 23 Table 7. Two-Dimensional Array after Node C Compared with All Paths....... 23 Table 8. Result of the Shortest Paths from Node A ............................................ 24 Table 9. Auction Record Contract 𝑳𝒏𝟏 .............................................................. 29 Table 10. Purchase Record Contract 𝑳𝒏𝟐 .......................................................... 29 Table 11. User A's Purchase Record Contract .................................................... 33 Table 12. Seller B's Auction Record Contract..................................................... 34 Table 13. Transaction Record Smart Contract ................................................... 40 Table 14. Comparison Table of Trust Evaluation Mechanism .......................... 61. 立. 政 治 大. ‧. ‧ 國. 學. n. er. io. sit. y. Nat. al. Ch. engchi. VII. i n U. v.
(9) Chapter 1 Introduction. 1.1 Research Motivation In recent years, the blockchain has become a hot spot, it includes features such as decentralization, publicity, independence, security, and anonymity. Among them, anonymity means that the identity information of the block nodes on the blockchain can be transmitted in an anonymous manner and it doesn't need to be verified.. 政 治 大. In the real social environment, it is difficult to easily determine whether the other. 立. is trustworthy when we meet with strangers, indeed, this situation is even more so on. ‧ 國. 學. the block chain.. In the digital signature system, the user's public key must be trusted by a third. ‧. party to issue a public key certificate. This certificate is used to prove the validity of. y. Nat. io. sit. the user's public key. However, it is difficult to find a reliable third party in such. n. al. er. point-to-point network and may be contrary to the de-centered nature of the blockchain.. Ch. engchi. i n U. v. Take the online shopping as an example, internet fraud is very common in recent years, malevolent sellers acquire good and excellent evaluations via undesirable tricks and penny antes so as to trick buyers out of confidence. During the shopping processes, people usually tend to choose certain commodities recommended by friends and have confidence in strange sellers on the basis of evaluation from persons they trust. PGP [1] is featured with similar characters. By making digital signatures via the users’ private keys against the public keys of others, the digital signatures and the public keys are consequently stored in the key ring and owners of the public keys shall subject to the owners’ trust degree. When the 1.
(10) signature of one user, PGP will judge whether to believe in the public key offered by the strange email or not, according to the trust degrees set by users in the key ring. Our research motivation is inspired by the PGP trust network web of trust and the concept of owner trust degrees, we expect to establish a decentralized trust evaluation mechanism that doesn't need a trusted third-party and it can reduce the probability of being fraud.. 1.2 Research Purpose. 政 治 大 In view of the smart contract based on the blockchain [2] technology, the block 立. chain thereof is public, transparent and cannot be changed or counterfeited. Hence,. ‧ 國. 學. the use of the smart contract for implement trust evaluation mechanism can ensure. ‧. that the calculation of the relevant parameters cannot be changed or counterfeited, and. sit. y. Nat. all users can verify the relevant transaction information in the smart contract. Before. io. er. trading with a target user, the user can figure out the credibility of the target user via the mechanism and take the result to serve as the reference base for transactions with. n. al. the target user.. Ch. engchi. i n U. v. 1.3 Research Contribution In the current online shopping, we can use the seller's transaction evaluation to understand whether a seller is trustworthy or not. In particular, most of seller transaction evaluations contain the product name, the product amount, the person who gave the evaluation, the evaluation comments, and the evaluation scores. However, when we look at the seller's transaction evaluation, the page usually shows a lot of evaluations. Because there are too many transaction evaluations, so buyers often only 2.
(11) look at the seller's evaluation score as a basis for trading. In addition, the seller's evaluation score is recorded by many strangers, although these strangers may be just the normal person, fraud is very common in recent years. The malicious seller can get the good evaluation by the bad way, so we question the existing evaluation mechanism. In our mechanism, we use the path algorithm to calculate whether the user and the seller have the direct relationship or indirect relationship between them and show the interpersonal network relationship between them. Hence, users can know via. 政 治 大 In addition, we also use this relevant information to calculate seller's trust degree, 立. which friends to build the relationship with the seller.. and to get a more valuable value of the trust score.. ‧ 國. 學. In this paper, we use the Ethereum to develop smart contracts and store all the. ‧. transactions recorded in smart contracts. Hence, all users can verify the transaction. sit. y. Nat. information to ensure that the relevant parameters cannot be tamped. In this way to. io. n. al. er. protect the rights and interests of users.. 1.4 Organization. Ch. engchi. i n U. v. This paper has six chapters. In the first chapter, we describe the research motivation, research purpose, research contribution, and the organization of paper. In the second chapter, we introduce the background and related works, among them, include the related documents of digital signature, digital certificate, PGP, elliptic curve cryptography, blockchain, smart contract, the small world problem, Dijkstra algorithm and trust calculation. In the third chapter, we introduce the reputation-based trust evaluation mechanism for decentralized environments proposed in this paper. The fourth chapter is the implementation of reputation-based trust evaluation 3.
(12) mechanism and shopping platform. In the fifth chapter, we compare our trust evaluation mechanism with others trust evaluation mechanism. In the sixth chapter is the conclusion of this paper and the future work.. 立. 政 治 大. ‧. ‧ 國. 學. n. er. io. sit. y. Nat. al. Ch. engchi. 4. i n U. v.
(13) Chapter 2 Background and Related Works. 2.1 Digital Signatures When we sign a check or contracts in real life, we usually sign our names or cover our special seals, in order to fulfill the matters described in the document but in the digital age, people can also sign the digital documents via the digital signature to indicate that the digital document is indeed approved by the interested party, and via. 政 治 大 achieve "non-repudiation" 立 purpose.. the digital signatures to ensure the correctness and completeness of the source, and to. ‧ 國. 學. The digital signature is a certification mechanism, according to the definition in [16], the digital signature must have the following characteristics:. ‧. (1) Must be able to verify the signature owner and the signature time.. sit. y. Nat. (2) The signature can be verified by the third party.. n. al. i n U. (4) The signature must be unable or difficult to be forged.. Ch. engchi. er. io. (3) Must be able to confirm the document contents at the signature time.. v. (5) The generation, identification, and verification of digital signatures must be simple.. 2.1.1 The Generation and Verification of Digital Signatures The digital signature is very similar to Public-key cryptography, the digital signature is implemented using the reverse operation of the Public-key cryptography. Before introducing the digital signature, we simply introduce the Public-key cryptography. In the Public-key cryptography, the user has own public key and private key, as 5.
(14) shown in Figure 1 , when Alice (message sender) to send confidential documents to Bob (message receiver), Alice used Bob's public key to encrypt the file. While Bob obtains this confidential file, he can decrypt the encrypted file with his own private key to obtain the plaintext information.. 政 治 大 Figure 1. Public-Key Cryptography 立 ‧. ‧ 國. 學. n. er. io. sit. y. Nat. al. Ch. engchi. i n U. v. Figure 2. Digital Signature In the digital signature, the user must also have a public key and a private key. Figure 2 shows the process of the digital signature, which consists of the following six steps: 6.
(15) (1) Alice hashes the plaintext. (2) Alice uses her private key to encrypt the hash value, and this encrypted hash value is the digital signature made by Alice. (3) Alice sends the plaintext and digital signature to Bob. (4) Bob uses Alice's public key to decrypt the received encrypted hash value. (5) Bob hashes the plaintext message, and this hash value must be the same as the hash value of step (1). (6) Bob compares two hash messages, if the result is the same, it means that the. 政 治 大. information source is actually sent by Alice and the plaintext has not been modified.. 立. ‧ 國. 學. 2.2 Digital Certificate. ‧. sit. y. Nat. In real life, we prove our identity by showing our identity card, student card, and. io. er. driver's license, the reason of stranger trust us is that the identity card has our photo, name, date of birth, household address and other information. And the most important. al. n. v i n of these is that the identity card C has the seal of the issuing h e n g c h i U authority so that the. information on the identity card will be trusted by others. However, in the cyber world, we must use the Public-key certificate to let others believe our identity. In the Public-key certificate, it records the username, the organization, the user's public key and other information and the issuing authority of this certificate.. 2.2.1 Certificate Authority The certificate authority issues the digital certificate for each user, the role of the digital certificate is to prove that the user public key listed in the certificate is legitimate, while anyone see the certificate, can believe the certificate holder has been 7.
(16) verified by the certificate authority, and the public key is indeed owned by the digital certificate holder. In addition, the scale of the certification authority can be as large as international organizations, government units, business organizations, etc. can also be small to individuals. However, the certificate authority must have a condition, that it’s must be a trusted third party.. 2.2.2 Scenario of Issuing a Digital Certificate. 立. 政 治 大. ‧. ‧ 國. 學. n. er. io. sit. y. Nat. al. Ch. engchi. i n U. v. Figure 3. Certificate Authority Figure 3 shows Alice (message sender) received Bob's (message recipient) digital certificate via the certificate authority and the use of the public key on the digital certificate to encrypt the message then send to Bob, the process has the following seven steps:. (1) Bob generates his own key pair : 8.
(17) Before using the public key cryptography system, the first step is to generate the key pair and keep the private key in a safe place. In this section, we assume that the key pair was generated by the user, however in the different situation, maybe the key pair will be generated by the certificate authority.. (2) Bob registers his own public key to the certificate authority : In this step, Bob submits his own public key to the certificate authority, and the certificate authority must verify that the public key is owned by Bob.. 政 治 大 (3) The certificate authority uses its own private key to digitally sign Bob's 立 public key and generates a digital certificate :. ‧ 國. 學. After confirming the user's identity in step (2), the certificate authority uses. ‧. his own private key to sign Bob's public key and generate a digital certificate.. er. io. sit. y. Nat. This step also indicates that the certificate authority has endorsed the public key.. (4) Alice receives Bob's digital certificate through the certificate authority :. al. n. v i n C h to Bob, so he U Alice wants to send a message gets Bob's digital certificate engchi. from the certificate authority, which is accompanied by Bob's public key and the certificate authority's digital signature.. (5) Alice uses the certificate authority's public key to verify Bob's digital certificate : Alice uses the certificate authority's public key to verify the digital signature of the digital certificate. If the verification is successful, it indicates that the public key is owned by Bob. 9.
(18) (6) Alice uses Bob's public key to encrypt the message and sends the message to Bob: This step is a general public-key cryptography that encrypts the message with the public key and sends the encrypted file to the recipient.. (7) Bob decrypts the file with his private key: While Bob receives the encrypted file from Alice, he decrypts the file with his own private key then he can read the message content.. 政 治 大 In the above seven steps, the first to third steps are required for the user to 立. register the public key, and the fourth step is only required if Alice first wants to send. ‧ 國. 學. the cipher text to Bob, after this, Alice can store Bob's public key in the own computer,. ‧. while he wants to send the file again to Bob, he can use it directly.. er. io. al. sit. y. Nat. 2.3 Pretty Good Privacy (PGP). n. v i n Pretty Good Privacy (PGP)C was developed by Philip h e n g c h i U R. Zimmermann in 1991,. it's an encryption software, which has the services of cryptographic privacy and authentication to protect the security of private email and confidential data transmission. PGP contains many cryptographic concepts such as symmetric. encryption, public key cryptography, digital signatures, one-way hash function, digital certificate, etc., one of the characteristics of PGP was decentralized, it can’t be controlled by the national government units or organizations, this characteristic makes people that don't trust the standards institutions more willing to use PGP. There is no certificate authority in the PGP, in contrast to the certificate authority, PGP's user sign the digital signature with each other, and store other users' public key 10.
(19) and digital signature in their own PGP key ring, and then the user can set the owner trust of the public key. Via signs the other public key that represents the user recognized the correctness of the public key, therefore establishing PGP's web of trust.. 2.3.1 Key Ring In the PGP system, all users have a group of key ring, which has two parts, one is the public key ring and the other is the private key ring, the public key ring stores. 政 治 大 and the private key ring is stored in the user's own private key, public key and related 立 information about the public key of all other users who are recognized by the user,. information, the following we will be based on the [16] to describe the structure of the. ‧ 國. 學. key ring.. ‧. Before introducing the public key ring and private key ring, we first introduce the. io. sit. y. Nat. following symbols and definitions that will be used, as shown in Table 1.. n. al. er. Table 1. Symbol Table of the Key Ring. Symbol 𝑃𝑅𝑎. Ch. engchi. Definition iv n U. User a's privacy key. 𝑃𝑈𝑎. User a's public key. H(). Hash function. E( ). Symmetric encryption. 2.3.1.1 Public Key Ring. Table 2. Public Key Ring 11.
(20) Time. Public. Public. Owner. User. Key. Digital. Digital Signature. stamp. Key ID. Key. Trust. ID. Legitimacy Field. Signature. Trust Field. …. …. …. …. …. …. …. …. 𝑇𝑖. 𝑃𝑈𝑖. 𝑃𝑈𝑖. 𝑜𝑤𝑛𝑒𝑟_𝑡𝑟𝑢𝑠𝑡𝑖. 𝑈𝑠𝑒𝑟𝑖. 𝑘𝑒𝑦_𝑙𝑒𝑔𝑖𝑡𝑖𝑚𝑎𝑐𝑦𝑖. …. …. …. …. signature𝑖 signature_𝑡𝑟𝑢𝑠𝑡𝑖. mod264 …. …. …. Table 2 shows the data structure of the PGP public key ring, which contains eight parts:. 立. 政 治 大. (1) Timestamp: The time that the public key is added to the public key ring.. ‧ 國. 學. (2) Public Key ID: The last 64 bits of the public key. (3) Public Key: The public key of this item. ‧. (4) Owner Trust: The trust degree of the user to this public key, the user can define. y. Nat. n. al. er. io. (5) User ID: The user who owns this public key.. sit. owner trust by himself.. i n U. v. (6) Key Legitimacy Field: PGP defined a scope which is used to judge whether the. Ch. engchi. public key can be trusted or not when PGP calculates the relevant parameters from the signature trust field, if the calculation results are within the range of this scope, it is possible to determine that the key is the correct public key with the key owner. (7) Digital Signature: The signature which signed this public key by another user, this field may contain many signatures from different users. (8) Digital Signature Trust Field: Each digital signature can use owner trust field of the public key ring to compute the trust degree, so that indicates the trust degree between PGP user and signer, the legitimacy of the public key is 12. ….
(21) calculated by all of the signatures in this field.. 2.3.1.2 Private Key Ring Table 3. Private Key Ring Timestamp. Public Key. Public. Encrypted Private. ID. Key. Key. …. …. …. …. …. 𝑇𝑖. 𝑃𝑈𝑖 mod264. 𝑃𝑈𝑖. E( H(𝑃𝑖 ), 𝑃𝑅𝑖 ). 𝑈𝑠𝑒𝑟𝑖. …. …. 立. … 治 … 政 大. User ID. …. ‧ 國. parts:. 學. Table 3 shows the data structure of the PGP private key ring, which contains five. ‧. (1) Timestamp: The time that the key was generated.. io. er. (3) Public Key: The public key of this key pair.. sit. y. Nat. (2) Public Key ID: The last 64 bits of the public key.. (4) Encrypted Private Key: The user chooses a password to encrypt the private key.. al. n. v i n C hthe private key, theUuser must type the correct While the user wants to access engchi. password, and then PGP will give the user permission to access this private key. (5) User ID: It usually stores the user's email address, can also be given a different name.. 2.3.2 PGP Web of Trust The web of trust is a concept be used in PGP, and there are three ways to establish the web of trust in PGP (refers to confirm whether the public key is correct): 1. Confirm the public key through user's own digital signature. 13.
(22) 2. Confirm the public key through the person that user fully trust. 3. Confirm the public key through the person that user marginally trust.. 2.3.2.1 Confirm the Public Key through User's Own Digital Signature We assume that Alice (A) and Bob (B) are friends, so A adds B's public key to the PGP public key ring and signs B's public key with his own private key. One day B sends an e-mail to A, which contains B's signature and the verification process has the. 政 治 大 (1) PGP search the B's public key from the A's key ring. 立 following four steps:. (2) After finding B's public key, check whether exists a digital signature that Alice. ‧ 國. 學. previously signed this public key.. y. Nat. signature.. ‧. (3) If exists a digital signature, then PGP use A's public key verify this digital. er. io. sit. (4) If the signature was validated successfully, then use the B's public key in the key ring to verify the digital signature of the e-mail, and if the verification is also. al. n. v i n Ce-mail successful, it means that the sent by B. U h e nis actually i h gc. 2.3.2.2 Confirm the Public Key through the Person that User Fully. Trust We assume that Tina and Alice are family, thus, A's key ring contains the T's public key and A has signed the T's public key, and A considers T to be a trusted person and the owner trust can be set in the PGP system, so A sets to "trust fully" for the T's public key, which means that any public key will be judged correct if it is 14.
(23) accompanied by the T's digital signature, one day B send an e-mail to A, which contain T's digital signature and the verification process has the following three steps: (1) PGP search the T's public key from the A's key ring and used A's public key to verify T's public key. (2) If the verification is correct, then use T's public key to verify the digital signatures which send by B. (3) If the verification is correct, then PGP judge B's public key is correct.. 2.3.2.3 Confirm the Public Key through the Person that User. 立. 政 治 大. Marginally Trust. ‧ 國. 學. We assume that David (D) and Emma (E) are Alice’s (A) friends, so the D's. ‧. public key and E's public key are stored in the A's public key ring and the owner trust. sit. y. Nat. of both public key are set to "trust marginally", one day A accept the Julie’s (J). io. er. message, and this message contains J's public key, D's digital signature, and E's digital signature, and due to there are two trust marginally people sign J's public key, so A's. al. n. v i n C hbut if the messageUthat sends by J only contains PGP judge J's public key is correct, engchi. one of the digital signatures, then PGP will think that J's public key is still not enough to confirm the correct, and the J's public key is judged as an unrecognizable public key. Figure 4. shows Alice's PGP web of trust, the user who is framed by a bold line indicates their public key has been directly confirmed by Alice's public key, the user who is framed by a thin line indicates that Alice's PGP can determine their public key as the correct public key, and the user who is framed by the dotted line indicates that Alice's PGP can’t determine their public key as the correct public key. 15.
(24) 政 治 大. Figure 4. Alice's PGP Web of Trust. 立. ‧ 國. 學. The concept of PGP is trusting the stranger through our friend who we trust. According to the small world problem [4], the connection between two persons can be. ‧. built through six persons. However, for the key ring of PGP is independently owned. sit. y. Nat. by each user, PGP can only deal with the trust relationship of which the network. n. al. er. io. diameter is 2. Unless plenty of public keys are stored in the key ring, it is difficult to. i n U. v. build a relationship with any stranger. In the third chapter, we refer to the concept of. Ch. engchi. PGP and makes some modifications, and use smart contracts to achieve similar to the public key ring as record table, so that all data and information can be shared and will not be easily tampered with malicious people, to create the perfect trust evaluation mechanism.. 2.4 Elliptic Curve Cryptography Both Bitcoin and Ethereum are the applications of blockchain, and the blockchain technique applies Elliptic curve signatures of Elliptic curve cryptography 16.
(25) to ensure the safety of the digital currency system. The Elliptic curve cryptography system was respectively proposed in 1985 by Kobilitz and Miller, which is based on the elliptic curve discrete logarithm problem, so it is more difficult than RSA cryptosystem that based on factorization problem. According to NIST [12] experiments, when the RSA key length is 1024 bits, the Elliptic curve cryptography system achieves the same security with just 160 bits, and when the RSA key length of 2048 bits, the Elliptic curve cryptography system achieve the same security with just 224 bits, in signature respect, the elliptic curve has the. 政 治 大 implementation of our paper, we also use elliptic curve signature to sign all the 立. advantages of faster processing and the signature length smaller than RSA. In the. transaction records to achieve verifiability and to ensure that the transaction. ‧ 國. 學. evaluation is correct.. ‧. Nat. er. io. sit. y. 2.5 Blockchain. The blockchain [5] originating from Bitcoins[6], this term was proposed by. al. n. v i n C h is a decentralized Satoshi Nakamoto in2008, the blockchain consensus network built engchi U by relevant techniques including the digital signatures of elliptic curves, hashing. functions, consensus algorithm, and others. It is featured with undeniable characters such as being public, transparent and difficult to be counterfeited. In addition, blockchain is made up of many blocks in series, and which is an ordered list of reverse links, all blocks are immediately after a certain block, on the blockchain, all the transaction records are stored in the block, the average of each block contains at least five hundred to one thousand transactions. Each block has a block header, it used to record the transaction information. The block contains the following six parts: (1)Software Version (2)The hash value of the 17.
(26) previous block (3)Merkle root (4)Timestamps (5)Difficulty values (6)Nonce. There are a cluster of nodes on the blockchain network, which we called miners, the legality of all transactions on the blockchain must be verified by these miners. Every miner will store the legal transaction in their own blocks after the transaction was validated, then the miners have to satisfy the proof-of-work in order to successfully produce a new block. When a miner succeeds in creating a new block, he will broadcast the message to other nodes on the blockchain, and other nodes agree with the effectiveness of the new block only when all of the transactions in this new. 政 治 大 nodes accept this new block, they will store the hash value of this new block in their 立 block are validated and not yet existed in the block chain network. Thus, if other. own block header.. ‧ 國. 學. On the blockchain, all nodes regard the longest chain as correct chain and. ‧. continue to extend this chain. However, sometimes blockchain might occur fork, it. sit. y. Nat. means that appeared more than one of the longest chain at the same time. The cause of. io. er. the fork is that two nodes simultaneously broadcasted the different new block, and the internet has the latency problem so other nodes receipt the message in different time.. al. n. v i n Cthe In this situation, in order to break can only wait for other miners create h edeadlock ngchi U. the new block to make one of the chains become the longest chain on the block chain. In this study, we refer to the feature of the blockchain and store the transaction records on the blockchain to ensure the data can be shared and can’t be easily tampered with malicious people.. 2.6 Smart Contract The smart contract was proposed by Nick Szabo in 1994 [13], he defined smart contract as "a set of promises, specified in the digital form, including protocols within 18.
(27) which the parties perform on the other promises ". However, there was no trustworthy execution environment at that time, so smart contract hasn't been actually applied in real life, but after the Ethereum was proposed, it greatly increases the possibility of the implemented smart contract. The Ethereum was invented by VitalikButerin and a group of programmers, the same as Bitcoin, Ethereum is a kind of applications on the blockchain and the purpose of Ethereum is to become a smart contract platform. Due to the smart contract is based on the blockchain, so the smart contract is. 政 治 大 be counterfeited. While the smart contract was deployed, it also permanently stored 立. featured with undeniable characters such as being public, transparent and difficult to. on the blockchain.. ‧ 國. 學. The main development language of the smart contract is Solidity. When the. ‧. program designer programs a smart contract and deploys it, the smart contract will. sit. y. Nat. similar to independent participants of the blockchain network. Upon the reception of. io. er. messages, the smart contract will automatically perform relevant codes based on the program logic contained in the smart contract, consequently, the smart contract could. n. al. Ch. also serve as a trustworthy participant.. engchi. i n U. v. The smart contract is featured with undeniable characters such as being public, transparent and difficult to be counterfeited, currently, there are many applications for smart contracts such as insurance claims [18], corporate finance and other practical applications. In our paper, we use the smart contract to record all transaction information and digital signatures in order to make all users can verify transaction history.. 19.
(28) 2.7 The Small World Problem The small world problem [4], also known as the Six degrees of separation, the concept was proposed by an experiment conducted by Stanley Milgram in 1967. The purpose of the experiment is to calculate how many people are between two persons, which experimental method is to design a parcel experiment and pre-set the target recipient, the parcel that sent to the target recipient include the photo and occupation of target recipient, the experimental description file, a postcard, and the. 政 治 大 Among them, experimental description file explain hope the people who received 立. experimental description file.. the package rely on the information and forward this parcel to the target recipient, but. ‧ 國. 學. if you don't know the target recipient, please forward this parcel to your friend who. ‧. most likely knows the target recipient and send the postcards within the parcel back to. sit. y. Nat. Harvard University at the same time so as to calculate the degrees of separation.. io. er. The results of this parcel experiment show that the 42 of the 160 parcels were successfully delivered to the target recipient, after calculation, the average of each. al. n. v i n parcel just need 5.5 middlemen C can complete this task,Uin other words, just need 6 hengchi people we can contact any person in the world.. However, we know the internet did not exist yet in the background of this parcel experiment, but now we can easily via Facebook and Twitter or other social software to contact with other people. According to Facebook research [14] shows that the current average distance between each user and other users is 3.57, in other words, among the 1.59 billion Facebook users, we only need to 3 or 4 people that we can connect to any one user.. 20.
(29) 2.8 Dijkstra Algorithm The Dijkstra algorithm is the shortest path algorithm [15], which concept is a kind of greedy algorithm, we can use this algorithm in the weighted directed graph without negative values to find the shortest path between the starting node and all nodes. Here we use a brief example to introduce this algorithm.. 立. 政 治 大. n. al. er. io. sit. y. ‧. ‧ 國. 學. Nat. Figure 5. Weighted Directed Graph. Ch. engchi. i n U. v. Table 4. Two-Dimensional Array Figure 5 is a weighted directed graph and Table 4 is a two- dimensional array table which based on Figure 5. In this example, we set node A as the starting node and use the Dijkstra algorithm to calculate the shortest path between node A and all nodes. The Dijkstra algorithm steps are as follows: 21.
(30) (1) In order to find the nearest node with the target node, as shown in Table 5, except for the starting node itself, we can see that the distance between the node C and the starting node A is the shortest, so we substitute node C into step(2).. 政 治 大. Table 5. Find the Nearest Node from the Starting Node A. 立. (2) As shown in Table 6, we set the node C as an intermediate node and compare. ‧ 國. 學. whether via the node C can make the distance between the starting node and the target node be shorter. In this example, the distance between node A and node B is. ‧. 50, and via the node C as the intermediate node, the path can be shortened to 45,. y. Nat. io. sit. so we replace the original distance with this distance. After a round of comparison,. n. al. er. we continue to repeat step (2), then compare the next target node, until the completion of all the target node comparison.. Ch. engchi. i n U. v. Figure 6. Comparing the Path Distance (in Graph). 22.
(31) Table 6. Comparing the Path Distance (in Array). 政 治 大 that the starting node can 立be helped by the intermediate node to make the distance. (3) After node C completes all comparisons, we can get Table 7. Here we can find. ‧ 國. 學. between some nodes in the network graph to be nearer.. Next, we repeat step (1) and step (2) to find the other node which is nearest. ‧. to the starting node A as an intermediate, until all nodes have ever been. n. al. er. io. sit. y. Nat. intermediate nodes.. Ch. engchi. i n U. v. Table 7. Two-Dimensional Array after Node C Compared with All Paths. (4) After completing the above three steps, we can get the shortest path between the starting node and all nodes, as shown in Table 8.. 23.
(32) Table 8. Result of the Shortest Paths from Node A. 治 政the Calculation 2.9 Literatures Regarding of Trust Degree 大. 立. In the third section of this chapter, we explain how PGP builds the web of trust,. ‧ 國. 學. however, for the key ring of PGP is independently owned by each user, so PGP can. ‧. only deal with the trust relationship of which the network diameter is 2. Unless plenty. sit. y. Nat. of public keys are stored in the key ring, it is difficult to build a relationship with any. io. er. stranger. In [7] also mentioned that people sometimes hard to judge whether the other person is credible, so before building a relationship with strangers, If we can calculate. al. n. v i n the trust between ourselves and C stranger as a reference,Uit can help us to judge the hengchi credibility of others in an easier way so that definitely reduce the risk of being. deceived. In [8], Meng et al. proposed to calculate the trust degrees between two users under the transaction environment of P2P e-commerce. The computational formula is listed as below:. 𝑇𝑎𝑏 = 𝛼𝐿𝑎𝑏 + (1 − 𝛼)𝑅𝑎𝑏 (1) In view of formula (1), 𝑇𝑎𝑏 refers to the overall trust degree of User a against User b, 𝐿𝑎𝑏 refers to the direct trust degree, 𝑅𝑎𝑏 refers to the indirect trust degree, 𝛼 and 1 − 𝛼 refers to the weight of the direct trust degree and the indirect trust 24.
(33) degree. The formula of the direct trust degree is listed as below:. 𝐿𝑎𝑏 =. ∑𝑛 𝑖=1 𝑉𝛼 (𝑏,𝑖)∙𝑇𝐴𝛼 (𝑏,𝑖)∙𝑇𝑇𝛼 (𝑏,𝑖,∆𝑡). (2). ∑𝑛 𝑖=1 𝑇𝐴𝛼 (𝑏,𝑖)∙𝑇𝑇𝛼 (𝑏,𝑖,∆𝑡). Among them, 𝑉𝛼 (𝑏, 𝑖) refers to the evaluation of the ith transaction made by User a to User b, 𝑇𝐴𝛼 (𝑏, 𝑖) refers to the transaction amount, 𝑇𝑇𝛼 (𝑏, 𝑖, ∆𝑡) refers to the attenuation function of the trading hour, and ∆𝑡 refers to the time gap between the current time and the transaction. In view of the formula (2), it could be inferred that the trust degree will increase along with more times of honest trades, bigger transaction amounts and smaller time gaps of transactions, and will decrease on the. 政 治 大 The formula regarding立 the indirect trust degree is listed as below:. contrary.. ‧ 國. ∑𝑚 𝑗=1(𝐿𝑎𝑗 ∙𝐿𝑗𝑏 ) 𝑚. 學. 𝑅𝑎𝑏 =. (3). Among them, m refers to the number of users ever traded with User b, 𝐿𝑎𝑗 refers. ‧. to the direct trust degree of User a against User j, while 𝐿𝑗𝑏 refers to the direct trust. y. Nat. io. sit. degree of User j against User b.. n. al. er. As to the computing method proposed by [8] for the trust degree, it is featured with. i n U. v. merits that the trust degree between two users will be affected to some extent due to. Ch. engchi. times of transactions, transaction amounts and time gaps of transactions. Consequently, the considerations regarding the calculation of the trust degree will be more comprehensive. However, based on the formula (2), it could be found that the direct trust degree between User a and the target User b is 0 if there’s no transaction before. Furthermore, formula (3) could only calculate for target users of which the maximum network diameter is 2. Therefore, when User a had never traded with the target User b and the network diameter between them is greater than 2, then the trust degree between them could not be worked out. In [9], Qiao et al. employ the general principle of interpersonal trust proposed by 25.
(34) the social psychology for reference to put forward a computing method of trust degree which is being equipped with the theoretical concept of six degrees of separation. In consequence, it could solve the problem in [8] that those with a network diameter greater than 2 could not be calculated. Moreover, the paper [9] divided the trust degree into the trust degree generated on the basis of familiarity and the trust degree generated on the basis of similarity. The computational formula is listed as below:. tr(A, N) = Ftr(A, N) + Str(A, N) (4). 政 治 大 refers to the trust degree of User A against the Target User N on the basis of 立. tr(A, N) refers to the trust degree of User A against the Target User N. Ftr(A, N). familiarity. Str(A, N) refers to the trust degree of User A against the Target User N. ‧ 國. 學. on the basis of similarity.. ‧. In [9], according to the six degrees of separation, the interpersonal relationship. sit. y. Nat. could be established via just six persons. It means that User A can connect with the. io. er. Target User N via six degrees of relationships at most. After combining the communication times among users in the social network, the trust generated on the. al. n. v i n C h be worked out.UThe formula is listed as below: basis of familiarity could consequently engchi Ftr(A, N) = 𝑊𝑁 ∙ ∑𝑛𝑖=1 [∏𝑚 𝑗=1. 𝑁(𝑆𝑗−1 ,𝑆𝑗 ) 𝐿𝑗. ] (5). Among them, i refers to the i-th path among the n paths from User A to the Target User N, j refers to the j-th degree of such path, m refers to the degree where the target users is located, 𝐿𝑗 refers to the sum of communication times among all users of the j-th degree and all users of the j-1th degree, 𝑁(𝑆𝑗−1 , 𝑆𝑗 ) refers to the communication times between UserSj−1 and User Sj , 𝑆𝑗 refers to users on the j-th degree of the path, and 𝑊𝑁 refers to the weighted distance of target users against User A. 26.
(35) The study only refers to the compute method of the trust degrees generated on the basis of familiarity, so the trust degrees generated on the basis of similarity by only a brief introduction, and the trust degrees generated on the basis of similarity is divided into external similarity and internal similarity, the formula is as follows:. Str(A, N) = 𝛼𝑆𝑈 (A, N) + (1 − 𝛼)𝑆𝑖 (A, N). (6). In the above formula, 𝑆𝑈 (A, N) represents the external similarity, which is calculated based on the similarity between the age of the two users and the home. 𝑆𝑖 (A, N) represents the internal similarity, which is based on the user's preference on. 政 治 大. the social network to calculate, α is the adjustment factor.. 立. ‧. ‧ 國. 學. n. er. io. sit. y. Nat. al. Ch. engchi. 27. i n U. v.
(36) Chapter 3 Reputation-based Trust Evaluation Mechanism In this study, we refer to the relevant trust calculation literature and use the advantages of these documents and also improve the shortcomings of these documents, thus establishing the reputation-based trust evaluation mechanism. Among them, "reputation" means that the user's transaction evaluation and related records and. 政 治 大. we use these parameters to calculate the trust score to provide this score for buyer as a. 立. reference.. ‧ 國. 學. In recent years, many malicious sellers through transactions in the small amount to get a good reputation, after obtaining the good evaluation, they sell high prices of. ‧. fake goods and cheat to get the high amount of illegal income. In our mechanism,. sit. y. Nat. when the buyer calculates the trust degree of the seller, we provide the average sale. n. al. er. io. amount of the seller for the buyer as a reference, then the buyer can use this average. i n U. v. sale amount to compare with the current goods sold by the seller, to reduce the risk of consumer fraud.. Ch. engchi. In this chapter, there are two parts, in the first section, we define and introduce the relevant parameter settings in this mechanism. In the second section, we introduce the four evaluation scenarios of our mechanism, among them, for each scenario will correspond to one formula of trust calculation.. 3.1 Records of Trust Degree The transaction records of our mechanism are stored in the blockchain, each User N 28.
(37) within the mechanism possesses the elliptic curve public key 𝑛𝑝𝑘 , the private key 𝑛𝑠𝑘 , and three smart contracts, which are the user information contract, the auction record contract 𝐿𝑛1 and the purchase record contract 𝐿𝑛2 , where the user information contract is used to store the user's account and the processed password and the public key 𝑛𝑝𝑘 . 𝐿𝑛1 is the auction record contract of User N for recording the information of Buyer X, the evaluation made by the Buyer X for the transaction with the User N, the transaction amount and the transaction time and the digital signature of Buyer X for. 政 治 大. the transaction. The interval of the transaction evaluation v is [1-5].. 立. Transaction. Transaction. Transaction. Information. Evaluation. Amount. Time. 𝑥𝑖𝑛𝑓𝑜. v. a. t. Digital Signature. 𝑆𝑖𝑔𝑛𝑥𝑠𝑘 (𝑥𝑖𝑛𝑓𝑜 , v, a, t). ‧. Buyer. 學. ‧ 國. Table 9. Auction Record Contract 𝑳𝒏𝟏. sit. y. Nat. Ln2 is the purchase record contract of User N for recording the information of. n. al. er. io. the Buyer Y, the evaluation made by the User N for the transaction with the Seller Y,. i n U. v. the transaction amount, the transaction time and the digital signature of the Buyer X for the transaction.. Ch. engchi. Table 10. Purchase Record Contract 𝑳𝒏𝟐 Seller. Transaction. Transaction. Transaction. Information. Evaluation. Amount. Time. 𝑌𝑖𝑛𝑓𝑜. v. a. t. Digital Signature. 𝑆𝑖𝑔𝑛𝑥𝑠𝑘 (𝑌𝑖𝑛𝑓𝑜 , v, a, t). After the buyer evaluates the transaction, the system will write the relevant transaction records to the 𝐿𝑥2 of Buyer X and the 𝐿𝑦1 of Seller Y. In our mechanism, exists a transaction record smart contract as shown in Figure 7, which is used to store 29.
(38) all user's transaction records and designed for recording the relationships and network graphs among users. In our mechanism, each user can through their own public key to verify the transaction record which stored on the smart contract.. 立. 政 治 大. Figure 7. Transaction Record Smart Contract. ‧ 國. 學 ‧. 3.2 Scenarios of Trust Evaluation. sit. y. Nat. According to the small world problem, we can establish relations with anyone. n. al. er. io. through at most 6 people, but as [9] said, there are still isolated users in the social. i n U. v. network system or two users can not establish contact with other users.. Ch. engchi. In the computing method proposed by [8] for trust degrees, if the two users involved had never traded with each other before and the network diameter thereof is greater than 2, the trust degree thereof could not be calculated. In view of many different situations occur during the processes of trust evaluation; four scenarios are raised by the study. The formula is listed as below: 1. User A has ever traded with the Target User B, the calculation method is shown in formula (7). 2. User A has never traded with Target User B but indirect relation exists between them, the calculation method is shown in formula (8). 30.
(39) 3. User A has never traded with Target User B and no indirect relationship exists between them, the calculation method is shown in formula (9). 4. Target User B has never traded with any user, the calculation method is shown in formula (10).. 𝑇𝑎𝑏. 𝑆𝑎𝑏 + 𝑂𝑏 (7) 𝑅 + 𝑂𝑏 (8) = { 𝑎𝑏 𝑂𝑏 (9) 𝑇𝑖𝑛𝑖𝑡𝑖𝑎𝑙 (10). 治 政 3.2.1 Scenario 1: Direct Relationship 大 立 ‧ 國. 學. User A has ever traded with the Target User B in the first scenario, the trust degree consequently could be directly calculated via the previous transaction records. ‧. between them. In formula (7):. sit. y. Nat. 𝑇𝑎𝑏 :𝑇𝑎𝑏 refers to the overall trust degree of User A against the Target User B,. er. al. n. degree 𝑂𝑏 .. io. which is composed by the direct trust degree 𝑆𝑎𝑏 and the whole trust. Ch. engchi. i n U. v. 𝑆𝑎𝑏 :𝑆𝑎𝑏 refers to the direct trust degree of the User A against the Target User B which could be calculated according to relevant parameters that stored in 𝐿𝑎1 . The calculation formula of 𝑆𝑎𝑏 is listed as below:. 𝑆𝑎𝑏 =. ∑𝑛 𝑖=1 𝑣(𝑏,𝑖)∙𝑎(𝑏,𝑖)∙𝑡(𝑏,𝑖,∆𝑡) ∑𝑛 𝑖=1 𝑎(𝑏,𝑖)∙𝑡(𝑏,𝑖,∆𝑡). (11). 𝑣(𝑏, 𝑖): Refers to the evaluation made by the User A for the i-th transaction with the Target User B. 𝑎(𝑏, 𝑖): Refers to the impact function of the transaction amount which by 31.
(40) the User A for the i-th transaction with the Target User B. In this part, we will substitute the transaction amount into 𝑙𝑜𝑔2 (𝑎), where “a” refers to the amount of the transaction. 𝑡(𝑏, 𝑖, ∆𝑡): Refers to the attenuation function of the transaction time. ∆t refers to the time gap between the current time and the transaction.. The following assumes that the Buyer A deal with the Seller B and User A had ever traded with Target User B, where the user A’s purchase record contract. 政 治 大 regarding with Seller B, after calculation, we can get the direct trust degree 𝑆 立 as shown in Table 11. In this table, we can find two transaction records that. 𝑎𝑏. is 4.36, the process of calculation is as follows:. ‧. ‧ 國. 學. n. er. io. sit. y. Nat. al. Ch. engchi. 32. i n U. v.
(41) 立. 政 治 大. ‧ 國. 學. Table 11. User A's Purchase Record Contract. ‧. 𝑂𝑏 : Refers to the value obtained on the basis of trust degrees of all users against. y. er. io. sit. Nat. the User B in 𝐿𝑏2 . The formula is listed as below:. 𝑛 𝑖=1 𝑛 𝑖=1. n. ∑ 𝑣(𝑖)∙𝑎(𝑖)∙𝑡(𝑖,∆𝑡) v 𝑂a𝑏l = ∑ (12) i 𝑎(𝑖)∙𝑡(𝑖,∆𝑡) n Ch engchi U. 𝑣(𝑖): The i-th transaction evaluation in 𝐿𝑏2 . 𝑎(𝑖): Refers to the impact function of the transaction amount which is the i-th transaction in 𝐿𝑏2 . In this part, we will substitute the transaction amount into 𝑙𝑜𝑔2 (𝑎), where “a” refers to the amount of the transaction. 𝑡(𝑖, ∆𝑡): Refers to the attenuation function of the transaction time which is i-th transaction in 𝐿𝑏2 . ∆t refers to the time gap between the current time and the transaction. 33.
(42) The following assumes that the Buyer A deal with the Seller B and user A had ever traded with Target User B, where the Seller B's auction record contract as shown in Table 12, after calculation, we can get the whole trust degree 𝑂𝑏 and the process of calculation is as follows:. 立. 政 治 大. ‧. ‧ 國. 學 sit. y. Nat. n. al. er. io. Table 12. Seller B's Auction Record Contract. Ch. engchi 3.2.2 Scenario 2: Indirect Relationship. i n U. v. In the second scenario, User A had never traded with Target User B but they had indirect relation exists between them. It means that two users involved could establish a relationship via other users. In this scenario does not apply to formula (7), because t User A and User B has not been traded, so 𝐿𝑎1 does not stores the record about User B. Thus, in this scenario, we use the formula (8), 𝑅𝑎𝑏 refers to the indirect trust degree which could be calculated on the basis of relevant parameters recorded by the transaction record smart contract. The formula is listed as below: 34.
(43) 𝑅𝑎𝑏 =. ∑𝑒𝑗=1 𝑣(𝑆𝑗−1, 𝑆𝑗, )∙𝑎(𝑆𝑗−1, 𝑆𝑗, )∙𝑡(𝑆𝑗−1, 𝑆𝑗,,∆𝑡)∙𝑑(𝑗) ∑𝑒𝑗=1 𝑎(𝑆𝑗−1, 𝑆𝑗, )∙𝑡(𝑆𝑗−1, 𝑆𝑗,,∆𝑡)∙𝑑(𝑗). 立. (13). 政 治 大. ‧ 國. 學. Figure 8. User A's Network Relationship Graph. ‧. First, we assume that User A's network relationship graph is shown in Figure 8.. y. Nat. io. sit. In transaction record smart contract, we could find out the shortest path 𝑃𝑎𝑏 between. n. al. er. User A and User B via the path algorithm. Suppose three paths like ( a , e ), ( e , f ),. i n U. v. and ( f , b ) are included in 𝑃𝑎𝑏 , it means that we could then find transactions. Ch. engchi. concerning a vs. e, e vs. f and f vs. b by transaction record smart contract. According to six degrees of separation, all users will be distributed in the A-centered concentric circle with 0-7 degrees. Among them, User A stays at 0 degrees. The symbols and definitions in formula (13) are as follows: j: Refers to the path of the j-th degree in 𝑃𝑎𝑏 . 𝑆𝑗 : Refers to the users at the j-th degree. e: Refers to the degree where the target User B exists.. 𝑣(𝑆𝑗−1 , 𝑆𝑗 ): Refers to the transaction evaluation made by the 𝑆𝑗−1 against the 35.
(44) 𝑆𝑗 . 𝑎(𝑆𝑗−1 , 𝑆𝑗 ): Refers to the impact function of the transaction amount made by the 𝑆𝑗−1 against the 𝑆𝑗 . In this part, we will substitute the transaction amount into 𝑙𝑜𝑔2 (𝑎), where “a” refers to the amount of the transaction. 𝑡(𝑆𝑗−1 , 𝑆𝑗 , ∆𝑡): Refers to the attenuation function of transaction time between the 𝑆𝑗−1 and the 𝑆𝑗 . As to the attenuation function of transaction time, the study refers to the formula in [8], with the detailed definition listed as below:. 立. 𝑒. 0. ∆𝑡 < 𝛼 𝛼 ≤ ∆𝑡 ≤ 𝛽 ∆𝑡 > 𝛽. (14). ‧. ‧ 國. 1. ∆𝑡 −1. 學. 𝑡(𝑆𝑗−1 , 𝑆𝑗 , ∆𝑡) = {. 政 治 大. sit. y. Nat. Among them, α and β refers to the thresholds of time. The value could be. io. er. set according to different situations.. 𝑑(𝑗): refers to the attenuation function of distances of the j-th degree. The value. al. n. v i n C h falls among [0-1]. calculated via the function The computational formula engchi U for the attenuation function of distances is listed as below:. 𝑑(𝑗) =. 7−𝑗 6. (15). In scenario 2, we find the shortest path 𝑃𝑎𝑏 between User A and Target User B through the relevant information recorded in the transaction record smart contract. However, after we used shortest path algorithm search for the shortest path, the searching result may be more than one path. 36.
(45) 政 治 大. Figure 9. Multiple Shortest Paths between Two Users. 立. ‧ 國. 學. As shown in Figure 9, we used the shortest path algorithm searches for the shortest path between User A and Target User B, the search result include three. ‧. shortest path, which are {a -> c -> b}, {a -> d-> b} and {a -> e -> b}, and the number. sit. y. Nat. on the edge represents the weight of trust evaluation. However, the shortest paths. n. al. er. io. might contain the user who User A evaluated lower or mistrust. The evaluation. i n U. v. provided by the neighboring user who is not trusted by the User A is less of a. Ch. engchi. reference value than the evaluation made by the neighboring user who is trusted by the User A. Therefore, in order to screen out more valuable evaluation, we can set the trust degree threshold T, it means that if the trust degree less than T that made by the User A against the adjacent User B, then we do not calculate this path and this trust degree threshold T can be set according to different situation. Here we set T to 3, thus we can simplified Figure 9. As shown in Figure 10.. 37.
(46) Figure 10. After Filtering via the Trust Threshold. 政 治 大. After we used trust threshold T to screen out the three shortest paths, we can get. 立. two shortest paths {a -> c -> b} and {a -> d-> b}, then we substitute {a -> c -> b} into. ‧ 國. 學. formula (13), then we can get the indirect trust degree 𝑅𝑎𝑏1 . We also substitute {a ->. ‧. d-> b} into formula (13), then we can get the indirect trust degree 𝑅𝑎𝑏2 . However we must use the weight to integration 𝑅𝑎𝑏1 and 𝑅𝑎𝑏2 these two paths,. y. Nat. sit. the weight is according to the trust degree made by the User A against the adjacent. n. al. er. io. nodes which in 𝑅𝑎𝑏1 and 𝑅𝑎𝑏2 . The formula is as follows:. v. 𝑅 ni C𝑎𝑏 = ∑𝑛𝑖=1 𝑊𝑖 𝑅𝑎𝑏𝑖 (16). hengchi U. In formula (16), “n” represents the number of shortest paths that after used trust threshold T to screen out, 𝑊𝑖 represents the trust weight of the i-th shortest path. The formula is as follows: 𝑆. 𝑊𝑖 = ∑𝑛 𝑖. 𝑖=1 𝑆𝑖. (17). In formula (17), 𝑆𝑖 represents the direct trust degree made by the User A against the adjacent nodes which on the i-th path. In the example of Figure 10, indirect trust degree 𝑅𝑎𝑏 = 𝑊1 𝑅𝑎𝑏1 + 𝑊2 𝑅𝑎𝑏2 , 5. 4. the trust weight 𝑊1 = 4+5 and the trust weight 𝑊2 = 4+5 。 38.
(47) The following assumes that the Buyer A trade with the Seller D and the situation of trust calculation is in the scenario 2, the two users of the network relationship shown in Figure 11. The transaction record smart contract as shown in Table 13, via the calculation of indirect trust degree, we can get 𝑅𝑎𝑏 is 4.07, the calculation process is listed as below:. 立. 政 治 大. ‧. ‧ 國. 學. n. er. io. sit. y. Nat. al. Ch. engchi. i n U. v. Figure 11. Network Relationship Graph. 39.
(48) Table 13. Transaction Record Smart Contract. 立. 政 治 大. 3.2.3 Scenario 3: No Indirect Relationship. ‧ 國. 學. In the third scenario, User A had never traded with Target User B and no. sit. y. Nat. this scenario. Hence, 𝑂𝑏 is used here to represent 𝑇𝑎𝑏 .. ‧. indirection relation exists between them. 𝑆𝑎𝑏 and 𝑅𝑎𝑏 could not be calculated in. er. io. 3.2.4 Scenario 4: New Seller. al. n. v i n C h User B had neverUtraded with any user. The In the fourth scenario, the Target engchi. overall trust degree 𝑇𝑎𝑏 is consequently denoted with the initial trust degree 𝑇𝑖𝑛𝑖𝑡𝑖𝑎𝑙 . The value of 𝑇𝑖𝑛𝑖𝑡𝑖𝑎𝑙 could be set according to different situations, our mechanism uses the symbol * to present 𝑇𝑖𝑛𝑖𝑡𝑖𝑎𝑙 . In the implementation of the fourth chapter, when the trust calculation situation is scenario 4, our system will notify the user of this seller has not yet sold any product.. 40.
(49) Chapter 4 System Implementation This chapter has three parts. In the first section, we conducted a simulation testing of the trust evaluation mechanism proposed in this study. In the second section, we introduce the shopping platform which composed of smart contract and trust evaluation mechanism. The third section is the result and discussion.. 4.1 Implementation and Simulation Testing of Trust. 治 政 大 Evaluation Mechanism 立 ‧ 國. 學. 4.1.1 Implementation Environment. ‧. OS: Windows7 64bits. y. sit. n. al. er. io. RAM: 8GB. Nat. CPU: Intel Core i7-4790 3.6GHz. Program Language: Java. 4.1.2 Simulation Testing. Ch. engchi. i n U. v. In this section, we used Java language to implement the trust evaluation mechanism proposed in this study and tested this mechanism, however, before the test, we have to generate users and related transaction evaluation records, first, in the number of users, we assume that there are 1,000 users in our mechanism and each user we choose a random integer which between 0 and 7,to determine the probability of each user trading with other users, as shown in Figure 12, if the random integer is 0, indicate this user has not been traded with any user, if the random integer is 1, 41.
(50) indicates the probability of this user trade with each user is 5%, if the random integer is 2, indicates the probability of this user trade with each user is 10%, if the random integer is 3, indicates the probability of this user trade with each user is 15%, if the random integer is 4, indicates the probability of this user trade with each user is 20%, if the random integer is 5, indicates the probability of this user trade with each user is 25%, if the random integer is 6, indicates the probability of this user trade with each user is 33%, if the random integer is 7, indicates the probability of this user trade with each user is 50%, after finished above step, we must also generate transaction data, as. 政 治 大 the transaction amount is [50-1000]. The interval of the attenuation function of the 立. shown in Figure 13. The interval of the transaction evaluation is [1-5]. The interval of. transaction time is [0.1-1].. ‧ 國. 學. After generated completion of the 1000 users, as shown in Figure 14, we show. ‧. the relationship between the users in a two-dimensional array, the symbol "X" in the. sit. y. Nat. picture indicates that the two users have not yet traded, and the numerical parts mean. io. er. that the transaction record between the two users, in the case of 1_5_500_0.8, parameter "1" indicates that two users have traded, parameter "5" means that the. al. n. v i n C h "500" indicatesUthat the transaction amount is transaction evaluation for 5, parameter engchi 500, parameter "0.8" represents the attenuation function of the transaction time for this transaction. In the process of test, we randomly selected two users and calculate the seller's trust degree, as shown in Figure 15, the network diameter between the user 168 and the user 861 is 2, and which calculated 49 shortest paths can make two users have contact, the result of trust degree is 3.5.. 42.
(51) 立. 政 治 大. ‧ 國. 學 ‧. Figure 12. Probabilities of Transactions. n. er. io. sit. y. Nat. al. Ch. engchi. i n U. Figure 13. Generating Users. 43. v.
(52) 學. ‧ 國. 立. 政 治 大 Figure 14. Users Data. ‧. n. er. io. sit. y. Nat. al. Ch. engchi. 44. i n U. v.
(53) 立. 政 治 大. ‧. ‧ 國. 學. n. er. io. sit. y. Nat. al. Ch. engchi. i n U. v. Figure 15. Result of Trust Degree. 45.
(54) 4.2 The Shopping Platform Composed of Smart Contract and Trust Evaluation Mechanism. 4.2.1 Implementation Environment OS: OS X EI Capitan 10.11.1 CPU: Intel Core i5 1.7GHz RAM: 4GB. 立. 政 治 大. Program Language: Node.js、Java Script、Solidity、HTML. ‧ 國. 學. 4.2.2 System Architecture and Smart Contract. ‧. Figure 16. as show the system architecture of our platform, this architecture. y. Nat. io. sit. consists of web front end which composed of HTML and JavaScript, the back end of. n. al. er. the web page composed of Node.js, and Ethereum blockchain, and we used Solidity to. i n U. v. develop the smart contracts which stored in the blockchain and the Node.js server in. Ch. engchi. the back end of the web page is based on the operation of the platform user to execute the corresponding program, and through the web3.js API access the data on smart contract , there are four smart contracts on the blockchain of our shopping platform, which are transaction record contract, user information contract, purchase record contract and auction record contract.. 46.
(55) 立. 政 治 大. ‧. ‧ 國. 學 Figure 16. System Architecture. n. er. io. sit. y. Nat. al. Ch. engchi. 47. i n U. v.
(56) 立. 政 治 大. ‧. ‧ 國. 學. Figure 17. Transaction Record Contract. sit. y. Nat. io. er. Figure 17. is the transaction record contract, this contract is responsible for recording the transaction records of all users in the shopping platform and the digital. al. n. v i n C h and this contractUis the parent contract for the signatures of the transaction records, engchi. user information contract, the purchase record contract and the auction record contract, when a new user to register, web3.js will call the function on this contract, then generate a new contract and return the contract location, as shown in Figure 22.. 48.
(57) 立. 政 治 大. io. sit. y. ‧. ‧ 國. 學. Nat. Figure 18. User Information Contract. n. al. er. Figure 18. is the user information contract, when a new user to register, web3.js. i n U. v. will store the account, password, and public key in this contract, and the password has been processed.. Ch. engchi. 49.
(58) Figure 19. Purchase Record Contract. 政 治 大 Figure 19. is the purchase 立 record contract, after user made the transaction. ‧ 國. 學. evaluation, web3.js store the transaction evaluation, the transaction amount, the transaction time, and the digital signature of the buyer for the transaction in the this. ‧. contract.. n. er. io. sit. y. Nat. al. Ch. engchi. i n U. v. Figure 20. Auction Record Contract Figure 20 is the auction record contract, after the platform user successfully sold the goods, and when the buyer make the transaction evaluation, web3.js will store the 50.
(59) transaction evaluation, the transaction amount, the transaction time, and the digital signature of the buyer for the transaction in this contract.. 4.2.3 Operation Interface and Process Flow (1) Register: After the user registers and enters the account password, the Node.js generates the user's elliptic curve key pair and call the transaction record contract on the blockchain to generate the user information contract, purchase record. 政 治 大 key in the user information contract. 立. contract, and auction record contract, and store the account, password and public. ‧. ‧ 國. 學. n. er. io. sit. y. Nat. al. Ch. engchi. i n U. Figure 21. Registration Page. 51. v.
(60) Figure 22. The Key Pairs and Contract Address that Generated by the Registration. (2) Login: User type the account and the password, after confirmed by the database. 政 治 大. comparison, the user can do the operation such as sell goods, purchase goods, and evaluation... 立. ‧. ‧ 國. 學. n. er. io. sit. y. Nat. al. Ch. engchi. i n U. v. Figure 23. Login Page. (3) Auction: The user types the product name and price, after confirmed and 52.
(61) submitted, the goods will display on the product list page for other users to purchase.. 立. 政 治 大. ‧. ‧ 國. 學. n. al. er. io. sit. y. Nat. Figure 24. Auction Page. i n U. v. (4) Trust evaluation: Users can calculate their trust with the seller before purchasing. Ch. engchi. the goods, and use this trust score as a reference, as shown in Figure 25.. 53.
Outline
相關文件
• Suppose the input graph contains at least one tour of the cities with a total distance at most B. – Then there is a computation path for
11[] If a and b are fixed numbers, find parametric equations for the curve that consists of all possible positions of the point P in the figure, using the angle (J as the
Expecting students engage with a different level of language in their work e.g?. student A needs to label the diagram, and student B needs to
(B) The girl who having a book in her hand is my sister.. (C) The girl with a book in her hand is
(A) The scene where the heroine of Guardian: The Lonely and Great God places a maple leaf between the pages of a book was shot in Canada.. (B) The maple leaf on the Canadian
Estimated resident population by age and sex in statistical local areas, New South Wales, June 1990 (No. Canberra, Australian Capital
We summarize these properties as follows, using the fact that this function is just a special case of the exponential functions considered in Theorem 2 but with base b = e
The Swiss mathematician John Bernoulli, who posed this problem in 1696, showed that among all possible curves that join A to B, as in Figure 15, the particle will take the least