Create a new transaction

Hey folks.

After the crypto login with Moralis the User object has not the password property (, while it is shown on the screenshot there, that it has.

But the password is needed to perform transactions (

Or maybe, has the Moralis Web3 SDK a method for creating transactions?

Hi. The code snippet of the user object in the docs is just an example of the attributes a user has, it’s not representative of a brand new user. If the address is not known when Moralis.Web3.authenticate() is called a new user will be created with:

  • a randomly generated username
  • the password and email attributes will be undefined

In fact the user object returned is bit more complicated and looks like this:

  className: "_User"
  id: "EFurGjRPhl"
  _objCount: 1
  attributes: {
    ACL: ParseACL {permissionsById: {…}}
    accounts: ["0xda66...cb83"]
    authData: {moralisEth: {…}}
    createdAt: Mon Mar 22 2021 09:50:03 GMT-0700 (Pacific Daylight Time) {}
    ethAddress: "0xda6...cb83"
    sessionToken: "r:1fc10586d0339be71fc3cac25592693e"
    updatedAt: Tue Apr 27 2021 09:43:25 GMT-0700 (Pacific Daylight Time) {}
    username: "Y9jPGr0H1TcMFHUpYZPjj9xhE"
1 Like

Thank you for your answer, but I still wish to know how to make transactions on blockchain using Moralis platform.

For making on-chain transactions see Web3 docs here

To get notifications of transactions and contract events see here:

1 Like

Thanks, I’ve seen these topics already. I think, you directed me to this piece of code on

const web3 = await Moralis.Web3.enable(); const contract = new web3.eth.Contract(contractAbi, contractAddress);

It’s not actually what I want to invoke, but later I will try to call a smart contract method too (the way shown in the Moralis Web3 docs).

Well, I hope that after the crypto login with Metamask the logined EthAddress becomes unlocked, so I will be able to use the web3.eth.signTransaction => web3.eth.sendSignedTransaction. Will give that a try.

yes. after calling Moralis.Web3.enable() in the browser it will prompt the user to sign in with their wallet. The web3 instance you get back from calling this method will then be connected to the user’s wallet and be able to sign transactions.

1 Like

yeah, the web3.eth.sendTransaction works for me, therefore the question can be marked as solved.


@vladimirwebatix Can you share with us what you did to make your transaction work?

yeah, sure thing, consider that code snippet:

let moralis_node = {};

Moralis.Web3.authenticate().then(async (current_user) => {
  moralis_node.web3 = await Moralis.Web3.enable();

// This object has to be filled somehow with values before the add transaction button is clicked
let transaction_data ={};

add_transaction.button.addEventListener('click', () => {
  const transactionObject = {
    from: Moralis.User.current().get('ethAddress'),
    to: transaction_data.destination_address,
    value: transaction_data.amount,
    gasPrice: transaction_data.gas_price,
    gas: transaction_data.gas_limit
  moralis_node.web3.eth.sendTransaction(transactionObject, (error, result) => {
    console.log("The sendTransaction error == ", error);
    console.log("The sendTransaction result == ", result);

Thank you very much. I managed to make a Metamask popup appear with a 0 amount. Now I will dig deeper.
It is a pity this is not documented in the Moralis doc :


The docs assume the reader has some knowledge of Web3 already. If you have any suggestion on how to improve the docs please let us know.

Once you call Morals.Web3.enable() this gives you a fully functional web3 instance connected to the user’s wallet. At this point the Moralis docs link to the Web3 docs here

Bookmark that page. Most of the functionality you’ll need is in web3.eth and web3.Contract

Thank you for the response.

If you have any suggestion on how to improve the docs please let us know.

Actually I think what can be useful is that the Moralis doc can provide an example in the helper function section with sendTransaction along with getTransactions(), etc.

So in the end, I managed to have a button sending a ETH transaction to Metamask, which is a good start.

Hi @vladimirwebatix, do you know if there is some example code to triggering a transfer from account to another on button click or similar please?

Many thanks in advance for your reply / support!

1 Like

Hi Leonidas.

You can use my code snippet above, just be aware, that add_transaction.button should be equal to your button HTML element, something like that:

let add_transaction = {};
add_transaction.button = document.getElementById('my_transfer_button');

Awesome thank you so much …I was playing around with this last night but got nowhere.
I will give it another shot :slight_smile: thanks man!


1 Like

Hii, I’m trying to create a simple dApp in React-native.
I tried to use react-moralis library in react-native but stuck at the ETH transaction.
I want to send test ETH using Ropsten Text Network to another wallet but not getting conformation from MetaMask

Video :

it asks for login to see that video, do you get to sign the transaction? the authentication with wallet connect works?

Thanks for replying.
yes, the authentication with wallet connect works but does not get a transaction pop-up.
I used

maybe you need to use enableWeb3({provider:'walletconnect'})

const { web3, enableWeb3, isWeb3Enabled, isWeb3EnableLoading, web3EnableError } = useMoralis();

enableWeb3(); or enableWeb3({provider:‘walletconnect’});

getting error like this :
web3EnableError [TypeError: undefined is not an object (evaluating ‘connector.connect’)]