How to log in to your wallet with the private key in Moralis Cloud Web3 SDK?

How to log in to your wallet with the private key in Moralis Cloud Web3 SDK?

In classic web3.js I do like this:
const Web3 = require(“web3”);

const web3 = new Web3(new Web3.providers.WebsocketProvider(process.env.WEB3_PROVIDER_ADDRESS));
web3.eth.accounts.wallet.add(process.env.ACCOUNT_PRIVATE_KEY);
const account = web3.eth.accounts.wallet[0].address;

If you want to do this in a cloud function, maybe this helps:

  web3 = new Moralis.Web3(new Moralis.Web3.providers.HttpProvider("https://speedy-nodes-nyc.moralis.io/YOUR_ID_HERE/bsc/mainnet"));

How to log in to your wallet with the private key?

I guess that you could do it if you hardcoded the private key in a cloud function, but it is not recommend to do that from a cloud function.

After understanding better what you want to do, as in to send signed transactions from your server and not from a cloud function, you can use normal web3.js on server side.