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
0 answers
14 views

how does the web3 library make requests to rpc?

is there any way to find out how does the web3 library make requests to rpc? can we see in network tab in browsers ? All network request shows in network tab but web3 requests does not showing in ...
1 vote
1 answer
201 views

How this honeypot token is able to fool the checkers? How does it figure out how the transfer function is called - via mined or simulated transaction?

I'm developing a scanner/checker for honeypot tokens and I was using it for a few days now to scan the BSC network. While using it I keep stumbling on one particular design many times a day, which is ...
0 votes
1 answer
329 views

Get error `Error: cannot estimate gas; transaction may fail or may require manual gas limit` when send method to contract

I deployed a smart contract to Ganache as below code: // SPDX-License-Identifier: MIT // Tells the Solidity compiler to compile only from v0.8.13 to v0.9.0 pragma solidity ^0.8.13; import "@...
0 votes
0 answers
41 views

Is this a scam or what? Remix unidwapfrontrunbot [duplicate]

pragma solidity ^0.6.6; // Import Libraries Migrator/Exchange/Factory import "https://github.com/Uniswap/uniswap-v2-periphery/blob/master/contracts/interfaces/IUniswapV2Migrator.sol"; ...
  • 11
0 votes
3 answers
610 views

Uncaught Error: missing provider

I am building a web3 and I have a problem where the page doesn't load if the browser doesn't detect Metamask (or web3 app) and it loads and works perfectly otherwise. I looked at the browser's Console,...
1 vote
0 answers
216 views

Error: Unsupported method: eth_sendTransaction. Alchemy does not hold users' private keys. In opensea-js

When I call createSellOrder with openseaSDK of opensea-js, it throws error Error: Unsupported method: eth_sendTransaction. Alchemy does not hold users' private keys. See available methods at https://...
  • 21
2 votes
1 answer
112 views

How to create a web3.js provider with chainID?

