JavaScript required
We’re sorry, but Coda doesn’t work properly without JavaScript enabled.
Darkblock Docs
Darkblock Docs
Darkblock Docs
What is Darkblock?
How does it work?
Creating a darkblock
Viewing Darkblock content
The Darkblock Protocol
Supported Blockchains
HIDEME Sample NFT with Darkblocks
For Creators
Products
The Darkblock API
The Darkblock Viewer
The Upgrader
The Darkblock Web App
The Darkblock TV App
Features
NFT Upgrades
Collection Upgrades
Content Stacking
Editing Metadata
Send to Kindle
Use Cases
Comics and Books
Movies
Content Creation
PFPs
Gamified Experiences
Developer Integration
Getting Started
The Darkblock API Overview
Get an API Key
Embed Darkblocks into any website
NPM
Ethereum
Polygon
Solana
Tezos
Avalanche
Customization
Direct Integration
HIDEME UGC (User Generated Content)
Content Monetization
Subscriptions using Unlock Protocol
Content Rental with Unlock Protocol
Help / Support
Terminology
Help, I made a mistake!
Tutorials
Unlockable Party Pack
Developer Integration
Getting Started
Typical developer integration involves using the
Darkblock API
to facilitate fault-tolerant, scalable minting of Darkblocks.
The Basics
First,
grab your API key
.
Then you can use our swagger docs to try out
minting Darkblocks
.
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
app.darkblock.io
, or you can
embed the viewer
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
How we built web3investors .xyz
.
Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
Ctrl
P
) instead.