blockchain-http
blockchain-http copied to clipboard
Add validator IP geolocation
we currently augment validators with this data in our apps, but this seems universally useful.
We use the free service from keycdn.com. For example this is what the explorer does. Note the user agent would be different.
const fetchGeo = (ipAddress) => async () => {
const response = await fetch(
`https://tools.keycdn.com/geo.json?host=${ipAddress}`,
{
headers: { 'User-Agent': 'keycdn-tools:https://explorer.helium.com' },
},
)
const { data: { geo } } = await response.json()
return geo
}