Radica is a project that aims to provide authentication for products using NFC and Blockchain technology. This repository contains the smart contracts that will be used to manage the authentication process along with other features.
- Node.js
- NFC Reader (ACR122U)
- NFC Tags (ISO 14443, Type 2, NFC Forum Type 2)
Warning
Node at version 23 has some incompatibilities with the nfc-pcsc library. Please use Node version 22 or lower.
Note: If you do not have an NFC Reader or NFC Tags, you can still run the project without them. You will not be able to test the NFC functionality, but you can still test the smart contracts.
Clone the repository and install the dependencies.
git clone https://github.com/RadicaDev/radica-contracts.git
Change directory to the project folder.
cd radica-contractsInstall the dependencies.
npm installTo deploy the smart contracts to a local blockchain, use the following command.
npx hardhat node --hostname 0.0.0.0Note: The
--hostnameflag is used to allow connections from other devices on the network. If you do not want to use the mobile app, you can omit this flag.
In a new terminal, deploy the contracts to the local blockchain.
npx hardhat ignition deploy ./ignition/modules/RadicaTag.ts --network localhostBefore creating a new tag, you need to initialize it. Be sure to have the cryptographic keys in the ./crypto-keys folder.
Run the following command to create the keys.
node init-keys.cjsRun the following command to initialize the tags.
npx hardhat run scripts/init-tags.tsExit with Ctrl + C when you have initialized all the tags.
Note: The
init-tags.tsis needed since we are not using the official NFC tags. In order to make this tool accessible to everyone, we use standard NFC tags and we simulate the signature verification process.
To create a new tag, use the following command.
npx hardhat run scripts/create-tag.ts --network localhostYou can also use the create-tags.ts script to create multiple tags at once.
To verify a tag, use the following command.
npx hardhat run scripts/verify-tag.ts --network localhostYou can also use the verify-tags.ts script to verify multiple tags at once.
To run the tests, use the following command.
npm test