This folder contains a simple Python script that uses indy-vdr to execute various calls to an Indy network to fetch ledger transactions.
The various transaction parameters returns information such as schema_id lookups, cred_def_id lookups, pool ledger transaction or main ledger transactions about the accessed ledger.
An example of the JSON data returned by the call for a specific ledger transaction is provided below.
No authorized DID is required and this tool will always run in anonymous mode when run without a DID.
The easiest way to use this now is to use the ./run
script and the Docker build process provide in this folder. Work is in progress to add a CI/CD capability to indy-vdr
so that the artifacts are published to PyPi and native Python apps can be used. In the meantime, we recommend building your own plug-in.
Here is guidance of how you can run the script to get ledger transaction information about any accessible Indy network. We'll start with a test on local network (using von-network) and provide how this can be run on any Indy network, including Sovrin networks.
If you are running locally, you must have git
, docker
and a bash terminal. On Windows, when you install git
, the git-bash
terminal is installed and you can use that.
To try this in a browser, go to Play With Docker, login (requires a Docker Hub ID) and click the "+ ADD NEW INSTANCE` link (left side). That opens a terminal session that you can use to run these steps.
The rest of the steps assume you are in your bash terminal in a folder where GitHub repos can be cloned.
To start a local Indy network to test with, we'll clone a VON Network, build it and start it using the following commands run in a bash terminal:
git clone https://github.com/bcgov/von-network
cd von-network
./manage build
./manage start
cd ..
The build step will take a while as 1/3 of the Internet is downloaded. Eventually, the start
step will execute and a four-node Indy ledger will start. Wait about 30 seconds and then go to the web interface to view the network.
- If you are running locally, go to http://localhost:9000.
- If you are on Play with Docker, click the
9000
link above the terminal session window.
Note the last command above puts you back up to the folder in which you started. If you want to explore von-network
you'll have to change back into the von-network
folder.
When you are finished your running the validator tool (covered in the steps below) and want to stop your local indy-network, change to the von-network folder and run:
./manage down
We'll remind you of that later in these instructions.
Run these commands to clone this repo so that you can run the fetch validator info command.
git clone https://github.com/didx-xyz/indy-ledger-monitor
cd indy-ledger-monitor/fetch-ledger-tx
For a full list of script options run:
./run.sh -h
To get the details for the known networks available for use with the --net
option, run:
./run.sh --list-nets
To run the ledger info script, run the following command in your bash terminal from the fetch-ledger-tx
folder in the indy-ledger-monitor
clone:
This repo dose not require any privileged DID and can be used without one at all times.
To fetch pool transactions, run:
./run.sh --net <netId> --pooltx
or
./run.sh --genesis-url <URL> --pooltx
To fetch a specific main ledger transaction use the --maintx
argument and provide a transaction sequence number;
./run.sh --net <netId> --maintx 1
To fetch a range of main ledger transactions use the --maintxr
argument and provide a transaction sequence number range;
./run.sh --net <netId> --maintxr 1-5
To fetch a schema id from the ledger use the --schemaid
argument and provide a schema id;
./run.sh --net <netId> --schemaid QXdMLmAKZmQBhnvXHxKn78:2:SURFNetSchema:1.0
To fetch a credential definition id from the ledger use the --credid
argument and provide a transaction credential definition id;
./run.sh --net <netId> --credid A9Rsuu7FNquw8Ne2Smu5Nr:3:CL:15:tag
To fetch a NYM from the ledger use the --nym
argument and provide a NYM;
./run.sh -a --net=<netId> --nym Uvb86cUzmdgZ8AfbN176tc
For the first test run using von-network:
- the
<SEED>
is the Indy test network Trustee seed:000000000000000000000000Trustee1
. - the URL is retrieved by clicking on the
Genesis Transaction
link in the VON-Network web interface and copying the URL from the browser address bar.
If you are running locally, the full command is:
./run.sh --net vn --pooltx
or
./run.sh --genesis-url http://localhost:9000/genesis --pooltx
If running in the browser, you will have to get the URL for the Genesis file (as described above) and replace the localhost
URL above.
You should see a long JSON structure printed to the terminal. You can redirect the output to a file by adding something like > pool_transactions.json
at the end of the command.
To see the ledger info script against any other Indy network, you need a URL for the Genesis file for the network. The pool Genesis file URLs are easy, since that is published data needed by agents connecting to Indy networks. Sovrin genesis URLs can be found here. You need the URL for the raw version of the pool transaction files. For example, the URL you need for the Sovrin MainNet is:
https://raw.githubusercontent.com/sovrin-foundation/sovrin/master/sovrin/pool_transactions_live_genesis
For the other Sovrin networks, replace live
with sandbox
(Sovrin Staging Net) and builder
(Sovrin Builder Net).
Getting a Seed for a DID with sufficient authorization on specific ledger is an exercise for the user. DO NOT SHARE DID SEEDS. Those are to be kept secret.
Do not write the Seeds in a public form. The use of environment variables for these parameters is very deliberate so that no one accidentally leaks an authorized DID.
Did I mention: DO NOT SHARE DID SEEDS?
For info on plug-ins see the plug-ins readme.
The following is an example of the data for a single ledger transaction from Sovrin Mainnet:
./run.sh --net smn --maintx 1
{
"reqId": 1603231860162518000,
"state_proof": {
"multi_signature": {
"participants": [
"royal_sovrin",
"sovrin.sicpa.com",
"OASFCU",
"findentity",
"ServerVS",
"danube",
"atbsovrin",
"pcValidator01",
"Stuard",
"DustStorm",
"prosovitor",
"VeridiumIDC",
"BIGAWSUSEAST1-001"
],
"value": {
"txn_root_hash": "HTCnwnhv2ES1DCNeHxMJD7HhxVLWCSUszPGBMXiHpoJr",
"ledger_id": 1,
"state_root_hash": "5Gqwywact5rWiNGNTr3XjkvzebtQV7AM2EyMcjSBpNd5",
"timestamp": 1603231818,
"pool_state_root_hash": "4Asf2cSvxUguXoSsxHxbKSmgXHiaNgWWYR5uLj35BiuA"
},
"signature": "RD4s4FhUpCbcXYKUduHnd6CM79EEJ4RCrKpPFioYMyHMKLB5vX3zWv2Yy28BuAtcMEuLmCUNJBrUhVxF1hWFoP7KTunSDeViqyWuiWrVMpwZUymGsYR2bZ1aAJSrD31Zr5LGW1XGoHNqJH8RsCmpVQmrWcHXxmHRUpk2xRU9goigFq"
}
},
"type": "3",
"seqNo": 1,
"identifier": "LibindyDid111111111111",
"data": {
"txnMetadata": {
"seqNo": 1
},
"ver": "1",
"rootHash": "HTCnwnhv2ES1DCNeHxMJD7HhxVLWCSUszPGBMXiHpoJr",
"txn": {
"metadata": {},
"type": "1",
"data": {
"dest": "NMjQb59rKTJXKNqVYfcZFi",
"role": "0",
"verkey": "Ce9jZ2bQcLRCrY3eT5AbjsU5mXFa4jMF6dDSF21tyeFJ",
"alias": "Phil Windley"
}
},
"auditPath": [
"6rwuBfxhqdByev94TgaXrC3TyDYnPvoChi86in3tj1gc",
"WxtLaCqWq36hcqozYp5WFJGmCPtUh1nuSU3tkB5RZmq",
"XtbhzTr7upNXsJUkEiciogpGpu1wu9ARLgNEuotkwWM",
"2gCD8YRUUMVZyJ7TLXT4qbCxw1h1hijX8koaLDFc1bJq",
"BuvAvcc92Tgwu6PUFMZY21WM3dg5KD1fhfFHkdgGfGWJ",
"6xzkXYsfhy2LRBpkwb4n2zJwrgNrDTQKvnk4oP8e9jvM",
"EAbTZdeMabd5aW59CbyhQ1q7MRpHXMFVzcJFQSz6yCV3",
"94F6q15MhEhQeijZuA1zerM2oefBbUiifdzdbcQ7hKPN",
"4bmnnZRY1RtMhdLcEcKy5FccPdt27iH45PiVAuoBMwsj",
"3fdwTL8jHHQYfzNrtmZ4yLzGNEUC65hwMSVT86Uf7PQh",
"8UpRMwf1YwhqZUVARivJwkSFqe91ft4jipgo8Z1Xaeh4",
"BQPTuYEpmnZQ6GdjBAzHBGJVzkpWnfNMNGNpyJ8LAQZ",
"G8L5Sz9pPT351NkVvYWV6kcwR1ycwEAsk5pQZApTPbsA",
"4jGpg6VrrSKmZrwQozupNCEkpmsMdekGt4SkAzuHmqHP",
"CCuh1YQexAhFwvVagcGc7knXUoinjz4hShneqMacvhN3",
"6zJcFtbCmMNRyQiYtUyTZM4y1aK4MwGHQKf67QfckEgX"
],
"reqSignature": {},
"ledgerSize": 55766
}
}