darkblock-logo
Darkblock Docs
Developer Integration

Getting Started

Typical developer integration involves using the to facilitate fault-tolerant, scalable minting of Darkblocks.

The Basics

Then you can use our swagger docs to try out .
For upgrades, here is some example code to help you out:
NFT Upgrade Using Darkblock API

const axios = require('axios');
const FormData = require('form-data');
const { createReadStream }= require('fs')

/**
* Mints a Darkblock as an upgrade to an existing NFT.
* This involves uploading a file and providing details like NFT contract, token, and platform.
* A unique signature is required to verify the creator's identity.
* The signature is created by concatenating the NFT platform, NFT ID, and a SHA-256 hash of the uploaded file.
*
* @return {Promise<Object>} The response data from the Darkblock API.
*/
async function upgradeNFTWithDarkblock() {
const apiKey = 'YOUR_API_KEY';
const url = `https://api.darkblock.io/v1/darkblock/upgrade?apikey=${apiKey}`;
const filePath = "YOUR_FILE_PATH"; // Replace with actual file path
let formData = new FormData();

// Append data to the form
formData.append('name', 'Upgrading My NFT');
formData.append('darkblock_description', 'Upgrading My NFT');
formData.append('file', createReadStream(filePath));
formData.append('nft_contract', '0xC4451ae26328eB85710...');
formData.append('nft_token', '7');
formData.append('creator_address', '0x438cba7e454b59a9....');
formData.append('nft_platform', 'Polygon');
formData.append('nft_standard', 'ERC-721');
formData.append('darkblock_signature', '0x33780...');
formData.append('download', 'true'); // Setting this true will make the content downloadable

try {
const response = await axios.post(url, formData, {
headers: formData.getHeaders()
});

const { data, status } = response;

// Check if the status is 200 and a tx_id is present in the response
if (status === 200 && data.tx_id) return data;
else console.log('Upgrade failed:', JSON.stringify(data));

} catch (error) {
console.error('Upgrade failed:', error.response ? error.response.data : error.message);
}
}
You can see the content available at , or you can into your website.

Advanced

You can clone and launch your own microsite using Paper to sell Polygon ERC-1155 NFTs, with a landing page embedding the Darkblock viewer to enable consumption of the purchased content. See this blog post on .

Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
CtrlP
) instead.