Web

Making an call to the web endpoint

Fetch website from blockchain

Retrieve a website based on the blockchain and transaction id's (txid) provided.

Retrieve website

POST https://api.bloqifi.com/v0/web

Retrieve a website

Headers

Name
Type
Description

Content-Type*

String

application/json

Request Body

Name
Type
Description

txids*

Array

List of transaction id's ['123', '321']

blockchain*

String

Bloqcoin, Dogecoin, Bitcoin

Brotli compressed data if there is Content-Encoding support, otherwise raw text/html

text/html

The web endpoint will take all the transaction ids provided, merge the received hex strings containing OP_RETURN together and combine these into the final content. Bloqcoin is the obvious choice, as it supports 102480; //!< bytes (+1 for OP_RETURN, +2 for the pushdata opcodes). And as such can host an entire website in one transaction id.

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/web', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    blockchain: 'Bloqcoin',
    txids: ['123', '321']
  })
});

const data = await rawResponse.text();

if (rawResponse.status === 200) {

  // data contains the raw data
}

Good to know: Notice that the Blockchain used is capitalized, this is required.

In the example we will be using Bloqcoin, other supported blockchains are:

Dogecoin, Bitcoin

Let’s consider what the output of our response should look like:

If the browser or client is capable of decompressing Brotli, then a compressed version of the output is delivered as the content is already compressed in the blockchain.

Fetch website from IPFS

Retrieve a website based on the hash provided.

Retrieve website

GET https://storage.bloqifi.com/ipfs/CID

Retrieve a website

Brotli compressed data if there is Content-Encoding support, otherwise raw text/html

Configure a custom domain name for your IPFS

If you'd prefer to use a friendly DNS name for your website, such as www.example.com, instead of the default DNS name. You can create a custom domain name and associate it with the DNS name.

When a client makes a request using this custom domain name, the DNS server resolves it to the DNS name for your IPFS content.

Next, use your DNS service, such as your domain registrar, to create a CNAME record to route queries to your IPFS content. For more information, see the documentation for your DNS service.

Last updated

Was this helpful?