current position:Home>The three methods of Ganache + truss are different in obtaining the ether balance
The three methods of Ganache + truss are different in obtaining the ether balance
2022-02-03 23:28:25 【Q & A of Denglian community】
use ganache+truffle, Call the smart contract to get the Ethernet balance , Use web3.eth.getBalance, And use remix In order to get , The three results are different
The contract acquisition method is like this :function getMyBalanceInEth(address addr) public view returns(uint) {return addr.balance;}
Call the contract at the front end :const { getMyBalanceInEth } = this.meta.methods;const amount = await getMyBalanceInEth(this.allaccounts[0]).call();alert(amount); result :180143885539597660000000000
Use... On the front end web3( The result is right , and ganache According to the same )web3.eth.getBalance result :99555222160000000000
3. stay remix-ide Deploy and call the result :99495222160000000000( The result is just different from the correct result 0.06 An ether )
Ask experts to help see what's wrong , thank you
Other answers 1:
Other answers 2:
copyright notice
author[Q & A of Denglian community],Please bring the original link to reprint, thank you.
https://en.netfreeman.com/2022/02/202202032328231578.html
The sidebar is recommended
- What is the current circulation of link?
- Excuse me, Web3 JS how to call approve authorization, can you give an example code? thank you
- When verifying the smart contract in Etherscan, the ABI error is always prompted
- Ethereum contract cannot be called
- How to modify the issuance of Ethereum tokens
- How to set the asset withdrawal function of token publishing contract address?
- On the problem of geth connection cluster
- Can a blockchain generate blocks in milliseconds?
- How to obtain the signature when an external contract calls this contract?
- Why use call? Can't you directly use the method to import the interface of the contract
guess what you like
-
How to use other addresses to transfer eth out of the contract
-
Through abi Can't a query method be called by encoding be defined as view
-
There are some tokens in the contract. Can you approve the tokens in the contract to a certain address
-
How does Web3 get nonce including padding status
-
How to connect the front end to the Ethereum Wallet
-
web3. JS calling contract method reports an error VM exception while processing transaction: revert
-
Why does if (1 = = 1) {XXX} affect the execution of XXX code?
-
There was a problem issuing the uniswap contract
-
How to determine the order of transactions with the same gas price in the same block
-
How to use the call, callcode, and delegatecall functions called by the solidity contract?
Random recommended
- Remix compilation error
- How to get the gas price of pending transaction?
- Etherscan website cannot be accessed
- The code is picked up on the Internet. When it is written after Remix deployment, it is' gas estimation failed, gas required exceeds allowance (8000000) or always failing transaction
- Error in solidity: typeerror: data location must be 'memory' for return
- Full path returned from traversal of solidness multitree
- Remix deployment contracts have been pending
- How can you always prompt timeout when developing deployment contracts with truss
- When compiling, truss prompts that the version of solidity is wrong, but the version required by the contract has been set in truss config. What should I do
- Is there a decentralized shopping contract
- BTC account balance query
- Truffle migrate deploys a contract,
- When using truss run verify to verify Etherscan code, errors are always reported
- Generally, there are many transactions in eth's pending pool. After all, there are at most 200 transactions per block
- DAPP page monitoring network
- How does solidity call the global variables of other contracts?
- Super ledger expansion
- On the mapping of proficient in Ethereum smart contract development course.
- Verification and transfer of Ethereum balance and token balance
- How does solidity realize large number operation
- How does library query block information
- How does Ethereum change the consensus mechanism
- The difference between memory and storage temporary variables set in solidity
- Problems of Web3 interaction
- How does truss deploy multi file contracts and merge contract files
- Fail with error 'TransferHelper: TRANSFER_ FROM_ FAILED'
- Can one method in solidity call two methods of transferring tokens
- Ethereum node server
- Course blockchain full stack development - Web3 cannot be imported in the actual practice of Ethereum DAPP development
- Xiaobai learns the development process of Ethereum smart contract DAPP
- The shared folder with Remix ide enabled locally cannot be connected
- A timeout pops up at the end of deploying the contract with truss, but there is already a contract on the chain when looking at the chain. Is the contract complete in this case?
- Will the use of nest Oracle for stable currency exchange have advantages over curve and centralized exchange exchange exchange?
- Smart contract operation offline program
- The DAPP browser integrated environment of wallet is insufficient
- Is there ide code completion and error prompt comparable to remix
- How does Bellman optimize the performance of proof
- Web3 calls the smart contract method. Can you call multiple contract methods at one time? Either they all succeed or they all fail
- Please ask a question about Ethereum chain configuration change
- Decompiled smart contracts are not understood