@ayanworks/polygon-did-registry-contract 2.0.1-alpha.8 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md DELETED
@@ -1,141 +0,0 @@
1
- # Polygon DID Registry Contract
2
-
3
- This library is an implementation of a registry contract that supports the Polygon DID Method.
4
-
5
- ## Overview
6
-
7
- The Polygon registry contract acts as a public ledger, where the Polygon-Identity specified Decentralised Identifiers will be logged. The specifications related to polygon DID method are mentioned in the document. A DID generated using the Polygon DID generator, can be stored and managed on the ledger using this contract library.
8
-
9
- ## Contract Deployment
10
-
11
- | Network | ChainId | Registry Address |
12
- | :-------------: | :-----: | :----------------------------------------: |
13
- | Polygon Mainnet | 137 | 0x98bF771e1E93Db917A89986bcdaBa3b43643F367 |
14
- | Polygon Testnet | 80001 | 0x8B335A167DA81CCef19C53eE629cf2F6291F2255 |
15
-
16
- ## Methods
17
-
18
- - `createDID(address, string)` : The method createDID is used to create and log a new DID on the polygon chain. The parameter of address type, will act as the reference key, to refer the did document stored on the chain. The string type variable will contain the did document, that will be stored on the matic chain.
19
-
20
- - `updateDIDDoc(address, string)` : The method updateDID is included in contract, which will facilitate the controller, and only the controller of the did, to update the document if need arises. Though the Polygon DID method, defines how the DID doc is defined as per standards, and that can be resolved.
21
-
22
- - `deleteDIDDoc(address)` : The method deleteDID is included in the contract, that only the controller of DID can access, to delete a particular DID from ledger.
23
-
24
- - `getDIDDoc(address)` : The method getDID helps to resolve the DID document.
25
-
26
- - `transferOwnership(address)` : The method transferOwnership, helps in transferring the ownership of contract to a new owner. Only the current owner can access this function.
27
-
28
- - `getOwner()` : the method getOwner helps one to fetch the current owner of the contract.
29
-
30
- - `getTotalNumberOfDIDs()` : the method getTotalNumberOfDIDs helps one to fetch the total number of DIDs ever written on Polygon Ledger, with the number of currently active DIDs.
31
-
32
- - `getTotalNumberOfDeletedDIDs()`: the method getTotalNumberOfDeletedDIDs helps one fetch the total number of DIDs deleted from Polygon Ledger.
33
-
34
- - `getDIDDOcByIndex(uint256)` : The method getDIDDOcByIndex helps,to resolve DID document by index.
35
-
36
- ## Example ethers code
37
-
38
- Using ethers, the following illustrates how one can interact with PolygonRegistry contract, from client side application.
39
-
40
- ## Loading the Contract
41
-
42
- ```
43
- const ethers = require('ethers');
44
- const url = https://rpc-mumbai.matic.today; // For matic testnet
45
- const DID_ADDRESS = `<Contract Address>`;
46
- const provider = new ethers.providers.JsonRpcProvider(url);
47
-
48
- let wallet = new ethers.Wallet(`<Signer Key/Private Key>`, provider);
49
- let registry = new ethers.Contract(DID_ADDRESS, <Contract ABI>, wallet);
50
- ```
51
-
52
- ## Creating a DID
53
-
54
- ```
55
- let returnHashValues = await registry.functions.createDID(<DID address>, DidDoc);
56
- ```
57
-
58
- ## Updating a DID
59
-
60
- ```
61
- let returnHashValues = await registry.functions.updateDIDDoc(<DID address>, DidDoc)
62
- ```
63
-
64
- ## Delete a DID
65
-
66
- ```
67
- let returnHashValues = await registry.functions.deleteDIDDoc(<DID address>)
68
- ```
69
-
70
- ## Resolving a DID
71
-
72
- ```
73
- let returnDidDoc = await registry.functions.getDIDDoc(<DID address>);
74
- ```
75
-
76
- # Deploying the Contract on Matic network
77
-
78
- Pre-requisites
79
-
80
- - NodeJS
81
-
82
- ```
83
- https://nodejs.org/en/download/
84
- ```
85
-
86
- - Truffle
87
-
88
- ```
89
- https://www.trufflesuite.com/docs/truffle/getting-started/truffle-with-metamask
90
- ```
91
-
92
- - Ganache
93
-
94
- ```
95
- https://www.trufflesuite.com/ganache
96
- ```
97
-
98
- - A wallet connected to polygon network, with Matic token in it. One can receive the Matic Test Tokens from their faucet.
99
-
100
- ## Deployment
101
-
102
- Clone the above repository
103
-
104
- ```
105
- git clone https://gitlab.com/polygon-did/polygon-did-smart-contract.git
106
- ```
107
-
108
- Install Dependencies
109
-
110
- ```
111
- npm i
112
- ```
113
-
114
- Run a ganache instance (only required for Local Deployment)
115
-
116
- ```
117
- ganache-cli
118
- ```
119
-
120
- Update your and RPC URL in .env file.
121
-
122
- ```
123
- RPCURL="<Place your RPC URL here>"
124
- SIGNER="<Place your mnemonic/Private Key here>"
125
- ```
126
-
127
- On a new console window run
128
-
129
- ```
130
- truffle migrate --network <network name>
131
- ```
132
-
133
- ## Testing
134
-
135
- For Testing use the command
136
-
137
- ```
138
- truffle test
139
- ```
140
-
141
- The test cases run on a ganache setup.