Coinstack Stamping

An irreversible feature of Blockchain is useful in Document Stamping service especially. Coinstack provides the way to create the transaction with arbitrary data as we have seen the previous chapter. When you store a fingerprint (hash value) of a document in the transaction, you have to follow this step:

  1. Create you Bitcoin address.

  2. Send Bitcoins for the transaction fee to the address.

  3. Calculate a hash value of the document. (ex. SHA256)

  4. Create a data output with the hash value of the document.

  5. Create a transaction with the data output.

  6. Send the transaction in the Bitcoin network.

  7. Keep watching the balance for the transaction fee.

However, when you store only the hash value of the document, these process could be the burden for fast and simple. Coinstack provides the easy way through abstracting steps of registering data in the transaction, that is, Document Stamping.

1. Stamp Document

The hash value from the method SHA256 is stored in Blockchain, and the stamp ID that is used as a key when to check a history would return. You can register the fingerprint of the document in the Blockchain by calling only one function instead several steps.

curl \
    -H "apiKey: YOUR_API_TOKEN_KEY" \
    -H "Content-Type: application/json" \
    -X POST \
    -d '{"hash" : "YOUR_SHA256_VALUE"}' \
String message = "Hello, world";
Sha256Hash hash = Sha256Hash.create(message.getBytes());
String stampid = coinStackClient.stampDocument(Hex.encodeHexString(hash.getBytes()));

The result is returned as JSON type like below.

{ "stampid": "7f902baec17633d12fb70892698157f595682910c96e3ee44cbdc3e2545d6665-2" }

2. Get Stamp Status

You can get a Stamp object and check the status of the Stamp with the stamp ID that returns when it is registered in the Blockchain.

curl \
    -H "apiKey: YOUR_API_TOKEN_KEY"
Stamp stamp = coinStackClient.getStamp("YOUR_STAMP_ID_VALUE");

The result is returned as JSON type like below.

    "tx": "a22c7e42459b91eb325378da4721f53026962b03cd73187549c2e62cb1064464",
    "vout": 0,
    "confirmations": 522,
    "timestamp": "2015-10-30T08:43:42Z"

results matching ""

    No results matching ""