Batch 7 Document
Batch 7 Document
Batch 7 Document
A
Project Report Submitted
In partial fulfillment of the requirements for the award of the Degree of
BACHELOR OF TECHNOLOGY
In
ARTIFICIAL INTELLIGENCE & DATA SCIENCE
By
Department of
ARTIFICIAL INTELLIGENCE & DATA SCIENCE
CERTIFICATE
This is to certify that the project entitled “Secure Document Storage System Using Web3” is
being submitted by
in partial fulfillment of the requirements for the award of degree of B.Tech in Artificial
Intelligence & Data Science from Jawaharlal Nehru Technological University Kakinada is
a record of bonafide work carried out by them at Lakireddy Bali Reddy College of
Engineering.
The results embodied in this project report have not been submitted to any other university or
institute for the award of any degree or diploma.
EXTERNAL EXAMINER
ACKNOWLEDGEMENT
We take great pleasure to express our deep sense of gratitude to our project guideDr.
Ch. Rajendra Babu , Professor, for his valuable guidance during the course of our project work.
We would like to thank Dr. O. Rama Devi , Professor & Head of the Department of
Artificial Intelligence & Data Science for her encouragement.
We would like to express our heart-felt thanks to Dr. K. Appa Rao, Principal, Lakireddy
Bali Reddy College of Engineering for providing all the facilities for our project.
Our utmost thanks to all the faculty members and Non-Teaching Staff of the Department
of Computer Science & Engineering for their support throughout our project work.
Our Family Members and Friends receive our deepest gratitude and love for their support
throughout our academic year.
We are here by declaring that the project entitled “Secure Document Storage System
Using Web3” work done by us. We certify that the work contained in the report is original and
has been done by us under the guidance of our supervisor. The work has not been submitted to
any other institute in preparing for any degree or diploma. We have followed the guidelines
provided by the institute in preparing the report. We have confirmed to the norms and guidelines
given in the Ethical Code of Conduct of the Institute. Whenever we have used materials (data,
theoretical analysis, figures and text) from other sources, we have given due credit to them by
citing them in the text of the report and giving their details in the references. Further, we have
taken permission from the copyright’s owner of the sources, whenevernecessary.
A document management system employing the Inter Planetary File System (IPFS) and Pinata
facilitates trusted sharing of sensitive data via user-defined access controls without intermediaries.
One-time cryptographic gateway tokens enable recipients to access uploaded content from
to permitted parties only. The system architecture integrates IPFS with Pinata's access management
capabilities to control policies and encryption keys. Documents are encrypted and stored across the
IPFS network's distributed hash table. Metadata including access rules is maintained by Pinata.
Users must present a valid cryptographic token to decrypt and retrieve documents. Tokens are
generated using public key cryptography and issued to specified recipientsby document owners.
Detailed security analyses demonstrate the system's resilience to tampering and unauthorized
access. Threat models explore protections at the protocol and application layers. Experimental
simulations verify selective retrieval under varied conditions, validating that only recipients in
possession of a valid one-time token can decrypt and access uploaded documents. Byleveraging
decentralized storage and configurable access controls, the proposed document management system
reduces reliance on central authorities and mitigates single points of failure. Evaluations confirm
confidential sharing is enforced, with documents disclosed only to authorized parties. The
integration of IPFS and Pinata enables decentralized, trustworthy sharing of sensitive data with
CONTENTS PAGE NO
1. INTRODUCTION 1-2
1.1 Overview of the Project 1
1.2.Feasibility Study 1-2
1.3.Scope 2
2. LITERATURE SURVEY 3-4
2.1.Existing System & Drawbacks 3
2.2.Proposed System & Advantages 4
5-6
3. SYSTEM ANALYSIS
5
3.1.Overview of System Analysis
5
3.2.Software used in the project
6
3.3.System Requirements
7-16
4. SYSTEM DESIGN
7
4.1.Overview of System Design
7-8
4.2.Methodology
8-16
4.3.Modules
17-32
5. CODING & IMPLEMENTATION
6. SYSTEM TESTING 33-35
36-37
7. RESULTS
38
8. CONCLUSION
38
8.1.Conclusion
39-41
9. REFERENCES
LIST OF TABLES
1.INTRODUCTION
This project “Secure Document Storage System using Web3” aims to develop
a decentralized document management system leveraging Web3 technologiesto enable
secure file storage and sharing capabilities without centralized servers. The system
allows users to upload files and documents to IPFS (InterPlanetary File System), which
is a distributed network for storing file content spread across peer-to- peer nodes. IPFS
removes single points of failure and censorship by distributing data with built-in
redundancy. When files are uploaded to IPFS, a unique gateway token is generated
which can be shared with others to allow access to the uploaded files.
The Ethereum blockchain maintains the core access control logic and file sharing
workflows via smart contracts deployed on it. The Hardhat development environment
is utilized for compiling, testing and deploying the smart contracts defining the backend
logic of the system. Hardhat provides a flexible and fast way to iterate on building
robust blockchain-enabled backends. Metamask browser extension injects a Web3-
enabled Ethereum wallet into the application to manage user accounts and signing of
transactions on the blockchain for secure access control.
The frontend application providing the user interface for file storage and sharing
capabilities is built using ReactJS. It interacts with the blockchain contracts deployed
on Ethereum using the ethers.js library, which facilitates communication between
frontends and blockchain networks. Overall, through the strategic combination of IPFS,
Ethereum, Hardhat, Metamask and ReactJS, the system demonstrates building full-
stack decentralized applications leveraging the latest Web3 and blockchain
technologies in a practical manner. The result is a serverless and decentralized
document management system with tamper-proof historical records, transparency,
accountability, reliability and security.
1.3 SCOPE
The scope of the project involved designing and developing a web-based
application that enables users to upload documents securely to the InterPlanetary File
System (IPFS). The application would integrate with the Ethereum blockchain, where
smart contracts would be deployed to manage access controls, sharing permissions, and
potential monetization rules for the uploaded files. Users could generate and share
cryptographic access tokens, allowing selective retrieval of files from IPFS by
authorized parties only. The project scope included a user-friendly interface, blockchain
integration, IPFS connectivity, smart contract development, encryption mechanisms,
and implementing core features like file uploads, access management, sharing, and
retrieval.
Additionally, the project scope encompassed developing a comprehensive
testing strategy to ensure the system's functionality, security, and reliability. This
included unit testing of individual components, integration testing of the blockchain
and IPFS interactions, as well as end-to-end testing of the complete application
workflow. The scope also involved documenting the system architecture, deployment
procedures, and user guides to facilitate future maintenance and potential expansion
of the platform.
2. LITERATURE SURVEY
Censorship risk: Companies have been known to delete or restrict access to files
due to legal/policy issues.
Lack of user ownership: Users do not truly own their data as companies
maintain control over files.
Difficult access management: It is challenging to restrict sharing or access to
files over time. Downloads cannot be tracked or monetized.
SYSTEM ANALYSIS
Secure Document Storage System Using Web3
3. SYSTEM ANALYSIS
4. SYSTEM DESIGN
4.1 OVERVIEW OF SYSTEM DESIGN
The system design phase plays a pivotal role in translating the requirements and
specifications gathered during the analysis phase into a comprehensive blueprint for the
secure document management system. This phase involves several critical decisions
regarding the system's architecture, components, and their interactions, ultimately
shaping the overall functionality and performance of the final product. The design
process begins with the identification of the core modules and their respective
responsibilities. In the context of this project, the key modules include the blockchain
module for managing smart contracts and transactions on the Ethereum network, the
file storage module for interfacing with IPFS, the access management module for
enforcing access controls and permissions, the user authentication module for
integrating with Metamask wallets, and the application interface module for providing
a user-friendly frontend. Each of these modules is designed to encapsulate specific
functionalities and interact with other components through well-defined interfaces and
communication protocols. The design phase also involves selecting appropriate data
structures and algorithms to ensure efficient data management, file storage, and
retrieval processes. Moreover, the design phase takes into consideration the scalability
and performance requirements of the system. The architecture is crafted to handle
increasing volumes of users, files, and transactions efficiently. Load balancing, caching
mechanisms, and optimized algorithms are incorporated to ensure responsive and
seamless user experiences, even under high loads.
4.2 METHODOLOGY
To ensure a structured and systematic approach to the system design, several
industry-standard methodologies and best practices were adopted. One such
methodology is the Object-Oriented Design (OOD) paradigm, which emphasizes the
principles of encapsulation, inheritance, and polymorphism. By adhering to these
principles, the system components can be designed as modular and reusable units,
promoting code maintainability, extensibility, and testability.Additionally, the design
phase incorporates the principles of the Unified Modeling Language (UML), a
standardized graphical notation for visualizing and documenting the system's
that work together to allow users to securely store, share and monetize files on a
decentralized network.
The key modules identified in the system design include:
Selected Softwares
VisualStudio IDE
Visual Studio Code is a popular open source IDE developed by Microsoft. It
provides intuitive editing features like syntax highlighting, code completion and
debugging tools to help code applications. Visual Studio Code supports a variety of
programming languages like Python, C++, JavaScript and more. It has a lightweight yet
powerful editor that works on Windows, Linux and macOS. The integrated terminal
and extensions also make Visual Studio Code very extensible for developers' workflow.
Solidity
Solidity 1s a contract-oriented programmmg language for writing smart
contracts on the Ethereum blockchain. It is used for implementing smart contracts on
Ethereum and other blockchain platforms. Solidity was influenced by C++, Python
and JavaScript and is designed to target the Ethereum Virtual Machine (EVM). Smart
contracts written in Solidity are compiled into bytecode that runs on the EVM.
Java Script
JavaScript is a scripting language that allows for the creation of dynamic and interactive
effects on web pages like form validation, sliding banners, and more. It is the most
widely used programming language on the web due to its implementation in all major
web browsers. JavaScript can run on the client-side as well as the server-side using
Node.js. It uses object-oriented programming principles and supports features like
functions, arrays, JSON, classes etc.
AIReplace these credentials with your actual email and password const emailUser =
username@domainname.com';
auth: {
user: emailUser,
pass: emailPass,
},
});
const mailOptions=
};
try {
await transporter.sendMail(mailOptions);
});
app.listen(port, () => {
try {
FrmData.append('file', File);
url: 'https://api.pinata.cloud/pinning/pinFileToIPFS',
data: FrmData,
headers: {
pinata_secret_api_key: '${import.meta.env.VITE_API_SECRET}',
'Content-Type': 'multipart/form-data',
},
});
State?.Account &&
State?.Contract &&
setFileURL(null);
} catch (err) {
return null;
};
{ e.preventDefault();
try {
{ method: 'POST',
headers: {
'Content-Type': 'application/json', },
pientEmail,
}),
});
if (response.ok) {
} else {
} catch (error) {
};
return (
<div
>
<small>Select File</small>
</div>
<span>{File?.name}</span>
<Ip>
<span>{File?.size}</span>
<Ip>
<span>{File?.type}</span>
<Ip>
</div>
)}
</div>
</section>
<form onSubmit={handleSubmit}>
<label>
required/>
</label>
<br/>
</form>
</section>
</div>
);
};
try {
setAccessors(List);
} catch (err) {
};
try {
await GetListOfAccessors();
} catch (Err) {
};
try {
await GetListOfAccessors();
} catch (Err) {
};
useEffect(() => {
GetListOfAccessors();
return (
<div>
<input
type="text"
onChange={(E) => {
setText(E.target.value);
}}
/>
<button
onClick={Allow}
>
Share
</button>
<button
onClick={DisAllow}
>
Revoke
</button>
</section>
</div>
{Accessors.length > 0 ? (
return (
<p>{Accessor?.User}</p>
<p>
{Accessor?.Allow == true ? (
<span className="text-green-300">True</span>
):(
<span className="text-black">False</span>
)}
</p>
</div>
);
})
):(
)}
</div>
</section>
</div>
</div>
);
};
IPFS
Offline Access: IPFS supports offline access to content by caching files locally,
allowing users to access data even when disconnected from the network.
Versioning and History: IPFS maintains a version history of files, allowing users
to access previous versions and track changes over time.
Peer-to-Peer Communication: IPFS enables direct peer-to-peer communication
between nodes, reducing reliance on intermediaries.
Scalability: IPFS is designed to scale effortlessly with network growth, making it
suitable for handling large volumes of data.
Global Reach: IPFS operates on a global scale, allowing users to access and
share content across geographical boundaries without restrictions.
Community Collaboration: IPFS fosters collaboration and community-driven
development, enabling users to contribute resources and improve the network
collectively.
Future-Proofing: IPFS is built with future technologies and use cases in mind,
making it adaptable to evolving requirements and advancements in the field of
decentralized storage.
Remix IDE
Remix is a popular web-based IDE used for writing, deploying and debugging
smart contracts for Ethereum and other EVM-compatible blockchains. It has an in- built
JavaScript VM that allows testing and debugging smart contracts without running a
local Ethereum node. Remix supports Solidity, Vyper and LLl
Easy to get started - Remix provides a browser-based IDE that allows developers
to quickly start building and testing smart contracts without needing toinstall tools
locally.
Built-in Ethereum VM - Remix includes a local Ethereum VM allowing
developers to deploy and test contracts right in the IDE without needing a full node.
Debugging capabilities - Remix supports debugging transactions and inspecting
state while transacting with contracts to help fix issues.
Library integration - Remix is integrated with key Ethereum libraries likeWeb3.js
making it easy to connect DApps to the blockchain.
Open source - Remix is open source allowing developers to help contribute to the
platform and shape its evolution.
Extensibility - Developers can write plugins to extend Remix's functionality for
particular use cases or integrations.
Collaboration support - Remix allows developers to quickly share and
collaborate on smart contract projects with built-in GitHub integration.
Gas estimation - Remix provides estimates of gas costs for transactions, helping
optimize gas usage.
Deployment configurability - Developers can easily configure different
Ethereum networks and accounts to deploy contracts to different environments.
Template support - Remix includes templates and examples to kickstart
development of common contract types like tokens.
Integration with MetaMask - Seamless connectivity with MetaMask for
encrypted keys/accounts used in transactions.
Formatted contract code - Remix automatically formats contract source code to
follow best practices and conventions.
Testing tools - Built-in Remix testing suite and integration with other tools like
Truffle for test-driven development.
Support for Vyper - In addition to Solidity, Remix supports Vyper for writing
contracts in an alternative language.
Charting data - Remix can chart contract data like gas usage to visualize
performance.
The proposed workflow of our document management system shows the process for
securely uploading, storing, and sharing documents using IPFS and blockchain. A
user uploads a document to IPFS which returns the content identifier (CID). The CID
and access control rules are stored on the blockchain via a smart contract. To share,
the owner generates a one-time access token for the recipient. This token is emailed to
the recipient. When the recipient tries to access the document using the token, the
custom IPFS gateway validates the token against the blockchain. If valid, it retrieves
the document content from IPFS and displays it. Overall, the workflow outlines how
documents are uploaded to IPFS, metadata and access rules are maintained on-chain,
unique tokens generated for access, and content selectively retrieved based on token
validation for secure sharing.
SYSTEM TESTING
Secure Document Storage System Using Web3
6. SYSTEM TESTING
Software Testing
Goals of Testing
Testing Methodology
Black Box Testing is the testing process in which tester can perform testing on
an application without having any internal structural knowledge of application. Usually
Test Engineers are involved in the black box testing.
White Box Testing is the testing process in which tester can perform testing on
an application with having internal structural knowledge. Usually the developers are
involved in the white box testing.
Gray Box Testing is the process in which the combination of black box and
white box techniques is use.
Levels of Testing
Unit testing
Individual components are tested to ensure that they operate correctly. Each
component is tested independently without other system components.
System testing
The sub-systems are integrated to make up the entire system. The testing process
is concerned with finding errors, which result from un-anticipated interactionsbetween
subsystem components.
Integration testing
Sometimes global data structures can represent the problems to uncover errors
that are associated with interfacing the objective is to make unit test modules and built
a program structure that has been detected by design.
Acceptance testing
This is the final stage in the testing process before the system is accepted for
operational use. Acceptance testing may reveal errors and omissions in the system
requirements definition because real data exercises the system in different ways from
the test data.
Regression testing
Regression testing is actually that helps to ensure changes that don't introduce
unintended behavior as additional errors. Regression testing may be conducted
manually by executing a subset of all test cases or using automated capture play back
tools.
Expected
Test case Id Operation Description Pass/Fail
Results
TC_02 File Access Share a file and Try accessing file Pass
gateway token with user
TC_03 File Access Share a file and Try accessing with Fail
invalid gateway user
token
7.RESULTS
8. CONCLUSION
8.1 CONCLUSION
9.REFERENCES
[l] Iddo Bentov, Ariel Gabizon, and Alex Mizrahi. Proof of activity: Extending
bitcoin's proof of work via proof of stake [extended abstract]. ACM
SIGMETRICS Performance Evaluation Review, 45(3):34-37, 2017.
[2] Lung Chen, Liwei Xu, Nish Shah, Yin Lu, and Justin Gurnmeson. Depoof: A
blockchain- based de-perimeterisation system for proof of existence of
documents. Proceedings of the 1st Workshop on Cryptocurrencies and
Blockchains for Distributed Systems, pages 16-21, 2018.
[3] Tien Tuan Anh Dinh, Rui Liu, Meihui Zhang, Gang Chen, Beng Chin Ooi,
and Ji Wang. Blocktel: Blockchain as a service for secure and scalable iot
provisioning. IEEE Transac- tions on Services Computing, 2017.
[4] David F Ferraiolo, Ravi S Sandhu, Serban I Gavrila, D Richard Kuhn, and
Ramaswamy Chandramouli. Proposed nist standard for role-based access
control. ACM Transactions on Information and System Security (TISSEC),
4(3):224-274, 2001.
[5] Francesco Fusco, Emanuele Michienzi, Vinod Sasidharan, and Giuseppe
Zazzaro. Se- curing health data clouds using blockchain technology. IEEE
Access, 8:128169- 128184, 2020.
[6] Christos Kalloniatis, Evangelia Kavakli, and Stefanos Gritzalis. Addressing
privacy re- quirements in system design: the pris method. Requirements
engineering, 13(3):241-255, 2008.
[7] Amit Sahai and Brent Waters. Fully secure functional encryption: Attribute-
based encryp- tion and (hierarchical) inner product encryption. In Annual
International Conference on the Theory and Applications of Cryptographic
Techniques, pages 62-91. Springer, 2005.
[8] Shikhar Sarang, Dhruv Rana, Smit Patel, Darshil Savaliya, Udai Pratap Rao,
and Akhil Chaurasia. Document management system empowered by effective
amalgam of blockchain and ipfs. Procedia Computer Science, 215:340-349,
2022. 4th International Conference on Innovative Data Communication
Technology and Application.
[9] Laurynas Siksnys and Ievgenii Ramasvauskas. A permissioned blockchain for
identity and access management by colligative use of attribute based
encryption and role based access control. MDPI Proceedings, 13(1):13, 2019.
39
LBRCE, AI&DS Department
Secure Document Storage System Using Web3
[l0]Garima Verma and Soumen Kamar. Secure document sharing model based on
blockchain technology and attribute-based encryption. Multimedia Tools and
Applications, pages 1- 18, 2023.
[ll]Javad Zarrin, Hao Wen Phang, Lakshmi Babu Saheer, and Bahram Zarrin.
Blockchain for decentralization of internet: prospects, trends, and challenges.
Cluster Computing, 24(4):2841-2866, 2021.
[12] https://docs.pinata.cloud/
[13] https://docs.ipfs.tech/
[14] https://legacy.reactjs.org/docs
[15] Yang, S. et al. "Preventing Replay Attacks in Ethereum Smart Contracts using
Nonces." 2021 IEEE International Conference on Blockchain (Blockchain).
2021.
[16] Khan, A. and Salah, K. "On the Importance of Nonce in Ethereum." 2018
Crypto Valley Conference on Blockchain Technology (CVCBT). 2018.
[17] Wang, W. et al. "Measurement and Analysis ofEthereum Nonce Systems."
ACM Transactions on Blockchain Technology 1.1 (2018): 1-12.
[18] Cheng, R. et al. "Ekiden: A Platform for Confidentiality-Preserving,
Trustworthy, and Performant Smart Contract Execution." IEEE European
Symposium on Security and Privacy. 2019.
[19] Lin, H. et al. "SZETHA: Optimizing Transaction Processing and Smart Contract
Execution in Blockchains." IEEE 26th International Conference on Network Protocols
(ICNP). 2018.
[20] Dickerson et al. "Adding concurrency to smart contracts." Proceedings of the ACM
Symposium on Principles of Distributed Computing. 2017.
[21] Anjana, P. et al. "Efficient techniques for blockchain transaction processing." 2018
IEEE International Conference on Big Data (Big Data). 2018.
[22] Gao, X. et al. "Performance analysis of private blockchain platforms in varying
workloads." Proceedings of the 27th ACM SIGOPS Asia-Pacific Workshop on
Systems. 2019.
[23] Wang, W. et al. "A survey on consensus mechanisms and mmmg strategy management
in blockchain networks." IEEE Access 7 (2019): 22328-22370.
[24] Sedgwick, K. "The Importance of a Nonce in Blockchain." Bitcoin Magazine, 7 Dec.
2020.