Rarepress.node

Rarepress outside of the browser

Skøgard
6 min readJul 28, 2021

Today I’m releasing an important part of the Rarepress stack called rarepress.node. It’s basically Rarepress, but outside of the browser:

What is Rarepress?

But first, a quick recap on what Rarepress itself is:

Rarepress is an NFT minting framework that has significantly lowered the barrier to minting NFTs in the browser, to practically zero.

  1. Zero learning curve: All you need is 2 lines of JavaScript to mint an NFT.
  2. Zero cost: No need to even own Ethereum. Just get started minting NFTs immediately for FREE.
  3. Zero maintenance: No need to maintain complex infrastructure such as IPFS. Everything is just a simple JavaScript function call away.

Until today Rarepress has been a frontend-only framework, which means you could only use Rarepress in a frontend web app.

This is all great, but not flexible enough for a lot of use cases. We must go deeper.

Problems

Here are some of the problems with rarepress.js:

  1. Browser only: All minting, trading, and programming of NFTs take place in the browser. What if you want to mint local files on your computer? What if you want to mint files on a server? What if you want to tokenize a raw stream of data?
  2. Manual: Because browser wallets only let you manually sign one message at a time, it’s not possible to mint and trade thousands of NFTs automatically.
  3. Single identity: You can only use a single wallet address to mint NFTs when using browser based wallets. What if you could mint NFTs from as many addresses as you want, each used for its own purpose?

Introducing Rarepress for Node.js!

We already have a way to mint in the browser with rarepress.js, what we now need is a way to mint NFTs outside of the browser. It would be also great if it had the same API so you can use the same code everywhere.

And today, that’s exactly what I am releasing: Introducing Rarepress.node!

Node.js runs on linux servers, laptops, raspberry pis, and even in mobile devices, which means the possibilities are limitless.

Rarepress.node has exactly the same and easy to use syntax from Rarepress.js, because…it inherits from Rarepress.js! Here’s an example code:

Did you notice?

It’s EXACTLY the same code as the original rarepress.js for the browser! (Except that you have to require the rarepress.node module at the beginning).

This means you can take your existing rarepress apps from the browser and port it to rarepress.node powered apps instantly.

Of course there are many differences in how rarepress.node works compared to rarepress.js. Let’s walk through them.

Features

Here are some highlights:

  1. Built-in Wallet: Rarepress.node includes a built-in HD wallet (Hierarchical Deterministic wallet). You can programmatically instantiate as many wallets as you want from a single seed and mint NFTs using all those addresses.
  2. 100% Automated: You can now programmatically loop through 10,000 algorithmically generated images and tokenize them all into NFTs, automatically. No manual wallet approval for every mint. Imagine having to approve all 10,000 signature requests on your MetaMask. With Rarepress.node you can just run your code and it will mint a whole 10,000 item collection without you approving anything.
  3. Multi-identity: You can now mint from as many addresses as you want. You can even generate them deterministically and keep track of all the addresses you own.
  4. Same syntax as rarepress.js: Best of all, you don’t have to learn anything new! Rarepress.node builds on top of the original Rarepress.js (See GitHub here) so it inherits 100% of the features from the original, and you can use it exactly like how you would use it in the browser.

Walkthrough

To explain the true power of rarepress.node, let’s walk through a simple code that automatically loops 100 times and creates a collection of NFTs, WITHOUT making you approve every time (in the browser you have to approve every time).

Here’s the code:

Let’s walk through the code line by line to understand how all this works:

Step 1. Require rarepress.node

Since this is a node.js environment you need to require the package first:

Step 2. Initialize Rarepress

In the browser version of rarepress.js you can only instantiate a single global rarepress obejct because there can be only one wallet (for example MetaMask).

With rarepress.node, instead of a single wallet, we can use multiple wallet addresses derived from a single seed.

To specify the key derivation path, simply set the key attribute with a desired BIP44 derivation path (in addition to the usual host attribute to specify the rarepress host)

In this case we only used one wallet, but you can imagine creating multiple instances of Rarepress and initializing with different wallets for each.

Step 3. Automated Signature

One of the biggest benefits of rarepress.node is that it lets you do everything programmatically and automatically.

Instead of having to approve every sign request (in the browser, you have to sign the MetaMask popup every time when you need to do anything), you can write a piece of JS code that loops through and automatically mints 100s and 1000s of NFTs:

This automated wallet signature is possible because rarepress.node ships with a wallet built-in.

By default a wallet is generated when you first run a rarepress.node application, which stores your encrypted seed at your home directory under ~/.mushie.

Step 4. Same syntax for interacting with Rarepress

The only difference between rarepress.js and rarepress.node is the initialization part:

  1. you can create multiple instances of rarepress
  2. you can instantiate each rarepress with different key derivation paths

But once initialized, the rest of the syntax is 100% identical to the browser version of rarepress.js:

Conclusion

It’s very simple to use. To install, just do:

npm install rarepress.node

And then you can start minting your NFTs!

You can learn more about Rarepress.node on the GitHub repo:

If you have any questions, come to discord and ask!

Also you can learn more about the entire Rarepress stack at:

Finally, if you want to stay updated on Rarepress, follow me on Twitter at @skogard:

--

--