I'm trying to use the REST API endpoints to observe sidetree transactions on ION, but the operations don't seem to contain any reference to the DIDs they pertain to. Is there a way to dereference the DIDs of each operation?
(I'm using ION version 0.5.0)
This is what I'm doing so far:
GET http://ion-instance:3002/transactions
this gets a list of transactions, which all look like this:
[{
"transactionNumber":6490271109873672,
"transactionTime":1511134,
"transactionTimeHash":"0000000000000ef8f824192e0f7b5d2ad525bab1f322fa5081e80e7481c8b96e",
"anchorString":"EiAy4Y72hlK7laJfnkAsCKw6azkiICcOE2Df3QF4cxSlKw"
}]
For each of these transactions, I take the anchorString
value, and use it to make a request like this:
GET http://ion-instance:3003/EiAmQ0AVj3ixs3jK-25yWEgcsaS3q47sPD_EEguzIn8S7Q?max-size=2000
Which gives me a JSON object that looks like this:
{"batchFileHash":"EiBtjyhK_Z2cszuSqUhmCSK1t17iTvtmydxaMZKdxsBo8A","merkleRoot":"UH2qCm60I9mniBHVcdeUkVd1OmPF8P2rnBM93dGU0AQ"}
I then take the batchFileHash
value, and use it to make the same request again, e.g.
GET http://ion-instance:3003/EiBtjyhK_Z2cszuSqUhmCSK1t17iTvtmydxaMZKdxsBo8A?max-size=2000
Which gives me an object like this:
{
"operations": [
"eyJoZWFkZXIiOnsiYWxnIjoiRVMyNTZLIiwia2lkIjoiI2tleTEiLCJvcGVyY.....",
"eyJoZWFkZXIiOnsiYWxnIjoiRVMyNTZLIiwia2lkIjoiI2tleTEiLCJvcGVyY....."
]
}
I take each operation and run it through a base64decode operation which gives me something like this:
{
"header": {
"alg": "ES256K",
"kid": "#key1",
"operation": "create",
"proofOfWork": "{}"
},
"payload": "eyJjcmVhdGVkIjoiMjAxOS0wNC0yM1QxNzoyMzow....",
"signature": "MEUCIHPTgpJ7K8SLsGxBM05Rti9MMJnxgbdwllGZ9XhxD1QV...."
}
I take the payload value and run it through another base64decode operation, which gives me something like this:
{
"created": "2019-04-23T17:23:06.754Z",
"@context": "https://w3id.org/did/v1",
"publicKey": [
{
"id": "#key1",
"type": "Secp256k1VerificationKey2018",
"publicKeyJwk": {
"kty": "EC",
"crv": "P-256K",
"key_ops": ["sign", "verify"],
"x": "5XuyCgM-ZvnR7XxJtXhUMXrzIen4W6kuGFHiVPeEWSQ",
"y": "-RaqLq1AX_aRbxJwrx-mhcPffNMD7qNlEfe5-y0xH-o",
"d": "dX0aOwt1lBZ0NIxQ-EyHhYOOgwD6-MZMMeQw3RBKhh8",
"kid": "#key1"
}
}
]
}
However, I can't seem to figure out how to ascertain the DID this operation relates to.