Verifying the proofs

The Verifier Contract

Verifying a trusted location proof on-chain consists of a call to the IoTeX location Verifier contract.
The official Verifier Contracts are deployed to the following addresses:
Network
Address
Verifier Contract IoTeX Testnet
0xB9ae925fF8318915e3266e0EA41a37408033caC6
Verifier Contract IoTeX Mainnet
0x539057424d2A1A0B7D7Af6F322f34569b967b272

Using the Verifier

From inside your smart contract, you can import the deployed instance of the Verifier like below:
pragma solidity ^0.8.0;
import "../interface/IGeoLocationDataVerifier.sol";
IGeoLocationDataVerifier public verifier;
contract YourContractName {
IGeoLocationDataVerifier public verifier;
// Construct the contract using the official GeoStream Verifier address
constructor(address _verifier) {
verifier = IGeoLocationDataVerifier(_verifier);
}
// ...
}
You should then use the Verifier in the section of your contract logic where the Proof of Location is required:
// ...
function _someLogicThatNeedsProofOfLocation(
address deviceowner, int256 latitude, int256 longitude, uint256 distance,
bytes32 deviceHash, uint256 fromTimestamp, uint256 toTimestamp,
bytes memory signature
) {
// Generate the hash of the proof
bytes32 digest = verifier.generateLocationDistanceDigest(
deviceOwner, latitude, longitude,
distance, deviceHash, fromTimestamp, toTimestamp);
// Require the proof is valid
require(verifier.verify(digest, signature), "Invalid proof signature");
// Your custom logic here
// ...
Learn more: Verifier Contract Source