New answers tagged

0

On a personal project I made on react also using Metamask I used eth_requestAccounts like this, as you can see in my code: await window.ethereum.request({ method: 'eth_requestAccounts' });


0

You are declaring accounts as an empty array: thus accounts[0] will be null. either declare it manually, or use this


0

Assuming you have been activated personal rpc of your geth, to do this programatically without hardcoding the keystore file directory path in python, do the following: from web3 import Web3 import eth_keys from eth_account import account w3 = Web3(Web3.HTTPProvider('http://127.0.0.1')) address = '0x...' password = 'password' wallets_list = w3.geth.personal....


0

Here, Etherscan is used as the default RPC provider. They are just like Infura/Alchemy - provide access to Ethrereum nodes. Each provider has their own terms of usage and pricing.


0

Answering your second question to calculate maxFeePerGas programmatically you could call this function in ethers.js provider.getFeeData() which will return maxFeePerGas maxPriorityFeePerGas gasPrice, however currently it seems maxPriorityFeePerGas is hardcoded to a value of 2.5 gwei as per their code. Alchemy has the function eth_maxpriorityfeepergas to ...


0

Since each Ethereum transaction requires computational resources to execute, each transaction requires a fee. Gas refers to the fee required to conduct a transaction on Ethereum successfully. See these links to know more about fees: 1, 2. Gas fees are paid in Ethereum's native currency, ether (ETH). If you are looking for a centralized architecture, you ...


0

Web3 and Create-react-app If you are using create-react-app version >=5 you may run into issues building. This is because NodeJS polyfills are not included in the latest version of create-react-app. Refer the Solution in the Below link https://github.com/ChainSafe/web3.js#troubleshooting-and-known-issues


0

The method is paypable. This is a Solidity identifier that indicates that you can send the native coin (e.g. ETH or BNB or FMT) along with the contract call. Therefore the blockexplorer shows an extra field to specify the amount. Line 66 in your referenced contract checks if the correct value was sent along. More info: https://docs.soliditylang.org/en/latest/...


1

Instead of writing your tests in Mocha/Jest framework. Write the above code in a separate script and run it using hardhat run scripts/<yourscriptname> --network rinkeby. Please note that you will have to remove expect/describe and all functions related to mocha framework. Use simple assert functions in your testing script.


0

Ok, so the way I got it to start up on port 9545 was to modify the truffle-config.js. The default file generated when I ran truffle unbox react had these lines: networks: { develop: { port: 8545 } } Contrary to the documentation, it does seem like truffle develop results in this file being read. I changed the network name to development: ...


2

Metamask doesn't expose private keys as it's a huge security issue. You shouldn't expect users to expose their private keys either. If you want to sign a transaction or arbitrary data, you can use the Metamask RPC methods. You can find the methods here. With this, you can perform data signing, encryption-decryption with the private keys, in a safe way.


1

calldata represents the data of the (internal) transaction. This data cannot be adjusted inside a call, therefore you cannot write into calldata. There are two ways to go ahead with this: Have the data be provided by the sender that calls your method and define it there as a calldata parameter. Perform an internal transaction to the schedule method (which ...


0

According to the docs you linked the send method takes an options object with the [parameters](so should I report an issue for safe-react that it’s possible to create tx in such case ?) from,gas, gasPrice, value. so for your example that would be await ReentrancyDeployed.methods.depositFunds().send({ value: web3.utils.toWei("10", "ether"...


0

For anyone finding this thread in the future Apart from current maintenance this is the reason according to Quicknode customer support: First, no provider is capable of seeing the ENTIRE mempool at all times. It's a p2p network and the mempool is not consistent across all endpoints at all times. There are even private mempools and peers that do not ...


1

truffle develop spins up a specially configured ganache to interact with the truffle console. This is on purpose run on a different port (9545) to not conflict with the default ganache port 8545, see https://github.com/trufflesuite/ganache-cli-archive).


0

A user will be able to fake their public address for read only purposes (see impersonator) but will never be able to fake a signature for a message or transaction. I'm not actually sure what your use-case is, but you can safely bind an address to a certain user through a simple utility involving asymmetric encryption. If you have a frontend + backend ...


1

0x0000000000000000000000000000000000000000000000000000000000000002 is a string that is encoding a number in a hexadecimal system. You can turn it into an integer using parseInt(hexString, 16); where hexString is the string that you want to decode, and 16 is the base number system (hexadecimal).


0

I guess this would depend on depends why you have made the _mint function external? Perhaps you could consider creating a safe public 'mint' function in the smart contract which calls this and make it internal.


0

On mobile WalletConnect tries to default to deeplinking instead of QR codes. If everything is properly integrated you will see a screen like this There you can also switch to the QR code.


1

Just treat the scripts as any other embedded scripts: <script src= "https://cdn.jsdelivr.net/npm/ethereumjs-common@latest/dist/index.min.js"></script> <script src= "https://cdn.jsdelivr.net/npm/ethereumjs-tx@latest/dist/index.min.js"></script>


0

The latest docs says to do the following: contract.events.TokenMinted().on('data', this.contractEventHandler ) it depends on the version of web3 you have. Here are the docs. https://web3js.readthedocs.io/en/v1.5.2/web3-eth-contract.html#id50 Note; I was having errors when I tried to locally copy and manipulate a react state variable in the ...


0

Your gas price is extremely low. You can query the gas price with web3.eth.gasPrice(), when I did this I got 2000000000. As your 35000 is very low it will take a long time (or potentially never) for a miner to pick up this transaction.


0

deploy() will trigger this deployment of the contract and .deployed() checks if the contract is already available on the blockchain and if the deployment is still ongoing will wait for the deployment transaction to be mined (see https://github.com/ethers-io/ethers.js/blob/master/packages/contracts/src.ts/index.ts#L819).


1

In your hardhat.config.js you should have accounts instead of account. Due to this typo, ethers cannot invoke 'sendTransaction' once the signer is null


0

There are multiple frameworks for this. Onboard.js Web3Modal Snapshot Lock All of these frameworks provide extensive documentation on how to integrate these.


0

ApiKeys exist to limit the resource consumption on public rpc providers and to protect against abusive behaviors such as DDoS attacks. In order to avoid use of an ApiKey, one option is to run your own private ethereum node, which requires a large amount of disk space, a considerable amount of time to sync and extra caretaking. If it is desirable for you to ...


0

You get the gas cost warning, because it is not possible to estimate failing transactions. To test why your transaction is reverting it is easiest to test against the remix integrated network, as they provide more information (e.g. revert message). In general you code will not work as donate send eth to receiver which is set to the contract itself in the ...


Top 50 recent answers are included