POST/did-registry/v5/jsonrpc
The JSON-RPC API provides methods assisting the construction of blockchain transactions and interaction with the ledger, i.e. write operation on ledger.
Request
- application/json
Bodyrequired
The body follows the JSON-RPC 2.0 specification.
It requires the following fields:
- jsonrpc: must be exactly "2.0"
- method: method to be invoked
- params: method parameters
- id: identifier established by the client
API Methods
insertDidDocument
Call to build an unsigned transaction to insert a new DID document. Requires an access token with "didr_invite" or "didr_write" scope.
Parameters:
- from: Ethereum address of the signer
- did: DID to insert. It must be for a legal entity (DID v1)
- baseDocument: JSON string containing the @context of the DID document
- vMethodId: Verification method ID. Recommended: thumbprint of the public key JWK.
- publicKey: Public key for secp256k1 in uncompressed format prefixed with "0x04"
- isSecp256k1: It must be true
- notBefore: capability invocation is valid from this time
- notAfter: expiration of the capability invocation
updateBaseDocument
Call to build an unsigned transaction to update the base document of an existing DID. Requires an access token with "didr_write" scope.
Parameters:
- from: Ethereum address of the signer
- did: Existing DID
- baseDocument: JSON string containing the @context of the DID document
addService
Call to build an unsigned transaction to create a service for an existing DID. Requires an access token with "didr_write" scope.
Parameters:
- from: Ethereum address of the signer
- did: Existing DID
- service: JSON string containing the service schema that needs to be added
revokeService
Call to build an unsigned transaction to revoke a service from a DID by a service id. Requires an access token with "didr_write" scope.
Parameters:
- from: Ethereum address of the signer
- did: Existing DID
- serviceId: Identifier of the service
addController
Call to build an unsigned transaction to add a new controller to an existing DID document. Requires an access token with "didr_write" scope.
Parameters:
- from: Ethereum address of the signer
- did: Existing DID
- controller: DID of the new controller
revokeController
Call to build an unsigned transaction to revoke a controller from a DID document. Requires an access token with "didr_write" scope.
Parameters:
- from: Ethereum address of the signer
- did: Existing DID
- controller: DID of controller to revoke
addVerificationMethod
Call to build an unsigned transaction to add a verification method. Please note that this verification method will only appear in the DID document after adding a verification relationship. Requires an access token with "didr_write" scope.
Parameters:
- from: Ethereum address of the signer
- did: Existing DID
- vMethodId: New verification method ID. Recommended: thumbprint of the public key JWK.
- isSecp256k1: Boolean defining if the public key is for secp256k1 curve or not
- publicKey: Public key as hex string. For an ES256K key, it must be in uncompressed format prefixed with "0x04". For other algorithms, it must be the JWK transformed to string and then to hex format.
addVerificationRelationship
Call to build an unsigned transaction to add a verification relationship. Requires an access token with "didr_write" scope.
Parameters:
- from: Ethereum address of the signer
- did: Existing DID
- name: Name of the verification relationship
- vMethodId: Reference to the verification method
- notBefore: Verification relationship is valid from this time
- notAfter: Expiration of the verification relationship
revokeVerificationMethod
Call to build an unsigned transaction to revoke a verification method. Requires an access token with "didr_write" scope.
Parameters:
- from: Ethereum address of the signer
- did: Existing DID
- vMethodId: Reference to the verification method
- notAfter: Date on which the revocation takes effect. It must be in the past
expireVerificationMethod
Call to build an unsigned transaction to expire a verification method. Requires an access token with "didr_write" scope.
Parameters:
- from: Ethereum address of the signer
- did: Existing DID
- vMethodId: Reference to the verification method
- notAfter: New expiration date. It must be in the future
rollVerificationMethod
Call to build an unsigned transaction to roll a verification method. Requires an access token with "didr_write" scope.
Parameters:
- from: Ethereum address of the signer
- args: Roll arguments. JSON with the following fields:
- did: Existing DID
- vMethodId: New verification method ID. Recommended: thumbprint of the public key JWK.
- isSecp256k1: Boolean defining if the public key is for secp256k1 curve or not
- publicKey: Public key as hex string. For an ES256K key, it must be in uncompressed format prefixed with "0x04". For other algorithms, it must be the JWK transformed to string and then to hex format.
- notBefore: Verification relationship is valid from this time
- notAfter: Expiration of the verification relationship
- oldVMethodId: Old verification method id that will be rolled
- duration: Duration of the period of transition. During this period both verification methods will be valid.
sendSignedTransaction
Call to send a signed transaction to the blockchain. Requires an access token with "didr_invite" or "didr_write" scope.
Must be exactly "2.0"
Method that needs to be invoked
Array of parameters
Identifier established by the client
Responses
- 200
- 400
Response
- application/json
- Schema
- Build unsigned blockchain transaction to register a DID
- Build tx
- Send a transaction
Schema
- MOD2
Must be exactly "2.0"
Same identifier established by the client in the call
result object
Result of the call
{
"jsonrpc": "2.0",
"id": 482,
"result": {
"from": "0x8445fC96e27ceB0d1794be16a1Ac8BF5D765AACB",
"to": "0x823BBc0ceE3dE3B61AcfA0CEedb951AB9a013F05",
"data": "0x250f4d9700000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000120fb33cccb447605de75846617385f6d2aac28010f53a89ecb5ce151751c53c8d400000000000000000000000000000000000000000000000000000000000000206469643a656273693a7a5a766970744568464e31723275313868686937486f66000000000000000000000000000000000000000000000000000000000000000865794a68622e2e2e00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000216469643a656273693a7a323536617342576d4842736a325a4e567847354d686b7000000000000000000000000000000000000000000000000000000000000000",
"value": "0x0",
"nonce": "0xb1d3",
"chainId": "0x181f",
"gasLimit": "0x1000000",
"gasPrice": "0x0"
}
}
{
"jsonrpc": "2.0",
"id": 482,
"result": {
"from": "0x8445fC96e27ceB0d1794be16a1Ac8BF5D765AACB",
"to": "0x823BBc0ceE3dE3B61AcfA0CEedb951AB9a013F05",
"data": "0x250f4d9700000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000120fb33cccb447605de75846617385f6d2aac28010f53a89ecb5ce151751c53c8d400000000000000000000000000000000000000000000000000000000000000206469643a656273693a7a5a766970744568464e31723275313868686937486f66000000000000000000000000000000000000000000000000000000000000000865794a68622e2e2e00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000216469643a656273693a7a323536617342576d4842736a325a4e567847354d686b7000000000000000000000000000000000000000000000000000000000000000",
"value": "0x0",
"nonce": "0xb1d3",
"chainId": "0x181f",
"gasLimit": "0x1000000",
"gasPrice": "0x0"
}
}
{
"jsonrpc": "2.0",
"id": 1,
"result": "0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331"
}
Bad request
- application/problem+json
- Schema
- Bad Request
Schema
Default value: about:blank
An absolute URI that identifies the problem type. When dereferenced, it SHOULD provide human-readable documentation for the problem type.
A short summary of the problem type.
Possible values: >= 400
and <= 600
The HTTP status code generated by the origin server for this occurrence of the problem.
A human readable explanation specific to this occurrence of the problem.
An absolute URI that identifies the specific occurrence of the problem. It may or may not yield further information if dereferenced.
{
"title": "Bad request",
"status": 400,
"detail": "Bad request"
}