For Developers

As a protocol, it is important for us to have a wide assortment of tools available for developers to work with and extend our platform.  We have APIs, NPMs, best practices and access to our development team through Discord.

Get an API Key

Send an email to info@darkblock.io and we will generate and send one over to you quickly.

API Access

We’ve got over half a dozen endpoints in our API that will help you get information about, validate and mint Darkblocks for your NFTs.  You will need your own API key.

You can find our Stoplight API implementation here:

https://apidocs.darkblock.io/docs/darkblock-openapi-1

React NPMs

The Darkblock Viewer enables you to add unlockable content to any website with ease. The best way to add the Darkblock Viewer to your website is to use one of our chain-specific NPM packages.

We have built out a robust set of npms available across 5 different chains.

https://www.npmjs.com/search?q=darkblock

We have npms for each of these chains:

Ethereum:
https://www.npmjs.com/package/@darkblock.io/eth-widget

Solana:
https://www.npmjs.com/package/@darkblock.io/sol-widget

Polygon:
https://www.npmjs.com/package/@darkblock.io/matic-widget

Avalanche:
https://www.npmjs.com/package/@darkblock.io/avax-widget

Tezos:
https://www.npmjs.com/package/@darkblock.io/tez-widget

And we also have a viewer widget that helps support many of the different content types that can be served from a Darkblock:

https://www.npmjs.com/package/@darkblock.io/shared-components

Collection Upgrades

Use collection upgrades to deliver content to all owners of the NFTs across an entire NFT collection.

One piece of unlockable content can be delivered to all owners in the collection with one API call.

You can use this collection as a type of exclusive club that gives the owners access to a stream of content over time. If you create more NFTs on the same collection then those new owners will automatically have access to all the same content. This is great for the web3 versions of Patreon and Onlyfans, and a great way to increase utility of your NFT collection!

For manual upgrades you can use our handy-dandy upprade forms (chain dependent!):
Polygon: https://app.darkblock.io/platform/matic/collection
Ethereum: https://app.darkblock.io/platform/eth/collection
Solana: https://app.darkblock.io/platform/sol/collection
Avalanche: https://app.darkblock.io/platform/avax/collection

If you are looking for programmatic access you can use this endpoint to create new Darkblocks that target a collection:
https://apidocs.darkblock.io/docs/darkblock-openapi-1/727535253430e-mint-darkblock-upgrade-collection
(More info about how to construct the request found there!)

Try before you buy! We recommend creating a test collection and playing around with the tools first. Darkblock creation is permanent!

There are some subtle differences in how collection upgrades work based on the chain.

Solana (Metaplex)
We target by collection name because this is the data available on-chain for each NFT for the Metaplex standard.

EVM Compatible (Ethereum, Polygon, Avalanche)
We use the contract address to target a collection for EVM NFTs because there is no popular on-chain metadata standard to target a collection of NFTs.

Tezos
Coming soon!

Direct Integration

Would you like to use your own viewer? Integrate into a native application? Use dDarkblock to store programmatic data like javascript, json, and anything else you can imagine? You can integrate with the protocol more directly and control what happens with the unlockable data.

Listing the available content

To see a list of unlockable content for an NFT you can use this API call: https://api.darkblock.io/v1/darkblock/info?nft_platform=<PLATFORM>&nft_id=<NFT_ID>

Platforms supported: Ethereum, Solana, Tezos, Polygon, Avalanche

NFT_ID composition for EVM Chains and Tezos: <CONTRACT_ID>:<TOKEN_ID>

NFT_ID composition for Solana: <TOKEN_ID>

Here is an example for Solana: https://api.darkblock.io/v1/darkblock/info?nft_id=412EiTpy6Uee5uB1GktpmTJaCUgFgDKLZDKQ419DCAGK&nft_platform=Solana

Example when no Darkblock is found: https://api.darkblock.io/v1/darkblock/info?nft_id=0x130cfab3817467f532c179d4e6502f5a7e7d44c7:4&nft_platform=Ethereum

More info on that endpoint here: https://darkblock.stoplight.io/docs/darkblock-openapi-1/74f56892076b1-get-darkblock-info

Darkblock Protocol Requests

Once Darkblock unlockable content is detected we need to construct a session token to access the content. This session token is a combination of the epoch timestamp (milliseconds), the signature of the concatenation of the current epoch timestamp and the wallet address of the user, and the chain.

One session token is needed per chain, and can be cached, as they do not currently expire. They will be prone to expiration in the future, the rules around this will be coming soon based on partner feedback.

Here is the format of the session token: <EPOCH>_<SIGNATURE>_<PLATFORM>

Example:

Signature of 16529845012790x438cba7e454b59a9f897d4731fd3eaef37160c0a

Becomes the following session token: 1652984501279_0x23ddc5b8767a3c2c7c9bab3bdcb86c88a328d21b214e2edad91c6d40b4ad34860c99cfbbf06381c718d8ef3c8068145834ba9a2c8bd442afae7468fef1d10a2f1c_Ethereum

The ArtId can be taken from the Darkblock info response and combined with the session token, owner wallet address, NFT Contract and Token Id, and platform to construct a Gateway request.

https://gateway.darkblock.io/proxy?artid=<ART_ID>&session_token=<SESSION_TOKEN>&token_id=<TOKEN_ID>&contract=<CONTRACT>&platform=<PLATFORM>

Example:

https://gateway.darkblock.io/proxy?artid=9b3aa571-d42f-4699-b09f-6b6c76dab994&session_token=1652985436749_0x1c52329bee2409530b07ddce694df6e75671c3b51bde4aa02f25630f99c369e21d420301b7b7d89eb892b389f1fe32a262c3eae296d2ae81bc05805aca46d8f21c&token_id=30553606573219150352991292921105176340809048341686170040023897669293200900097&contract=0x495f947276749ce646f68ac8c248420045cb7b5e&platform=Ethereum

(not a working example)

For Ethereum compatible chains you can use this handy-dandy signature tool that allows you to paste in some arbitrary text and create a signature with Metamask:

https://random-crap-public.s3.amazonaws.com/sign.html

Questions?

Come hit us up on the Darkblock discord!