Proof of Location API

The Trusted Location API currently provides only one endpoint, more will be added in the future.

Proof of location in a circular geo-fence

API documentation

Proves the presence within a certain distance from a specific GPS location at a certain time.

post

This service allows to prove that the user has been within a certain distance from a specific GPS location, within time range [t1, t2]. Requires that the user has the IoTeX ioPay wallet installed, and enabled the Metapebble plugin.Tip: You can view the input and output data schame in the "Schema" tab and expand them.

Body
signaturestring · min: 1Required

The signature of the SIWE message created by the 'owner' address.

messagestring · min: 1Required

A SIWE (Sign In With Ethereum) message.

ownerstringOptional

The wallet address of the user of which you want to prove the location. This must be the IoTeX wallet address that the user associated to Metapebble.

Default: 0x954a4668f429C1A651aa8E0dF08C586B1272AEF6
Responses
200
Successful response
application/json
post
POST /api/pol HTTP/1.1
Host: 
Content-Type: application/json
Accept: */*
Content-Length: 176

{
  "signature": "text",
  "message": "text",
  "owner": "0x954a4668f429C1A651aa8E0dF08C586B1272AEF6",
  "locations": [
    {
      "from": 1,
      "to": 1,
      "scaled_latitude": 1,
      "scaled_longitude": 1,
      "distance": 1
    }
  ]
}
{
  "ok": true,
  "data": [
    {
      "scaled_latitude": 1,
      "scaled_longitude": 1,
      "from": 1,
      "to": 1,
      "distance": 1,
      "signature": "text",
      "devicehash": "text",
      "imei": "text"
    }
  ]
}

Mainnet

Mainnet applications can use the mainnet verifier contract to validate proofs of location obtained from this endpoint:

Testnet

Testnet applications can use the testnet verifier contract to validate proofs of location obtained from this endpoint:

Please notice that the testnet API endpoint generates proofs based on location data that is not "trusted" (i.e., test locations data generated by a script for development and test purposes). Therefore, any attempt to validate those proofs on the mainnet validator contract will fail.

Make sure you query the mainnet API for proofs of location that are supposed to be used in production.

Last updated

Was this helpful?