Want to mint on NodeJS, using private key

Hello,

In our business model our website will be the custodian of e-wallets on behalf of our members.
Our members are buyers and sellers of NFT-backed merchandise (eg. videos) in the music space.
Our members aren’t very crypto-savvy and most don’t own wallets themselves. They simply pay via credit card and the website creates a wallet on the member’s behalf and stores the private key.

So we don’t have (and don’t want to have) a MetaMask dialog popping up on our webpage.
Instead we wish to do the lazy-minting from our NodeJS server.

I’ve been searching high and low on how to do this in Moralis, but have not been able to find anything that looks fit for our purpose.

Can someone please point us in the right direction?

Thank you so much!

1 Like

Hello,
You can do a transaction on your server and sign it with your private key.
It is possible to do that. It doesn’t depend on Moralis. for example you can use web3 to make that transaction using a private key.
Lazy minting in particular could mean that no transaction is done on chain until a sell or transfer is done (that is how it works on opensea for example)

Hi @cryptokid,

Thank you for the prompt reply.

RE: "You can do a transaction on your server and sign it with your private key. … It doesn’t depend on Moralis. "
Ok, and sorry I’m new to this, but I had hoped that Moralis would make these things easier… That’s the vibe I got from the site.

Are you saying that Moralis is not helping much for this use-case and we should just use Web3, with say, Infura, like so:

const Web3 = require(‘web3’)
const Provider = require(’@truffle/hdwallet-provide’)

const provider = new Provider(privateKey, ‘https://rinkeby.infura.io/v3/74aa9a15e…’);
const web3 = new Web3(provider);

What is the equivalent code when using Moralis, please?
And what is the value-add?

You can use infuria, or your speedy node from Moralis, is same thing, that is only the node where the transactions/requests will be sent

but you still have to write that code with Web3 that uses that private key

In case that you want to use MetaMask, in a browser, then there are easier to use functions like Moralis.executeFunction