Marketplace has launched, further enabling blockchain developers! Learn more

How to Lazy Mint an NFT on Rarible with Rarepress

September 09, 2022


NFTs are great for creators to monetize their artwork and for people to get ownership of an item. But since gas prices are usually high given the highly in-demand space on Ethereum, minting an NFT or an NFT collection can become costly for a creator. Lazy minting solves this, so in this guide, we will learn how to lazy mint an NFT using Rarepress.

  • Ethereum node
  • NodeJS
  • Code editor and Terminal/CLI

Why Lazy Minting?

To mint an NFT, you write data on the blockchain, which on a high level, means attaching the address of the NFT to the address of the minter. Since storing some data on the blockchain is a write operation, a gas fee must be paid. Although Ethereum is the most popular blockchain, new and existing creators often hesitate to mint an NFT on it and pay this fee since there isn’t a guarantee that their NFT would gain popularity. The concept of lazy minting solves this to an extent.

What is NFT Lazy Minting?

Lazy Minting is a process in which the creator does not have to pay the gas fee for minting the NFT upfront, and they can list it on marketplaces for sale. Whenever a buyer buys the NFT, it is minted just in time, and the minting cost is added to the total cost of the NFT. Rarible, a leading NFT marketplace, has a very convenient protocol that supports lazy minting; here, we will use Rarepress, a JavaScript library built on the Rarible protocol.

What is Rarepress?

Rarepress is a JavaScript library that provides an API interface with the Rarible NFT protocol. Rarepress provides an interface with the Rarible protocol smart contracts and works on lazy minting, so anyone with minimal experience of Ethereum can mint an NFT for free. Further, we will install Rarepress and write a short script to mint our NFT on Rarible.

Setting up Rarepress

We will write some JavaScript code and run it on CLI to mint NFT. To do so, Rarepress needs to be installed using npm, which comes with Node.js.

First, create a directory rarepress_demo and open it in your terminal.

mkdir rarepress_demo

cd rarepress_demo

Then install it by typing:

npm i rarepress

Now that we have installed Rarepress, we can move to creating our script to mint NFT. But we will need an Ethereum node to interact with the contract, so first, we will boot a node.

Booting our Ethereum Node

Rarepress interacts with the Rarible protocol contracts deployed on the Ethereum blockchain. To do so, it requires an Ethereum RPC connection. To save the time and burden of creating an Ethereum node, we will simply get a free trial QuickNode Ethereum Mainnet node.

Screenshot of Quicknode Ethereum endpoint

Save the HTTP provider URL as we will use it next.

Lazy Minting an NFT on Rarible

Now that we have everything in place, let us write the script to mint our NFT. Create a JavaScript file index.js, and paste the following code in it:

const Rarepress = require('rarepress');

