TimeLockr is a simple smart contract built on the Ethereum blockchain that allows users to store and lock up encrypted messages on-chain. The messages can be unlocked after a specified time period. This contract provides a secure and decentralized way to store sensitive information.
- Lock encrypted messages on the blockchain.
- Set a time duration for locking the messages.
- Unlock messages after the specified time has passed.
- Flexible fee structure based on the locking duration.
- Whitelist feature for exempting certain addresses from paying fees.
Name | Parameters | Description |
---|---|---|
MessageLocked | _user (address), messageId (bytes32), timestamp (uint256) |
Emitted when a message is locked. |
MessageUnlocked | _user (address), timestamp (uint256) |
Emitted when a message is unlocked. |
FeeUpdated | prevFee (uint256), fee (uint256), timestamp (uint256) |
Emitted when the fee is updated. |
MinimumLockUpTimeUpdated | prevLockTime (uint256), lockTime (uint256), timestamp (uint256) |
Emitted when the minimum lock time is updated. |
AddedToWhitelist | user (address), timestamp (uint256) |
Emitted when an address is added to the whitelist. |
RemovedFromWhitelist | user (address), timestamp (uint256) |
Emitted when an address is removed from the whitelist. |
- Ethereum wallet or compatible browser extension (e.g., MetaMask).
- Smart contract development environment (e.g., Remix, Hardhat).
- Deploy the TimeLockr contract on the Ethereum blockchain.
- Interact with the contract functions using Ethereum wallets or develop custom applications.
- Call the
lockMessage
function with the recipient's address, the encrypted message, and the desired lock time. - If not whitelisted, ensure that the transaction value is sufficient based on the locking duration.
- The message will be stored and locked up on the blockchain.
- Call the
unlockMessage
function with the message ID. - If the time has passed the lock-up period, the message will be unlocked and added to the user's messages.
- Call the
getRemainingTime
function with the message ID to check the remaining lock time for a message.
- Call the
getMessage
function with the message ID to retrieve an unlocked message.
- Call the
updateFee
function to update the fee required for locking messages. - Call the
updateMinimumLockTime
function to update the minimum lock time.
- Call the
addToWhitelist
function to add an address to the whitelist for fee exemption. - Call the
removeFromWhitelist
function to remove an address from the whitelist.
This project is licensed under the MIT License - see the LICENSE file for details.