Skip to content

Latest commit

 

History

History
36 lines (23 loc) · 1.41 KB

Readme.md

File metadata and controls

36 lines (23 loc) · 1.41 KB

Car Registration System 🚗

📌Overview:-

The Car Registration System allows users to register their cars, update car details (such as color), and transfer ownership of their cars to other Ethereum addresses. The contract ensures that only the current owner of the car can make modifications to the car's details or transfer its ownership.

📌This contract demonstrates how to:-

✅ Use structs to define car properties. ✅ Use mappings to track car ownership. ✅ Use modifiers to restrict access to sensitive actions. ✅ Enable interaction between users and the contract on the Ethereum blockchain.

📌Features:-

✅ Car Registration: Allows users to register a car with model and color. ✅ Change Car Color: Only the car owner can update its color. ✅ Transfer Car Ownership: Only the car owner can transfer the car ownership to another address. ✅ Ownership Control: Restricts sensitive actions to the car owner via custom modifiers.

📌Functions:-

✅registerCar(_model, _color): Registers a new car. ✅changeCarColor(_carId, _newColor): Changes the car color (only by owner). ✅transferCarOwnership(_carId, _newOwner): Transfers ownership (only by owner). ✅getCar(_carId): Retrieves car details.

📌Example Usage:-

✅Register a car: registerCar("Tesla Model S", "Red") ✅Change color: changeCarColor(1, "Blue") ✅Transfer ownership: transferCarOwnership(1, newOwnerAddress) ✅View car details: getCar(1)