Show / Hide Table of Contents

    Class Ledger

    Provides methods for building messages suitable for submission to the ledger and methods for signing and submitting messages to the ledger.

    Inheritance
    System.Object
    Ledger
    Namespace: Hyperledger.Indy.LedgerApi
    Assembly: Hyperledger.Indy.Sdk.dll
    Syntax
    public static class Ledger : Object
    Remarks

    This class provides methods for generating messages for submission to the ledger; each of these methods is prefixed with the word 'Build' and returns a JSON message which must be signed and submitted to a node pool. These messages can be submitted to the ledger using the SignAndSubmitRequestAsync(Pool, Wallet, String, String) or can be signed first using the SignRequestAsync(Wallet, String, String) method then submitted later using the SubmitRequestAsync(Pool, String) method.

    Fields

    NYM_ROLE_STEWARD

    The 'Steward' NYM role.

    Declaration
    public const string NYM_ROLE_STEWARD = "STEWARD"
    Field Value
    Type Description
    System.String

    NYM_ROLE_TRUST_ANCHOR

    The 'Trust Anchor' NYM role.

    Declaration
    public const string NYM_ROLE_TRUST_ANCHOR = "TRUST_ANCHOR"
    Field Value
    Type Description
    System.String

    NYM_ROLE_TRUSTEE

    The 'Trustee' NYM role.

    Declaration
    public const string NYM_ROLE_TRUSTEE = "TRUSTEE"
    Field Value
    Type Description
    System.String

    Methods

    BuildAttribRequestAsync(String, String, String, String, String)

    Builds a ledger request for storing an ATTRIB.

    Declaration
    public static Task<string> BuildAttribRequestAsync(string submitterDid, string targetDid, string hash, string raw, string enc)
    Parameters
    Type Name Description
    System.String submitterDid

    The DID of the party that will submit the request to the ledger.

    System.String targetDid

    The DID the ATTRIB will belong to.

    System.String hash

    The hash of the ATTRIB data.

    System.String raw

    The raw JSON attribute data.

    System.String enc

    The encrypted attribute data.

    Returns
    Type Description
    System.Threading.Tasks.Task<System.String>

    An asynchronous System.Threading.Tasks.Task<> that resolves to a System.String containing the request JSON.

    Remarks

    Builds a request message that is suitable for setting an attribute on the ledger.

    The submitterDid, targetDid are mandatory and any one of the hash, raw or enc parameters must also be provided, depending on what type of data should be stored.

    BuildCredDefRequestAsync(String, String)

    Declaration
    public static Task<string> BuildCredDefRequestAsync(string submitterDid, string data)
    Parameters
    Type Name Description
    System.String submitterDid
    System.String data
    Returns
    Type Description
    System.Threading.Tasks.Task<System.String>

    BuildGetAttribRequestAsync(String, String, String, String, String)

    Declaration
    public static Task<string> BuildGetAttribRequestAsync(string submitterDid, string targetDid, string raw, string hash, string enc)
    Parameters
    Type Name Description
    System.String submitterDid
    System.String targetDid
    System.String raw
    System.String hash
    System.String enc
    Returns
    Type Description
    System.Threading.Tasks.Task<System.String>

    BuildGetCredDefRequestAsync(String, String)

    Declaration
    public static Task<string> BuildGetCredDefRequestAsync(string submitterDid, string id)
    Parameters
    Type Name Description
    System.String submitterDid
    System.String id
    Returns
    Type Description
    System.Threading.Tasks.Task<System.String>

    BuildGetDdoRequestAsync(String, String)

    Builds a ledger request to get a DDO.

    Declaration
    public static Task<string> BuildGetDdoRequestAsync(string submitterDid, string targetDid)
    Parameters
    Type Name Description
    System.String submitterDid

    The DID of the party who will submit the request to the ledger.

    System.String targetDid

    The DID of the DDO to get from the ledger.

    Returns
    Type Description
    System.Threading.Tasks.Task<System.String>

    An asynchronous System.Threading.Tasks.Task<> that resolves to a System.String containing the request JSON.

    Remarks

    This message builds a request message that is suitable for requesting a DDO from the ledger.

    The resulting message can be submitted to the ledger using the SignAndSubmitRequestAsync(Pool, Wallet, String, String) method or can be signed first using the SignRequestAsync(Wallet, String, String) method then submitted later using the SubmitRequestAsync(Pool, String) method.

    BuildGetNymRequestAsync(String, String)

    Builds a GET_NYM ledger request.

    Declaration
    public static Task<string> BuildGetNymRequestAsync(string submitterDid, string targetDid)
    Parameters
    Type Name Description
    System.String submitterDid

    The DID of the party submitting the request.

    System.String targetDid

    The target DID.

    Returns
    Type Description
    System.Threading.Tasks.Task<System.String>

    An asynchronous System.Threading.Tasks.Task<> that resolves to a System.String containing the request JSON.

    Remarks

    Builds a request message that is suitable for requesting a NYM from the ledger.

    BuildGetRevocRegDefRequestAsync(String, String)

    Declaration
    public static Task<string> BuildGetRevocRegDefRequestAsync(string submitterDid, string id)
    Parameters
    Type Name Description
    System.String submitterDid
    System.String id
    Returns
    Type Description
    System.Threading.Tasks.Task<System.String>

    BuildGetRevocRegDeltaRequestAsync(String, String, Int64, Int64)

    Declaration
    public static Task<string> BuildGetRevocRegDeltaRequestAsync(string submitterDid, string revocRegDefId, long from, long to)
    Parameters
    Type Name Description
    System.String submitterDid
    System.String revocRegDefId
    System.Int64 from
    System.Int64 to
    Returns
    Type Description
    System.Threading.Tasks.Task<System.String>

    BuildGetRevocRegRequestAsync(String, String, Int64)

    Declaration
    public static Task<string> BuildGetRevocRegRequestAsync(string submitterDid, string revocRegDefId, long timestamp)
    Parameters
    Type Name Description
    System.String submitterDid
    System.String revocRegDefId
    System.Int64 timestamp
    Returns
    Type Description
    System.Threading.Tasks.Task<System.String>

    BuildGetSchemaRequestAsync(String, String)

    Declaration
    public static Task<string> BuildGetSchemaRequestAsync(string submitterDid, string schemaId)
    Parameters
    Type Name Description
    System.String submitterDid
    System.String schemaId
    Returns
    Type Description
    System.Threading.Tasks.Task<System.String>

    BuildGetTxnRequestAsync(String, Int32)

    Builds a GET_TXN request

    Declaration
    public static Task<string> BuildGetTxnRequestAsync(string submitterDid, int data)
    Parameters
    Type Name Description
    System.String submitterDid

    The DID of the submitter.

    System.Int32 data

    seq_no of transaction in ledger

    Returns
    Type Description
    System.Threading.Tasks.Task<System.String>

    An asynchronous System.Threading.Tasks.Task<> that resolves to a System.String containing the request JSON.

    BuildNodeRequestAsync(String, String, String)

    Builds a NODE ledger request.

    Declaration
    public static Task<string> BuildNodeRequestAsync(string submitterDid, string targetDid, string data)
    Parameters
    Type Name Description
    System.String submitterDid

    The DID of the submitter.

    System.String targetDid

    The target DID.

    System.String data

    id of a target NYM record

    Returns
    Type Description
    System.Threading.Tasks.Task<System.String>

    An asynchronous System.Threading.Tasks.Task<> that resolves to a System.String containing the request JSON.

    BuildNymRequestAsync(String, String, String, String, String)

    Builds a ledger request to store a NYM.

    Declaration
    public static Task<string> BuildNymRequestAsync(string submitterDid, string targetDid, string verKey, string alias, string role)
    Parameters
    Type Name Description
    System.String submitterDid

    The DID of the party who will submit the request to the ledger.

    System.String targetDid

    The DID the NYM belongs to.

    System.String verKey

    The verification key for the NYM.

    System.String alias

    The alias for the NYM.

    System.String role

    The role of the NYM.

    Returns
    Type Description
    System.Threading.Tasks.Task<System.String>

    An asynchronous System.Threading.Tasks.Task<> that resolves to a System.String containing the request JSON.

    Remarks

    Builds a request message that is suitable for storing a NYM for the targetDid on the ledger.

    Only the submitterDid and targetDid parameters are required, however the other parameters provide greater control over the process. Normally the targetDid and verKey parameters would be from values generated by a prior call to Hyperledger.Indy.SignusApi.Signus.CreateAndStoreMyDidAsync(Hyperledger.Indy.WalletApi.Wallet,System.String).

    The role parameter dictates what permissions the NYM will have - valid values are 'STEWARD' and 'TRUSTEE' and 'TRUST_ANCHOR'.

    BuildPoolConfigRequestAsync(String, Boolean, Boolean)

    Declaration
    public static Task<string> BuildPoolConfigRequestAsync(string submitterDid, bool writes, bool force)
    Parameters
    Type Name Description
    System.String submitterDid
    System.Boolean writes
    System.Boolean force
    Returns
    Type Description
    System.Threading.Tasks.Task<System.String>

    BuildPoolUpgradeRequestAsync(String, String, String, String, String, Int32, String, String, Boolean, Boolean)

    Declaration
    public static Task<string> BuildPoolUpgradeRequestAsync(string submitterDid, string name, string version, string action, string sha256, int timeout, string schedule, string justification, bool reinstall, bool force)
    Parameters
    Type Name Description
    System.String submitterDid
    System.String name
    System.String version
    System.String action
    System.String sha256
    System.Int32 timeout
    System.String schedule
    System.String justification
    System.Boolean reinstall
    System.Boolean force
    Returns
    Type Description
    System.Threading.Tasks.Task<System.String>

    BuildRevocRegDefRequestAsync(String, String)

    Declaration
    public static Task<string> BuildRevocRegDefRequestAsync(string submitterDid, string data)
    Parameters
    Type Name Description
    System.String submitterDid
    System.String data
    Returns
    Type Description
    System.Threading.Tasks.Task<System.String>

    BuildRevocRegEntryRequestAsync(String, String, String, String)

    Declaration
    public static Task<string> BuildRevocRegEntryRequestAsync(string submitterDid, string revocRegDefId, string revDefType, string value)
    Parameters
    Type Name Description
    System.String submitterDid
    System.String revocRegDefId
    System.String revDefType
    System.String value
    Returns
    Type Description
    System.Threading.Tasks.Task<System.String>

    BuildSchemaRequestAsync(String, String)

    Builds a SCHEMA ledger request to store a schema.

    Declaration
    public static Task<string> BuildSchemaRequestAsync(string submitterDid, string data)
    Parameters
    Type Name Description
    System.String submitterDid

    The DID of the submitter.

    System.String data

    The JSON schema.

    Returns
    Type Description
    System.Threading.Tasks.Task<System.String>

    An asynchronous System.Threading.Tasks.Task<> that resolves to a System.String containing the request JSON.

    Remarks

    Builds a request message that is suitable for storing a schema on a ledger. Schema specify the data types and formats which are used to make up claims.

    The data parameter must contain a JSON string with the members "name", "version" and "attr_names" that define the schema. For example the following JSON describes a schema with the name "access" that is version 1.0 of the schema and specifies the attributes "ip", "port", and "keys":

    {
        "name":"access",
        "version":"1.0",
        "attr_names":["ip","port","keys"]
    }

    ParseGetCredDefResponseAsync(String)

    Declaration
    public static Task<ParseResponseResult> ParseGetCredDefResponseAsync(string getCredDefResponse)
    Parameters
    Type Name Description
    System.String getCredDefResponse
    Returns
    Type Description
    System.Threading.Tasks.Task<ParseResponseResult>

    ParseGetRevocRegDefResponseAsync(String)

    Declaration
    public static Task<ParseResponseResult> ParseGetRevocRegDefResponseAsync(string getRevocRegDefResponse)
    Parameters
    Type Name Description
    System.String getRevocRegDefResponse
    Returns
    Type Description
    System.Threading.Tasks.Task<ParseResponseResult>

    ParseGetRevocRegDeltaResponseAsync(String)

    Declaration
    public static Task<ParseRegistryResponseResult> ParseGetRevocRegDeltaResponseAsync(string getRevocRegDeltaResponse)
    Parameters
    Type Name Description
    System.String getRevocRegDeltaResponse
    Returns
    Type Description
    System.Threading.Tasks.Task<ParseRegistryResponseResult>

    ParseGetRevocRegResponseAsync(String)

    Declaration
    public static Task<ParseRegistryResponseResult> ParseGetRevocRegResponseAsync(string getRevocRegResponse)
    Parameters
    Type Name Description
    System.String getRevocRegResponse
    Returns
    Type Description
    System.Threading.Tasks.Task<ParseRegistryResponseResult>

    ParseGetSchemaResponseAsync(String)

    Declaration
    public static Task<ParseResponseResult> ParseGetSchemaResponseAsync(string getSchemaResponse)
    Parameters
    Type Name Description
    System.String getSchemaResponse
    Returns
    Type Description
    System.Threading.Tasks.Task<ParseResponseResult>

    SignAndSubmitRequestAsync(Pool, Wallet, String, String)

    Signs and submits a request to the validator pool.

    Declaration
    public static Task<string> SignAndSubmitRequestAsync(Pool pool, Wallet wallet, string submitterDid, string requestJson)
    Parameters
    Type Name Description
    Pool pool

    The validator pool to submit the request to.

    Wallet wallet

    The wallet containing the submitter keys to sign the request with.

    System.String submitterDid

    The DID of the submitter identity.

    System.String requestJson

    The request JSON to sign and submit.

    Returns
    Type Description
    System.Threading.Tasks.Task<System.String>

    An asynchronous System.Threading.Tasks.Task<> that resolves to a JSON System.String containing the result of submission when the operation completes.

    Remarks

    This method adds information associated with the submitter specified by the submitterDid to the JSON provided in the requestJson parameter then signs it with the submitter's signing key from the provided wallet and sends the signed request message to the specified validator pool.

    SignRequestAsync(Wallet, String, String)

    Signs a request message.

    Declaration
    public static Task<string> SignRequestAsync(Wallet wallet, string submitterDid, string requestJson)
    Parameters
    Type Name Description
    Wallet wallet

    The wallet to use for signing.

    System.String submitterDid

    The DID of the submitter identity in the provided wallet.

    System.String requestJson

    The request JSON to sign.

    Returns
    Type Description
    System.Threading.Tasks.Task<System.String>

    An asynchronous task that resolves to a System.String containing the signed message.

    Remarks

    This method adds information associated with the submitter specified by the submitterDid to the JSON provided in the requestJson parameter then signs it with the submitter's signing key from the provided wallet.

    SubmitRequestAsync(Pool, String)

    Submits a request to the ledger.

    Declaration
    public static Task<string> SubmitRequestAsync(Pool pool, string requestJson)
    Parameters
    Type Name Description
    Pool pool

    The validator pool to submit the request to.

    System.String requestJson

    The request to submit.

    Returns
    Type Description
    System.Threading.Tasks.Task<System.String>

    An asynchronous System.Threading.Tasks.Task<> that resolves to a JSON System.String containing the results when the operation completes.

    Remarks

    This method publishes a message to the validator pool specified in the pool parameter as-is and assumes that the message was previously prepared for submission. Requests can be signed prior to using this call to the SignRequestAsync(Wallet, String, String) method, or messages can be both signed and submitted using the SignAndSubmitRequestAsync(Pool, Wallet, String, String) method.

    Back to top Copyright © 2017 The Linux Foundation®