New answers tagged web3js
1
vote
Accepted
Methods not appearing when printing contract but do appear on Etherscan
It seems just a problem with the ABI you import in the arbritage object. That object seems to refer to an arbitrage bot contract, like arb-bot or similar, not to your deployed contract.
1
vote
abi-decoder's decodeMethod returns undefined
The problem seems related to how abi-decoder computes the function identifier (the hash of the function signature); in particular, it associates swap function to the 0x899a73f4 ID and not to the ...
0
votes
Track logs of a specific wallet address not emitting anything
I also looked for a solution for a single address, but unfortunately there is no solution. I'm adding this here for those who happen to pass by.
async function listenTransaction(receiver, callback) {
...
0
votes
How to get reason revert using web3.eth.call
Follow this.
Basically different RPC's will have different error response data. So you'll have to check the response and then simply use parseError on contract's interface.
https://ethereum....
0
votes
Creating a token for my personal dapp use only
You could use a stablecoin pegged on the Dollar value to do that. Those coins are supposed to have a "fixed" value of 1 Dollar (which actually slightly value around 1 Dollar). You can then ...
0
votes
Staking pool for native coins
Since we're talking about the blockchain's native asset, you can't mint those. So if the staking reward is in the native asset, somebody (probably you) have to be inserting those into the contract. ...
0
votes
Test BNB / WBNB for Development testing purpose
For test networks you can deploy one token yourself and call it BNB. Mint as many as token you want for yourself. Then use this your self deployed token as BNB.
1
vote
Test BNB / WBNB for Development testing purpose
It would be hard to obtain 100 TBNB as the faucet only give small amounts. As for liquidities, you can check on PancakeSwap on testnet by connecting you wallet to the BNB Testnet if there is any.
The ...
1
vote
React (opts:) not working, am i missing dependency?
That version of Web3Modal doesn't work any more and has been deprecated. Try v3 check docs here: https://docs.walletconnect.com/web3modal/react/about?platform=ethers
0
votes
ERC20 Transaction failing due to invalid nonce value
You can encounter this same error in ethersjs.
As of ethers v6, you can get the required nonce using the getNonce method on your signer.
const wallet = new ethers.Wallet(
address,
provider
);...
0
votes
in cloud window.ehtereumundefined,in local window.ehtereum is object
The RPC provider window.ethereum is injected by the browser using wallet extension or its own implementation.
When running as a service outside a browser the object window doesn't exists. To access ...
0
votes
Verification of contract using Brownie
A few things to double check to make sure its working correctly:
Run brownie compile to ensure most recent contract is compiled
Ensure environment variable in .env file is named ETHERSCAN_TOKEN
Make ...
1
vote
Listening to UniswapV3 PoolCreated event with web3
Dev Advocate at Chainstack here.
As far as I know, Infura (and getblock), at this point, don't allow for subscriptions over WebSocket.
I don't wanna be the devil's advocate, but Chainstack allows for ...
0
votes
Error happened while trying to execute a function inside a smart contract: Chainlink Functions Contract Deployment
Because the address is the owner itself or not the pending_address to take ownership of the contract.
There are 2 steps to transfer the ownership of the contract.
Current owner call function ...
1
vote
Accepted
Error (9322): No matching declaration found after argument-dependent lookup
Try to use vm.deal()
Also try put the function testDust() public in contract ContractTest is Test {}
deal(address(LocalHLP) , bob , 10000e18 ,);
0
votes
Send selected token (the one you deployed) with web3js
To interact with a contract on a blockchain, you must have to communicate with a RPC or any other endpoint prefer. To that you may have to use a direct API call, a library like web3 or ethers from a ...
0
votes
Callback After Dapp Approval
The best approach is using wagmi on your dapp. It makes pretty easy to watch transaction confirmation and straight forward. Here is an example using wagmi react. There are several hooks assist your ...
0
votes
'value at "/0" is required'
Find the problem and fixed it.
The part I fixed: Instead of rawTransaction after you write signedTx and put dot it shows you raw but I saw in an example of people doing it they wrote rawTransaction so ...
0
votes
Callback After Dapp Approval
Yes, you can use JavaScript along with the Web3.js library to listen for a 'Approval' event emitted by your BEP-20 token contract. Once the event is detected, you can trigger a pop-up on your website.
...
2
votes
Tracking the spedup transactions from metamask
There is one way of tracking this. Follow these steps.
Fetch the nonce of the last transaction submitted by the account. In this case, the nonce of increaseAllowance called.
Subscribe for pending ...
0
votes
Accepted
Signature verification using web3js
In the hardhat testcase you are assembling the v,r,s incorrectly.
instead of
const signature = `0x${v.toString(16)}${r.toString('hex')}${s.toString('hex')}`
you should make the signature like this.
...
0
votes
Accepted
How to send a token other then eth with metamask without extension of course?
I am assuming this question is about sending ERC20 tokens, programmatically.
For that, you would need the following things.
The private key of the account from which you will send the tokens. (you'll ...
1
vote
Ethereum Address string size
0x0000000000000000000000000000000000000000 how to generate address keep 37 chracter constant and generate last 5 characters like this
0x0000000000000000000000000000000000000001
...
0
votes
Gas estimation errored with the following message (see below). The transaction execution will likely fail. Returned error: invalid opcode
You can only test in Goerli or Sepolia. In remix, importing the openzeppelin library requires your compiled version ^0.8.20; while most bsc or other Ethereum compatible chains are not yet compatible ...
0
votes
Gas estimation errored with the following message (see below). The transaction execution will likely fail. Returned error: invalid opcode
There may be other issues, but the first thing that pops out to me is an array out-of-bounds issue.
If you try to access (read or write) to an index in an array that is larger than the arrays length, ...
0
votes
Accepted
How set Market or Agressive fee
To set the transaction fee to a default or aggressive mode when using RainbowKit and Web3.js, you can do the following:
First, you estimate the gas price with web3.eth.getGasPrice(), which will ...
0
votes
How to fix `Expected 0 arguments, but got 1` error on web3.eth.contract method?
There is an active web3js GitHub issue about this problem that will hopefully fix this issue in the future.
However, one "ugly" workaround to make this work while pleasing next type checks ...
-2
votes
"What are the key considerations for optimizing gas costs in complex Ethereum smart contracts while ensuring security and scalability?"
here are some tips for reducing gas consumption in Smart Contracts:
Use an appropriate data type for each variable. For example, use uint8 instead of uint256 if you only need to store a small number.
...
2
votes
How to get a index position of the storage on the smart contract?
If you are using foundry for development, the cast command line utility will give you entire storage layout for your contract.
You'll have to give an rpc-url for the network and the blockscanner api ...
0
votes
How to track incoming to smart contract transactions using web3js?
Contract N1 interfaces method A in contract N2.
Once method A in contract N2 successfully executes, it logs an event on the blockchain and it passes as argument the output of the method.
You then use ...
1
vote
Error "does not exist" using web3.eth.personal.sign
This answer is just for in case you are not created the rpc provider by your own but using external provider(like: Infura, Alchemy, Pokt, ...) as they will not support --rpcapi personal (Actually, all ...
Top 50 recent answers are included
Related Tags
web3js × 6086solidity × 1688
go-ethereum × 758
metamask × 632
javascript × 512
truffle × 479
nodejs × 411
blockchain × 373
transactions × 364
contract-development × 349
ethereumjs × 274
ethers.js × 266
events × 253
dapps × 249
react × 222
remix × 196
ether × 196
contract-deployment × 194
erc-20 × 192
contract-invocation × 185
infura × 183
web3-providers × 173
web3.py × 161
dapp-development × 160
tokens × 151