-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
2,841 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Programmable Society NFT Certificate | ||
|
||
|
||
NFTs are a great solution for solving the authencity problem in education. How to make sure that somebody holds a particular degree or has passed a particular course? With NFT, the authencity is verifiable via cryptographic identity. For example, only the course certificates signed by a univeristy or professor secret key can be considered authentic. In 2023 at KTH course "Programmable Society with Smart Contracts", we have given an NFT course certificate to the students who passed the course. It's a first for KTH and possibly for Sweden. Read more at <https://www.monperrus.net/martin/nft-course-certificate>. | ||
|
||
## Content | ||
|
||
This folder contains the code for the Programmable Society NFT Certificate: | ||
|
||
- `DD2485.sol` the contract | ||
- `metadata.json` the metadata to be hosted on IPFS | ||
- `nft-certificate-programmable-society-2023.odt` the image of the certificate that will be hosted on IPFS (as PNG export) and visible on your favorite NFT platform | ||
|
||
Design decision: | ||
- the contract is soulbound | ||
- the contract and NFT metadata are not dated in order to bereused in subsequent editions and save gas. The minting transaction date gives the real year. | ||
|
||
## Deployment | ||
|
||
- `DD2485.sol`: [0xf098f2d49118c339a52406482fdc975dc5e82617](https://etherscan.io/address/0xf098f2d49118c339a52406482fdc975dc5e82617) [transaction](https://etherscan.io/tx/0xbb1960300982c2f8d33ebdd48e756b3ea500387a80801089c21f049b14b35338) | ||
- `metadata.json` [ipfs://QmV2VNRws2GUvMV1CDdirQ4rptUQ6V9Vadi2UQ2XvtSGsQ](https://cloudflare-ipfs.com/ipfs/QmV2VNRws2GUvMV1CDdirQ4rptUQ6V9Vadi2UQ2XvtSGsQ) | ||
- `nft-certificate-programmable-society-2023.odt` [ipfs://QmZrF8Lbhhkay4nSUWykYkHfRHMaHnbfFYAMDvEKy8qjZj](https://cloudflare-ipfs.com/ipfs/QmZrF8Lbhhkay4nSUWykYkHfRHMaHnbfFYAMDvEKy8qjZj) | ||
|
||
## Infrastructure | ||
|
||
This is a hardhat project. | ||
|
||
```shell | ||
npx hardhat help | ||
npx hardhat compile | ||
# contracts in artifacts/contracts/DD2485.sol | ||
npx hardhat test | ||
REPORT_GAS=true npx hardhat test | ||
npx hardhat node | ||
npx hardhat run scripts/deploy.ts | ||
``` | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.20; | ||
|
||
import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; | ||
import "@openzeppelin/contracts/access/Ownable.sol"; | ||
|
||
contract DD2485 is ERC721, Ownable { | ||
|
||
uint256 private _tokenIdCounter; | ||
|
||
constructor() ERC721("KTH_DD2485", "KTH_DD2485") Ownable(msg.sender){ | ||
|
||
} | ||
|
||
function tokenURI(uint256) public pure override returns (string memory) { | ||
// https://cloudflare-ipfs.com/ipfs/QmV2VNRws2GUvMV1CDdirQ4rptUQ6V9Vadi2UQ2XvtSGsQ | ||
return string("ipfs://QmV2VNRws2GUvMV1CDdirQ4rptUQ6V9Vadi2UQ2XvtSGsQ"); | ||
} | ||
|
||
function safeMint(address to) public onlyOwner { | ||
_safeMint(to, _tokenIdCounter); | ||
_tokenIdCounter += 1; | ||
} | ||
|
||
function burn(uint256 tokenId) external { | ||
// Only the owner of the token can burn it. | ||
require(ownerOf(tokenId) == msg.sender); | ||
_burn(tokenId); // this is an internal function | ||
} | ||
|
||
function transferFrom(address from, address to, uint256) public pure override { | ||
// This a Soulbound token. It cannot be transferred. It can only be burned by the token owner. | ||
require(false); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"name": "Course Certificate - Programmable Society DD2485 - KTH Royal Institute of Technology", | ||
"description": "The owner of this NFT has successfully passed KTH Course Programmable Society DD2485, examined by Professor Martin Monperrus and Professor Benoit Baudry", | ||
"image": "ipfs://QmZrF8Lbhhkay4nSUWykYkHfRHMaHnbfFYAMDvEKy8qjZj" | ||
} |
Oops, something went wrong.