Why the need for explicit conversion of Struct element if it is already stored with that type?

If we have the following struct and array: struct Family { bytes32 lastName; uint8 houseNo; uint16 age; } Family[] myFamily; And the following function: function getName(bytes32 name) public view returns (bytes32, uint8, uint16) { for(uint8 i = 0; i < myFamily.length; i++){ if(name == myFamily[i].lastName) { return (myFamily[i].lastName,uint8(myFamily[i].houseNo), myFamily[i].age); } } } Why the need…

Why does declaring returns type bytes memory give a compiler error?

If we have the following code: pragma solidity >= 0.5; contract stringsContract { function takesTwo(string memory str, uint idx) public pure returns (bytes memory) { bytes memory bytesStr = bytes(str); return bytesStr[idx]; } } Why do we get TypeError return argument bytes1 is not explicitly convertible to expected type (type of first return variable bytes…

Is it safe to do multiple payments in between locks (Reentrancy Guard)?

https://diligence.consensys.net/blog/2019/09/stop-using-soliditys-transfer-now/ provides a simple example related to Use a Reentrancy Guard. contract Guarded { … bool locked = false; function withdraw() external { require(!locked, “Reentrant call detected!”); locked = true; … // Multiple Payments locked = false; } } [Q] Is it safe to do mutliple different payments in between the locks? An example will…

Does a trusted blockchain import from BitcoinCore require that chainstate and blocks be from the same source?

Can the chainstate folder from a pruned node be used with the blocks folder from a full node to provide the full blockchain? Assume that both nodes have been running for months. If the blocks folder contains references to filenames in the chainstate folder, then the answer is no. I know this because the filenames…

Is there a ‘command’ to get the max supply of bitcoin that will ever exist using the bitcoin-cli?

I would like to know if there a way(‘command’) to know what is the max supply of bitcoin using my own node without trusting a third party. Also if anyone could explain to me why : bitcoin-cli gettxoutsetinfo returns this message when written: *error: Could not connect to the server 127.0.0.1:8332 (error code 0 -…

Why do transaction receipts not include the value of Ether transferred?

I’m writing some logic to identify the currency used in an ethereum transaction, and am wondering the following: web3.eth.getTransaction returns a value field that indicates the value transferred in Wei. However I’m using receipts, and web3.eth.getTransactionReceipt does not include the value transferred, which seems a little unintuitive. Why is this the case?