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

how to fix “MetaMask - RPC Error: The method 'eth_signTransaction' does not exist / is not available”?

I am learning how to use Web3.js and I am getting this error: MetaMask - RPC Error: The method 'eth_signTransaction' does not exist / is not available. When trying to sign a transaction (for later ...
0
votes
0answers
8 views

How can I do contract call transaction from Metamask qr code scan?

I have a payable function in the smart contract that takes some ether from the sender and does some tasks. I want to generate QR code for this contract call transaction so that user can scan and ...
0
votes
1answer
6 views

How to compare / sort address in Python?

I need to ensure address0 < address1 in Python. Solidity compares this directly, but how to do it in Python? (Or in any other programming language) I would guess that addresses need to be converted ...
0
votes
0answers
9 views

Fixed Payment function inside smart contract

I've been playing around with the PaymentSplitter Openzeppelin contract that you can find here: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v3.0.1/contracts/payment/PaymentSplitter.sol ...
0
votes
0answers
7 views

Retrieving the prefix 0x02 or 0x03 of the public key from the uncompressed form

I use this code to generate a public key but it provide the uncompressed form. So it doesn't provide the first part that is either 0x02 or 0x03. I tried addHexPrefix() from  ethereumjs-util but it ...
0
votes
1answer
11 views

Check valid slippage before sending transaction using web3

I have a web3 script that buys and sells the token on Binance Smart Chain (BSC). Now let's say there is a token that has mentioned a mandatory 10% fee in their contract but I don't know about that at ...
0
votes
0answers
7 views

Blockchain with fixed number of blocks using geth

I want to create a private blockchain with geth. In my case, the smart contract should be deployed (for example in block 9) and every block after this block should be deleted after creation. I want to ...
0
votes
0answers
7 views

My WEBCONNECT STOPPED WORKING [closed]

My question is that I get 505 error message when I want to connect my gitcoin account to my trust wallet. In my tokenpocket they asked to provide a new qr code. Meanwhile, it has been working before. ...
0
votes
0answers
9 views

Is there any way to get the latest event only from Smart Contract using web3?

I have my own smart contract on the network and need to get the latest event only using web3 on frontend side. Web3.contract.getPastEvents() function returns all the event logs that were occurred so ...
0
votes
1answer
11 views

How to get latest 100 event logs only from Smart Contract using web3?

I deployed my smart contract to the network and building frontend which will interact with the smart contract. The problem is when I get the event logs using web3.contract.getPastEvents(), it returns ...
0
votes
1answer
14 views

How to deal with 256 bit numbers in javascript and perfom bitwise operations on them?

How to deal with 256 bit numbers in javascript and perform bitwise operations on them? From here I have read that JavaScript stores numbers as 64 bits floating point numbers, but all bitwise ...
0
votes
0answers
20 views

How can I listen emitted events from BSC network

How can I noticed and get the results of events whenever events are emitted on BSC network. I have tried web3.on() method, but the on() method can work with WebSocketProvider and BSC network does not ...
1
vote
1answer
12 views

How to get all ERC721 tokens deployed on the smart contract

I have deployed a basic ERC721 token with some image metadata. I want to build a dashboard to view all the tokens and looking for an effective way of doing it. One approach I have tried is: Loop ...
0
votes
0answers
12 views

Getting error Error: Returned error: execution reverted on web3 [closed]

require("dotenv").config() const { ChainId, Token, TokenAmount, Pair, Trade, TradeType,Route ,Percent, WETH} = require('@uniswap/sdk'); var Fetcher = require('@uniswap/sdk'); const express = ...
0
votes
0answers
11 views

arguments to solidity function with html error

getting the above issue, here is my solidty code for the mentioned function function dividendTokenBalanceOf(address account) public view returns (uint256) { return dividendTracker.balanceOf(...
3
votes
0answers
21 views

Strange blocks behaviour, transactions are dropped from a validated block

I have faced a very strange issue on Goerli Testnet using infura. The number of transactions in a blocks dropped from 168 transactions to 164. I'm working on a blocks tracker, after receiving the ...
0
votes
0answers
18 views

Swap with different pairs on different dexes

I'm currently using web3.js to play with the blockchain. I've already been able to swap an asset for another one using a router, but now I would like to swap an assetA for an assetB on a dex, and the ...
0
votes
0answers
16 views

Error: Invalid JSON RPC response: “”

I'm trying to get some info from an array using web3, when I try this async componentDidMount() { const product = await store.methods.storeProducts(0).call(); console.log(product); ...
0
votes
0answers
12 views

TypeError: (0,. ..) is not a function [closed]

I'm using helper.js to store 'ether' and 'tokens' functions to run test on Exchange.test.js. Here is the code in helpers.js: export const ether = (n) => { return new web3.utils.BN( ...
0
votes
0answers
9 views

How to read price for a token from a dex

On the website https://defiprime.com/exchanges i see many different dex exchanges. i want to know how i can write for example the contrat id from a token and then i want to get the current price on a ...
0
votes
0answers
14 views

Get Symbol name and amount from transaction receipt

is it possible to get the symbol names and amounts from the transaction receipts? Right now I monitor contract events where I am able to get the contracts symbol name and the amount but when there are ...
0
votes
1answer
28 views

Retrieving the private/ public key with web3js for a specific wallet provided by truffle/hdwallet-provider

I can't find a way to retrieve the private key / public key / public address for a web3 account loaded via a provider. I have tried the web3.eth.accounts command but I am not getting the private key / ...
0
votes
0answers
5 views

Nethereum and Metamask via Asp.Net?

I'm using Nethereum on the server currently, manually creating Account objects using private keys copied/pasted from a MetaMask wallet. I'm now trying to build access to this functionality through ...
0
votes
1answer
10 views

getting incorrect topic[0] from web3.utils.sha3

I have the following event: event DelegatedManagerSet(bytes32 indexed loanId, address indexed delegator, address indexed delegated, bool isActive); I am trying to calculate the value of topic[0]. I ...
1
vote
1answer
22 views

What's the difference between using the send() method in contract and web3.eth.sendSignedTransaction specifying the data field

I just started learning about interacting with smart contract deployed on Ethereum blockchain and I've come across these two methods to interact with non-view functions in the contract. MyContract....
0
votes
0answers
38 views

Scam: Variation of the price of the token in 5 orders of magnitude in a second. How does it work?

When purchasing a token, the wrong price is displayed. Specifically, trade.minimumAmountOut (slippageTolerance).raw ('trade' object is from @pancakeswap-libs/sdk-v2) minimumAmountOut shows much less ...
0
votes
0answers
16 views

Hyperledger caliper with local ethereum network

i am trying to use caliper with ethereum. i have deployed my contract using truffle. i am trying to run caliper locally. i am getting this error pls help. caliper launch manager --caliper-workspace . -...
0
votes
0answers
28 views

How to get the liquidity of a pair in pancakeswap or uniswap?

How can I know in pancakeswap or uniswap when a pair is created and how much liquidity is added? At the moment what I have thought is to read the "PairCreated" logs of the Factory contract, ...
0
votes
0answers
23 views

web3 how to send transaction with BNB

i'm begin working with web3.js api and i cant understand how to send transaction in BNB. According to documentation https://eth.wiki/json-rpc/API#eth_sendtransaction i cant find some parameter that ...
0
votes
0answers
10 views

Get current block and execute transaction in next block

I am able to get the current block by using web3.eth.getBlockNumber(). Is it possible to send and sign a transaction in in the next block? e.g. in my tx I have: gasPrice: web3.utils.toHex(5e9), // 5 ...
0
votes
0answers
9 views

Is there an official comprehensive list of Metamask RPC Error codes?

Metamask errors are handled using a JSON object with two fields. Error Code (code) Error Message (message) Example if a user denies to sign a transaction: {code: 4001, message: "MetaMask Tx ...
0
votes
0answers
45 views

Pancakeswap Error when trying to swap token to BNB using Web3.js and Python

I have written a Swap in python using web3.js. I can't seem to get it to work when I try to buy BNB for tokens. The transaction is created, but the Pancakeswap router gives me the following error: ...
0
votes
0answers
6 views

pooltogether-community-ui yarn dev — Error: “networkId” is required

After pooltogether yarn dev is started, it prompts Error: "networkId" is required。 Click "Connect Wallet" to prompt Onboard isn't ready!
0
votes
0answers
18 views

i need to get the uniswap v3 price for any given swap pair preferably using the v3-sdk

Can anyone provide an example of how to use uniseap-v3 sdk to fetch token swap prices or any other working method
0
votes
0answers
17 views

How do I fix this? Module name “web3” has not been loaded yet for context: _. Use require([])

I am trying to get smart contract to work with front end. I am struggling to understand why requireJS isn't allowing me to use web3js. I have tried to use this guide https://rclarke-m.medium.com/using-...
0
votes
1answer
19 views

Sign Metamask message and verify with ethereumjs-utils 7.0.10

I'm trying without success to get signed Metamask message confirmed with ethereumjs-util in the backend. Metamask appears to the user, they can sign the message - but when the message is being ...
0
votes
1answer
4 views

How to know the blocknumber of a transaction hash with web3js?

Its possible to know the blocknumber of a trx hash with web3js or other JS script ?
0
votes
1answer
20 views

How to use web3 to interact with contract deployed on private network [closed]

I have created a small private network using geth on my local machine and deployed a smart contract on this local private network using remix IDE. I want to be able to connect my nodejs backend to ...
0
votes
0answers
16 views

Remix. Different contract behavior on Javascript VM and Injected Web3

The following basic contract does not have the same behavior when deployed on Javascript VM and on Injected Web3: // SPDX-License-Identifier: GPL-3.0 pragma solidity >=0.7.0 <0.9.0; contract ...
0
votes
0answers
18 views

How to Generate Buffer for Private Key

I am a beginner in Ethereum development. I am using Web3 js 1.0 to build a simple node js application that sends ether from one wallet to another on Mainnet. I am having problem in creating buffer ...
0
votes
1answer
12 views

how can i convert decoded transaction input value

sorry for my broken english. i can decode transaction input hash with web3.eth.abi.decodeParameters. but i can convert _value data human readable. i try hex, bignumber but i failed. how can i convert ...
0
votes
0answers
12 views

Uniswap v3 how to get the path for 3 legged swaps? [closed]

How is the multi jump swap or three legged swap done in uniswap v3? How is the multiple pool variable set?
0
votes
0answers
11 views

How to get the values required by the mint() function in uniswap v3 NFT position manager contract?

How are the ticks and the amounts calculated when adding liquidity to uniswap v3? The mint function is called with these parameters but it keeps reverting because the input params are wrong. Can ...
1
vote
1answer
14 views

Connecting to Geth Node using Web3 WebSocket Provider resets every 2 hours

I have a Node JS application which connects to a Geth Node using the Web3WsProvider which under the hood uses W3CWebSocket. The app starts and connects to the node and is set mostly to make read only ...
1
vote
0answers
14 views

Listening to smart contract events RPC, using web3, on aleth node

bakcground, I am working on an ethereum based fork of cpp-ethereum/aleth node and not using the official golang client (geth), unfortunately from what I read, websocket support has been 'ditched' in ...
1
vote
0answers
9 views

How to get a price for Uniswap three legged trade

Hi i see that this question has been asked a few times but no direct answer is there anywhere. I want to get the path through which a swap can take place between any 2 tokens, even if the pool dosent ...
1
vote
0answers
8 views

Get Contract Symbol from Transaction when multiple token transfers (swaps) in transaction occure

I want to monitor and extract the token transactions for a bunch of wallets using web3 subscriptions to the log events. I then extract the token information from the events contract. My problem is, ...
0
votes
0answers
16 views

Transaction contains data, but the ABI signature could not be found

Contract code: pragma solidity ^0.8.4; contract TestContract { uint public variable; address public owner; event VarSet(uint from, uint to); function set_variable(uint num) ...
0
votes
2answers
57 views

web3 multiple swaps within one block

I created a scrip that executes a swap/ transaction. However, I want to perform multiple swaps within the same block. E.g. 1 trade with 0.1 ETH and another trade with 0.2 ETH The above script executes ...
0
votes
0answers
22 views

Send transaction & get receipt with log

Using sendTransaction to submit a tx. It works. Then wanting to get the receipt and check the logs to extract data. That codes works in isolation. How to put the two together? The problem is the ...

1
2 3 4 5
92