const mint = async () => {

    const rarepress = new Rarepress();

    await rarepress.init({ host: "ADD_QUICKNODE_HTTP_URL_HERE" })

    let cid = await rarepress.fs.add("ADD_LINK_TO_IMAGE_HERE") //We will be using "" for this example

    let token = await rarepress.token.create({

      type: "ERC721",

      metadata: {

        name: "NAME_OF_YOUR_TOKEN", // We will be using "Hello World NFT" for this example

        description: "DESCRIPTION_OF_YOUR_TOKEN", // We will be using "Minting NFT so easy!" for this example

        image: "/ipfs/" + cid



    await rarepress.fs.push(cid)

    await rarepress.fs.push(token.tokenURI)

    let receipt = await rarepress.token.send(token)

    console.log(`Check token at:${}`)




In your code, replace:

  • ADD_QUICKNODE_HTTP_URL_HERE with QuickNode’s HTTP URL from the last step.
  • NAME_OF_YOUR_TOKEN with a custom name for your token. 
  • DESCRIPTION_OF_YOUR_TOKEN with a custom description for your token. 

Explanation of the code above:

Line 1: Importing the Rarepress library.

Lines 3-4: Creating an async function mint and initializing a new Rarepress instance.

Lines 8: Adding our image to the Rarepress file system.

Lines 10-17: Creating a new token and adding a metadata array. type is the type of token; ERC721 or ERC1155 are supported by Rarepress. name and description are the name and description of your token, and image will store the IPFS address with the path of your NFT asset.

Lines 19-20: Storing the image to IPFS.

Line 22: Pushing the token to the Rarible marketplace.

Line 24: Printing the token’s id along with a URL to Rarible so that we can get a link to directly view the token on the marketplace.

Line 25: Ending the script process after successfully publishing our NFT on Rarible.

Line 27: Calling the mint function.

Save the file and run it using:

node index

Once you run the script, you will be prompted with the option to enter a seed or create a new seed. You can generate the seed of your already existing wallet or create a new one; another step will be to set a password for the wallet, which will be used every time you mint using Rarepress.

After successful execution, the output will look like this:

The link from the output should take you to the NFT’s page on Rarible.


Congratulations on listing your NFT on a marketplace for free. In this guide, we learned about lazy minting and how to lazy mint an NFT using JavaScript and Rarepress.

Subscribe to our newsletter for more articles and guides on Ethereum. If you have any feedback, feel free to reach out to us via Twitter. You can always chat with us on our Discord community server, featuring some of the coolest developers you’ll ever meet :)

Related articles 35

How to do a non-custodial transaction with QuickNode
Originally Published On: Jun 19, 2021
Updated On: Sep 9, 2022

Private keys are one of the most... A non-custodial wallet is a... Custodian of Private... At We could use pretty much any... We could use any of the many... Let us create a token transfer... Congratulations on making a...

Continue reading
How to Set Up a Near Project from Scratch
Originally Published On: Jan 27, 2022
Updated On: Sep 9, 2022

In this tutorial we will look at... In this section, we will... In this section, we will look at... In this section, we will look at... When writing smart contracts on... In the last section, we looked... In the last section, we looked... In the last section, we looked... We have finally come to the end...

Continue reading
Estimating gas price using pending transactions in Python
Originally Published On: Feb 20, 2021
Updated On: Sep 9, 2022

To send a transaction on the... Gas is the unit to measure the... Why do we want to estimate gas?... Our first step here would be to... For our purposes today, we could... The first thing we’re going to... Now you know how to estimate gas...

Continue reading
Como crear y lanzar un ERC-721 (NFT)
Originally Published On: Dec 27, 2021
Updated On: Sep 9, 2022

Coleccionables digitales que son... Fungible significa que es lo... ERC es la abreviación para... Ahora que conocemos qué es y... Antes de escribir nuestro... Felicidades por crear tu propio...

Continue reading
How to Access Bitcoin Mempool
Originally Published On: Aug 16, 2021
Updated On: Sep 21, 2022

Bitcoin is the father of... The transactions which are sent... For our purpose today, we need a... We will use Bitcoin RPC methods... Congratulations on mastering the...

Continue reading
How to Mint an NFT on Polygon with Ethers.js
Originally Published On: Mar 28, 2022
Updated On: Sep 9, 2022

This guide demonstrates how to... Ethers.js is a complete Ethereum... As a reminder, the act of... We will deploy our contract on... Time to write the code! Start by... Note, you will need some... That’s it! You have minted an...

Continue reading
How to access Ethereum Mempool
Originally Published On: Oct 15, 2020
Updated On: Sep 15, 2022

On Ethereum, when a transaction... In blockchain terminology, a... For the purpose of this guide,... First, query the Let’s examine how to subscribe... This short guide showed you how...

Continue reading
The Web3 Developer Stack
Originally Published On: Jul 3, 2021
Updated On: Sep 15, 2022

A developer stack is a bag of... If we can imagine web3 as a car... The Chainlink price feed... Head over to the We’ll need a Kovan node to... We’ll now write a short... Congratulations :D You’ve taken...

Continue reading
How to Mint NFTs on the Stacks Blockchain
Originally Published On: Aug 19, 2022
Updated On: Sep 9, 2022

Stacks is an emerging blockchain... The Stacks ecosystem has adopted... Open up a terminal window and... Implementing the SIP-009... This section will demonstrate... The moment you've been waiting... Awesome Work! You’ve learned how...

Continue reading
Introduction to Scaffold-ETH 🏗
Originally Published On: Oct 7, 2021
Updated On: Sep 9, 2022

Developing applications involves... First of all, before getting... Scaffold-ETH comes with a demo... We will set up a QuickNode... Congratulations, and thank you...

Continue reading
How to connect to Ethereum using PHP
Originally Published On: Jun 11, 2021
Updated On: Sep 9, 2022

PHP is a very popular choice... Before installing the web3.php,... We could use pretty much any... Now, make a PHP script file... Congratulations on connecting to...

Continue reading
How to use Subspace with QuickNode
Originally Published On: Sep 8, 2020
Updated On: Sep 9, 2022

In this guide, we'll understand... To install Subspace, we'll need... For our purposes today, we could... Now let's create a short script,... Run the file using the node...

Continue reading
How to Connect Your Dapp With MetaMask Using Ethers.js
Originally Published On: Dec 13, 2021
Updated On: Sep 9, 2022

In our dApp, we will have a... A dApp is an application that... We will need to install the... Ethers.js is a lightweight... With this application, we will... Next, we will create a function... After connecting to MetaMask, we... To handle the wallet address of... This section will show us how to... In this tutorial, we...

Continue reading
How to get the balance of an ERC-20 token
Originally Published On: Jun 14, 2021
Updated On: Sep 21, 2022

When a new token is made on the... You could use any Ethereum... Now that you've done the legwork... Getting the ERC20-Token Balance... In the top of your... ABI is short for You will most likely interact... You can use a similar process... We now have a connection to an... Having made it to the end, you...

Continue reading