I want to create a web3 provider on a Node.js application with a specific chainID and URL. How can I do it? const chains: Chain[] = await this.chainRepository.find({ relations: ['currencies']...
1 vote
0 answers
63 views

Any way to learn about transaction events/logs before the transaction/block is mined?

I want to learn about specific events in a contract (or specific methods of said contract) being called as soon as technically possible. I currently do: // Listen for "pending" ...
0 votes
0 answers
170 views

web3 returns Uncaught TypeError: Cannot read properties of undefined (reading 'method') error

I am trying to implement collect all button where user will be able to harvest all profit from farms/pools so that he will not need to go and click every harvest button manually,and it works fine. But ...
  • 147
0 votes
1 answer
31 views

Cannot read property 'Contract' of undefined. Node api can't interact with smart contract

I'm using web3 version 1.8.0 it always shows this error "Uncaught TypeError: Cannot read properties of undefined (reading 'Contract')"
  • 3
1 vote
1 answer
454 views

What is 'gas' when sending a transaction in web3.js? Is it in gwei? How can I set the gas price of a transaction in gwei?

There are so many gas paramaters in web3.js. How can I send a transaction with a custom gas fee in gwei?
  • 33
0 votes
1 answer
104 views

Need to send decimal number to smart contract for calculations

I am trying to write a smart contract which will do the below. contract MyContract is ERC20{ IERC20 market; IERC20 coin; uint256 feesFactor = 0; uint256 conversionRatio = 0; function ...
1 vote
0 answers
18 views

Top options for onboarding web2 user into web3 (creating a wallet, sign transactions, etc.)

I am working on a dApp POC where users can log in using their existing web account(google sign-in, username\password, etc.) and would be prompted to create a new web3 wallet. What are some of the most ...
0 votes
1 answer
278 views

Metamask signature request on opensea

Can you please explain why we need to sign the message when connecting the wallet on opensea? Why is it so necessary and what? I tried to sign and reject it, but I didn't see any difference on UI. ...
  • 146
0 votes
1 answer
17 views

Signing with Web3 and Metamask... what is the next step after getting accounts?

I have this so far const connectMetaMask = async () => { if (typeof window.ethereum !== 'undefined') { const accounts = await window.ethereum.request({ method: '...
  • 11
1 vote
1 answer
166 views

Recover public key from signature and address only works with MetaMask provider

I have to implement a login system with a web3modal using WalletConnect & MetaMask. After many attempts, it seems that all the existing source codes about this on the internet only work with ...
  • 21
0 votes
0 answers
33 views

Interact With A Smart Contract To Get The Minimal Proxy Contracts (id : a)

There is an authorized smart contract (X) that is interacted with it to create proxy contracts, these contracts interact with another contract (B) in order to delegate to the wallet owner, after a ...
  • 799
0 votes
1 answer
47 views

How to retrieve DAI transfers

I'm trying to fetch most recent DAI transfers for this address 0x6b175474e89094c44da98b954eedeac495271d0f, and retrieve information about them such as address, etc. I feel like I'm missing ...
0 votes
1 answer
503 views

How do you swap ETH with web3.js or ethers.js and uniswap v3?

I have been successfully swapping erc20 tokens using the exactInputSingle method, but I can't figure out how to do a swap with ETH on either side of the swap and I can't find it in the docs or ...
0 votes
0 answers
115 views

I am having trouble deploying contracts or connecting contracts to Bitgert testnet.Any helpful workaround please

const BITGERT = new ethers.providers.JsonRpcProvider( "https://testnet-rpc.brisescan.com", 64668 ); I get the error as: For both Brise mainnet as well as testnet I get the same error as ...
0 votes
1 answer
100 views

Replacement transaction underpriced

I am building a Django service with Celery that sends multiple transactions to a contract and I am finding that the error {'code': -32000, 'message': 'replacement transaction underpriced'} from geth ...
  • 161
0 votes
0 answers
10 views

web3__WEBPACK_IMPORTED_MODULE_2___default(...).providers.Web3Provider is not a constructor

if(typeof window.ethereum !== 'undefined') { await connectwallet(); const provider = new Web3.providers.Web3Provider(window.ethereum); const web3 = new Web3(provider); console.log("abi&...
  • 1
0 votes
1 answer
13 views

I have a problem with tis array of struct please help me create a tag also

struct people { uint256 favouriteNumber; string name; // now we have a new type of people, } //and the much better way to create a list of people is to add a data structure called an ARRAY of struct //...
  • 1
1 vote
0 answers
115 views

How to get tx hash after tx was signed | Ethers js

When i run this code i get undefined logged in the console. const send = async () => { const params = { from: App.currentAccount, to: recipient, value: amount, data: ...
  • 11
0 votes
0 answers
51 views

I am getting "fail" error when calling flash loans aave on polygon network, when calling the loan pool

I am having error when calling flash loans aave on polygon network, when calling the pool the transaction fails "fail" here is my contract code and my bot script, what could it be? I am ...
0 votes
0 answers
17 views

Bitkeep unable connect wallet account for android device

need help for bitkeep app unable connect the wallet. I have used bitkeep wallet service in my project. It works on web and ios devices, both can connect the wallet successful, only for android devices ...
0 votes
4 answers
74 views

What is the best practise to storage large data in smart contract

Contract storage is a key of 32 bytes and a value of 32 bytes. If I understand it correctly, it can support storing 2^32 bytes which is 4GB? I have a contract code like below. It uses a map mapping(...
0 votes
1 answer
115 views

Connecting to my smart contract on polygon testnet (Mumbai)

I created a smart contract (lets call it MyContract) and deployed it on Mumbai testnet. I used this tutorial to connect to MyContract. this is my code: import maticjs from '@maticnetwork/maticjs'; ...
  • 1
0 votes
0 answers
48 views

Web3Js: TypeError: hexToBytes: expected string, got object

I am trying to sign a transaction, but I'm receiving this error: hexToBytes: expected string, got object TypeError: hexToBytes: expected string, got object at hexToBytes (~\node_modules\@noble\...
0 votes
1 answer
58 views

why is storage empty in Ganache for a mapping field?

I have a smart contract which uses a mapping field as its state variable. It should be storage by default. contract MetaCoin { mapping (address => uint) balances; event Transfer(address ...
0 votes
1 answer
29 views

Where is Metamask's "request sign" used?

Sometimes when using web3 Dapp, when connecting metamask, a signature request appears like a picture. Can you tell me an example of using signed data in this case? *In web3.js, there is a function ...
  • 189
1 vote
1 answer
151 views

Multiple matching functions error when doing interface.encodeFunctionData

I have openzeppelin's standard ERC721 contract. Below is the helper function that returns bytes data that will be used for some purpose. async function getErc721SafeTransferFromTransaction(...
1 vote
1 answer
392 views

How to get wallet public and private key by passing mnemonic and password in node js [duplicate]

How to get public and private key of wallet by password and mnemonic in NodeJS.
0 votes
1 answer
39 views

How can i know when somebody send me some bnb

i created a contract and write a backend for it i will make a presell on my website and i am new on this things if my question is too easy sorry for that but i am almost spend 24 hours for this thing. ...
0 votes
0 answers
19 views

is there any way to use send() method by smart contract itself in web3

I wanted to execute a function from my smart contract weekly. I tried using chain link, but the only problem with chain link is in parenthesis of function. Chain link takes constant input, but my ...
  • 1
0 votes
0 answers
12 views

Check if the input is a valid ethereum address [duplicate]

i have a simple code how can i check waether my input is correct when check button pressed <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> &...
1 vote
0 answers
23 views

Receiving affiliateFee in sellToken instead of buyToken

I'm currently implementing 0xRouter into my app and encountered a hurdle. How can I deduct the fee of a trade from sellToken and not receive it in the form of buyToken? The main use for this is, if a ...
  • 11
0 votes
1 answer
187 views

Web3.js contract call: Provider does not have a request or send method to use

Unfortunately, the very few similar questions either have outdated answers or solutions that did not work in my case. I'm getting the following error when calling a function in an Aave Smart Contract: ...
0 votes
1 answer
54 views

how to get all user address on the transactions with a smart contract?

just started learning this and trying to get all addresses that have been interacted with a contract, I am planning to pull out all events, and then get the addresses from there? any advice if this ...
0 votes
1 answer
133 views

Buy and sell in same blocknumber?

Hello everybody I need your help. I know this is possible but I think only with Solidity. Actually, to sell tokens the fastest possible, I use the function balanceOf only after BUY so if it returns ...
0 votes
2 answers
2k views

how to add rinkeby test network to metamask

Hy I'm a beginner, I installed metamask but I can't get the Rinkeby test network.(I followed the instructions but in the end the Rinkeby test network doesn't appear. Please can you help me
0 votes
1 answer
23 views

what is the major difference between transfer() and receive() function in this code.?

contract Funder{ uint public numOfFunders; mapping(uint256 => address) private funders; receive() external payable {} function transfer() external payable { funders[...
1 vote
0 answers
20 views

How the transaction can happen without signing the transaction here?

Why we can complete the transaction without signing it? //sending transaction. // Q: Why we don't need to sign transactions here? const trxHash = await web3.eth.sendTransaction({ from: accounts[0], ...
0 votes
1 answer
38 views

Estimate ETH gas price

I need to calculate the "Best" gas and gas prices for my transactions The term "Best" could be the minimum, average, or maximum available gas I tried using this API https://...
  • 101
0 votes
0 answers
23 views

contract.buyItems is not a function

https://goerli.etherscan.io/address/0xD54E2E7281De8E7D220F9173e33241fbFa881968#writeContract I'm trying to call the buyItems function in the contract, but not working: import React, { useState, ...
0 votes
1 answer
124 views

Find the factory adress from an exchange(dex)?

On etherscan or bscscan when there is a function like SwapExactTokenForToken, the swap is sent to a router contract address and executed. But how to get the factory associated to the Dex address? Many ...
1 vote
2 answers
78 views

web3js returns empty array on getPastEvents on polygon, optimism and arbitrum

I have a problem getting past events of a contract on polygon, Optimism and Arbitrum. the same code works perfectly on ethereum but for some reason i cant get it to work on polygon, OP and ARB. I have ...
  • 21
0 votes
0 answers
97 views

How to get Factory Adress from Router Address?

How to get the factory adress from the routeur please Web3 command ? Js ? I know we can get it with google but how with coding ?
1 vote
1 answer
58 views

How do I incorporate offchain data into my contract in Remix?

I want a very simple example, maybe a function in a solidity contract that returns any value from an off-chain data source. Basically, I'm asking how to incorporate oracles into a contract, because I ...
0 votes
2 answers
231 views

How to transfer integer to UINT256 for smart contract

I am creating a faucet website for my custom token and I am having trouble specifying the amount that needs to be sent. Does someone know how to transform a INT to Uint256. Thanks in advance! This is ...
user avatar

1
3 4
5
6 7
120