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
19 views

Walletconnect integration not working on mobile

This is a weird one. I have successfully integrated walletconnect on my Dapp for the first time and it works just fine on my pc. When I try accessing it on my phone, it doesn't work. I am trying a ...
0
votes
0answers
19 views

TypeError: num.bitLength is not a function

I need to transform stakeValue into BN, for transfer it to smartcontract const web3 = await getWeb3() const toBn = web3.utils.toBN.bind(web3.utils) const erc20Instance = await createInstance('...
0
votes
1answer
30 views

Does SSR break the web3 philosophy of data transparency?

I have noticed a lot of Dapps these days are server side rendered using frameworks like Next.js where data is rendered server-side on hosting providers like Vercel, Cloudflare, or self hosted servers. ...
0
votes
0answers
44 views

Calling Contract meet UNPREDICTABLE_GAS_LIMIT error

the detail scenario is i try to call pancake erc20 pair swap method using ethers the code like below: const gasLimit = await pancakePair.estimateGas.swap( !shouldStartEth ? DAI_TRADE : ...
0
votes
2answers
43 views

Best back-end framework to complement web3.js [closed]

I'm working on a personal project to get started with learning web3, its a simple app where users can connect their wallets and load a dashboard that displays a feed of transactions based on wallets ...
0
votes
0answers
22 views

How to send transaction to smart contract from ESP32

I am working with Arduino ESP32 micro controller and I want to call a function from Etherium Smart contract. This is the address of my contract: 0x8FD15D33683f580DD0394e99f829668D1278fEcF I don't use ...
0
votes
0answers
19 views

How does MetaMask populate its Infura enpoints securely?

As MetaMask uses Infura as one of its node providers, multiple endpoints have to be generated for that purpose. How does MetaMask manage to acquire that many endpoints? And how do they protect their ...
0
votes
1answer
33 views

Why stake tokens function it is not working (solidity/react)?

I created a simple dapp with react/truffle/web3 that allows users to enter a number of tokens and submit it to stake it, the problem that I got is that when clicked on submit button, Metamask popup to ...
0
votes
0answers
59 views

How to get the nfts in a user wallet address

I am currently working on an nft marketplace and each user has a dashboard and a profile page. And on both pages I would like to get the list of nfts a user has listed, sold and owns. Currently I have ...
1
vote
0answers
23 views

Interacting with erc20 using web3js

I am trying to fetch the balance for a wallet with address WALLET_ADDRESS, in an ERC20 contract located at CONTRACT_ADDRESS with the following approach: let contractInstance = new web3.eth.Contract(...
0
votes
1answer
44 views

How to call a contract function from ReactJS, that takes a struct as an argument?

I am struggling to figure out how to actually call a function (using React) in a contract that takes a struct as an argument (which also has another struct in it) ? The contract function looks like ...
0
votes
1answer
22 views

How Can I convert the value of the input form to Towei unit with web3

I Have a form with an input and a button with a type of submit, I want to submit a number from the input and convert it toWei unit using web3 that will be passed into a function that will allow the ...
0
votes
1answer
23 views

can i smiulate 2 transactions using .call in web3 or in anyother way?

i want to be able to simulate 2 transactions using .call in web3.js. To see if 1 tx affects the other. I cant find a way to do so. .call only works for 1 at a time and a custome node takes a lot of ...
0
votes
1answer
29 views

How to get the address of the contract deployer?

What is the easiest way to get the address of the deployer from a contract (assuming I have the contract addresses of course)? It's possible to see on etherscan, but I was wondering if there was a way ...
1
vote
1answer
91 views

Swap for tokens with Bot Protection Enabled (BpEnabled)

!!Apology in advance for such verbosity!! Background I came across this BEP20 token (0xcc7a91413769891de2e9ebbfc96d2eb1874b5760) which had sufficient Liquidity added at TGE but bot protection was ...
0
votes
0answers
9 views

function call got a different result on remix and with web3js

i call the exact same function from the exact same contract on remix and got a different result that i had calling it with web3js. Actually remix give me the "good" result. All the others ...
0
votes
0answers
163 views

Web3.js package throws a lot of errors when importing in React app

When I try to import web3 package in my React app it throws a lot of errors saying there are missing modules. I created the react app using the command - npx create-react-app ./ Importing as import ...
0
votes
0answers
124 views

How to disconnect Metamask Wallet from website using web3?

const connectMetamask = async () => { const accounts = await window.ethereum.request({ method: 'eth_requestAccounts'}); setWalletAddress(accounts[0]); setWeb3Instance(window.web3....
0
votes
2answers
75 views

Cannot approve or sell token swapExactTokensForTokens: transaction fails (not a honeypot)

I am trying to sell a token (DOBO). Buying DOBO is no problem and it goes through. But I cannot sell it. I get a failed transaction, but no error message on node.js (see https://bscscan.com/tx/...
0
votes
1answer
30 views

Initiate transaction from my DAP to send BNB from trust wallet using wallet connect

Does anyone know how I can initiate transaction from my DAPP to send BNB while connected to trust wallet using walletconnect? I see an example for etheruem transaction here: https://docs.walletconnect....
0
votes
1answer
14 views

Setup passwort for Ethereum address transfers?

Is it possible to setup password for Ethereum address for security reason, so that any time i would like to transfer found i need to include transfer password? On web3 or any other script,...? So that ...
1
vote
1answer
67 views

How do I get the tax or slippage of a transaction?

This transaction : https://bscscan.com/tx/0x47782bb10f4b103960b598863437c7957fd83ec28eb9c777f2ace12599bf7bab It shows the user deposited 25,636,769,405.862801219 of tokens, but the token has a tax of ...
0
votes
0answers
20 views

web3.js batchrequest - cannot batch.add sendSignedTransaction as request does not exist

Property request doesnt exist on sendSignedTransaction, which means these cant be batch.added. This seemed to have worked in the past. Is there a fix for this? thanks for your help! var batch = new ...
0
votes
1answer
53 views

Failing to sign a transaction with eth_sign

I am trying to use the eth_sign method However i am getting the following error: code: -32602, message: 'Invalid parameters: must provide an Ethereum address.' My function is as follows: const ...
0
votes
0answers
25 views

Best approach to transfer a % of a token

i´m very new in blockchain and i'm trying to understand how to handler the amounts and values. I want to transfer 10% of the total token BEP20 amount to an array of wallets. Is this a good way to do ...
0
votes
0answers
10 views

I need a code for automatic eth transactions [duplicate]

I have my ethereum address registered to a site, now I have a new eth wallet but I can't change it to the new wallet on the site. Is it possible for the eth to be automatically transfered from my old ...
0
votes
1answer
38 views

How to define private key variable using config library?

i am trying to interpret a code for buying tokens through Pancakeswap using Python. I got stuck at the Private Key where the variable is "config.private" in the code. But I have seen other ...
0
votes
0answers
6 views

Truffle console: problem with accessing the file using path.resolve

I tried the answer given at: Truffle console: How to retrieve a specific opcode from a smart contract? and contract's name also but it gives me the error truffle(development)> const ...
0
votes
0answers
51 views

web3.py geth txpool help

I need to help accessing the geth.txpool API namespace in web3.py. Heres what I do (for example): from web3 import Web3 web3 = Web3(Web3.HTTPProvider('https://mainnet.infura.io/v3/MY_KEY')) txPool = ...
0
votes
0answers
25 views

How to set Web3.js eth account using metamask

With web3.js for a lot of functions you need to have a web3.eth.account set. As far as I am aware you need the private key to set this account and metamask does not for obvious reasons give you assess ...
0
votes
1answer
58 views

SendSignedTransaction TIMEOUT

I'm trying to sign data offline and then send signed transaction via web3.js Here's my code snippet: const {sign} = require('@warren-bank/ethereumjs-tx-sign'); const {Loader} = require("loader-in-...
0
votes
1answer
23 views

How to deploy smart contracts from other accounts using javascript?

How can we deploy contracts using web3.js or ethers.js just like thirdweb does? I create a contract on web3.js then used the deploy function with send but then alchemy gave an error that it can't ...
0
votes
0answers
12 views

Track wallet address for new transactions in real time [duplicate]

I'm trying to find the best way of tracking an Ethereum wallet address for any new transactions in real time (or as close to it as possible) and then do some filtering on it. I've tried using the web3....
0
votes
0answers
23 views

Occasionally, I get the error: code -32000, message: header not found. When working with smart contracts with web3 in nodejs [duplicate]

I've tried to fix this for a whole day now. I've read the answers to the question: What is that error called "code: -32000, message: 'header not found'" when I deploy smart contracts ...
2
votes
0answers
25 views

Web3.js but for C++ [duplicate]

Does anyone know a library for interacting with Ethereum smart contracts through C++? Just like there's web3 for JavaScript. If not, any guidance on how I can interact with Ethereum smart contracts ...
0
votes
1answer
133 views

Undefined output when using getPair and getReserves in web3 / node.js

Happy new year to you all! I am trying to get the wBNB/BUSD pair address from Pancakeswap (using getPair) and then check for their liquidity (using getReserves). I have pretty much copied the code ...
0
votes
0answers
16 views

Is this how to efficiently run a function in a For Loop?

Code: https://rinkeby.etherscan.io/address/0x87660f32382de6cd36b685ae76a54f389af016a4#code Question: Is it normal to expect each iteration of the for loop to require a separate 'confirmation' from ...
0
votes
1answer
38 views

How to read transaction['data'] from getTransaction [duplicate]

How does one read transaction['data']? If I get the data of a transaction e.g. something like this: ...
0
votes
0answers
31 views

How to track transaction by token address with web3.py?

I'm just starting explore web3 and I wanna track transaction by token address with web3.py. Is this possible?
0
votes
0answers
13 views

How to use window.ethereum to read from EVM storage slots since window.web3 got deprecated in latest metamask update?

I was playing Capture the Ether challenge and in one of the challenge we had to read data from storage slot in the EVM. I referred this medium article: https://medium.com/@saurfang/lets-play-capture-...
0
votes
0answers
25 views

sendSignedTransaction - (node:90923) UnhandledPromiseRejectionWarning: Error: Returned error: Invalid Signature

Hi I'm using Web3js and Ganache. I'm trying to send a serialized transaction but got the following error: (node:90923) UnhandledPromiseRejectionWarning: Error: Returned error: Invalid Signature . I'...
0
votes
1answer
157 views

Approve BUSD token in pancakeswap

im new in blockchain and i´m playing with the web3 javascript library. I´m trying to approve the BUSD token to do a swap. My js code is something like this: async function approveToken(web3, c, ...
0
votes
1answer
78 views

Integrate wallet connect on my website

How do I integrate walletconnect on my website. Just link it is on pinksale.finance. Haven't found anything straight forward online. Thanks.
0
votes
0answers
30 views

Why the transaction reverted when I try to sell tokens on uniswap v2 router2, but success on browser?

I am using web3 to send transaction to uniswap v2 router2 to sell my tokens for ETH, with both the sold token and WETH approved for router2 with amount of uint256max, and I set amountOutMin to 0 ...
1
vote
0answers
39 views

As in web3.js get the same signature as the signature from the signTypedData_v4 method?

I have a standard typed data object that uses Metamask, according to this scheme(without JSON.stringify): If you sign such an object like this: let sig = web3.eth.accounts.sign(JSON.stringify(order), ...
0
votes
0answers
13 views

how to access contracts on a dapp-tools testnet with their address?

I have a json file like this : { "DEPLOYER": "0x3889c142090745AAa4803745739eE0a548204357", "CHANGELOG": "0xE3BAdfF0e84a551b8B53d5fac5aF9fB20f906898", ...
0
votes
0answers
15 views

Solidity Mapping, values are same for different users

I'm coming from Java background and trying to learn Solidity,but stuck with mapping. Idea was to have simple balance that i can reduce or increment. But the problem is that when i enter some address ...
0
votes
1answer
48 views

Truffle console: How to retrieve a specific opcode from a smart contract? and contract's name also

I am working on Truffle console using commands like:(i.e. web3.js, if I am not wrong) module.exports = async function(callback) { try { // Fetch accounts from wallet - these are unlocked const ...
1
vote
0answers
32 views

How to listen to smart contract emitted events using C#

I have to add/update some data in a database when specific events are emitted by a solidity smart contract. When using web3.js there is a simple method called watch(), but I didn't find anything like ...
0
votes
1answer
39 views

Proper way of automating trades on uniswap with nodejs

I am wondering what would be the proper way (if possible at all) to automate trades on uniswap using their SDK or just web3 or ethers with the router and factory contract instances. I want to build a ...