Questions tagged [hash]

A hash function is an algorithm that transfers data input of any size into a fixed size data which acts as a kind of "signature" for the data provided.

Filter by
Sorted by
Tagged with
31 votes
2 answers
7k views

Why are there no leading zeroes in ethereum block hash?

The block hash has to be below certain difficulty, right? In bitcoin this means, that there are many leading zeroes in hash value, eg. for bitcoin block #402329 hash is ...
Matias's user avatar
  • 1,109
8 votes
2 answers
3k views

Does a mining reward transaction have a hash?

I can't find a mining reward transaction hash for a given block. I can see the block hash, all the transactions inside the block, etc. But the mining reward transaction is not listed among the details....
q9f's user avatar
  • 32.9k
8 votes
2 answers
3k views

block-header hash verification

As part of a validation service I am working on, I need to be able to verify that the blockHeader hash was created correctly. Based on my understanding following are the steps to regenerate the header ...
AnuragP's user avatar
  • 431
3 votes
1 answer
2k views

Dangling hash node ref: too many open files

I'm running two supernodes with the geth client. At peak times they have 500-800 connections and handle around 16GB traffic per hour. This is how I run the node: geth --networkid "1" --identity "...
q9f's user avatar
  • 32.9k
6 votes
4 answers
3k views

keccak3 in SOLIDITY and in WEB3 different hashes for an address type field

How can I get the same resulting hash from Keccak-256 ()in solidity and web3.sha3() in web3? IN solidity using keccak256( address ) and using web3.sha3 ( address ) gives different results. In web3 ...
Dino Anastos's user avatar
6 votes
1 answer
2k views

Distribution of KECCAK-256 hash values

Are values hashed using KECCAK - 256 uniformly distributed? If I use a KECCAK - 256 hash and then convert it to a number in a range 0 - N using the modulo operation, would the probability of obtaining ...
mankee's user avatar
  • 263
2 votes
2 answers
5k views

Encrypt data using public key

I have three data fields in a form which will return a string. I would like to hash the value of these three strings and store it in the blockchain. However the data in these three strings is ...
David021's user avatar
15 votes
1 answer
34k views

What is a block hash?

When we look at this block - what does the first number Hash: 0xfe88c94d860f01a17f961bf4bdfb6e0c6cd10d3fda5cc861e805ca1240c58553 actually mean? How is it calculated? "Nonce" is the value that is ...
Matias's user avatar
  • 1,109
12 votes
2 answers
7k views

What datatype should I use for an IPFS address hash?

Here is an IPFS hash: QmTfCejgo2wTwqnDJs8Lu1pCNeCrCDuE4GAwkna93zdd7d. According to IPFS docs, they are base58 encoded, and I assume the Qm is metadata (because they all share this). What is the most ...
ZMitton's user avatar
  • 2,750
8 votes
2 answers
6k views

Solidity's keccak256 hash doesn't match WEB3 keccak hash

TL;DR: I have a method in a contract to calculate a keccak256 hash, and I'm trying to replicate it in Web3, but the hashes don't match. My problem is very similar to the one in this question, but the ...
Justcurious's user avatar
3 votes
1 answer
7k views

How are transaction hashes generated

I am trying to find out if each transaction hash created by a wallet has some similarity or if every hash is "random". I suppose my original question leads into whether or not a transaction hash be ...
Mbando's user avatar
  • 117
2 votes
1 answer
1k views

Is it possible to verify a given `block hash` is valid in a contract?

