This is a Next.js project bootstrapped
with create-next-app
.
Before starting the development server, please follow these steps:
Install and run Ganache to set up a local Ethereum blockchain for development. This will allow you to deploy smart contracts, develop applications, and run tests.
Use: Default rpc port: 8545 Default chain ID: 31337
As shown below:
Firstly you want to create an empty javascript project.
Then install Hardhat and have it set up in your project.
Then run the command to call hardhat;
After this, deploy the smart contracts located in the contracts
directory.
put VC.sol
in the Hardhat contracts
directory and put this in your deploy.js
const hre = require("hardhat");
async function main() {
const VC = await hre.ethers.deployContract("VC");
await VC.waitForDeployment();
console.log(
`VC deployed to ${VC.target}`
);
}
main().catch((error) => {
console.error(error);
process.exitCode = 1;
});
- Config with your Hardhat connect to Ganache
Next, deploy it:
npx hardhat run scripts/deploy.js --network localhost
Here's how Hardhard outputs the contract address
Copy the .env.example
file and fill in your own config:
- NEXT_PUBLIC_ETHEREUM_JSON_RPC your local ganache rpc url
- NEXT_PUBLIC_ETHEREUM_ISSUER_PRIVATE_KEY your private key
- NEXT_PUBLIC_ETHEREUM_CONTRACT_ADDRESS your contract address
npm run dev
Open http://localhost:3000 with your browser to see the result.
You can start editing the page by modifying pages/index.tsx. The page auto-updates as you edit the file.
API routes can be accessed on http://localhost:3000/api/issueVC. This endpoint can be edited in pages/api/issueVC.ts.
You can verify the generated VC by copying the VC result and clicking the "How does anyone verify the VC button." Then paste the VC result in the dialogue box and hit the validate VC button as shown below:
Explanation of roles in the app:
- VC owner: the identity that holds the VC / to whom the VC is issued to
- Attesting ETH address: the identity whose information is attested and proven as VC
- VC issuer: the identity that issued a VC, hard coded in the app
Please note the identity aggregation process, that is, the proving process of VC owner actually owning the attesting ETH address is intentionally omitted as it's out of this demo's scope. We'd like to focus on the VC use case and integration.
VC use case discovery and integration into your dApp (that shows VC Use case)
VC generation and privacy handling throughout the whole generation process
- an open-sourced web service, which accepts the user’s VC request, and returns a w3c-compatible VC JSON.
- an open-sourced SDK that verifies the VC generated in 1.
- Populate/self-create the VC content, but it should be on-chain and/or web2 identity-related information
- Find the VC use case in your dApp (what are you going to do with the VCs?)
- Extend the web service to diversify the ways to integrate the VC into your dApps.
Example: instead of returning the VC as bytes to the user, you can: - upload the VC bytes as SBT - trigger smart contract using the VC content - integrate the VC into wallets and manage/use VCs from there
TODO:
Must haves:
- VC content must be related to your on-chain and/or web2 identities (so nothing about your driving license for instance)
- the vc request must be triggered by the user or user-delegated service
- VC integration and use-case elaboration
Nice-to-haves:
- The data in the VC is LIVE retrieved instead of statically populated
- Highlight the privacy and/or user control during the VC integration
- The dApp of VC use-case has a working prototype
Please refer to https://github.com/litentry/litentry-parachain for more information if interested.