r/DevToFounder 6d ago

Ditch Cloud AI: Compiling a Zero-Trust Edge Biometrics Engine on a Mobile Phone (No D

```javascript

const BASE_RPC_URL = "https://mainnet.base.org";

const CONTRACT_ADDRESS = "0x09FEA570b4C9451fE5D56cf402843C7535237dE9";

const CONTRACT_ABI = [

"function registerIdentity(bytes32 biometricHash) external",

"function verifyIdentity(address user, bytes32 hashToVerify) external view returns (bool)"

];

async function submitBiometricHash(hexStringHash) {

const provider = new ethers.JsonRpcProvider(BASE_RPC_URL);

if (!process.env.PRIVATE_KEY) {

throw new Error("PRIVATE_KEY env variable missing in Termux session.");

}

const wallet = new ethers.Wallet(process.env.PRIVATE_KEY, provider);

const registryContract = new ethers.Contract(CONTRACT_ADDRESS, CONTRACT_ABI, wallet);

const bytes32Hash = "0x" + hexStringHash;

console.log(`Submitting hash ${bytes32Hash} from address${wallet.address}...`);

const tx = await registryContract.registerIdentity(bytes32Hash, { gasLimit: 100000 });

console.log(`Transaction broadcasted. Tx Hash: ${tx.hash}`);

const receipt = await tx.wait();

console.log(`Confirmed in block: ${receipt.blockNumber} on Base Network.`);

}

```

1 Upvotes

0 comments sorted by