Inside my contract, I want to verify a given block hash is valid or not. block_hash_validation(string blockhash) returns (bool){ ...//check() return true; || return false; } Q1: If yes, from ...
alper's user avatar
  • 8,395
1 vote
2 answers
3k views

Chain Reorganization (TX HASH Change)

I would like to know is it possible that hash of transaction will change during chain reorganization? I noticed that difference is only between block number and block hash. Also, polling geth with ...
Coder's user avatar
  • 43
32 votes
2 answers
24k views

Difference between keccak256 and sha3

I have been reviewing keccak256 implementation and sha3-256 that follows the FIPS standard. The sponge function is taking a while to set in, but I have noticed a difference in implementation : I ...
user2163865's user avatar
11 votes
2 answers
14k views

How to use ethers keccak256?

I tried to use ethers' keccak256 function like this: import { keccak256 } from "@ethersproject/keccak256"; const signature = keccak256("balanceOf(address)"); But the script ...
Paul Razvan Berg's user avatar
11 votes
2 answers
10k views

trying to use web3-utils but not working

Trying to use web3-utils. I installed the package via NPM , however, I am getting the error that sha3 is undefined.. TypeError: Cannot read property 'sha3' of undefined at C:\block2\deliver.js:...
Dino Anastos's user avatar
6 votes
2 answers
2k views

How to check provided string is a valid IPFS or IPNS path?

I want to check provided string is a valid IPFS or IPNS path or not under ipfs domain. For example when I do: ipfs ls <invalid-hash> //waits keep searching ... This will not return anything ...
alper's user avatar
  • 8,395
5 votes
1 answer
10k views

SOLIDITY: How to get a bytes32 keccak256 hash of an address and 2 uint256 variables

I would like to know how to get a bytes32 keccak256 hash of an address and 2 uint256 variables. I want something that will look like this. But from the remix IDE errors, I need to make the the 3 ...
BlockchainBoy's user avatar
4 votes
2 answers
3k views

Gas cost of a sha256 hash

I'm confused about the cost of the sha256 function, because my understanding of the cost from the yellow paper ( https://ethereum.github.io/yellowpaper/paper.pdf (Appendix E. Precompiled Contracts) ) ...
Michael Connor's user avatar
4 votes
3 answers
2k views

Can we use block hash as verifiable randomness for the off-chain lottery?

My team is writing a discord lottery bot, we want to use the block hash of some block in the future as a seed for the random generator. We want to allow lottery participants to independently verify ...
Artem Bernatskyi's user avatar
4 votes
3 answers
808 views

How to prevent front-running the salt when using CREATE2?

I was looking at Optionality's clone-factory, which is based off EIP-1167, and wondering whether it can be ported to use CREATE2. One concern is that a third-party could, in theory, "front-run&...
Paul Razvan Berg's user avatar
3 votes
1 answer
858 views

Is it possible to have a mapping with a hash as key?

Is it possible to have a mapping in Solidity with a hash as key? For example: mapping (hash => uint) hashToInt; If not, is there any way to group some information and put it as a key of a ...
arodriguezdonaire's user avatar
3 votes
1 answer
360 views

Why in some contracts I see: If (condition_1 & 0xfffffffffffffff...)?

I'm looking at the code of some smart contracts and I've seen somewhere where the code is something like: if (msg.sender == storage[0x00] & 0xffffffffffffffffffffffffffffffffffffffff) From my ...
Hiperfly's user avatar
  • 459
3 votes
2 answers
332 views

How to produce a hash from a very long seed on ether.camp?

If the seed on ether.camp is more than 64 chars then I get: [Error] Error: Invalid hex string hexWrite (eth-utils.js:17402) write (eth-utils.js:17477) fromString (eth-utils.js:17010) Buffer (eth-...
neuron2000's user avatar
1 vote
2 answers
861 views

What's the header hash displayed in the miner?

Is the "hash" value reported by geth: eth.getBlock("849245").hash, for example, the same "hash" that is given to the miner in the work package? Sorry if this is a naive query. The reason for the ...
rethsid's user avatar
  • 1,898
1 vote
1 answer
2k views

messageHash hash function

In this example, by which algorithm is messageHash hashed by? web3.eth.accounts.sign("Hello, world!", '0x0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef') { message: 'Hello, world!', ...
O. Shekriladze's user avatar
1 vote
1 answer
151 views

System for paid retrieval of (secret) information possible?

I've been thinking about designing a system, where every student's grades are stored on the blockchain in encrypted form. However, I've read enough posts describing why this is not a good idea: ...
Shuzheng's user avatar
  • 1,855
1 vote
1 answer
358 views

How to know if a transaction gets dropped and txhash becomes irrelevant before its mined

I am using a web3 sendTransaction function to send coins, and then storing the transactionHash in my databse await web3SendInstance.eth.sendTransaction({to:receiveAddress, from:web3.eth.defaultAccount,...
Barney Chambers's user avatar
1 vote
1 answer
151 views

Where to find the documents matching the dao proposals hash?

In each proposals of the DAO there is a hash that I guess is here for us to check the proposal document matches the submission. But where to find these documents? Any official link where links to each ...
Nicolas Massart's user avatar
1 vote
1 answer
884 views

Blockhash: Register the block number

I am reading the following article from a website: bad randomness In the context of Blockhash the author says: For instance, a good protocol (formulating a random trial as a “bet”) is the following: ...
zak100's user avatar
  • 1,406
0 votes
1 answer
4k views

Block header hash calculation [duplicate]

What inputs go into the RLP and Keccak function to calculate the block header hash? I looked up the header struct. Which of those values are fed into the RLP, Keccak? Were nonce and mixed hash left ...
abhinash's user avatar
0 votes
2 answers
494 views

Why aren't block hashes a reliable source of randomness?

I just saw this answer that informed me that block hashes were not a reliable source of randomness. In what situation are block hashes not a reliable way to obtain randomness?
Cedric Martens's user avatar
0 votes
1 answer
554 views

Blockhash Minus-256 Problem [duplicate]

What is meant by Blockhash Minus-256 Problem? I am reading an article at: Bad Randomness It talks about Blockhash Minus-256 problem but does not explain much about it. As a result I can’t ...
zak100's user avatar
  • 1,406
0 votes
1 answer
4k views

Hardhat local network keys generation

I noticed the generation of Hardhat local Etheruem network keys are found on the Mainnet. Example: After running npx hardhat node. Accounts ======== Account #0: ...
penguin's user avatar
  • 133