Skip to main content
6 votes

I was trying to convert private key of an account to its public key but getting an error

Well, obviously it doesn't like your private key format. I'm unsure what style private keys the function accepts. A typical private key is, for example, ...
Lauri Peltonen's user avatar
4 votes

Ethers.js equivalent for web3.eth.getStorageAt?

In Ethers V6 it's now getStorage await provider.getStorage(address, slot);
6be709c0's user avatar
  • 161
4 votes
Accepted

How to know why Uniswap cancelled my transaction?

No pair exists for the tokens in your path, it fails at calling getReserves on the pair, since the function doesn't exist there. You can try a tool like tenderly.co to easily analyse the revert point ...
Maka's user avatar
  • 1,240
3 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 ...
Siddharth Bhoite's user avatar
3 votes

How Can I Identify the Blockchain Where a Smart Contract Is Deployed Using Its Address?

If the question is, can I determine which single chain a contract is deployed on by using its address? The answer is you can't because it isn't unique. There isn't a 1-1 mapping of contract address -&...
Maka's user avatar
  • 1,240
3 votes
Accepted

Solidity: Reading events with web3.eth.contract

Dev Advocate at Chainstack here. I think you might be mixing up event logs with the events emitted by web3.js when sending a transaction, like in this case, deploying a smart contract. Please correct ...
Dave Dev Advocate Chainstack's user avatar
3 votes

How does Etherscan decode unverified contracts events?

Divide the resulting log by 32 bytes: 0x0000000000000000000000000000000000000000000000000000000000000032 //hex to dec = 50 0x0000000000000000000000000000000000000000000000000000000000000046 // 70 ...
Alexey Smirnov's user avatar
2 votes

error: replacement transaction underpriced

It self-resolved for me by just chillin' for 5 minutes.
HankCa's user avatar
  • 175
2 votes

How can I get the number of confirmations for specific transaction hash?

6 years.... So what about a solution? In v6 ethers.js we can do something like this: const tx = await this.eth.getTransactionReceipt(params.hash); console.log('tx', tx); console.log('tx confirmations'...
Ivan Efremov's user avatar
2 votes

How to read all token balances from wallet?

You can now use Amazon Managed Blockchain Query to easily retrieve a full list of token balances for a given EOA at finality (2 epochs on Ethereum) or from history (based on a timestamp). I've ...
Forrest's user avatar
  • 31
2 votes

How do I decode the transaction's log with Web3.py?

The above solutions are excellent, but only work on legacy transactions. To decode any type of transaction (legacy, EIP1559, EIP2930, etc) please rely on the py-evm package. Here's a working example, ...
coccoinomane's user avatar
2 votes

Get list of tokens balances from wallet address via web3?

You can try out Bitquery Balance Updates API. Try this API to get Wallet Balance on BSC network: https://ide.bitquery.io/Get-list-of-tokens-balances-from-wallet-address_1 query MyQuery { EVM(dataset:...
Akshat Meena's user avatar
2 votes

Decode input data on transaction

I have developed a simple ruby gem for decoding and encoding transactions input data in EVM based blockchains: https://github.com/rkotov93/evm-tx-input-decoder Here's usage example regarding your case:...
rkotov93's user avatar
2 votes

Is there a way to attach a "memo" to an ERC-20 `approve` transaction

You can use ethers to encode the transfer or approve function's data then append your memo to that data. The data will be more than the transfer function needs but luckily EVM will ignore the extra ...
Rachid Boudjelida's user avatar
2 votes
Accepted

When i type forge init --force / forge init

Thanks! Your second method successfully solved my problem!command as follows: sudo -i cd /bin/ rm forge exit That's all!
邓致远's user avatar
2 votes

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 ...
Giuseppe Bertone's user avatar
2 votes

How do I update a campaign without it creating a new campaign?

const updateCampaign = async (form) => { try { const data = await createCampaign({ args: [ // items have to be in the order they were the contract inside createCampaign()...
Foxxxey's user avatar
  • 4,357
2 votes

Encode an integer to a uint256 to call a function

const Web3 = require("web3"); const web3 = new Web3(); // You can also pass a provider URL here // Your uint256 value const uintValue = "10"; // Encode the uint256 value const ...
EthanOK's user avatar
  • 476
2 votes

Invoking a function with different amount of input than the function takes

Assuming this sub function is copied from OpenZeppelin's SafeMath.sol library, or similar. In Solidity, you can declare special library functions by declaring functions inside a library (instead of a ...
ardislu's user avatar
  • 547
2 votes
Accepted

How to Download dependencies when auditing a hardhat project?

Just check if it used yarn or npm, then run either npm install or yarn install. After installing run the test command npx hardhat test ./test/TestFilePath.
Zartaj Afser's user avatar
  • 4,717
2 votes

Web3 Schema Update

Immutability doesn't mean you can change the data inside, it means you can't change the code. To change the name you need to include a setter function. For example: string name = NaMe; function ...
Zartaj Afser's user avatar
  • 4,717
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 ...
Iresh Madhusankha - DevCresix's user avatar
2 votes
Accepted

How to know base token from the pool

Price in Uniswap pools is tracked in terms of token1/token0, so token1 is the numeraire token if that's what you're asking.
kfx's user avatar
  • 1,650
2 votes
Accepted

Good resource for web3 developer

I believe each person have their own style of studying new thing. For my experience here are some good resources and learning path that you can follow: First, you need to understand the basic of BC ...
tqdpham96's user avatar
  • 608
2 votes
Accepted

Issue with Smart Contract Interaction using Web3.js 4.2.0: TransactionRevertedWithoutReasonError on MetaMask and Sepolia Testnet

Referring to a Stack Overflow post (https://stackoverflow.com/a/77136409/13583700), I refactored the code as follows, and it successfully resolves the issue: const gasEstimate = await this....
Dawid's user avatar
  • 141
2 votes

I want to know a Contract address verified or not by programatically

Contract "verification" is not a blockchain concept. It's just a concept invented by blockchain explorers - there is no 'universal' verification, it's always per-service. Verification ...
Lauri Peltonen's user avatar
2 votes
Accepted

How does Etherscan decode unverified contracts events?

Found it! I managed to use hexDataSlice() from ethers.js https://docs.ethers.org/v5/api/utils/bytes/#utils-hexDataSlice and Javascript parseInt(): const result = (logs[0].data) const size = result....
user130657's user avatar
1 vote

Why require(minter == msg.sender) always throw error? I used the correct address as sender

The correct answer to the question is that the error is generated by the estimateGas function and not the send function. Based on the documentation, you need to pass the from address await tx....
GramThanos's user avatar
1 vote

Integrating KMS with ethers _signTypedData (EIP712)

This repository could provide a good solution : https://github.com/JonathanOkz/web3-kms-signer import { Signer } from "@web3-kms-signer/core"; import { KMSWallets } from "@web3-kms-...
a9911b's user avatar
  • 31
1 vote

err_cleartext_not_permitted error while running Dapp on Android Metamask

In laravel Project I used this at the end of the web.php or api.php file and it worked perfectly: URL::forceScheme('https'); In Another Technologies force Your users to go to https urls to solve this
anonymous's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible