-
Notifications
You must be signed in to change notification settings - Fork 106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[+] Anchoring schemas to CORD Network #245
base: main
Are you sure you want to change the base?
Conversation
java/registry/src/main/java/dev/sunbirdrc/registry/helper/RegistryHelper.java
Outdated
Show resolved
Hide resolved
6b1691f
to
79e6ede
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think unnecessary spaces, comments and debug print statements should be removed.
java/registry/src/main/java/dev/sunbirdrc/registry/controller/RegistryEntityController.java
Outdated
Show resolved
Hide resolved
java/registry/src/main/java/dev/sunbirdrc/registry/controller/RegistryEntityController.java
Outdated
Show resolved
Hide resolved
java/registry/src/main/java/dev/sunbirdrc/registry/helper/RegistryHelper.java
Outdated
Show resolved
Hide resolved
c6086c7
to
d47a8d5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
I feel someone with more Java experience should review it once. Need a reference to documentation on this in commit log (or as a comment)
d47a8d5
to
02a5fba
Compare
C4GT 2023 | CORD Network #Issue
Anchoring schemas to the cord network
How It Works
If you are using docker, then instead of localhost, either you can try adding
dhiagent
ordocker gateway url
application.yml should be like this
In order to create schemas in sunbird-rc, we are required to hit this endpoint :
/api/v1/Schema
.I have added an environment variable
anchor_to_cord
, which needs to be set to true if you want to anchor the schema to the chainJust when you hit the endpoint
api/v1/Schema
, once the definitionsManager of SunbirdRc confirms that no other schema with same name exists, then we go for anchoring it to the cord chain.In order to anchor it to the chain, we need to hit the
api/v1/schema
endpoint of Issuer Agent, which accepts the following schema :description
property as well.In the RegistryHelper.java
a. I have defined this function
b. This function creates a proper json structure to pass as a request body to the
api/v1/schema
endpoint of Issuerand calls the
anchorSchemaAPI()
andanchorRegistryAPI()
defined in the same file.In the RegistryEntityController, under the mapping
api/v1/{entityName}
, I have added the following codeScreenshots
Schema creation & anchoring to chain
If you hit the
api/v1/Schema/{id}
endpoint, this is the response and you can see it works just fine.