在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:ruchi26/Blockchain-based-Decentralized-File-Sharing-System-using-IPFS开源软件地址:https://github.com/ruchi26/Blockchain-based-Decentralized-File-Sharing-System-using-IPFS开源编程语言:HTML 38.3%开源软件介绍:Blockchain-based-File-Sharing-SystemThe aim is to share files in a peer to peer manner using a blockchain to ensure decentralization. METHODOLOGY4.1 Creating the BlockchainIn Data Share, a single block in a blockchain has the following structure: 4.1.1 Block StructureThe Block contains : In order to create a peer to peer network (p2p) for the blockchain to function, all the connected nodes must be in the same network. Only those users who are connected to the blockchain’s p2p network should have access to the blockchain’s data. This p2p network is created using Socket Programming. We are working on a permissioned blockchains which require access to be a part of the blockchain. This access is granted when a user clicks on ‘Connect to the blockchain’ displayed on the home screen. Using socket programming, the list of connected nodes gets updated as soon as a new user gets connected or disconnected to the network and the updated list is broadcasted to the whole p2p network. As soon as all the connected nodes get the updated list of the nodes in the network, the consensus protocol works smoothly whenever a new block is added or the blockchain gets updated. Thus, the peer to peer network works effectively. 4.1.2 Creating the Peer to Peer NetworkThe unique key/password shared between the sender and the receiver of the shared file to increase the security of the file(s) on the blockchain network. 4.1.3 File KeyThe upload page is to be filled out by the uploader eager to share the file. The file key entered here will be used to encrypt the file using AES encryption before uploading it to the IPFS network. The uploader will have to share the key only with the intended receiver(s) so he/she can download the file. The type of files that can be uploaded are .pdf , .png , .jpeg and .txt. As of now the size of the file that can be uploaded to the network is limited to 16 Megabytes. The download page is to be filled by the receiver who has the valid file key shared by the sender and intends to download the shared file from the blockchain to his/her local computer. The file key here is used to decrypt: the AES encrypted file downloaded from the IPFS network so that the file can be interpretable. Make sure you enter the correct file key and hash for a successful download. 4.2 Integrating with IPFSOur blockchain relies on IPFS for keeping it lightweight and scalable. If the files were stored directly on the blockchain, it would render the blockchain very heavy and inefficient. Combining IPFS and blockchain, we get to access the IPFS’s power of decentralized storage and enhance the blockchain’s security and accessibility. Instead of storing the file directly on the blockchain, we store the files on the IPFS network while the blockchain stores only the file’ hash. Each file will have a unique hash as IPFS employs the SHA-256 hashing algorithm. Thus, the file is stored in a secure decentralized network and is easily accessible through the blockchain. The file can be retrieved using its generated hash easily. Hence IPFS eliminates the bottleneck of storing entire files on the blockchain. 4.3 Using Cryptographic Encryption4.3.1 SHA-256 Hashing AlgorithmWe use the SHA-256 algorithm to generate a unique hash of the entire block that is used by the corresponding blocks to form the chain (via the previous hashes). IPFS as well uses this algorithm to generate the hash of the shared file. The SHA-256 hashing algorithm is employed because of the following advantages:
One-way:- Once the hash is generated, we can’t revert to the original data from the hash.
Deterministic:- For a particular input, the hash generated, always remains the same i.e. same input always gives the same hash.
Quick computation of the hash.
Avalanche-effect:- Even a slight change in the input will bring about a large change in the final hash, making it untraceable
Withstand collisions:- There is a very rare chance that the hash generated for two different inputs will be the same. Think of it as a human fingerprint! AES Encryption is a form of symmetric, cryptographic encryption that depends on a shared key between the sender and receiver to access any file (here the file key) . If we had not employed the AES encryption, any connected user to the blockchain can access the file hash and thus, the shared file using the hash, directly from the IPFS. Using the AES Encryption, we encrypt the file using the file key of the uploader. Thus, if any user tries to download the file directly from the IPFS, all they get is a non-readable file. Thus, only users with a valid file key can access the readable file contents, thereby enhancing the security of the blockchain and the file contents. 4.3.2 AES EncryptionRESULTTo test our application, we ran two instances of Data Share on the computer locally at different ports, which served as two different and independent nodes (let’s say node A and node B). From both of them, we connected to the blockchain network and shared files using file keys. From node A, we uploaded a file ‘x’ using file key ‘P’. We then downloaded the file ‘x’ from node B using the same key P’. Subsequently, we uploaded a file ‘y’ from node B using file key ‘Q’ and downloaded the file ‘y’ from node ‘A’ using the file key ‘Q’ After the consequent sharing of the two files, the blockchain was updated at both the nodes. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论