Getting Started with Rstory

in #crypto2 months ago

8a3sDSE3M4pCkdJLKrfk--1--kmn88.jpg

The above image was made by enhancing text with stable diffusion using the prompt 'a cyan glowing communication network across the planet.'

For Readers/Viewers

Rstory relies on the EOS blockchain and Anchor wallet. Here's a guide to getting started with Anchor. To buy an Rstory token on Alcor Exchange, you'll need EOS, which can be purchased from Coinbase and transferred to your Anchor wallet account. Once there's an Rstory token in your wallet, you can go to rstory.io, connect Anchor, and read Mark Bailey's scifi novels without having to purchase them by traditional means.

For Publishers

Here are the steps to integrate Rstory into your site:

  1. Upload a media product to IPFS and pin it. We use Pinata for pinning. PDF files work great. So do single file webpages. But the sky is the limit. This method works with any file that can be stored on IPFS. Once the file is pinned, save the hash value, which is the file's address in the IPFS system.
  2. Encrypt the hash. rstory.io uses weak hash encryption that any skilled adversary could break. Don't use this method if your use case requires more substantial security.
  3. Add a custom parameter to the html file where the link to the media product appears. rstory.io uses "data-encoded-hash="ENCRYPTED HASH"" Paste your encrypted hash in place of "ENCRYPTED HASH" in the html. Place the link in a page element with id="book-list"
  4. Add required imports to the html head.
  5. Add required javascript to the html body.
  6. Test page and deploy.

Hash encryption algorithm (python)

def custom_encode(input_str):
    return ''.join(format(ord(char), '02x') for char in input_str)

def custom_decode(encoded_str):
    return ''.join(chr(int(encoded_str[i:i+2], 16)) for i in range(0, len(encoded_str), 2))

a = 'RAW IPFS HASH'
x = custom_encode(a)
print(x)

Add scripts to head

<script src="https://rstory.mypinata.cloud/ipfs/QmRRRaytjur3gspxa9mUxaxLQhW6A19qRvp4TFweJfACkn"></script>
<script src="https://rstory.mypinata.cloud/ipfs/QmPrgG4X6sX3CHLLgrcQU8H8VTqh5mWqWfP6KLtfSfYKxc"></script>
<script src="https://unpkg.com/anchor-link@3"></script>
<script src="https://unpkg.com/anchor-link-browser-transport@3"></script>

Add javascript

The easiest way to do this is just to copy the javascript from the rstory.io html source. Use lines 225-326. This method relies on the product links being within an element with id="book-list".


Website - https://rstory.io
Twitter - https://x.com/Rstory_Official
Telegram - https://t.me/+m-WEaUc7Ud8yY2Qx
Github - https://github.com/ma-da/rstory

Sort:  

The rstory.io Github was updated. Now use lines 227-387.