When sensor measurements are captured digitally, the information is formatted to be processed by some software. Spatial data comes in many different formats - GeoJSON, KML, shapefiles, GeoTIFFs, cryptospatial coordinates etc etc.
Astral endeavors to design an open and agnostic protocol that will gracefully develop and evolve with the state of spatial computing. We also expect full trustlessness, self sovereignty and independent verifiability of all protocols we design. This requires a versatile, Web3-native spatial data identification, encoding and storage scheme.
To achieve this, with support from the Filecoin Foundation and London Blockchain Labs, we have drafted a GeoDID Method Specification and prototype modules and smart contracts to create, read, update and deactivate these geographic decentralized identifiers and the data assets they reference.
GeoDIDs will identify these files by wrapping the spatial data assets in DID documents, thereby providing a standard schema to grant the user verifiable control and enable trustless interoperability. Different spatial data formats will be supported through GeoDID Extensions - meaning GeoDIDs can support any current or future digital spatial data format. Required member variables will include relevant metadata to enable comprehensive indexing and use of the spatial data a GeoDID identifies.
We have designed the initial draft of the spec and would be curious for feedback from you or anyone interested when we release the spec to the community for review.
GeoDIDs are agnostic to the spatial data assets being identified. However, we are designing the alpha implementation of the GeoDID modules to rely on IPFS by default, so we can cryptographically verify the integrity of the data assets referenced.
The GeoDID Method Specification can be found here, and writing on the extensions here. A repository containing our prototype implementation of a GeoDID system is here.
A primer on DIDs before we go into the Core Specification of GeoDIDs
Decentralized identifiers (DIDs) are a new type of identifier that enables verifiable, decentralized digital identities. A DID identifies any subject (e.g., a person, organization, thing, data model, abstract entity, etc.) that the controller of the DID decides that it identifies. DIDs are URIs that associate a DID subject with a DID document allowing trustable interactions associated with that subject.
Each DID document can express cryptographic material, verification methods, or service endpoints, which provide a set of mechanisms enabling a DID controller to prove control of the DID.
To learn more about DIDs and why they're useful:
We are early in developing the GeoDID spec. For now, we are focused on storing
geojson
vector spatial data structures, andgeotiff
raster data. The GeoDID specification is designed to be flexible and identify any spatial dataset in any format - even ones that haven't been developed yet.
Geographic decentralized identifiers, or GeoDIDs, are DIDs designed to identify spatial data assets and to be compatible with any distributed ledger or network. Spatial data has unique properties that require special treatment - the GeoDID Method Specification defines an approach in creating, reading, updating and deleting identifiers for these assets using DIDs. In creating a GeoDID, data controllers permissionlessly create irrevocable, cryptographically-verifiable identities for spatial data assets that can be useful in decentralized applications
The objective of the GeoDID is to encourage contribution to the DID specification and Linked Data Signatures to identify and ensure trustable spatial data. This will allow rapid development of extensions to these without requiring the usage of trustless infrastructures such as blockchains or other distributed systems.
The GeoDID is inspired by the SpatioTemporal Asset Catalog (STAC) specification and utilizes a similar linked data structure. The structure alleviates a handful of problems associated with traversing large datasets, and allows for ease of use for the end user. Spatial data assets are identified in the service endpoints of the GeoDID document. These service endpoints can be classed as either Collections or Items. Each "Collection" contains a number of child Collections or Items; and each "Item" will contain several service endpoints that dereference to geospatial data assets. This hierarchy of encapsulating linked data within the GeoDIDs will allow for user's to find or create the data/datasets that they need easily.
The namestring that shall identify this DID method is: geo
.
A DID that uses this method MUST begin with the following prefix: did:geo
. Per the DID specification, this string MUST be in lowercase. The remainder of the DID after the prefix, is specified below.
did:geo:<geo-specific-identifier>
All GeoDIDs are base58 encoded using the Bitcoin / IPFS alphabets of a 16-byte UUID.
geo-did = "did:geo:" + geo-specific-identifier
geo-specific-identifier = new CID(0, 'dag-pb', hash, 'base58btc')
hash = multihash(byte, sha2-256)
byte = new TextEncoder().encode(ethereum address + UNIX Time)
For the draft version of this specification, <geo-specific-identifier>
referenced above is created by computing a sha2-256 multihash on the byte representation of the DID controller's ethereum address + Unix time: multihash(ethAddress + time, sha2-256).
Then we create a new CID Block by encoding the multihash with a base58 encoding. This will return a cid that will act as the identifier for the GeoDID.
The service
array in the GeoDID will contain several references to other GeoDIDs and/or assets. The idea is that if the GeoDID is the root DID in the hierarchy, regardless of its type, then it has the base DID identifier. If the GeoDID is a sub-collection or sub-item then it is referenced via path, and if it is an asset within the sub-item's service array, then it is referenced via fragment.
Standalone or Root GeoDIDs using the Base DID Identifier:
did:geo:9H8WRbfd4K3kQ2NTxT6L2wTNyMj1ARCaVVsT5GJ87Jw2
Paths reference other GeoDID sub-Collections or sub-Items:
did:geo:9H8WRbfd4K3kQ2NTxT6L2wTNyMj1ARCaVVsT5GJ87Jw2/sub-collection-A/sub-item-1
Fragments reference assets within the GeoDID sub-Items:
did:geo:9H8WRbfd4K3kQ2NTxT6L2wTNyMj1ARCaVVsT5GJ87Jw2/sub-collection-A/sub-item-1#raster-image-1
did:geo:9H8WRbfd4K3kQ2NTxT6L2wTNyMj1ARCaVVsT5GJ87Jw2/sub-collection-A/sub-item-1#thumbnail
In order to create a GeoDID, a method specific identifier must be created, which will be used to build the document. After the method specific identifier is created, the user will need to select the type of Document they would like to create, Collection or Item.
ECDSA keypair. (for the alpha version of the specification - future versions may be agnostic to which digital signature algorithm is used).
Spatial data asset(s), or URI(s) resolving to spatial data asset(s), along with relevant metadata / attribution.
If GeoDID Collection, some information about the relationships between the spatial data assets being identified.
Create Method Specific Identifier described in (2), above.
User chooses which type of GeoDID they want to create (Collection or standalone Item).
If the user decides to create a standalone Item then they just upload the assets, did-metadata information, and item-metadata they want in the DID. The GeoDID will be built, pinned on IPFS, and anchored on the Ropsten Testnet.
If the user decides to create a Collection then the client will build a collection GeoDID and return the GeoDID ID. The GeoDID will be built, pinned on IPFS, and anchored on the Ropsten Testnet.
The user will save this GeoDID ID to append children sub-collections or sub-items as children.
If the user decides to add children to the sub-collection, they repeat step 4, and use the returned GeoDID ID + Collection path to append more leaf nodes.
If the user decides to add items to the collection, they repeat step 3, until they finish adding all items.
In the near future, we will also create automation features to create trees, by uploading folders with files in it. We hope this will kill two birds with one stone, so the user will only need to prepare the data once, and upload it in bulk.
In the alpha implementation of the specification a GeoDID document can be resolved by invoking the resolve(<GeoDID ID>)
method at contract address <0x___TBD___>
on Ethereum's Ropsten testnet. This contract method will first verify that the user has access to this GeoDID by checking to make sure that his address registered the GeoDID via the create method. The contract will store a mapping from the user's address to GeoDID IDs.
Once the user has been authenticated, the contract will trigger an event that the astral-protocol-core package will be listening for. From there the geo-did-resolver will handle the rest, and dereference to the proper GeoDID Document.
The GeoDID Document can then be parsed and analyzed by the client, or spatial data assets can be fetched from their respective service endpoints. Do note that sometimes data assets will be identified by CIDs and stored on the IPFS network, while other service endpoints may be HTTP URLs - appropriate resolution methods will be required.
Controller Address
Each identity always has a controller address. To check the read only contract function identityOwner(address identity)
on the deployed version of the ERC1056 contract.
The identity controller will always have a publicKey
with the id set as the DID with the fragment #key
appended.
An entry is also added to the authentication
array of the DID document with type Secp256k1SignatureAuthentication2018
.
Service Endpoints are relevant in both GeoDID Controllers **<Collections?>**¸ and Items. It exists to list relevant relationships to and from itself. <?Each object in the> service array will contain a required link field and several that contain the GeoDID ID, its relationship to the DID ID, and a reference link if the controller needs to dereference it. The purpose of the link field is to enables browsers and crawlers to access the sets of Items, in an organized and straightforward way. These service endpoints can also contain references to assets that are related to a specific item.
The GeoDID Document identified by the CID can the be resolved using a browser with native IPFS support (ipfs://<CID>
), or by resolving via a gateway, like ipfs.io/ipfs/<GeoDID Document CID>
The DID Document may be updated by invoking the update(<GeoDID ID>)
method at contract address <0x_____>
on the Ropsten testnet.
Once the address has been verified as the DID controller, an oracle function will be invoked and will trigger an off chain event to open the GeoDID Document for the user to update. When user is done updating, they can submit the update, which will compute the CID of the GeoDID Document and compare the block to the previous CID version.
If the CIDs differ, the client will append the timestamp of the update within the GeoDID Document, recalculate the finalized CID, and will append a new Record in the astral-core-package. The updated CID will be returned via the oracle, and appends to the end of the array of GeoDID Document CIDs, meaning users can fetchVersionHistory(<GeoDID fragment>)
and retrieve all the CIDs of historical GeoDID documents.
A GeoDID Controller can revoke access to a GeoDID by invoking the deactivate(<GeoDID fragment>)
method. This simply sets that GeoDID's GeoDIDActive
record to false
- it does not remove information from the smart contract about the historical versions of the GeoDID. It does, however, mean that future attempts to resolve that GeoDID will not succeed.
Once we develop it, we will store code at https://github.com/AstralProtocol as a reference implementation of this DID method.\
The Core Specification of the GeoDID; includes default fields for specification.
There are two "types" of GeoDID Specifications under the Astral Protocol, that work together to enable structure between resources. At their core, they are both extensions of the DID and default GeoDID specification. However, they differ in their functionality and purpose, in order to enable a better user experience for all users.
The GeoDID Collection - A GeoDID Collection is a simple, flexible JSON file of service endpoints that provides a structure to organize and browse GeoDID Items. The collection is responsible for bundling a set of items or sub collections, by utilizing links to reference other child Collections or Items . The division of sub-collections is up to the implementor, but is generally done in order to make the end user's UX easier.
The GeoDID Item - A GeoDID Item is an extension of the Default GeoDID Structure. Unlike its counterpart, the GeoDID Item is responsible for identifying a particular resources and referencing relative assets, through the service endpoints. GeoDID Items can only act as the leaves of the tree and cannot link to other items or collections. It can only reference assets like raster imagery, videos, geojson and reference linked parent DID Documents.
id
string
REQUIRED The identifier for the DID Document. It can be the root DID ID or it can be a DID URL with a specific path or fragment. The id must be of the following format: did:<method>:<specific identifier>. The path(.../path), query(...?query), and fragment(...#fragment) are optional but will be used later as identifiers for the children collections and items.
authentication
[Authentication Object]
OPTIONAL BY DEFAULT Authentication is a process (typically some type of protocol) by which an entity can prove it has a specific attribute or controls a specific secret using one or more verification methods. With DIDs, a common example would be proving control of the private key associated with a public key published in a DID document.
did_metadata
did_metadata Object
REQUIRED The did_metadata object contains relative metadata pertaining to the particular GeoDID. For example, timestamps for the CRUD operations, the type of GeoDID, descriptions, etc.
service
Service Object
REQUIRED The service object contains several sub fields used to reference metadata, other GeoDIDs, and/or assets.
The publicKey
verification relationship is used to specify how the DID subject is expected to be authenticated, for purposes such as performing CRUD operations on the DID Document. However, the PublicKey Object is OPTIONAL by default as stated by the W3C working groups' DID specification.
id
string
The GeoDID ID + key fragment which will be used to reference the controllers public key.
type
string
The type of Verification method being used. (ex. Ed25519VerificationKey2018, Secp256k1VerificationKey2018)
controller
string
The GeoDID ID which will be used to reference the controllers.
ethereumAddress
string
The Ethereum address of the controller.
Note: Do not worry about this field as it will automatically be populated with the user's Ethereum address.
type
string
REQUIRED The type can either be a Collection or Item. ****
subtype
string
REQUIRED The subtype can either be a GeoJSON or Raster.
created
string
REQUIRED UPON CREATION The GeoDID package will automatically timestamp the GeoDID upon creation.
updated
string
REQUIRED UPON UPDATE The GeoDID package will automatically timestamp the GeoDID upon an update. If the GeoDID Document never updates then there will not be a
description
string
OPTIONAL A description describing the GeoDID Document. It can be anything but most likely the description will address the DID subject.
The Metadata Object array will contain an array of Metadata related to the assets or links within the GeoDID. (ex. List of Spatial Data Providers who provided the data, GeoJSON Feature)object list contains all the assets the GeoDID Item will need to reference.The Assets Object array will contain a list of references to assets relative to the GeoDID Item.
id
string
REQUIRED The DID URL that dereferences to the entity's metadata. [#metadata]
type
string
REQUIRED The type of metadata (ex. collection-metadata, item-metadata), or the type of the asset. (ex. GeoTIFF, geoJSON, JSON, CSV)
serviceEndpoint
string
REQUIRED The actual link in the format of an URL or CID. Relative and absolute links are both allowed.
This object list describes the one-to-many relationships with other GeoDIDs. These entities can be sub-collection or sub-item GeoDIDs. This object field will come in handy when a user needs to traverse or scrape a data collection.
id
string
REQUIRED The DID URL that dereferences to the entity's GeoDID Document. This field is required if you want to create a hierarchy of GeoDID Documents (ex. GeoDID collection is parent to GeoDID Items or Collections).
type
string
REQUIRED See chapter "Endpoint types" for more information.
rel
string
REQUIRED Relationship between the current document and the linked document. See chapter "Relation types" for more information.
The Collection Specification of the GeoDID; includes the collection's fields for specification.
As of right now, the Collection extends the default GeoDID Specification without any added fields. It is up to the user to add what they deem necessary,. However, the collection must function as a DID that will reference other DID documents or URL links. The metadata added to it must reflect that.
The Item Specification of the GeoDID; includes the item's fields for specification.
Spatial data assets identified by GeoDIDs will come in a particular format, likely with information about the spatial reference system, attribution and other metadata. GeoDID extensions will enable the GeoDID Core Spec to expand to support any type of spatial data asset - legacy, current, or future.
Under construction - stay tuned! @AstralProtocol
Under construction - stay tuned! @AstralProtocol
Under construction - stay tuned! @AstralProtocol
As part of our exploration process we build a system for storing geospatial data on IPFS for a Filecoin Development Grant in Q1 2021. This work has informed our thinking abourn building tools for Web3-native satellite imagery, which we're carrying forward.
This project was experimental, and code is not stable. If you'd like to build with Astral tools, reach out on Discord: https://discord.gg/4WPyYvRtzQ.
We're developing Geographic Decentralized Identifiers (GeoDIDs) to provide a Web3-native format for identifying spatial data assets.
To date our oracle systems are quite simple, and we're looking for developers who are interested in implementing those to pull spatial data from GeoDIDs into smart contracts.
We have been developing patterns and libraries to work with spatial data in smart contracts for a few years now, and are looking for additional support. Specifically, we are working on:
A Solidity library of geometric and topological functions, much like Turf.js.
A verifiable spatial data registry for GeoDIDs:
A zone registry, where users can control polygons representing areas of space on, beneath or above the Earth's surface.
Front-end packages and dApp interfaces to connect with spatial contracts.
Follow these simple steps to register GeoDIDs quickly
In order to store the GeoDIDs created by the core package, you will need to start up a local Powergate client or connect to an existing hosted client. Below will be a brief overview on how to setup a local Powergate client on your system. Further information is available at: https://github.com/textileio/powergate.
In your terminal, create a new directory and clone the Powergate repo into it:
git clone https://github.com/textileio/powergate.git
After you clone the repo, enter the following commands:
cd powergate/docker
make localnet
More information regarding Powergate's Localnet mode, please refer to their documentation: https://github.com/textileio/powergate#localnet-mode
Documentation about the Astral Protocol Core Package.
The @astralprotocol/core package is a Typescript NPM package that is responsible for any CRUD operations performed on the DID Documents. This includes the creation of DID Documents, loading the DID Documents, as well as updating them. The package also has utilities that enable the creation of the collision resistant GeoDID IDs, a custom **** did-resolver that enables DID Resolution, as well as pinning features for storing the Documents on IPFS or FFS. This package is meant to be used in conjunction with the @astralprotocol/contracts **** and @astralprotocol/subgraph **** packages. However, the package can also be used independently if the user does not want to rely on the Ethereum network.
Set up a local Powergate Client
In order to store the GeoDIDs created by the core package, you will need to start up a local Powergate client or connect to an existing hosted client. Below will be a brief overview on how to setup a local Powergate client on your system. Further information is available at: https://github.com/textileio/powergate.
In order to setup the Powergate Client locally on your system you must have Docker, Docker-Compose, and Go 1.16 installed.
In your terminal, create a new directory and clone the Powergate repo into it:
git clone https://github.com/textileio/powergate.git
After you clone the repo, enter the following commands:
cd powergate/docker
make localnet
For more
information regarding Powergate's Localnet mode, please refer to their documentation: https://github.com/textileio/powergate#localnet-mode
Check an implementation of core package:
API for the @astralprotocol/core package
Creates a new AstralClient Instance to utilize the following functions.
new AstralClient(_ethAddress, _endpoint?);
_ethAddress
string
REQUIRED
The Ethereum Address of the user.
_endpoint
string
OPTIONAL
The Graph Endpoint. Already has a default value that can be overloaded with another endpoint.
Creates a GenesisGeoDID Document. This creates a new root node for the linked data structure.
async createGenesisGeoDID(_typeOfGeoDID: string): Promise<IDocumentInfo>{}
Name
Type
Attributes
Description
_typeOfGeoDID
GeoDidType
REQUIRED
The type of Genesis GeoDID you want to create. OfType GeoDidType.
IDocumentInfo
Returns info regarding the Document Type, like the geodidid and the Document Itself.
Creates a Child GeoDIDDocument. This creates a child node for an existing linked data structure.
async createChildGeoDID(_typeOfGeoDID: string, _parentID: string, _path: string): Promise<IDocumentInfo>{}
_typeOfGeoDID
GeoDidType
REQUIRED
The type of Genesis GeoDID you want to create. OfType GeoDidType.
_parentID
string
REQUIRED
The Parent GeoDID ID of this new Child GeoDID
_path
string
REQUIRED
The path that will be appended to the Parent GeoDID ID
DocumentInfo
Returns information regarding the Document, like the GeoDID ID and the contents of the Document.
Pins the Document to IPFS or FFS via Powergate.
async pinDocument(_documentInfo: IDocumentInfo, _token?: string): Promise<IPinInfo>{}
_documentInfo
IDocumentInfo
REQUIRED
The Info related to the Document that is required for pinning.
_token
string
OPTIONAL
The Auth Token of the Powergate Instance that you want to pin the document on. If you don't have one yet, the client will automatically create a new one for you and return it for you to save.
IPinInfo
Returns information regarding the Pin, like the GeoDID ID, cid, Powergate Auth token, and the pinDate.
Loads the Document by the DocID and the Powergate Auth token associated with it.
async loadDocument(_docId: string, _token: string): Promise<ILoadInfo>{}
_docId
string
REQUIRED
The GeoDID id of the DID Document.
_token
string
REQUIRED
The Auth Token for the Powergate Instance that the Document in stored on.
ILoadInfo
Returns information regarding the Load, like the DocumentInfo as well as the Powergate Instance that the Document was pinned on.
Documentation about the Astral Protocol Contracts Package.
These contracts serve as the Registry for the Astral Protocol GeoDIDs. It allows binding of a GeoDID to an ethereum address and CID name resolving.
By registering a spatial asset Smart Contract events are triggered, which are picked up by the subgraph indexer to build the tree of relationships for easy querying.
Clone the astralprotocol repository and go to packages/contracts:
Run ganache yarn ganache
In a new terminal, deploy contracts with yarn truffle
Run tests with yarn truffle-test
You can deploy an instance by running yarn new-instance
. It builds a GeoDID tree with hardcoded GeoDID ids and CIDs.
You can test the removal of some links by running yarn remove-links
.
Watch the changes in a locally deployed subgraph.
Do coverage check up by killing the ganache
process in the first terminal and running yarn coverage
Create a .env
file in /packages/contracts
with a MNEMONIC
and ROPSTEN_API_KEY
API for the @astralprotocol/contracts package
constructor
Initiates the smart contract with an hardcoded uri type representing the did method (did:geo). Also initiates the msg.sender as the default admin and as a data supplier role.
registerRole
Registers a new user with the ability to register a spatial asset. Contract creator is hardcoded as default admin and data supplier roles.
enableStorage
Registers a new storage that can accept GeoDID document creation.
Name
Type
Attributes
Description
offChainStorage
bytes32
REQUIRED
Bytes32 representation of the off-chain storage signature to be enabled
disableStorage
Disables an existing storage.
Name
Type
Attributes
Description
offChainStorage
bytes32
REQUIRED
Bytes32 representation of the off-chain storage signature to be disabled
registerSpatialAsset
Registers on-chain one Spatial Asset.
Name
Type
Attributes
Description
owner
address
REQUIRED
To be designated the owner of the GeoDID. Currently must be msg.sender.
geoDIDId
bytes32
REQUIRED
GeoDID Id generated with the GeoDID creation (check @astralprotocol/core)
parentGeoDIDId
bytes32
OPTIONAL
GeoDID Id of the parent. Must be set to 0 if no parent is to be added.
childrenGeoDIDIDs
bytes32[]
OPTIONAL
GeoDID IDs of the children. Must be set to [] if no children are to be added.
cid
bytes32
REQUIRED
CID of the GeoDID Document generated with its creation (check @astralprotocol/core)
offChainStorage
bytes32
REQUIRED
Bytes32 representation of the off-chain storage signature (must be pre-approved)
geoDIDtype
uint256
REQUIRED
0 for Collection type GeoDIDs, 1 for Item type GeoDIDs. emit SpatialAssetRegistered(owner, geoDIDId, cid, offChainStorage, geoDIDId, _canBeParent[geoDIDId]);
SpatialAssetRegistered
address indexed to, bytes32 indexed geoDIDId, bytes32 indexed cid, bytes32 offChainStorage, bytes32 root, bool canBeParent
Successful registration of a GeoDID
ParentAdded
bytes32 indexed geoDIDId, bytes32 indexed parentGeoDIDId
If parentGeoDIDId is different than 0
ChildrenAdded
bytes32 indexed geoDIDId, bytes32 indexed childrenGeoDIDId
If the childrenGeoDIDIds array is not empty and the GeoDIDs exist
addChildrenGeoDIDs
Adds children GeoDIDs to an existing GeoDID. GeoDIDId must correspond to a GeoDID type that can be a parent (Collection or type 0).
Name
Type
Attributes
Description
geoDIDId
bytes32
REQUIRED
GeoDID Id generated with the GeoDID creation and registered in the smart contract
childrenGeoDIDIDs
bytes32[]
OPTIONAL
GeoDID IDs of the children. Must be set to [] if no children are to be added (nothing is executed in the function)
ChildrenAdded
bytes32 indexed geoDIDId, bytes32 indexed childrenGeoDIDId
If the childrenGeoDIDIds array is not empty and the GeoDIDs exist
addParentGeoDID
Adds a GeoDID as a parent to an already existing GeoDID.
Name
Type
Attributes
Description
geoDIDId
bytes32
REQUIRED
GeoDID Id generated with the GeoDID creation (check @astralprotocol/core)
parentGeoDIDId
bytes32
REQUIRED
GeoDID Id of the parent. It must exist.
ParentAdded
bytes32 indexed geoDIDId, bytes32 indexed parentGeoDIDId
If parentGeoDIDId exists
removeChildrenGeoDIDs
Removes children GeoDIDs from a specified GeoDID.
Name
Type
Attributes
Description
geoDIDId
bytes32
REQUIRED
GeoDID Id generated with the GeoDID creation (check @astralprotocol/core)
childrenGeoDIDIds
bytes32[]
OPTIONAL
GeoDID IDs of the children. Must be set to [] if no children are to be removed.
ChildrenRemoved
bytes32 indexed geoDIDId, bytes32 indexed childrenGeoDIDId
If the childrenGeoDIDIds array is not empty and the GeoDIDs exist.
removeParentGeoDID
Removes a specified parent GeoDID from a GeoDID.
Name
Type
Attributes
Description
geoDIDId
bytes32
REQUIRED
GeoDID Id generated with the GeoDID creation (check @astralprotocol/core)
parentGeoDIDId
bytes32
REQUIRED
GeoDID Id of the parent to remove. It must exist.
ParentRemoved
bytes32 indexed geoDIDId, bytes32 indexed parentGeoDIDId
If parentGeoDIDId exists
deactivateSpatialAsset
De-registers a spatial asset.
Name
Type
Attributes
Description
geoDIDId
bytes32
REQUIRED
GeoDID Id generated with the GeoDID creation (check @astralprotocol/core)
childrenGeoDIDIds
bytes32[]
OPTIONAL
GeoDID IDs of the children. Must be set to [] if no children are to be removed.
SpatialAssetDeactivated
bytes32 indexed geoDIDId, bytes32[] **** childrenToRemove
If geoDIDId exists
Documentation about the Astral Protocol Subgraph Package.
The @astralprotocol/subgraph serves as the indexing engine of the protocol, capturing the registration and modification events of GeoDIDs in the @astralprotocol/contracts. It acts like a decentralized querying database where it is substantially easier to make complex queries to the Spatial Assets registry. It is used to create the tree of GeoDID nodes that represents their relationships and groupings.
The current version of the subgraph (spatialassetsfinalv1) is indexing the Ethereum Roptsten network at the following GraphQL endpoints:
You can connect to these with your GraphQL client of choice or try them at The Graph's playground.
Clone the astralprotocol repository and go to packages/subgraph
Run sudo apt-get install libsecret-1-dev
Run git clone https://github.com/graphprotocol/graph-node/
(check setup instructions for docker version on https://thegraph.com/docs/)
Have the development steps of @astralprotocol/contracts done previously (with Ganache)
Ensure you have ganache running with the contracts deployed from packages/contracts
Update the SpatialAssets contract address that you got from the previous step in the subgraph.yaml
(if needed and ensure the correct file is named according to the network of deployment - for ganache it should read as mainnet: backup the current subgraph.yaml
file and rename it to subgraphRopsten.yaml
).
In another terminal, inside the graph-node folder, run cd docker && docker-compose up
. If using Docker for WSL, Docker must be running on Windows. If graph-node throws an error try clearing the data/postgres
folder, within the docker directory of graph-node, with sudo rm -rf data/postgres
. Restart docker if needed.
Generate subgraph typescript files with yarn codegen
, then create and deploy the subgraph to the graph-node with yarn create-local && yarn deploy-local
You can query the subgraph and view the GeoDID tree in the local provided endpoint.
The following query can be provided to the graphql endpoint to view the GeoDIDs tree (after doing the deployment steps above):
Planned upgrades to the GeoDID Method Specification
GeoDIDs identify spatial data assets. DIDs support selectors, paths, query parameters and fragments. These additional details that can be included in a GeoDID offer a powerful way to efficiently represent and store large spatial datasets in a much more resource-constrained manner that is still persistent, cryptographically verifiable and optionally private.
The next phase of research and development will be for GeoDIDs that support spatial querying and clipping.
For example, consider GeoDID representing a collection of satellite imagery. We should be able to specify a sub-collection, or even item, that defines a spatial and temporal query in the GeoDID itself. That way, a user could store a single GeoDID that specifies a single image, clipped to a particular area, extracted from the GeoDID Collection. The user would not need to store that clipped image, but only the GeoDID with query parameters - they would still have the confidence that the GeoDID would resolve to the same clipped image permanently.
This would be crucial for the auditability of spatial finance applications. A satellite image might prove that a particular green infrastructure project was completed by a certain date, or that some insured natural capital warranted a payout. For both traditional and decentralized spatial finance, this verifiability will likely bring a lot of value to
See Decentralized Identifiers by Dr Phil Windley for more details on selectors, paths, query parameters and fragments.