Categories
Cryptocurrency Ethereum Mastering Development

Etherscan api: how to get transaction fee?

For example: open this https://etherscan.io/tx/0xcb1e3530950cf2c43a307bcb5645ae71a12c76a60831617badd04aea3efe68aa It’s a random one I see these infos on webpage: Gas Limit: 136,500 Gas Used by Transaction: 35,531 (26.03%) Gas Price: 0.000000008 Ether (8 Gwei) Transaction Fee: 0.000284248 Ether ($0.05) I know that fee = gas_price x used_gas => 0.000000008 x 35,531 = 0.000284248 eth Perfect. I am interested in […]

Categories
Cryptocurrency Development Ethereum

How to read data returned by a function?

Counter.sol: pragma solidity >=0.5.0 <0.7.0; contract Counter { uint public _counter = 0; function GenNextID() public returns (uint) { return _counter++; } } I use Truffle and Ganache for local development. My test looks like the following. For some reason ctrInstance.GenNextID.call() does NOT mutate _counter and it always remains equal to 0. const Counter = […]

Categories
Cryptocurrency Development Ethereum

Metamask Signing gives different signature than web3.js

I have successfully been using metamask to sign EIP712 data. I am currently trying to write truffle tests and need to replicate the signing process outside the browser. The issue I am facing is that the signatures using EthUtil.ecsign and web3.eth.accounts.sign are not matching the one that is generated in the browser. Here is the […]

Categories
Cryptocurrency Development Ethereum

Calculated blockhash of PoA block mismatches with actual blockhash returned by RPC

I set up a Demo PoA chain using Parity Etheruem. I sent some transactions to it and it started producing blocks. A block on my demo PoA chain was generated with block hash 0x41055969db3b40fd07ef1374353c051f9f24f3aff806186b1e9d134f01d8467a. To verify, when I used block headers to calculate the block hash using the standard procedure, it resulted in a different […]