Update Link Record

This does not actually update a linked record on the blockchain. Instead, it creates a new linked record that prevents any further updates to the previous linked record, although it can still be queried for its status and content. Each linked record can only be updated once. To update the new linked record, a further new linked record must be created using the returned location of this linked record.

The record will be submitted to the blockchain asynchronously. You should use GET Location Status to find out whether the record has been confirmed before performing any other operations on the returned location.

  1. The record owner selects any encoders (usually the same ones as previously used) and salt to use

  2. The record owner updates a link record via nChain Event

  3. nChain Event encodes the record as specified to produce a fingerprint

  4. The fingerprint is written to the blockchain, updating the previous link location

  5. The result is the new fingerprint and its new link location on the blockchain

  6. The record owner stores the new salt, fingerprint and location for later processing

  7. Any number of updates can be performed

Example code:

curl -X POST "$URL/api/v1/linkedrecords/$LOC/update?encode=SHA256(01-02T13.14.15)|Base64" \
     -H "x-api-key: $KEY" \
     -H "accept: text/plain" \
     -H "Content-Type: application/octet-stream" \
     --data-binary "hello world"

Example cURL response:

{
  "txId": "7a22816fb63eff1....2377922ab58bdc2c2c13",
  "encoding" : [ 
    { "content-type": "…|Base64", "output" : "GDa1G3wEWsx4....y3RufuSXsARdiK8Wg=" }
  ]
  ...
}

The final "output" shows the record that was written to the blockchain.

  1. The record owner updates the previous link location with a new record via nChain Event

  2. The result is the new link Location of the new record on the blockchain

  3. The record owner stores the new link Location for later processing

  4. Any number of updates may be performed

  5. Ideally, the record owner should check the status of the new link location

Example code:

curl -X POST $URL/api/v1/linkedrecords/$LOC/update \
     -H "x-api-key: $KEY" \
     -H "accept: text/plain" \
     -H "Content-Type: application/octet-stream" \
     --data-binary "hello world"

Example cURL response:

{
  "txId": "4674e3fc20a708dc....c32b37c76b724db48",
  ...
}

Extract Location

At least the location (shown as "txId") should be stored for subsequent operations:

LOC1=$LOC
LOC=4674e3fc20a708dc....c32b37c76b724db848