Skip to main content
European CommissionEBSI European Blockchain
Select the Environment you want to work withEnvironment:

JSON-RPC API

Last updated on
POST 

/track-and-trace/v1/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

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

authoriseDid

Call to build an unsigned transaction to authorise a DID to create documents. Requires an access token with "tnt_authorise" scope.

Parameters:

  • from: Ethereum address of the signer
  • senderDid: DID of the signer. Must be a did:ebsi DID (UTF-8)
  • authorisedDid: DID to authorise. Must be a did:ebsi DID (UTF-8) registered in the DID Registry.
  • whiteList: Boolean to define if the DID is authorized or unauthorized

createDocument

Call to build an unsigned transaction to create a new Document. Requires an access token with "tnt_create" scope. By default it records the timestamp of the blockchain, but it's possible to define a different timestamp with its respective proof.

Parameters:

  • from: Ethereum address of the signer
  • documentHash: Document hash
  • documentMetadata: Document metadata as hex string
  • didEbsiCreator: DID of the document creator. Must be a did:ebsi DID (UTF-8)
  • timestamp (optional): Timestamp as hex string. By default it uses takes the timestamp from the blockchain
  • timestampProof (optional): Timestamp proof as hex string. It must be defined when "timestamp" is defined

removeDocument

Call to build an unsigned transaction to remove a document and all related resources. Requires an access token with "tnt_write" scope.

Parameters:

  • from: Ethereum address of the signer
  • documentHash: Document hash to remove

grantAccess

Call to build an unsigned transaction to grant a permission for a DID in a specific document. Requires an access token with "tnt_write" scope. "write" grant requires the transaction signer to be creator of the Document, or signer must have "delegate" permission in the Document. "delegate" grant requires the transaction signer to be creator of the Document.

Parameters:

  • from: Ethereum address of the signer
  • documentHash: Document hash
  • grantedByAccount: Entity that grants the permission. If the entity uses the did:ebsi method, grantedByAccount must be the UTF-8 DID encoded in hexadecimal. If the entity uses the did:key method, grantedByAccount must be the secp256k1 uncompressed public key (64 bytes or 65 bytes with 04 prefix) encoded in hexadecimal.
  • subjectAccount: Entity that receives the permission. If the entity uses the did:ebsi method, subjectAccount must be the UTF-8 DID encoded in hexadecimal. If the entity uses the did:key method, subjectAccount must be the secp256k1 uncompressed public key (64 bytes or 65 bytes with 04 prefix) encoded in hexadecimal.
  • grantedByAccType: DID method of grantedByAccount. Use 0 for did:ebsi or 1 for did:key.
  • subjectAccType: DID method of subjectAccount. Use 0 for did:ebsi or 1 for did:key.
  • permission: Type of the permission to grant. Use 0 for "delegate" or 1 for "write"

revokeAccess

Call to build an unsigned transaction to revoke a permission from a DID in a specific Document. Requires an access token with "tnt_write" scope. Keep in mind that whenever the document's creator private key is lost, then there is no possibility to revoke access for this creator's documents anymore.

Parameters:

  • from: Ethereum address of the signer
  • documentHash: Document hash
  • revokedByAccount: Entity that revokes the permission. If the entity uses the did:ebsi method, revokedByAccount must be the UTF-8 DID encoded in hexadecimal. If the entity uses the did:key method, revokedByAccount must be the secp256k1 uncompressed public key (64 bytes or 65 bytes with 04 prefix) encoded in hexadecimal.
  • subjectAccount: Entity whose permission is revoked. If the entity uses the did:ebsi method, subjectAccount must be the UTF-8 DID encoded in hexadecimal. If the entity uses the did:key method, subjectAccount must be the secp256k1 uncompressed public key (64 bytes or 65 bytes with 04 prefix) encoded in hexadecimal.
  • permission: Type of the permission to revoke. Use 0 for "delegate" or 1 for "write"

writeEvent

Call to build an unsigned transaction to write an event into a specific document. Requires an access token with "tnt_write" scope. By default, it records the timestamp of the blockchain, but it's possible to define a different timestamp with its respective proof.

Parameters:

  • from: Ethereum address of the signer
  • eventParams: Event parameters. JSON with the following fields:
    • documentHash: Document hash (hex string)
    • externalHash: External hash (string)
    • sender: Entity that sends the event. If the entity uses the did:ebsi method, sender must be the UTF-8 DID encoded in hexadecimal. If the entity uses the did:key method, sender must be the secp256k1 uncompressed public key (64 bytes or 65 bytes with 04 prefix) encoded in hexadecimal.
    • origin: Origin (string)
    • metadata: Metadata (string)
  • timestamp (optional): Timestamp as hex string. By default it uses takes the timestamp from the blockchain
  • timestampProof (optional): Timestamp proof as hex string. It must be defined when "timestamp" is defined

sendSignedTransaction

Call to send a signed transaction to the blockchain. Requires an access token with "tnt_authorise", "tnt_create" or "tnt_write" scope.

    jsonrpc stringrequired

    Must be exactly "2.0"

    method stringrequired

    Method that needs to be invoked

    params object[]required

    Array of parameters

    id integerrequired

    Identifier established by the client

Responses

Response

Schema
    jsonrpc string

    Must be exactly "2.0"

    id integer

    Same identifier established by the client in the call

    result object

    Result of the call

    oneOf
    string
Loading...