Follow Brian Li (@DecryptoBL) on Twitter.
Follow Brian Li (@bwhli) on Instagram.

Timestamping & Archiving Blog Posts on the ICON Blockchain

October 24, 2018

Recently, I was accused of editing past blog posts to fit my current perspective and narrative on a certain blockchain project. Considering this is my blog where I have 100% creative control over what gets published, I don’t think editing past content is necessarily an issue – especially when it’s an edit like the one below from a recent post on Substratum.

Update: As of September 1, 2018, I’ve been banned from the Substratum Telegram channel and subreddit for expressing an unapproved opinion.

Regardless, I decided to take this opportunity to figure out how to use blockchain to timestamp and archive blog posts. The idea here is to be able to point people to an HTML backup of a webpage on the blockchain to prove that I did not make any unreasonable edits since the “freeze date”.

To do this, I added a new WordPress custom field called txhash-icx to store an unique ICX transaction hash for each post. Next, I created a PHP partial called txhash-icx.php with the following code.

<?php
$meta_value = get_post_meta( $post->ID, 'txhash-icx', true ); 
 if (!empty( $meta_value )) {echo '<code>TX:<a target="_blank" rel="nofollow" href=" https://tracker.icon.foundation/transaction/' . $meta_value . '">' . $meta_value . '</a></code>';}
 else {}
?>

This code uses the txhash-icx value to generate a post-specific link to the ICON tracker where a post-specific HTML archive can be viewed. Finally, I inserted the txhash-icx.php partial into my single post template using WordPress’ get_template-part() function.

Next, I used the official ICONex wallet to generate a 0 ICX transaction with a post’s minified HTML source code in the data field. As you can see, an ICX transaction’s data field supports up to 250KB of data, which is plenty of space for this use case. This example post only took up 15KB.

After completing the transaction, I used the ICON tracker to view the transaction details. The HTML is displayed in the data field.

Finally, I copied the transaction hash and pasted it into the txhash-icx value field for the corresponding post.

Scroll down to the end of this post to see what the ICX transaction fingerprint for this post looks like. If you have any questions about how to set this up on your WordPress site, @ me on Twitter.


Questions?

Find me on Twitter, or send me an email.