Read content from chain

To access content stored on-chain, use the payload_transaction_id returned when the content was uploaded. If the content is encrypted, provide the password or AES key in the options.

import {BlocknoteReader} from "blocknote" 

const options = {};
const reader  = new BlocknoteReader(
    "7VR62WIMCSA5POMS2QAY64SMKW5GBTN2WCBTNA5H4W3WFMYLFHWQ",
    options   
);

reader.read().then((response) => {    
    console.log(response);
});
chevron-rightView a response examplehashtag
{
  payload: {    
    title: 'Sales report 2025',
    mime: 'application/pdf',
    size: 19851,
    addid: 260321436,
    accid: 1583377570,
    compression: 'brotli',
    txns: 16
  },
  content: <Buffer 25 50 44 46 2d 31 2e 34 0a 31 20 30 20 6f 62 6a 0a 3c 3c 0a 2f 54 69 74 6c 65 20 28 fe ff 00 4d 00 61 00 72 00 6b 00 64 00 6f 00 77 00 6e 00 20 00 54 ... 19801 more bytes>
}

Constructor

Name
Description
Type

payload_transaction_id

The payload_transaction_id of the upload to read

string

options

See the options table below

object

Options

Name
Description
Type
Default

password

The password to decrypt the content if required.

string

aes_key

The AES key to decrypt the content if required.

string

revision

Read a previous revision. The last revision is read by default.

number

return_raw

Returns the raw on-chain content, preserving any applied compression or encryption. aes_key and password are ignored.

boolean

false


Methods

read

Return

A promise that contains the payload and the content as a buffer.


getRevisions

Return

The number of available revisions.

Last updated