Coder Social home page Coder Social logo

seraph-id-smart-contracts's Introduction

Seraph ID Smart Contract Templates.

Overview

This repository contains two smart contract templates for the SeraphID Self-Sovereign identity framework:

  • Issuer (Dynamic on-chain claim registry)
  • RootOfTrust (Enabling hierarchical trust topologies)

Visit the Seraph ID official web page to learn more about self-sovereign identity!

Smart Contract Interface

Issuer

string Name();
string DID();
string PublicKey(); // The public key used to sign claims
Result GetSchemaDetails(string schemaName); // Returns all attributes attached to a schema
Result RegisterSchema(string schemaName, bool revokable, params string[] attributes); // Registers a new schema and defines revokability
Result InjectClaim(string claimID); // Injects a claim to allow for revokability
Result RevokeClaim(string claimID); // Revokes a claim
Result IsValidClaim(string claimID); // Returns a claims revocation status

Root Of Trust

string Name();
string DID();
Result IsTrusted(string issuerDID, string schemaName); // Checks if a did-schema pair is trusted
Result RegisterIssuer(string issuerDID, string schemaName); // Adds a trusted did-schema pair
Result DeactivateIssuer(string issuerDID, string schemaName); // Removes a did-schema pair

Return Types

All smart contract calls (except for static information like name, DID, PublicKey) will return a Result object with the following structure:

[
    {"type": "integer", "value": "<SUCCESSSTATUS>"},
    {"type": "<variable>", "value": "<variable>"}
]

If <SUCCESSSTATUS> is 0, an error has occured in the smart contract and the error reason will be listed as the value in the second object. The type of <variable> depends on the function being called.

Deploying

Deploying the smart contract is a prerequisite to issue claims using the Seraph ID SDK and can be done using neo-cli or neo-gui. Make sure to note down the resulting scripthash as this will be used in the Seraph ID SDK.

neo-cli

Make sure your wallet is open and contains enough GAS to pay for the smart contract creation.

neo> open wallet path\to\mywallet
neo> deploy Path\to\contract\seraph-id-issuer.avm 0710 10 true false false SeraphIssuer 2 Name Email Description

Contributing

Compiling

In order to compile the smart contracts into a avm file, the Neon compiler needs to be available in the PATH of your user.

Note: In order to build the smart contract the neon compiler needs to be run with the --compatibility flag. We recommend either building the compiler from source and changing the compatibility flag to always be on or running the neon compiler from the command line

References

License

  • Open-source MIT.

seraph-id-smart-contracts's People

Contributors

pjn82 avatar tsmcalister avatar wyattmufson avatar

Watchers

 avatar

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.