Skip to main content

All Questions

Filter by
Sorted by
Tagged with
0 votes
1 answer
22 views

In which language should i write my deployment code Javascript or Solidity

Which language should I learn to write the deployment code for a smart contract: JavaScript or Solidity (using Foundry)? What should I learn according to today's trends?
saksham mishra's user avatar
0 votes
1 answer
125 views

Signature verification using web3js

I am using web3 library to sign a transaction and then verify it from the smart contract. The signature is not verifying. This is the frontend code const DomainSeparator = ethers.keccak256( ...
Abdul Samad's user avatar
0 votes
1 answer
78 views

Rejecting the transaction doesn't catch the error in try-catch block

I am working on a Dapp porject ,Where I have to catch the metamask error. Here is my code: import React, { createContext, useContext, useEffect, useRef, useState, } from "react"; ...
Asir Shahriar Roudra's user avatar
0 votes
1 answer
1k views

unpredictable gas limit error doesn't go away after setting gasLimit manually

I have this contract which is written in solidity and one of the functions (getMyActivity()) returns an array of structs and im trying to call it from my frontend which is written in ReactJS but i get ...
Shadq's user avatar
  • 93
0 votes
2 answers
7k views

We were not able to estimate gas. There might be an error in the contract and this transaction may fail

I cannot add a candidate as it shows there is an error in the contract, but the code does not show any error. **// SPDX-License-Identifier: MIT pragma solidity >=0.5.0 <0.9.0; contract Election{...
Sheefa Jalali's user avatar
0 votes
2 answers
387 views

Send ETH from contract to wallet shows as a deduction from wallet rather than addition to it and balance is unchanged

I have the following smart contract function that is supposed to be called from a web app, using ethers and Metamask, running on Hardhat localhost blockchain. Its purpose is to send the specified ...
Laurentiu Neacsu's user avatar
0 votes
0 answers
92 views

Receiving Invalid Address on Web3

I am having issues launching my web3 connected to Solidity (on Remix) and MetaMask. The error that popped out was that I have an invalid address and they were referencing the function called ...
SpunkkyD's user avatar
1 vote
0 answers
41 views

Metamask Connect Button Not working when adding "Deposit" function

I'm following a tutorial for a basic app that utilizes Metamask, this is my code in index.js: import { ethers } from "./ethers-5.6.esm.min.js" import { abi, contractAddress } from "./...
Ofir Smolinsky's user avatar
0 votes
1 answer
685 views

MetaMask - RPC Error: execution reverted, Simple NFT Miniting Dapp

I'm building a simple NFT minting Dapp for fundraising. I first deployed contracts on Polygon testnet and then on Ethereum testnet goerli. While integrating, my front-end with my smart contracts using ...
DevABDee's user avatar
  • 483
0 votes
1 answer
69 views

ReferenceError: web3 is not defined

<script src="https://cdn.jsdelivr.net/gh/ethereum/web3.js/dist/web3.min.js"></script> <script> window.onload = function(){ if(typeof web3==&...
daredevil's user avatar
1 vote
1 answer
166 views

How is the Gas Price field in Metamask populated?

I have an evm compatible blockchain with a price limit set to 10000. However when I go to submit a transaction to a validator, Metamask populates the gas price at 0: How can I ensure transactions are ...
cormacncheese's user avatar
0 votes
2 answers
760 views

What exactly does the 'ethereum' keyword in 'window.ethereum' referring to?

Is it referring to the ethereum blockchain? Sorry if this seems too basic of a question. I'm new and I can't seem to find an answer anywhere.
user avatar
0 votes
1 answer
63 views

Need help understanding "the template code provided by Metamask for how we can detect to see if the user has Metamask installed"?

I'm going through an online Solidity Tutorial, and it shows me this: "Here's some template code provided by Metamask for how we can detect to see if the user has Metamask installed, and if not ...
user avatar
0 votes
1 answer
352 views

Why is my Smart Contract function not being recognized by web3?

I am trying to develop a new Dapp. I have written the smart contracts and they are working well. I now need to use web3 to interact with the smart contracts, for now using ropsten or rinkeby. I get ...
Philip Rutovitz's user avatar
0 votes
0 answers
7k views

MetaMask - Internal JSON-RPC error

i was developing a full stack nft marketplace, where i can mint nfts but when i try to buy it gives me this error :MetaMask - Internal JSON-RPC error code: 3, message: "execution reverted: Please ...
stofu's user avatar
  • 103
1 vote
2 answers
1k views

I am getting Returned error: VM Exception while processing transaction: invalid opcode error

I am getting an Invalid Opcode error while calling the refundAmount function which will refund the amount to the customer and cancel his/her ticket bookings. registrations is a structure mapping and ...
Yash Attal's user avatar
1 vote
0 answers
350 views

Contract not returning error to React Interface

I have a contract which I've tested with Mocha and Remix and is working just fine. The problem is when I'm running it with my React Interface. When I call a function in my solidity contract that ...
AlbertoV19's user avatar
1 vote
1 answer
2k views

I'm getting "Cross-Origin Request Blocked" error

I'm getting this error: Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://localhost:8545/. (Reason: CORS request did not succeed). I'm aware ...
Imestin's user avatar
  • 35
0 votes
0 answers
25 views

How to update Data on UI

I have a UI thats connected to metamask The UI updates all the Info now on address change and when metamask is enabled How can i make my UI update every second? so it always shows accurate stats on ...
redbulll's user avatar
1 vote
1 answer
967 views

How to convert to 8 digits in etherum

I have a token that has 8 digits, so the output is 4762575931 instead of 47.62575.. How can i change this so this works on UI and for metamask input? I know there is the function to wei but this is ...
redbulll's user avatar
0 votes
0 answers
108 views

Not able to call the solidity function through App.js? Anyone know how to call a solidity function?

I'm trying to call a Solidity function from App.js, but I'm unsuccessful even after a number of tries. Its a very simple function betOnTeam(). Inside this function I just want to check condition and ...
raghav's user avatar
  • 74
0 votes
1 answer
846 views

How can a smart contract payable based function returns value against any purchase

I am trying to get a return value from the payable function, the idea is a user must pay the fees and in return, he will get his special code. My JS test code is as follow it('get special code ...
wolvorinePk's user avatar
3 votes
1 answer
8k views

'ALERT: Trying to call a function on a non-contract address' Why Do I Keeping This Error?

This is the error from metamask directly: This is the error I get once after I submit the information to IPFS: My Smart Contract: pragma solidity 0.5.3; //Imports for safe math operations import "...
Ty Cooper's user avatar
0 votes
2 answers
137 views

Uncaught Error: Invalid number of arguments to Solidity function

function TriggerContract() { var account = getAccounts(); var test = web3.eth.defaultAccount; console.log(account); var q = document.getElementById("Quantity").value; var ...
Macdara Day's user avatar
1 vote
1 answer
761 views

Metamask stuck at Unknown network ID when trying to interact with local Ganache network

I'm getting unknown network ID error on transferring a token in meta mask as in the image below. I'm using local network with ganache. I can transfer from metamask account to another after ...
hafiz muhammed's user avatar
0 votes
2 answers
733 views

Web3.eth.accounts[0] never updating

I'm trying to use Web3 to access the current account I have selected on Metamask by doing web3.eth.accounts[0] in order to display it on my UI (in VueJS). However web3.eth.accounts[0] always returns ...
kws3778's user avatar
  • 103
3 votes
2 answers
4k views

Estimate Gas Cost before SendTransaction [duplicate]

How meta estimating gas cost before broadcasting. How can I calculate gas cost for myfunc() in web3js? function myfunc(){ require(msg.sender == owner) ... } await contractInstance.myfunc....
Slim Shady's user avatar