All Questions
Tagged with transactions web3js
373 questions
1
vote
1
answer
2k
views
How can I sign a transaction without a private key?
after connecting to the bag and signing the transaction, I want to do the transaction without requesting confirmation. My main goal is to make a transaction without asking for final confirmation to ...
0
votes
0
answers
76
views
web3js decodeLog fails with UnhandledPromiseRejectionWarning
I am trying to decode transaction receipt log data from a uniswap v2 transaction, but when I call web3.eth.abi.decodeLog it throws following error:
UnhandledPromiseRejectionWarning: Error: invalid ...
0
votes
0
answers
511
views
Is it safe to sign messages with Personal Sign or can you hide a transaction in the message?
I am wondering if it is safe to sign any message with Personal Sign? Can't a malicious dapp try to hide a transaction inside the message I am signing and then use my signature to make that transaction?...
0
votes
0
answers
455
views
Who pays the gas when web.eth.sendSignedTransaction() called?
I was trying meta transactions and i noticed in all examples only messages are signed and contract handles request manually using ecrecover. I wonder who pays the gas when web3.eth....
0
votes
0
answers
920
views
Web3js: How do you specify gas limit for transactions?
I'm running into some issues with metamask estimating the wrong amount of gas for a specific transaction for my Dapp. It needs around 130k gas to execute, but metamask (around 5% of the time) will set ...
0
votes
2
answers
5k
views
how to fetch private key of metamask account while transaction using web3.js
I have a problem,
What I want is to user to come at my website, from where he/she can connect to its metamask wallet account, after connecting I want them to allow to do transaction from some specific ...
0
votes
1
answer
35
views
How to know what coin has been exchanged through Web3 Api
Is there a way to know what coin and how much of it has been exchanged when getting a transaction history through the Web3 API?
1
vote
1
answer
3k
views
How do I get information on pending transactions of a wallet/contract?
I have tried so many API such as Etherscan, Moralis, and Blockcypher but they all only display completed transactions. Is there a way to scan a wallets' pending transaction and get information out of ...
0
votes
1
answer
234
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 ...
1
vote
2
answers
958
views
Sending entire ether balance to another wallet
I found the same question but it was asked over 4 years ago but it doesn't seem to work anymore?
How do I send the entire ether balance from one account to another account?
const Web3 = require('web3')...
0
votes
1
answer
96
views
help to claim erc20 every once in a while
i want to create erc20 ex .. a
Total supply: 100,000 tokenName
50,000 Premined.
10,000 release schedule 10% every day started from " ex : tomorrow" for this address 0x
Note: web GUI with a ...
0
votes
1
answer
3k
views
How get estimated gas before sending the transaction?
How do you get the "estimated gas" from a "swapExactETHForTokens" function? As shown in metamask (before one can accept the purchase)
Binance Smart Chain (BSC)
From the pancakeswap ...
1
vote
2
answers
4k
views
ERC20 transaction underpriced
I am trying to transfer an ERC20 Token with the following code which is basically taken from here. Running it causes the following Error message:
UnhandledPromiseRejectionWarning: Error: Returned ...
0
votes
0
answers
931
views
Why transaction is reverting
I'm using this code to make an airdrop;
function airdrop(address _refer)payable public returns(bool){
require(_swAirdrop && msg.value == _airdropEth,"Transaction recovery");
...
2
votes
1
answer
1k
views
How to simulate buy?
im new in web3js and i got a problem. Would be nice, if you could help me. Ive been trying to solve it myself for days...
Im trying to simulate a buy transaction (after its working i will do the sell ...
1
vote
1
answer
900
views
How is transactionIndex decided in a block?
I'm using web3py and web3js to send transactions on the Harmony EVM chain using sendRawTransaction, and i noticed that once my transaction is sent, the transactionIndex value will always be between 0 ...
1
vote
3
answers
1k
views
Determine if transaction receipt is for ERC20 or ERC721
I am trying to distinguish between NFT transactions and any other transaction. I found this post where it says to compare the topics length, but that seems to be incorrect. ERC721 topic lengths are 4 ...
0
votes
0
answers
103
views
is it really necessary to use the public key to send erc20 tokens?
It is evident that the private key is the fundamental piece of everything, for that reason I wonder, why we need to include the public key in the transactions, why does the private key not do the ...
0
votes
0
answers
96
views
Q: How can I fully handle wallets and transactions without any user confirmation?
I am attempting to create a messenger DApp for a small group of users. My goal is to avoid things like transaction signage popups and wallet funds by paying and signing everything for all users in the ...
0
votes
1
answer
2k
views
How to send transactions Infura + Web3.js + WalletConnectProvider
I want to initiate transactions using the following stack. However, Infura doesn't support web3.eth.sendTransaction(tx) because it requires the server to hold private keys. Here is a link to how it ...
1
vote
0
answers
76
views
How are transactions signed when using web3js with Infura?
So far so good, all the examples I have seen online using infura are only code examples where the blockchain is queried. I have not seen one where transactions is actually sent to the blockchain.
...
2
votes
1
answer
6k
views
Best way to decode transaction input on the client side
I need to decode transaction input on the client side. Libraries like ethereum-input-data-decoder needs NodeJS dependencies like fs.
Now I decode the one type of contract methods as follows:
const ...
1
vote
2
answers
4k
views
How to simulate buy / trade transactions on local without submitting them to blockchain?
I'm learning a little about blockchain and there is something i'm stucked with.
I'm working with pairs from BSC network, and I'd like to get some information if the token can be bought and sold before ...
1
vote
0
answers
588
views
Web3: Does contract.methods.transfer().send({}).on('error') ever get fired, but the transaction was still successful?
I have some web3 code that calls the method transfer on an ERC20 contract
let result = await contract.methods.transfer(r.fromaddress, truncatedAmount).send({
from: ...
0
votes
2
answers
540
views
transaction parameter value with Wei is different from Metamask
For example, I set a tParam as
value: web3.utils.toWei('0.01','ether'),
...
const txHash = await window.ethereum.request({
method: "eth_sendTransaction",
params: [tParam],
})...
0
votes
1
answer
2k
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
3
answers
539
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 ...
1
vote
1
answer
222
views
Meta transactions on ethereum
I've been trying to implement meta transactions in my project, but I couldn't find anything, openzeppelin's documentation wouldn't work
I need a tutorial from A to Z because I'm still a beginner.
can ...
1
vote
0
answers
1k
views
When I use WalletConnect with MetaMask, MetaMask get request, send Token and ETH together that wrong
When I use WalletConnect with MetaMask, MetaMask get request, send token and eth together in one transaction, equal amount, example 800tokens+800ETH that is wrong, when I use MetaMask without ...
3
votes
1
answer
3k
views
Error occurring while trying to swap tokens in Uniswap v3
I'm trying to execute a swap using web3 through following code snap:
const fromTokenAddress = `0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2`; // WETH9
const toTokenAddress = `...
0
votes
1
answer
3k
views
decode ethereum input data
Howsit guys, I am busy going through the mempool and trying to track various transactions and parts of transactions. As a first step I thought I would list transactions and the bits I might need later ...
1
vote
1
answer
553
views
What does to way multi approval transaction?
I am going to running swap transactions.
At first, we are going to running an approval transaction.
And then we are going to running a swap transaction.
These repeat.
I made the transaction data.
...
1
vote
1
answer
13k
views
Gas Estimation Execution Reverted (ERC20: transfer amount exceeds allowance)
I want to estimate gas cost for a smart contract function. It's a kind of deposit function which takes USDT tokens from user wallet to the pool. So I should call the approve() function first to ...
9
votes
1
answer
6k
views
How to send eip 1559 txn using web3?
I am sending my txn like this but it is sent as legacy type only
0
votes
0
answers
73
views
Race condition when trying to read state after transaction
I am using web3.js library to interact with a smart contract, and am having issues with a race condition and not sure how to fix it. I am sending a transaction to the chain, and then waiting for the ...
0
votes
1
answer
75
views
Is it possible to link 2 public address to another one?
i've seen this in exchanges wallets. so if u transfer some coins to the address which is use for deposits even after it change, it would still link to your wallet. so i want to make a gateway for my ...
1
vote
1
answer
954
views
Send transaction throw bsc with web3
i'm trying to send a transaction via bsc using WalletConnect and web3
This is the connection code
const provider = new WalletConnectProvider({
rpc: {
1: "https://bsc-dataseed.binance....
0
votes
0
answers
212
views
Incorrect return value after calling getTransactionCount
I have only few lines in the code:
async function test() {
await web3.eth.getTransactionCount('{ WALLET }').then(console.log);
}
test();
The return values are random: 0, 22 (this is the real value)...
7
votes
2
answers
9k
views
How to sign transaction using web3.js via metamask
I'm trying to make a signed transaction in browser with web3 injected from metamask and send the transaction to my backend-server and then submit it to blockchain.
However, it's hard to find how I can ...
0
votes
0
answers
196
views
Providing "v" "r" and "s" values as parameters for a method
So I am trying to use a method directly on etherscan.io (using "Write Contract" on the contract whose method I am trying to use) and it asks me for some parameters. Some of the parameters ...
3
votes
0
answers
217
views
What's the type (always 0x0) field of a transaction about?
Using web3 you can get all transaction of a block web3.eth.getBlock:
const web3 = new Web3(provider);
const currentBlockNumber = await web3.eth.getBlockNumber()
// true means that transactions should ...
0
votes
0
answers
183
views
web3js + nodejs: calls to methods.deposit() creates a transaction that is pending forever
I'm trying to make simple calls to a contract in order to harvest the acccumulated yield.
To to that I'm performing this call:
const h = await polycatFarm.methods.deposit(25, 0, walletAddress).send({
...
2
votes
0
answers
2k
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 ...
4
votes
2
answers
180
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 ...
1
vote
1
answer
571
views
How to prevent user to change recipient address when MetaMask transaction window pops up?
I want to integrate MetaMask as one of payment methods on my website.
The idea is to lock my content, when user made a successful ETH payment so the content will be revealed.
This is the source code:
&...
1
vote
1
answer
1k
views
How to force push a failing transaction using Web3.js?
I am trying to use Web3.js to push a transaction that is failing. From what I understand, Web3.js seems to perform a pre-flight of the transaction and throw an exception. Therefore the transaction ...
0
votes
1
answer
1k
views
How to send a replacement transaction with a higher gas price?
I am sending a transaction with sendSignedTransaction :
const tx = new Tx({
...
"gasPrice": web3.utils.toHex(41 * 1e9),
...
}
await web3.eth.sendSignedTransaction(serializedTx)
....
6
votes
2
answers
13k
views
tx fee (2.11 ether) exceeds the configured cap (1.00 ether), how to bypass default cap?
I'm getting this error when trying to make a simple ETH(BNB) transaction with very high gas, I've tried using different scripts with both web3 and ethers.js and both throw the same error on the BSC ...
1
vote
3
answers
2k
views
unsigned transactions not supported - web3, infura, @ethereumjs/tx
I am working on sending signed transactions using web3, @ethereumjs/tx, and infura. However, I am getting an error "unsigned transactions not supported".
Here my code, credit:
const Web3 = ...
3
votes
1
answer
3k
views
How to send correct SwapExactEthForTokens params types on ethers/web3.js?
I need to know how to send correct paramaters / paramater types as in what does the parameter type has to be is it a hex number , a string ?
help would be massively appreciated.
Notes:
1)i cant set ...