About: The Library Management System (LMS) is implemented as a smart contract on the Ethereum blockchain using Solidity. It enables a librarian (admin) to manage books β adding, updating, and removing them β while users (readers) can borrow and return books securely.
Each transaction (like borrowing or returning a book) is permanently recorded on the blockchain, ensuring transparency and accountability.
π§ Features
π Owner-controlled: Only the contract owner can add new books.
π Book tracking: Each book has a title, author, and number of available copies.
π Borrow & return system: Users can borrow available books and return them later.
π Events: Emits events when books are added, borrowed, or returned for easy on-chain tracking.
π§© Smart Contract Overview Function Description Access addBook(string title, string author, uint256 copies) Add a new book to the library Owner only borrowBook(uint256 bookId) Borrow a book if available Any user returnBook(uint256 bookId) Return a borrowed book Any user getBook(uint256 bookId) Get details of a specific book Public view
π§βπ» Roles: 1)Librarian (Admin):
Adds or removes books. Monitors borrowing records. 2)User (Member): Can view all available books. Can borrow and return books.
βοΈ How to Run
- Open in Remix
Go to Remix IDE .
Create a new file named LibraryManagement.sol.
Paste the smart contract code inside it.
- Compile
Select Solidity Compiler on the left panel.
Set the compiler version to 0.8.0 or higher.
Click Compile LibraryManagement.sol.
- Deploy
Go to the Deploy & Run Transactions tab.
Select the LibraryManagement contract.
Click Deploy.
- Interact
Once deployed, you can:
Call addBook("1984", "George Orwell", 3) β adds a new book (only the contract owner can do this).
Call borrowBook(1) β borrows the book with ID 1.
Call returnBook(1) β returns that book.
Call getBook(1) β views book details.

Contract address: 0x4255eb59fc63bbe3f0b6cc395bf1ba83dd745210