11

From the ganache-cli docs: --chainId: Specify the Chain ID ganache-cli will use for eth_chainId RPC and the CHAINID opcode. For legacy reasons, the default is currently 1337 for eth_chainId RPC and 1 for the CHAINID opcode. Setting this flag will align the chainId values. This will be fixed in the next major version of ganache-cli and ganache-core! So, in ...


9

Is it possible to somehow update an existing ERC-721 Token's MetaData after it was already minted? Yes. This is not disallowed by the standard and so you are free to do this. The official implementation of ERC-721 is maintained by 0xcert. It is free/open source and you can use the Metadata Mock contract as a starting point. You will simply add a public ...


7

chainid is available in native solidity 0.8.0. So you can get chain id like block timestamp or block number. Here is the code. block.chainid; Documentation https://docs.soliditylang.org/en/v0.8.0/units-and-global-variables.html Solidity update PR is here. https://github.com/ethereum/solidity/pull/10557


7

function getPrice(address tokenIn, address tokenOut) external view returns (uint256 price) { IUniswapV3Pool pool = IUniswapV3Pool(factory.getPool(tokenIn, tokenOut, FEE); (uint160 sqrtPriceX96,,,,,,) = pool.slot0(); return uint(sqrtPriceX96).mul(uint(sqrtPriceX96)).mul(1e18) >> (96 * 2); } ...


7

It is most likely a transaction that cancels another one. You can cancel a transaction by sending another transaction from the same address with the same nonce, with a gas price at least 10% greater than the gas price of the cancelled transaction. If you want to reduce the gas cost of your cancelling transaction to the minimum, making a transfer to yourself ...


6

To summarize : approve(address to, uint256 tokenId) : By calling this method, the sender authorizes the address to to transfer one of his tokens with the Id tokenId. setApprovalForAll(address to, bool approved) : By calling this method, the sender authorizes the address to to transfer all his tokens. to is then called an operator of the sender. In these ...


6

"Technological limits" is a quite broad term, but some other relevant limits are, for example: Maximum contract size of 24 kB (see in this article) Limited stack depth of 1024 (see deprecated Call Depth Attack) And most importantly, every computation requires gas, which is limited by your gas limit (see gas costs for EVM instructions) For a more ...


6

we want to use the block hash of some block in the future as a seed for the random generator. I think using a future block hash is generally considered "safe". (This article discusses using future block hashes, though on-chain inside contracts. I can't see how off-chain would be any less safe: https://blog.positive.com/predicting-random-numbers-in-...


5

A good overview of frontrunning, and related miner extractable value (MEV), problems are well established and well known at this point. The difference between these two modes of frontrunning that in MEV it is the miners who frontrun you, whereas normal frontrunning bot use the same mempool for transactions are other Ethereum clients. Here are some articles ...


5

There are 3 commons way to query the ethereum blockchain for now : The Ethereum dataset from Google BigQuery. You can retrieve various information such as basic information about transactions, smart contract function calls, token (erc20) transfers ... You can query this using SQL. For example, here is a query to get the top 10 biggest ethereum holder : ...


4

You either need to update your custom MetaMask Network to match the default chainId returned by Ganache (which is 1337) or, if you are using ganache-cli use a command like ganache-cli --port 7545 --chainId 5777 to change the chainId to 5777. If you are using Ganache GUI you can't change the chainId, so you'll need to change it in MetaMask instead.


4

The really cool thing about smart contracts is their immutable nature. They can't be altered or changed which gives everyone confidence. So much so that the data in some contracts begin to take on the characteristics of assets. The flip side is the owner has zero special privileges unless they are explicitly coded into the contract. Money cannot leave the ...


4

First question - There are two options here: The backend forms a transaction, and geth signs and sends it to the Ethereum network The backend forms and signs the transaction, and the geth sends it to the network Second question - maybe 2 options: The backend requests new blocks from the geth, extracts events from them and selects the necessary ones The ...


4

I'll come at this from a slightly different direction... The current price of ETH is ~$1500. The Yellow Paper states that storing a 256-bit (32-byte) word costs 20,000 gas. Average gas price is currently ~100 Gwei. That's 100 x 20,000 Gwei per 32 bytes, which is 2,000,000 Gwei, which is 0.002 ETH, which is $3. 1 GB is 1,073,741,824 bytes, so there are 33,554,...


3

Anyone know how to work with ERC-2309? Yes. The standard is fully specified at https://eips.ethereum.org/EIPS/eip-2309. That is how you work with it. super._mint(msg.sender, tempColorCounter); This line is not using the ERC-2309 standard because that _mint implementation is emitting an event each time. You will need to rewrite your minting implementation ...


3

The payload tells the contract which function you want to call, and the respective argument values to execute that call. Structure of a payload A payload comprises of 2 main parts - the function selector and its argument values. Let's say you want to call a particular function in a specific contract: transfer(address,uint256) This is how the payload is ...


3

New answer September 2020 A cool new tool was released: https://explorer.blocknative.com


3

UI Tools cleanunicorn.github.io/santoku etid.wtd.ru ethtx.info moesif.com/solidity-abi-hex-decoder/decode Note for these you will need the ABI of the contract. Node Packages @ethersproject/abi (part of the umbrella package ethers) abi-decoder ethereum-input-data-decoder Recommendation Use @ethersproject/abi, it's the safest approach of all. Ethers is ...


3

A pending transaction can be cancelled by using a wallet that supports it. For example, here are instructions from the MetaMask wallet with diagrams. https://metamask.zendesk.com/hc/en-us/articles/360015489251-How-to-Speed-Up-or-Cancel-a-Pending-Transaction Click the Cancel button. The other answers explain more about what happens behind the scenes.


3

At compilation all contracts are combined together to produce one bytecode so inheritance will not be very helpful to decrease contract size. From the error message the problem seems to be not enough gas and it appears you are using the default gas 6.7M gas. For reference at this moment mainnet has a block gas limit above 12M gas. A temporary solution is ...


3

Some answers Yes, miners mine Ropsten in order to provide a public good, not for profit. Would this disappear if there were to be an app with enough traction to clog Ropsten? Most likely. Ropsten has been plenty clogged before, not due to a popular dApp, but because of spam or 51% attacks. We did not see mining fall off during the attacks, nor did we see it ...


3

I would claim that the biggest advantage (and, at the same time, disadvantage) of Ethereum compared to Stripe/fiat is decentralization. If you setup some centralized service (Stripe?) to distribute money: The parties have to trust the centralized service. The service may be dishonest The centralized service may get blocked in some geographical regions The ...


3

You should install ethereum client https://geth.ethereum.org/downloads/ Create a folder to store blockchain node. Start geth from cmd with params geth --datadir "path to folder from 2" --networkid 1 and to wait synchronization is ended.


3

Metamask accounts are not compromised by giving permission to a website. The permission only allows the website to see your public address, not your private key or seed phrase. Typically, your account will be compromised if your seed phrase is stolen or lost. In that case, all the Metamask accounts that you generated with that seed phrase will be compromised....


3

No, It is an Oracle Provider, which allows you to access your oracle data to Smart Contract.


3

This can be achieved by the following: Declare storage variables at the contract level mapping(address => uint256[]) public userOwnedTokens; mapping(uint256 => int256) public tokenIsAtIndex; mint(tokenId) { // Prior minting logic from OpenZeppelin userOwnedTokens[msg.sender].push(tokenId); uint256 arrayLength = userOwnedTokens[msg.sender]....


3

Basically, what you want is to have a confirmation that a given block was included in the canonical chain. I assume that you do not need very high security because based on your examples a confirmation of only one block would be enough for your need. I think that expending your second option could be a solution. Alternative 1 - Validate double blocks with ...


3

To communicate between two different networks, you need a bridge of some sorts. The most straightforward bridge is an oracle service which relies data between the chains. To create a decentralized bridge is very difficult. Basically you need decentralized oracles (something similar to Chainlink) and a decentralized backend system which relies the data. The ...


3

From the blockchain's perspective, there is no such thing as "confirmation blocks". That's mostly a term coined by centralized exchanges and other trading platforms. When a miner mines a block, he broadcasts it to the network. Due to latency issues, some nodes hear of it sooner, some later. Because not everyone hears of it at the same time, it's ...


2

https://developers.coinbase.com/api/v2#exchange-rates By coinbase ,I think best api for exchange rates with accurate data example for ethereum: https://api.coinbase.com/v2/exchange-rates?currency=ETH


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