Transaction Not Passsed

Hey Guys, I followed the tutorial but when it was time to go to ETH Mainnet. I changed the server url and app ID to that of the mainnet and when I ran the code, metamask stopped popping up.
I believe no transaction was passed to metemask because my ETH balance is zero, please what am I doing wrong?

Do you see any errors in the browser console?

No Sir, nothing of such

If you try to run the transfer function with 0 balance, it should throw an error.

Can try to add a console.log in the function to see if the function ran successfully

I have two files here, the main.js and the index.html. Which one should I add the console.log?

in main.js transfer function

This is the main.js file, is it all good to go?

/* Moralis init code */
const serverUrl = “https://xxxxx/server”;
const appId = “YOUR_APP_ID”;
Moralis.start({ serverUrl, appId });

/* Authentication code */
async function login() {
let user = Moralis.User.current();
if (!user) {
user = await Moralis.authenticate({
signingMessage: “Log in using Moralis”,
.then(function (user) {
console.log(“logged in user:”, user);
.catch(function (error) {

async function logOut() {
await Moralis.User.logOut();
console.log(“logged out”);

document.getElementById(“btn-login”).onclick = login;
document.getElementById(“btn-logout”).onclick = logOut;

There are no errors in this code.

Please review the HTML code

<!DOCTYPE html>
    <title>Vanilla Boilerplate</title>
    <script src=""></script>
    <script src="[email protected]/dist/web3.min.js"></script>
    <script src=""></script>

    <h1>Moralis Hello World!</h1>

    <button id="btn-login">Moralis Metamask Login</button>
    <button id="btn-logout">Logout</button>
    <button onclick="runcode()">Run code</button>

    <script type="text/javascript" src="./main.js"></script>
    function runcode(){

you don’t have to change the server url for that transfer, that transfer will be made on the network where metamask is connected, it doesn’t depend on the server url

here you may want to write only onclick="runcode" so that it is not called instantly when the page loads

Alright, thanks for the correction