Blob
Making an call to the blob endpoint
Fetch blob from blockchain
The Blob object represents a blob, which is a file-like object of immutable, raw data; they can be read as text or binary data, or converted into a ReadableStream so its methods can be used for processing the data.
Retrieve blob
POST https://api.bloqifi.com/v0/blob
Retrieve a blob
Headers
Content-Type
String
application/json
Request Body
txids*
Array
List of transaction id's ['123', '321']
blockchain*
String
Bloqcoin, Dogecoin, Bitcoin
Returns a hex string compressed with Brotli which contains
a concatenation of all of the data in the array passed into the constructor.Take a look at how you might call this method using our official libraries, or via curl:
const rawResponse = await fetch('https://api.bloqifi.com/v0/blob', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
blockchain: 'Bloqcoin',
txids: ['123', '321']
})
});
const result = await rawResponse.text();
if (rawResponse.status === 200) {
const fromHexString = hexString => Uint8Array.from(hexString.match(/.{1,2}/g).map(byte => parseInt(byte, 16)));
const compressedData = fromHexString(result);
// data contains the raw brotli compressed data
const decompressedData = brotli.decompress(compressedData);
const textDecoder = new TextDecoder();
console.log( textDecoder.decode(decompressedData) );
}The output received from this endpoint is immutable, raw data compressed using Brotli
Brotli is a lossless data compression algorithm developed by Google. It uses a combination of the general-purpose LZ77 lossless compression algorithm, Huffman coding and 2nd order context modelling.
Install using NPM.
A reliable compressor and de-compressor for Brotli, supporting node & browsers via wasm
In node.js:
In browsers:
JavaScript Node
To construct a Blob from transaction ids, you can also use Bloqifi JavaScript Node:
Bloqcoin very fast. Dogecoin much reliable, Wow. // One line of code is all it takes.
One line of code is all it takes to use images, text and more on your own website.
Include the Bloqifi JavaScript node on your site, and define your image tags:
Join all your bloq transaction ids (txid) as one comma separated string, and add it as data-src on an image tag to show the image.
If you add images dynamically, you can hook up to the "ready" event
You can also have text containers. They work the same way as images as shown on the example below:
HEAD
The HTTP HEAD method requests the headers that would be returned if the HEAD request's URL was instead requested with the HTTP GET method.
For example, if a request might produce a large download, a HEAD request could read its Content-Length header to check the file-size without actually downloading the file.
Retrieve blob headers
HEAD https://api.bloqifi.com/v0/blob/OBJECTID
Retrieve a blob's headers
Fetch blob from IPFS
The Blob object represents a blob, which is a file-like object of immutable, raw data; they can be read as text or binary data, or converted into a ReadableStream so its methods can be used for processing the data.
Retrieve blob
GET https://storage.bloqifi.com/ipfs/CID
Retrieve a blob
Retrieve hex string
GET https://storage.bloqifi.com/ipfs/hex/CID
Retrieve a hex string
Last updated
Was this helpful?