Due Date: Monday October 6, 2025, at 23.59
Submission: Submit your work by making a pull request to this GitHub repository. The PR must include all required files and documentation as described below.
In our lectures, we have discussed the foundational concepts of blockchain, distributed ledger technology, and smart contracts. We've explored how smart contracts can automate processes and create trustless agreements on a decentralized network like Ethereum.
The purpose of this assignment is to move from theory to practice. You will get hands-on experience with the fundamental lifecycle of a decentralized application (dApp): writing, compiling, deploying, and interacting with a smart contract. You will use modern, industry-standard tools to deploy your contract onto the Sepolia Ethereum testnet, a public testing environment that mimics the real Ethereum network without using real money.
Upon successful completion of this assignment, you will be able to:
- Write a basic smart contract using the Solidity programming language.
- Understand and use state variables, functions, mappings, and events in Solidity.
- Use the Remix IDE, a popular web-based tool for smart contract development.
- Set up and use a MetaMask wallet to manage accounts and sign transactions.
- Acquire test Ether from a public faucet.
- Deploy a smart contract to a public Ethereum testnet (Sepolia).
- Interact with your deployed smart contract's functions.
- Verify your smart contract's source code on a block explorer (Etherscan).
You are tasked with creating a simple digital notary smart contract. The concept is straightforward: anyone can record the existence of a digital document at a specific point in time without revealing the document's contents. This is done by storing a cryptographic hash of the document on the blockchain. Because of the blockchain's immutable nature, this creates a permanent, timestamped proof that the document existed in that exact state.
There is a short tutorial in the tutorial folder that may help you to get started in Solidity programming.
Your Solidity smart contract, named ProofOfExistence, must have the following features:
-
State Variables:
- An address variable named
ownerto store the address that deployed the contract. - A mapping named
proofsthat links abytes32(the document hash) to auint256(the timestamp of when it was notarized).
- An address variable named
-
Constructor:
- A constructor function that sets the
ownervariable tomsg.sender.
- A constructor function that sets the
-
Functions:
notarizeDocument(bytes32 _documentHash):- Must check if this hash has not already been stored (
require()). - If new, store it in
proofswithblock.timestamp. - Emit a
DocumentNotarizedevent.
- Must check if this hash has not already been stored (
verifyDocument(bytes32 _documentHash):- Returns
trueif the hash exists (timestamp > 0), elsefalse.
- Returns
-
Events:
DocumentNotarized: Logsmsg.sender, hash, and timestamp.
- Install MetaMask: Create a new wallet and securely store your seed phrase.
- Switch to Sepolia Test Network.
- Get test ETH from Sepolia Faucet. If you are having some issues, drop me an email to request for some test ETH. Include your public key in your email.
- Open Remix IDE.
- Create
ProofOfExistence.sol. - Write your smart contract code according to the requirements.
- Open Solidity Compiler tab.
- Select compiler version (e.g.,
0.8.20or newer). - Compile
ProofOfExistence.sol.
- Open Deploy & Run Transactions tab.
- Select environment: Injected Provider - MetaMask.
- Connect MetaMask when prompted.
- Select
ProofOfExistenceunder "Contract". - Click Deploy and confirm transaction in MetaMask.
- Wait for transaction to be mined.
- Generate a Keccak-256 hash at online tool.
- Example:
"TIF5211 is awesome"→ prefixed with0x.
- Example:
- Call
notarizeDocumentwith the hash. Approve in MetaMask. - Call
verifyDocumentwith the same hash → should returntrue. - Call
verifyDocumentwith a different hash → should returnfalse.
- Open Sepolia Etherscan from your deployment transaction.
- Go to contract address → Contract tab → Verify and Publish.
- Select "Single File", compiler version, and "MIT" license.
- Paste Solidity source code and complete verification.
Submit your work by making a pull request (PR) to this GitHub repository.
- Create a folder named with your Student ID (e.g.,
12345678) inside thesubmissiondirectory. - Place all required files inside this folder:
INFO.mdorREADME.md(with your Name and Student ID)ProofOfExistence.sol(Solidity source code)deployment.txtorINFO.md(deployed contract address on Sepolia)- Verified contract URL on Sepolia Etherscan (in
deployment.txtorINFO.md) - Screenshots:
screenshots/deployment.png(deployment in Remix)screenshots/notarize.png(successfulnotarizeDocumentcall)screenshots/verify_true.png(verifyDocumentreturning true)screenshots/verify_false.png(verifyDocumentreturning false)
reflection.md(Reflection, 150–250 words)- Any auxiliary files (such as test scripts, Hardhat config, or additional documentation)
Make sure all files are organized and clearly named in your PR.
You may want to consult the documentation from Github to learn how to make a PR.
- (10) Correct state variables & constructor.
- (15)
notarizeDocumentworks (checks, stores, emits event). - (10)
verifyDocumentworks as required. - (5) Code formatted & commented.
- (10) Contract deployed to Sepolia.
- (10) Contract verified on Etherscan.
- (10) Screenshots demonstrate interactions.
- (10) All required info present & correct.
- (10) Screenshots clear & relevant.
- (10) Reflection thoughtful & meets word count.
Academic Honesty: All submitted work must be your own. Plagiarism will be dealt with according to university policy.
Good luck!
GDP