How to roll your own NFT marketplace AND start minting, all in 5 minutes.

Skøgard
4 min readSep 7, 2021

Today I’m going to show you how to roll your own Rarible and start minting to it. More specifically, I will share how you can:

  1. deploy your own Rarible NFT marketplace contract to Ethereum
  2. and programmatically mint NFTs to it.

All in 5 minutes. Let’s go.

1. Deploy Your Own NFT Marketplace Contract

We are going to use https://rariverse.org, a web app that lets you deploy your own Rarible contract through the Rarible token factory contract.

Let’s test on rinkeby network. Switch your network to rinkeby on your Metamask, and you’ll see the page auto-update. Now add the name and symbol for your NFT collection, and press “create”. It should pop up Metamask where you can send the deployment transaction. That’s all! Here’s the entire process in a gif:

The contract has been deployed at https://rinkeby.etherscan.io/address/0x6A988D6F7E28C67e41BD94720792Ce6FBdeEFf8c in this example.

Note: Sometimes it takes some time for the Rarible.com backend to index the newly created contract, so if it doesn’t show up on the website immediately, wait a couple of hours and try again. As long as the contract was successfully deployed, Rarible.com should be able to pick it up on their UI.

2. Mint to Your Collection

Now let’s try minting to your contract you just deployed. To mint to your collection we need to first get the contract address. Go back to the rariverse tab and copy the contract address:

Now let’s mint to this contract!

By default Rarepress publishes tokens to the global Rarible collection. But when you want to publish to your own contract, all you need to do is specify the contract attribute while creating your token.

You can do this both in the browser or in node.js, but for the sake of simplicity let’s just do it on node.js

First create a project folder and initialize the project:

mkdir custom-collection
cd custom-collection
npm init

Then install rarepress:

npm install rarepress

Now let’s write some code. Create a file named index.js:

const Rarepress = require('rarepress');
(async () => {
// 1. initialize
const rarepress = new Rarepress()
await rarepress.init({ network: "rinkeby" })
// 2. import a web image to fs
let cid = await rarepress.fs.add("https://static.wikia.nocookie.net/stephenking/images/8/8f/Itclown.jpg/revision/latest/scale-to-width-down/1000?cb=20210511191757")
// 3. create a token and save to local rarepress, referencing the image
let signedToken = await rarepress.token.create({
contract: "0x6A988D6F7E28C67e41BD94720792Ce6FBdeEFf8c",
metadata: {
name: "Friendly Clown",
description: "A friendly clown is giving you a red balloon",
image: "/ipfs/" + cid
},
})
console.log("signedToken", signedToken)
// 3. publish files to IPFS
await rarepress.fs.push(cid)
await rarepress.fs.push(signedToken.uri)
// 4. publish token to Rarible marketplace
let sent = await rarepress.token.send(signedToken)
console.log("sent", sent)
process.exit()})();

and run it with node index

Make sure to replace the contract: 0x6a988D6F7E28C67e41BD94720792Ce6FBdeEFf8c part with YOUR contract address you copied from the previous step.

If you do not include the “contract” attribute, it will mint your token to Rarible’s shared collection at https://etherscan.io/address/0xF6793dA657495ffeFF9Ee6350824910Abc21356C But because we’ve added the custom contract attribute, it will mint to our new contract.

It will publish everything to IPFS and also to the marketplace, and then give you the final result. Just copy the id part and open the browser at https://rinkeby.rarible.com/token/<id here>. (The example used below is here: https://rinkeby.rarible.com/token/0x6a988d6f7e28c67e41bd94720792ce6fbdeeff8c:14107779161967076660334329970500133928755960271447644359217263815656367741207)

Here’s the full walkthrough in a GIF:

Conclusion

Deploying your own Rarible collection contract and minting to it is this easy.

To learn more about the Rarible NFT marketplace protocol, visit:

And to learn more about Rarepress, the NFT Operating System that makes it super easy to interact with the Rarible protocol (as you saw above), visit:

--

--