We changed our privacy policy. Read more.

Questions tagged [web3js]

Javascript API and library for Ethereum To develop applications on Ethereum, you can use the web3 object provided by the web3.js library. Under the hood it communicates to a local node through RPC calls. web3.js works with any Ethereum node, which exposes an RPC layer. https://github.com/ethereum/wiki/wiki/JavaScript-API

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

What happens when you connect wallet to website?

When a user goes to a crypto-related website (like Pancakeswap for example), the website asks the user to connect their wallet (eg Metamask, Binance Chain Wallet). I have several questions: What ...
0
votes
0answers
8 views

Why can't I reach my account, after I imported my metamask account using my mnemonic seed phrases?

I have used metamask on my old computer, where I had multiple accounts in it. When I moved to my new computer, I used the mnemonic phrase to import my existing wallet. The accounts that are now ...
0
votes
1answer
6 views

web3.eth.getBlock("latest") giving no object in the block!

I am trying to get the numbers of transactions in a rinkeby testnet in the last block I wrote the following code var Web3 = require('web3'); const Project_ID_Infura = 'write your own Infura ID'; ...
0
votes
1answer
16 views

how to store the gasprice as integer rather than object?

I am trying to get a the gas price in terms of integer. I tried the following // Get references to the modules (or the module content) that we need var Web3 = require('web3'); const apiKey ='https://...
0
votes
0answers
7 views

web 3 - why calling smart contract return empty Result object

I am using ReactJs for the frontend. At first, I click the first button, and it shows me connected. After that, I click the send button which call myContract, and it returns the object like below: ...
0
votes
2answers
20 views

sha256 works with string memory but doesn't work with bytes32

