Search…
⌃K
Links

Hyperstructure & Geohashes

Hyperstructure

The GSR aims to act as a decentralized, neutral, and open protocol for declaring positions of digital assets. As such, it is designed as a Hyperstructure - a smart contract that will operate forever, without change or influence from any owner or other third party. It operates at gas cost, but applications accessing the GSR may charge fees to show GSR positions on their platforms, or even post encrypted scene data to the GSR and give out decryption keys in exchange for payments or token ownership.

Geohashes

The GSR allowing asset owners to publicly locate assets opens up novel forms of token gating. For instance, a city-focused smart contract may want to grant access to certain functions only to someone who has placed an asset in that city, perhaps for a certain amount of time. This is easy enough to calculate off-chain, and indexing services can support complex geographic queries to facilitate this. However, it may be useful to carry out this check on-chain instead. As such, the GSR supports an isWithin query that allows smart contracts on the Polygon blockchain to directly query if a specific NFT is currently located within a specific area. It does this by utilizing geohashes.
A geohash is an encoding of latitude and longitude coordinates that is optimized for fast area searches. Instead of storing the coordinates and a pair of latitude and longitude floating point numbers (which are not supported by the EVM in any case), a geohash encodes coordinates as a single string of bits, set up in such a way that each bit divides the given space in half. The more bits, the higher precision of the location description. This gives geohashes a useful property - a longer geohash definitely describes an area contained in the area described by a shorter geohash that is a prefix of the longer one. So the geohash 01101 11111 is definitely inside the geohash 01101. By storing locations as geohashes, it makes it gas-efficient to determine if a GSR Placement (which may be a small 10 meter area) is located in a set of larger geohashes (which may cover a whole city).
Traditionally, geohashes are displayed as a Base32 string. However this is not as useful on a blockchain. Instead, the geohashes are stored as a raw uint256, which may be decoded to the traditional string. However, the string version encodes more than just the raw numeric value - it also encodes the precision of the geohash. To keep this same ability in an integer system, each geohash value must be accompanied by a bitPrecision value, which encodes how many bits of the geohash number are relevant. In the GSR, these two values are collected into a single Geohash struct.