Git Product home page Git Product logo

grano-did-contract's Introduction

Grano DID Contract

Grano DID Contract is cosmwasm based did (decentralized identifier) implementation inspired by ERC1056 DIDRegistry implementation.

WARNING: Grano DID Contract is under VERY ACTIVE DEVELOPMENT and should be treated as pre-alpha software. This means it is not meant to be run in production, its APIs are subject to change without warning and should not be relied upon, and it should not be used to hold any value.

Test Contract

sh scripts/check.sh

Build Contract

sh scripts/build.sh

Start local chain

It is required to install grano-did-node first.

sh scripts/start.sh

Deploy & Interact with Contract

sh scripts/wasm.sh

Msg Type

Query

controller

{
	"controller": {
		"identifier": "grano14fsulwpdj9wmjchsjzuze0k37qvw7n7am3reev"
	}
}

attribute

{
	"attribute": {
		"identifier": "grano14fsulwpdj9wmjchsjzuze0k37qvw7n7am3reev",
		"name": "service"
	}
}

validTo

{
	"valid_to": {
		"identifier": "grano14fsulwpdj9wmjchsjzuze0k37qvw7n7am3reev",
		"name": "service",
		"value": "github"
	}
}

changed

{
	"changed": {
		"identifier": "grano14fsulwpdj9wmjchsjzuze0k37qvw7n7am3reev"
	}
}

Execute

changeController

{
	"change_controller": {
		"identifier": "grano14fsulwpdj9wmjchsjzuze0k37qvw7n7am3reev",
		"new_controller": "grano1m2pz9nj72lj2yxnpcmxqwfwk50v35gq7wd399m"
	}
}

setAttribute

{
	"set_attribute": {
		"identifier": "grano14fsulwpdj9wmjchsjzuze0k37qvw7n7am3reev",
		"name": "service",
		"value": "github",
		"validity": 1000
	}
}

revokeAttribute

{
	"revoke_attribute": {
		"identifier": "grano14fsulwpdj9wmjchsjzuze0k37qvw7n7am3reev",
		"name": "service",
		"value": "github"
	}
}

References

grano-did-contract's People

Contributors

eg-easy avatar

Stargazers

 avatar

Watchers

 avatar

grano-did-contract's Issues

【Refactor】Rename identity to identifier

Overview

I felt that "identity" was not appropriate because it encompasses a variety of information about the subject.
Since the DID's ID is only an identifier, I prefer to change the name to avoid unnecessary connotations.

[create] state for DID

Overview

Create state for DID.

  • owners (addr -> addr)
  • changed (addr-> uint)
  • nonce (addr -> uint)

📄 Add state for attributes

Overview

  • Add state for attributes
pub const ATTRIBUTES: Map<(&Addr, &String), Vec<String>> = Map::new("attribute");
pub const VALIDITIES: Map<(&Addr, &String, &String), Timestamp> = Map::new("validities");
  • Update ATTRIBUTES state when setAttribute and revokeAttribute is called.

Function

setAttribute

  • If the key is not exist, add the new key, and the value.
  • If the key is exist and the value is different, add the value.
  • If the key is exist and the value is the same, update the validity.

revokeAttribute

  • If the key is not exist, return error.
  • If the key exist and the value is different, return error.
  • If the key and value are exist, update the validity to 0.

Tasks

  • [ ]

📄 Add state for attributes

Overview

  • Add state for attributes
pub const ATTRIBUTES: Map<&String, String> = Map::new("attributes");
  • Update ATTRIBUTES state when setAttribute and revokeAttribute is called.

Function

setAttribute

  • If the key is not exist, add the new key, and the value.
  • If the key is exist, update the value.

revokeAttribute

  • If the key is not exist, return error.
  • If the key is exist, update the validity to 0.

Tasks

  • [ ]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.