Skip to main content

Register contract

Typically, deploying a contract through Warp Gateway requires wrapping contract transaction in another transaction (Warp Gateway posts a contract transaction to the Bundlr Network as a data of the bundled transaction - more about in this doc).

This process does not allow to create a legit AtomicNFT as the data of the nested transaction (our contract) cannot be served via Arweave gateway (it will be possible as soon as Nested Bundles will be implemented by Warp).

Therefore, a new contract creation method has been exposed in Warp SDK. Let's go through the process.

  1. User needs to prepare contract transaction, all the tags required by the SmartWeave Protocol need to be included, initial state should be set in the tag, tags specific for AtomicNFT ('Title', 'Description', 'Type', 'Content-Type') should also be included in the contract tags.
const contractTags = [
{ name: 'Content-Type', value: 'text/plain' },
{ name: 'App-Name', value: 'SmartWeaveContract' },
{ name: 'App-Version', value: '0.3.0' },
{ name: 'Contract-Src', value: 'XA-sFBRvgIFFklmDV-TUlUPc3_pE3rIsXwH2AjwOYrQ' },
name: 'Init-State',
value: JSON.stringify({
ticker: 'ATOMIC_ASSET',
owner: address,
canEvolve: true,
balances: {
[address]: 10000000,
wallets: {},
{ name: 'Title', value: 'Asset' },
{ name: 'Description', value: 'Description' },
{ name: 'Type', value: 'Text' },
  1. User then needs to upload the contract. One can use Irys or other provider (e.g. Turbo or arbundles). Here, we will use Irys. In order to deploy contract we need to initialize Bundlr and upload the contract within data:
const jwk = JSON.parse(fs.readFileSync('.secrets/warp-wallet-jwk.json').toString());
const bundlr = new Bundlr('', 'arweave', jwk);

const data = fs.readFileSync('tools/data/data.txt');

const tx = await bundlr.upload(data, { tags: contractTags });
  1. Finally, contract is sent to Warp Gateway where it is indexed so it can be immediately available for all Warp tools, contract data can be also served by Arweave gateway. When using Irys - node1 or node2 must be set as a register method's second parameter, when using other providers - second parameter should be set to arweave. Warp Gateway verifies whether contract contains contract specific tags (e.g. Contract-Src, Init-State, App-Name and App-Version).

register method is dedicated to atomic assets so contract init state should be set in a tag and not in the data field of the contract, additionally - contract should contain Content-Type tag.


register method requires installing warp-contracts-plugin-deploy. Learn more about this plugin in Deploy Plugin section.

import { WarpFactory } from 'warp-contracts';
import { DeployPlugin } from 'warp-contracts-plugin-deploy';

const warp = WarpFactory.forMainnet().use(new DeployPlugin());
const { contractTxId } = await warp.register(, 'node2');
console.log(`Check the data:${contractTxId}`);

The whole process allows to have data and contract linked into one transaction and both are served under the same id.