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.
256
questions
2
votes
1
answer
71
views
How are Ethereum 2 block hashes computed?
After the merge, the block hash computation has a different formula. Before that, the following data were used to compute the hash via feeding the list of hex values to an RLP encoder and hashing the ...
0
votes
0
answers
9
views
What's difference between filter for hashes and filter for full transactions?
I'am trying to understand the main difference between a filter for hashes and a filter for full transactions. Can anyone explain me this please?
0
votes
1
answer
42
views
To what extent was the block hash malleable under proof-of-work?
To emphasise, I’m solely interested in blocks prior to the transition to PoS.
Given that a miner making any change to the block header would have resulted in a completely different hash, my thinking ...
2
votes
1
answer
26
views
Generating a NFT token
Let's say we are generating an NFT token for a picture. How is the token generated? Is it just the hash value (say SHA256) of the picture? Is it possible to find a collision? If so, how is the ...
1
vote
1
answer
418
views
How to Resolve "ambiguous primary types or unused types" Error with _TypedDataEncoder.hash?
I am trying to compute the hash to be signed for EIP-712 typed data using the ethers.js(v5.7.2) library in TypeScript. I'm using _TypedDataEncoder.hash() to hash the typed data, but I am encountering ...
0
votes
1
answer
97
views
How to rebuild ethereum block hash using Solidity/JavaScript [duplicate]
Can someone point me to a good resource to see how a BLOCK HASH is being built by hashing the BLOCK HEADER fields (which fields and how to process/encode them - keccak/rlp)?
My main goal is to get the ...
1
vote
0
answers
11
views
How to manually hash blocks and transactions to get a better feel for the Ethereum protocol?
Is there a way to easily get a transaction, the full transaction payload, and then hash it with keccak256 using a hash tool, to get a better feel for how the protocol works?
Ditto for full blocks.
I ...
0
votes
0
answers
9
views
How to create provance hash for NFTs
i am working on the NFT project where i need to implement the provance hash. but i am unable sure from where is should start. like it is doen through smart contracts are from JS Libraries or node js ...
0
votes
1
answer
151
views
How to calculate a pair address given token addresses
How do you combine two token addresses to form a pair address?
I would imagine this is purely mathematical and doesn't require a call to web3. I want to know how to do it without calling the internet....
0
votes
1
answer
209
views
"invalid signature length" when trying to verify signature
I'm using the entire source code to sign and verify messages from https://solidity-by-example.org/signature/ on Remix. But when I go through the process of running the functions getMessageHash, ...
0
votes
0
answers
9
views
Verify computation result on chain
I would like to know if there is a way to verify the correctness of an input (a number) on-chain.
This is my current design: The deposit function on contractA takes an input called computeResult. ...
2
votes
0
answers
37
views
Calculating difficulty and target with 256 bits
Why do the yellow paper and Ethereum implementations use 2**256 instead of 2**256 - 1 when calculating hash target from difficulty?
The Ethereum Yellow Paper uses 2**256 / difficulty to define the ...
0
votes
0
answers
21
views
Bad blockNumber and blockhash - Ethereum PoA private network
I was trying to develop a simple smart contract to be deployed in my private eth network...
The deployment works, transactions can be made to the contract, but there is a weird behaviour I am failing ...
0
votes
1
answer
72
views
How to get the subgraph hash once compiled and deployed?
I have a graph-node running in a EC2 instance. The subgraph has been compiled, created and deployed already and it is running with no issues.
I want to query its status by running the following ...
6
votes
4
answers
775
views
Verifying signed messages on chain
I have the following message, domain and types:
const domain = {
// Defining the chain aka Goerli testnet or Ethereum Main Net
chainId: NETWORK_ID,
// User friendly name to the ...
2
votes
0
answers
40
views
Hash metamask message
I have the following metamask message (type v4):
const message = {
domain: domain,
// Defining the message signing data content.
message: {
Commit: {
...
0
votes
1
answer
86
views
Does a TX hash get produced *before* it's been confirmed in 1 block?
I has code which sends ETH and ERC-20 and of which I want to make sense:
let tx1 = await transferETH(amount, privateKey);
console.log(`${tx1.hash}`);
const receipt1 = await tx1.wait();
console.log(`...
0
votes
1
answer
23
views
Hash an array of variables and reverse hash them off chain
I'm trying to accomplish a task but I'm not sure how to approach the problem. I want to hash some variables inside a byte32 array. For example:
["Hashley", 32, "Random string"] -&...
3
votes
1
answer
234
views
calldata ambiguity - likelihood of hash collision
To call a function in a smart contract, a transaction (or a message call depending on where it originates from) is sent to the contract address with a data field that has the encoded function ...
0
votes
1
answer
283
views
How to generate the correct hash for signatures?
I want to create a hash in JavaScript for a signature.
The hash needs to have the same output as this in solidity:
keccak256(abi.encodePacked(address, bytes32))
My solution in JavaScript so far ...
1
vote
1
answer
68
views
"Reverse ENS lookup" using php-keccak
I am using kornrunner/php-keccak and I am attempting to do a "reverse lookup" on an ENS name, essentially the same as this question which was never answered. Any thoughts?
Here's my attempt ...
0
votes
1
answer
34
views
Is there a way to change the block hashing method of private Etherem?
As all we know, Ethereum hashes blocks by Keccak-256 and this method used in private Ethereum too. Now, if we need to use Keccak-512 for hashing blocks in a PoA private Ethereum (For our project), ...
1
vote
1
answer
161
views
Why blockhash returns zero always? [duplicate]
I have a problem with understanding. I created a utility function, safeMath() , which I run first to create the block. Next, I get the block number, which is usually in the range from 10 to 14. And ...
0
votes
1
answer
75
views
How is calculated the "lowest hash value" in Proof-of-stake random block selection?
https://www.geeksforgeeks.org/proof-of-stake-pos-in-blockchain/
Dont know how you can get the "lowest hash value". Hash value in PoW I can understand, is it related? How does it work in PoS?
0
votes
1
answer
148
views
How do I predict my transaction hash before putting through a transaction?
I'm trying to figure out how to get the transaction hash for some transactions. I don't have the hashes in my data; all I have is approximate time (to the minute), size, and token. I think I can get ...
0
votes
2
answers
1k
views
Ethers: Get transaction hash without sending transaction
My transaction fails, so it doesn't give me a hash that I would be able to use to debug it when I call ethers.wallet.sendTransaction(tx). The tx object has 4 fields: from, to, data, value. If I do
...
1
vote
0
answers
55
views
Computing a 512 bit hash
Ethers.js has this 512 bit hash function ethers.utils.sha512, but as far as I can tell there is no OPCODE or precompiled contract for doing this. There seems to be some implementations in solidity ...
1
vote
0
answers
22
views
Explorers have not mixhash [closed]
Why do ethereums explorer (like blockchain.com or etherscan.io) , have not mixhash in block information? Only Nonce. And why nonce in block explorer on blockchain.com is always 0?
2
votes
1
answer
45
views
What information can I get from a hash?
Say i have a hash - I think sha256/keccak:
90ad6dec4ce7167e92c7a7122232d48a1fd5e6c5e81cb3f45c147424b6728437
What do i do with it?
Is there something on etherscan that can decipher it or show what it ...
2
votes
1
answer
76
views
Question about the namehash algorithm in EIP-137
I am trying to recreate the namehash algorithm from EIP-137.
After spending a lot of time trying to create my own algorithm, I tried to find a working python3 package online and couldn't find any.
I ...
3
votes
2
answers
401
views
if I put a message's sha256() hash on smart contract, can anyone recoverd the message?
If no one can recover the message, can I use this message as a "password" to some functions in the smart contract? like:
contract Test {
bytes32 hash;
constructor(bytes32 _hash) {
...
0
votes
1
answer
221
views
How to decode and update input data of a specific transaction?
So, I've decoded the input-data and fetched it via block-hash, Now what I want to do is that, I want to update the input data and post that updated input data back to the same transaction of the same ...
1
vote
0
answers
21
views
How is the the net probability mentioned in EIP-55 calculated?
In EIP-55, it says:
the net probability that a randomly generated address if mistyped will accidentally pass a check is 0.0247%
I am curious about how this probability is calculated and tried to ...
0
votes
1
answer
190
views
Sha256 Hash from Solidity Smart Contract doesn't match web3.js Hash
I'm struggling to match two hashes. I hash a Json in String format in my Smart Contract like this.
function verifyProof(string calldata _fullProof) public returns(bool r){
bytes32 hashed = ...
0
votes
1
answer
139
views
Signature from array of tokenId's isn't verifying
The domain message is:
struct Offer{
address from;
address to;
uint256 nonce;
uint256[] tokenIds;
uint256 duration;
}
bytes32 constant ...
0
votes
1
answer
71
views
How are we able to verify signatures using the public key?
I get that:
private key --ECDSA--> public key
private key + message --ECDSA-->signature
But then how do we verify the signature with the public key?
Wouldn't we have to reverse-ECDSA the public ...
0
votes
1
answer
190
views
How to determine if the hash is finalized?
For some reason, I am require to store the hash to database. I would like to know is there any criteria to determine that the hash is finalize?
For example,
Block #15000000 have hash value of
...
0
votes
1
answer
864
views
What is the difference between "hash" and "block hash" as is demonstrated in the data?
In the following data, there are two kinds of hashes. One is a "hash" variable and the other is a "block hash". While I sense that the latter should be the block header hash, I do ...
1
vote
1
answer
522
views
Solidity Keccak256 raw data vs abi encoded data
I am new to solidity. I am trying to store some hash of the data to the blockchain. I saw some online tutorial used keccak256(abi.encodePacked( <data input> )) to calculate the hash. I am ...
1
vote
1
answer
205
views
In Polygon transaction ID of Sync-State transactions does not match Keccak-256(RLP(nonce,gasPrice,gasLimit,to,value,data,v,r,s)
Polygon has special “Sync-State” transactions added to the blocks https://polygonscan.com/address/0x0000000000000000000000000000000000000000 .
Transaction hash returned by eth_getBlockByNumber does ...
0
votes
1
answer
60
views
How much ether was transferred in this transaction?
Is there any way to determine how much ether was transferred in the following transaction?
If so, how much was it?
Transaction of interest
{
"hash": "...
0
votes
1
answer
34
views
when i call my function metamask telling "this operation is expected to fail"
Hi guys im trying to create question challenge dapp and i have a checkAnswer() function can accessable from frontend.
My question struct:
struct Question{
string qDesc;
uint qPrize;...
1
vote
1
answer
728
views
How to hash an address?
I just want to hash the senders' address
function myHash() public returns(string memory){
return(keccak256(abi.encodePacked(msg.sender)));
}
but no matter what I do I get the ...
1
vote
1
answer
52
views
Hash two addresses in vyper
I'm trying to write a function in vyper that takes two addresses and returns a 256-bit hash (either keccak256 or sha256).
Afaik the builtin hash functions only take Bytes, bytes32 and Strings as ...
0
votes
0
answers
128
views
how to calculate root hash in MPT?
I already know how to build an MPT, but don't know how to compute root hash, especially how to deal with the leaf nodes.
I would be grateful for specific examples.
11
votes
2
answers
12k
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 ...
0
votes
2
answers
2k
views
What exactly is the output of a keccak256() function?
I've been looking through articles and youtube videos and I still don't get it.
I'm trying to get to a place where I can explain it to myself in simple terms (I'm still pretty new to coding).
What I ...
1
vote
1
answer
151
views
Can you get a duplicate hash with params that are NOT a string or array, using keccak256(abi.encodePacked(a, b))?
It's relatively common to confirm a msg.sender is pre-approved for some contract interaction by verifying a signed hash of their address and another parameter. For instance:
bytes32 checkHsh = ...
1
vote
1
answer
361
views
Provable way to whitelist a contract before it is deployed?
I would like to prove that a contract, that is going to be deployed, matches specific code and potentially with a specific state too.
For example, Bob say's he is going to deploy a contract that looks ...
1
vote
0
answers
165
views
Patricia Merkle trie and LevelDB in each block
I have a few questions regarding Ethereum's modified Patricia Merkle trie and LevelDB.
Does each block only contain the root hash of all the tries (World State, transaction, and receipt) or the ...