The problem occurs when generating a sha256 inside contract. This works fine: function SimpleHash(string memory val) public returns (bytes32) { bytes32 h = sha256(abi.encodePacked(val)); ...
0
votes
1answer
21 views

How to do transaction USDT using web3.js [duplicate]

I am trying to send the ERC20 USDT tether token. But I faced some errors. Could anyone let me know the code about the transaction USDT? Thanks.
0
votes
0answers
9 views

getNFTs() of Moralis SDK returning bad request

I am trying to retrieve nfts of an address for a side project. This is my code. const moralisWeb3 = useMoralisWeb3Api(); async function connectorValue() { try { const nfts = await ...
0
votes
0answers
16 views

How to setup transaction data manually with 1inch contract v3 and web3

I am writing a trading bot by using 1Inch contract on BSC chain. 1inch contract addr: 0x11111112542d85b3ef69ae05771c2dccff4faa26 To perform an transaction, i follow: Use swap API to get tx data: ...
0
votes
2answers
10 views

how can i send a transaction in spesific block numbers with web3Js?

I wanna know how to send the transaction in spesific block numbers with web3js ( Yes its for sniping bot ) The purpose is to avoid the tax in 1-3 blocks since liquidity is added For example : New ...
0
votes
0answers
19 views

How to read smart contract balances of particular adress

sorry if this is very googlable,but i coudnt manage to find good info so far. I want to read balances of particular adresses on different smart contracts, and even better if i can get the value of ...
1
vote
0answers
16 views

Why does web3 say the transaction hasn't been mined in 750 seconds when the blockchain transaction says it was mined in 1:30 seconds

We keep getting an error from our node application with the following error: Transaction was not mined within 750 seconds, please make sure your transaction was properly sent. Be aware that it might ...
0
votes
1answer
25 views

Get all token ids for a single erc721 contract address

I am trying to get all the token id for a given erc721 contract address. What would be the best way of doing this? I have tried using the web3 library with the following code but get response size ...
1
vote
1answer
34 views

What does msgSender() this code do in the OpenSea repository's example ERC721?

abstract contract ContextMixin { function msgSender() internal view returns (address payable sender) { if (msg.sender == address(this)) { bytes ...
0
votes
0answers
15 views

Metamask browser web3.js functionality not working over HTTPS, but works fine with HTTP

I have created a simple page with this web3.js function. It simply prompts metamask to change chain back to Ethereum Mainnet. await ethereum.request({ method: 'wallet_switchEthereumChain', ...
1
vote
0answers
18 views

Should I go with web3.py or web3.js as a beginner to start with dapp development? [closed]

I already have foundation in JavaScript and have done web app in HTML, CSS, Js and Django for a bit, and I am looking forward to learn about Dapp. Initially I want to go with web3.py but after looking ...
0
votes
0answers
13 views

web3SendInstance.eth.sendTransaction returning txhash but transactions get lost

I am using web3.eth.sendTransaction to try and send Ether from one address to another let result = await web3SendInstance.eth.sendTransaction({to:receiveAddress, from:web3.eth.defaultAccount, ...
0
votes
1answer
20 views

Error encountered during contract execution [contract creation code storage out of gas] [duplicate]

Transaction Hash: 0xa67bab86a7249fe3e332c32507cd575c3fff3fd7da2134b04bbab35ea5815ed0 Can someone help me with this? That i used for my 0.15 bnb ...
0
votes
1answer
11 views

proving ownership of public key with signature using web3.js

I am interested in storing public keys in a centralized database. The idea is, I'm going to have people who are interested in participating in a future ERC-721 drop sign up via a simple web form and ...
0
votes
2answers
17 views

Unexpected error calling ethereum contract using web3.js

Unexpected error calling ethereum contract using web3.js MyContract.methods.actual_balance("0xE8D.........").call({}) .then(r=>{ console.log(r) }).catch(err=>{ console.log(err) ...
0
votes
1answer
16 views

Can't Call Payable Function from Web3

I am trying to call a public payable function from my smart contract (^0.8.0) in a ropsten testnet function purchaseCardPack() public payable { require(msg.value == cardPackFee, "...
0
votes
0answers
13 views

MetaMask RPC Error: Already Known

I am trying to send a pair of transactions to a smart contract on Ropsten. I thought this might be a nonce issue on the second of the transactions where it wasn't being updated to a proper value but ...
0
votes
0answers
20 views

How to write headless Puppeteer/Cypress E2E tests for Dapps

I'm trying to write E2E tests for my Dapp in which I also want to interact with the contracts on local/test chains. I've managed to do this with Metamask but the issue is that I'm not able to run it ...
0
votes
0answers
17 views

Failed token purchase transactions on uniswap with web3.py

I'm getting failed transactions(reverted) when I try to buy tokens from uniswap v2 using the swapExactEthForToken method in my build transaction with web3.py. I have added my code below. I have tried ...
0
votes
0answers
7 views

what are the steps to execute this contract

I want to execute this program https://solidity-by-example.org/signature/, but I do not know where should I run web3 code any one can tell me the hole steps that describe how to run this ?
1
vote
1answer
39 views

Cannot read properties of undefined (reading 'address')

Im trying this Solidity and VueJS tutorial from MEDIUM. I even git cloned the github sourcecode, but I keep getting this error on the browser console: ERROR 1: Error initializing Drizzle. ERROR 2: ...
0
votes
1answer
24 views

How to know if a transaction gets dropped and txhash becomes irrelevant before its mined

I am using a web3 sendTransaction function to send coins, and then storing the transactionHash in my databse await web3SendInstance.eth.sendTransaction({to:receiveAddress, from:web3.eth.defaultAccount,...
0
votes
1answer
11 views

How to data mine ETH transactions for transfers / payouts?

If you look on etherscan, they unroll the transaction into a lot of really good data. I'm trying to figure out where they are getting this information from and how they are unrolling it. For instance, ...
0
votes
0answers
18 views

unsiwap v2 router swapTokensForExactTokens returns Error: Transaction reverted without a reason string

I am trying to swap usdt tokens to wbtc using uniswap v2 router with web3.js on testnet but get the error: Transaction reverted without a reason string my swap function: export async function ...
1
vote
1answer
32 views

how I can sign message using web3js?

I know that I can sign a message using web3js, but I don't know how I can do that, then how to verify that signature using ecrecover()?
0
votes
0answers
8 views

Web3js Module Not Found

I'm using latest version of node, latest version of web3js. I'm pretty new to this and trying to test out some web3 stuff. I'm trying to use the getPendingTransactions as mentioned on the web3js ...
0
votes
1answer
14 views

How to convert decimals amount to eth?

From a subgraph I'm getting my total debt as: 1000148245, how can I convert this value to eth decimals?
0
votes
1answer
24 views

How can I catch error event(Error: Returned error: insufficient funds for gas * price + value) to send tether on Ethereum network?

This code is to send tether from one address to other address on Ethereum network. const Web3 = require('web3') const web3 = new Web3('https://mainnet.infura.io/v3/...
0
votes
1answer
22 views

How to get account balance by using this account address i got from this code?

async function onInit() { await window.ethereum.enable(); const accounts = await window.ethereum.request({ method: 'eth_requestAccounts' }); const account = accounts[0]; console.log(account) window....
0
votes
0answers
9 views

Why two Uni V3 pools have different bytecodes?

I am trying to assess if two smart contracts (address_1 and address_2) are both Uni V3 pools using web3. My idea was to request each contract's runtime bytecode as follows: sc_i_bytecode = w3.eth....
0
votes
0answers
4 views

Is it compulsory to write a script (web3) to initiate a flashloan contract?

Can I just develop the smart contract with all my logic and deploy it using remix ?, Will it work ?
0
votes
0answers
11 views

Cutting "transaction fee" other than "gas" in an ERC20 token transfer transaction

good day. I'm new to smart contracts and couldn't figure something out. I am using the following contract for ERC20 token transfer. Actually, everything works fine, there are transfers, but what I ...
0
votes
0answers
8 views

Can you call a variable value with web3.js, without writing the function in solidity?

I have used remix and I can see that whenever I create a public variable, it also creates a function for the variable and when you press it, it shows the variable value but, when I want to call a ...
0
votes
1answer
8 views

Interacting with Deployed contract- Truffle develop

Hoping some of you may be able to help me. I have a very simple contract that i have deployed. I won't post the entire contract here, but i will post the one function i am having trouble calling from ...
0
votes
0answers
9 views

UnhandledPromiseRejectionWarning: Error: invalid type (version=abi/5.0.7) When Decode Input Data Input in Binance Smart Chain (BSC)

I used web3js decode input data but dislay ERROR : UnhandledPromiseRejectionWarning: Error: invalid type (argument="type", value="_factory", code=INVALID_ARGUMENT, version=abi/5.0....
0
votes
1answer
8 views

How To Decode Contract When only Know Address Contract, No ABI? [duplicate]

I know the contract address. Unknown ABI . So how do I Decode that contract.. I use bytecode-decompiler in EtherScan but It only decodes Function unknow. So how to Decode the full code Contract . ...
0
votes
0answers
18 views

Difference between Receipt & Confirmation callbacks

I'd like to verify programmatically that a transaction was successful - that is the Etherum network itself recognizes that for a given transaction hash, it was valid. Using web3.eth....
0
votes
0answers
29 views

Can't seem to withdraw money from contract

I am new with solidity. I've implemented this withdraw function function withdraw() public payable onlyOwner { require(payable(msg.sender).send(address(this).balance)); } And I am calling ...
0
votes
1answer
34 views

Can I connect to Rinkeby using remix and metamask?

I've finished my dapp by deploying the contract to Remix, and it works well in Ganache. Now I wanna connect my dapp to Rinkeby by web3.js. I deployed my contract in Remix, and when I wanna interact ...
0
votes
1answer
45 views

Solidity contract to handle multiple uniswap trades and refund to sender at the end

I'm looking for a simple solidity contract that I can send tx swap data to, wether in hex or an array. Ex: send funds to contract Swap a > b, Swap b > c, Swap c > a, return funds to address I ...
0
votes
1answer
21 views

In React.js, How can I get return data from smart contract method including event and emit?

I have smart contract server function and that function including emit and event. event TokenMinted( address indexed _recipient, uint256 indexed _tokenId ); function ...
0
votes
1answer
10 views

Trouble sending correct amount of a token with web3

i'm trying to transfer a value of 1 of my erc20 token to my contract. In my front end I am using: tokenContract.methods.approve(contract_addr, 1).send({from: accounts[0]}); In my smart contract I am ...
0
votes
1answer
11 views

web3 event keeps on running after resolve()

In my project I have a contractInteract function that interacts with a blockchain contract returning a promise. I add a "confirmation" event. This event logs "Confirmed!" every ...
0
votes
1answer
25 views

How can I open an URL in Metamask explorer from a mobile navigator website?

How to open the URL of web3 in the Metamask explorer from a href link in that web3?
0
votes
0answers
35 views

How to send tether token in ether wallet using web3

I am gonna send tether token from my wallet address to other wallet address using web3. const Web3 = require('web3'); const web3 = new Web3('https://mainnet.infura.io/v3/projectId'); web3....

1
2 3 4 5
98