Smart Contracts for secure Blockchain Identities, implementation of the ERC734 and ERC735 proposal standards.
Learn more about OnchainID and Blockchain Identities on the official OnchainID website: https://onchainid.com.
- Install contracts package to use in your repository
yarn add @onchain-id/solidity
- Require desired contracts in-code (should you need to deploy them):
const { contracts: { ERC734, Identity } } = require('@onchain-id/solidity');
- Require desired interfaces in-code (should you need to interact with deployed contracts):
const { interfaces: { IERC734, IERC735 } } = require('@onchain-id/solidity');
- Access contract ABI
ERC734.abi
and ByteCodeERC734.bytecode
.
- Install dev dependencies
npm ci
- Update interfaces and contracts code.
- Run lint
npm run lint
- Compile code
npm run compile
- Run
npm ci
- Run
npm test
- Test will be executed against a local Hardhat network.
npx hardhat run scripts/deploy-claim-issuer.ts --network localhost
2) Deploy identity contract (deploy identity contract and add a key if you like to verify isClaimValid):
npx hardhat deploy-identity --from 0x70997970C51812dc3A010C7d01b50e0d17dc79C8 --key 0x70997970C51812dc3A010C7d01b50e0d17dc79C8 --network localhost
npx hardhat add-key --identity <claim-issuer-contractAddress> --from 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 --key 0x90F79bf6EB2c4f870365E785982E1f101E93b906 --type 1 --purpose 3 --network localhost
const signer = await ethers.getSigner('<address-of-claim-key>');
const message = ethers.utils.arrayify(
ethers.utils.keccak256(
ethers.utils.defaultAbiCoder.encode(
['address', 'uint256', 'bytes'],
['<identity-contract-address>', 1876049749 , '0x8f3e8b45fa62fc6abf12d73c4feef3c54f0404bea83c85f1159df7de9f8f1944']
)
)
);
npx hardhat run .\scripts\signature-verify.ts --network localhost
npx hardhat add-claim --identity <identity-contract-address> --from <address-of-key-added-to-claim-issuer> --claim '{\"topic\": \"1876049749\", \"scheme\": \"1\", \"issuer\": \"<claim-issuer-contract-address>\", \"data\": \"0x8f3e8b45fa62fc6abf12d73c4feef3c54f0404bea83c85f1159df7de9f8f1944\", \"signature\": \"<input signature here>\", \"uri\": \"https://ipfs.moralis.io:2053/ipfs/QmWTqnY1TvKgmaKCjjaQFNejwfoNJRrYkKt7iaj22SxJNL/hashedEmployeedetails.json\"}' --network localhost
bash runSuper.sh