This article outlines the basic principles underlying the Crypto-Spatial Coordinate system.
The most fundamental function of the CSC
contract is to make an immutable pairing between a physical address (encoded as a geohash and an Ethereum contract address.
For details behind the reasoning, see our blog post.
Below is the skeleton of the CSC
contract:
1 | contract CSC { |
To keep track of all CSC
‘s, we utilize a registry:
1 | contract CSCRegistry { |
When a CSC
gets registered in the CSCRegistry
, an event named RegisterCSC
is triggered. On the backend, we’re parsing these events and ultimately let the developer query them using our API or to subscribe to them using websockets.
A convenient way to create many CSC
s is to employ the factory pattern.
1 | contract Factory { |
The Factory
contract keeps track of both the registry and serves as a central point of deployment. It has the benefit that it is easy to track all CSC
‘s of a certain type: just look for all CSC
‘s that were deployed via the Factory
.
A later tutorial will go into detail how to query the API for CSC
‘s filtered by a specific address.