blockchainhyperledgerhyperledger-indy

Hypelerdger Indy Node - Seed value


I am playing with indy-sdk and in walkthrough demo in step 3 (https://github.com/hyperledger/indy-sdk/blob/master/docs/getting-started/indy-walkthrough.md#step-3-getting-the-ownership-for-stewards-verinym) the seed value for Steward sets equal to '000000000000000000000000Steward1'.

If I change it(or leave it empty), I am getting an error. Also, in /tmp/indy/poo1.txn there is no information about this specific value.

My question is how did we know that this is the right value and how we could get it?


Solution

  • Why it doesn't work

    000000000000000000000000Steward1 is seed which (given default key derivation method) generates DID Th7MpTaRZVRYnPiabds81Y. You can verify yourself using indy-cli (command line tool)

    indy> wallet create test key=123
    Wallet "test" has been created
    
    indy> wallet open test key=123
    Wallet "test" has been opened
    
    wallet(test):indy> did new seed=000000000000000000000000Steward1
    Did "Th7MpTaRZVRYnPiabds81Y" has been created with "~7TYfekw4GUagBnBVCqPjiC" verkey
    

    In the network you are using, the owner of DID VsKV7grR1BUE29mG2Fm2kX (ie. whoever has knowledge about its associated private key or seed) has steward role which grants permissions to do various operations on the ledger. So if you modify the seed, it will generate different DID which won't have required permissions to execute operations used further in the tutorial (like writing data on the ledger).

    Where is 000000000000000000000000Steward1 coming from

    From what you say I presume you are using prebuilt docker image from indy-sdk repo running pool of indy-node instances in it, following some of these instructions. So the simple answer is that configuration for 000000000000000000000000Steward1 is pre-baked in it. Look at the dockerfile used for building indy-pool image. Notice these lines

    RUN awk '{if (index($1, "NETWORK_NAME") != 0) {print("NETWORK_NAME = \"sandbox\"")} else print($0)}' /etc/indy/indy_config.py> /tmp/indy_config.py
    RUN mv /tmp/indy_config.py /etc/indy/indy_config.py
    

    Let's look what's in these files

    docker exec indylocalhost cat '/etc/indy/indy_config.py'
    # Current network
    
    # Disable stdout logging
    enableStdOutLogging = False
    
    # Directory to store ledger.
    LEDGER_DIR = '/var/lib/indy'
    
    # Directory to store logs.
    LOG_DIR = '/var/log/indy'
    
    # Directory to store keys.
    KEYS_DIR = '/var/lib/indy'
    
    # Directory to store genesis transactions files.
    GENESIS_DIR = '/var/lib/indy'
    
    # Directory to store backups.
    BACKUP_DIR = '/var/lib/indy/backup'
    
    # Directory to store plugins.
    PLUGINS_DIR = '/var/lib/indy/plugins'
    
    # Directory to store node info.
    NODE_INFO_DIR = '/var/lib/indy'
    NETWORK_NAME = 'sandbox'%                                      
    

    This

    # Directory to store genesis transactions files.
    GENESIS_DIR = '/var/lib/indy'
    

    Looks like what we are looking for. Let's see what's there

    docker exec indylocalhost ls '/var/lib/indy/sandbox'
    data
    domain_transactions_genesis
    keys
    node1_additional_info.json
    node1_info.json
    node1_version_info.json
    node2_additional_info.json
    node2_info.json
    node2_version_info.json
    node3_additional_info.json
    node3_info.json
    node3_version_info.json
    node4_additional_info.json
    node4_info.json
    node4_version_info.json
    pool_transactions_genesis
    

    In blockchains, genesis file is typically the file you use to initially kick off the network and may populate network with some data. In case of hyperledger-indy, there's 4 "subledgers" which contain different types of transactions: domain, pool, config, audit. The domain subledger is the one which contains things such like DIDs, credential schema or credential definitons. We are looking for a DID, so let's look at file domain genesis file.

    docker exec indylocalhost cat '/var/lib/indy/sandbox/domain_transactions_genesis'
    {"reqSignature":{},"txn":{"data":{"dest":"V4SGRU86Z58d6TV7PBUe6f","role":"0","verkey":"~CoRER63DVYnWZtK8uAzNbx"},"metadata":{},"type":"1"},"txnMetadata":{"seqNo":1},"ver":"1"}
    {"reqSignature":{},"txn":{"data":{"dest":"Th7MpTaRZVRYnPiabds81Y","role":"2","verkey":"~7TYfekw4GUagBnBVCqPjiC"},"metadata":{"from":"V4SGRU86Z58d6TV7PBUe6f"},"type":"1"},"txnMetadata":{"seqNo":2},"ver":"1"}
    {"reqSignature":{},"txn":{"data":{"dest":"EbP4aYNeTHL6q385GuVpRV","role":"2","verkey":"~RHGNtfvkgPEUQzQNtNxLNu"},"metadata":{"from":"V4SGRU86Z58d6TV7PBUe6f"},"type":"1"},"txnMetadata":{"seqNo":3},"ver":"1"}
    {"reqSignature":{},"txn":{"data":{"dest":"4cU41vWW82ArfxJxHkzXPG","role":"2","verkey":"~EMoPA6HrpiExVihsVfxD3H"},"metadata":{"from":"V4SGRU86Z58d6TV7PBUe6f"},"type":"1"},"txnMetadata":{"seqNo":4},"ver":"1"}
    {"reqSignature":{},"txn":{"data":{"dest":"TWwCRQRZ2ZHMJFn9TzLp7W","role":"2","verkey":"~UhP7K35SAXbix1kCQV4Upx"},"metadata":{"from":"V4SGRU86Z58d6TV7PBUe6f"},"type":"1"},"txnMetadata":{"seqNo":5},"ver":"1"}
    {"reqSignature":{},"txn":{"data":{"dest":"7JhapNNMLnwkbiC2ZmPZSE","verkey":"~LgpYPrzkB6awcHMTPZ9TVn"},"metadata":{"from":"V4SGRU86Z58d6TV7PBUe6f"},"type":"1"},"txnMetadata":{"seqNo":6},"ver":"1"}
    {"reqSignature":{},"txn":{"data":{"dest":"MEPecrczs4Wh6FA12u519D","verkey":"~A4rMgHYboWYS1DXibCgo9W"},"metadata":{"from":"V4SGRU86Z58d6TV7PBUe6f"},"type":"1"},"txnMetadata":{"seqNo":7},"ver":"1"}
    {"reqSignature":{},"txn":{"data":{"dest":"EAPtwgevBpzP8hkj9sxuzy","verkey":"~gmzSzu3feXC6g2djF7ar4"},"metadata":{"from":"V4SGRU86Z58d6TV7PBUe6f"},"type":"1"},"txnMetadata":{"seqNo":8},"ver":"1"}
    {"reqSignature":{},"txn":{"data":{"dest":"LuL1HK1sDruwkfm68jrVfD","verkey":"~Nyv9BKUJuvjgMbfbwk8CFD"},"metadata":{"from":"V4SGRU86Z58d6TV7PBUe6f"},"type":"1"},"txnMetadata":{"seqNo":9},"ver":"1"}
    {"reqSignature":{},"txn":{"data":{"dest":"462p8mtcX6jpa9ky565YEL","verkey":"~LCgq4hnSvMvB8nKd9vgsTD"},"metadata":{"from":"V4SGRU86Z58d6TV7PBUe6f"},"type":"1"},"txnMetadata":{"seqNo":10},"ver":"1"}
    

    And you can see that DID Th7MpTaRZVRYnPiabds81Y is hardcoded on this ledger using verkey ~7TYfekw4GUagBnBVCqPjiC which is matching what we've generated from seed 000000000000000000000000Steward1. You can also see it's given role "2". If you dig deeper, you can find in indy-plenum, the consensus alg. project used by indy that role ID 2 is steward role.