Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

0
votes
1answer
17 views

i want to get data from the transaction hash i tried many codes at last i am getting boxes in the output

1) First, I got the input console.log(web3.eth.getTransaction('0x725fc75264726f409793164e336e7d5ed35df8d2be469a0cc1a3a8cc4756b9b9').then((i) => console.log(i) )); 2) I manually pasted the input ...
0
votes
1answer
19 views

Match web3py hashing function to solidity hashing function

If I am using web3py to hash some data, like so, msgHash = w3.soliditySha3(['bytes32','bytes32'], [dataBytes, saltBytes]); What would be the correct way to hash inside of a Solidity contract and ...
1
vote
1answer
27 views

For Recipient how do I store Sender's account address and Password of Recipient's own account in hashed from?

How to check following things using Solidity: Password matching (hash formed) if password matches then transfer take place
0
votes
0answers
34 views

Can I use an address value in such a hash function

I have a method which updates 3 mappings in my contract. To save data I use some items properties and message sender address, which allows easily to get users data. mapping(bytes32 => uint256) ...
2
votes
1answer
38 views

How do I use SoliditySha3 in Nethereum?

According to this, web3 should contain the function soliditySha3. It can take an object (JSON), serialize it, and use the result as input to Keccak256. According to the documentation, the arguments ...
1
vote
1answer
30 views

Hash functions soldity to python

In Solidity, I run the following code: function hashTest() public returns(bytes32,bytes32,bytes32) { bytes32 _solution = 0xbc756c25d68ea2f260ea5f15e1e1c734c019cbc014270dd386eacca4699f60f6; bytes32 v ...
1
vote
1answer
20 views

How will Proof of Stake affect blockhash generation

When (and if) Ethereum switches to proof of stake, how will the hash of blocks (most likely) be set?
1
vote
0answers
31 views

Does web3 soliditySha3 work with json object?

The above hash data is generated by web3 soliditySha3 with the objects below. It seems the function generates hashes as I wanted; each object has different hash value. But I am not sure if it's ...
0
votes
0answers
11 views

compare signed and unsigned hash [duplicate]

with ecrecover the signer's address can be extracted from a signed hash: ecrecover(signedHash, v, r, s) == address But I could not discover how to validate the hash. function validateHash(...
2
votes
0answers
39 views

Can we use Ethereum Swarm to store normal data other than blockchain or dapp data.

I want some basic data to be stored like name and city phone no etc.So just want to ask can I use ethereum swarm just to store file and make several node to create decentralized storage.
0
votes
2answers
62 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 ...
1
vote
1answer
48 views

get same output as solidity SHA256 in JS

Is there a js function/library which gives same output as sha256 in solidity? I am saving a hash in a mapping and can access it via cli (truffle console) and see what the hash is but I would like to ...
0
votes
1answer
41 views

Is data inputted as a parameter for a smart contract function visible?

Let's say I have something like this: bytes32 person; function registerPerson(address _person) public { bytes32 x; x = sha256(abi.encodePacked(_person)); person = x; } For privacy reasons, ...
1
vote
1answer
32 views

Hashing header “offline” python

I am trying to prove that the TransactionsRoot and the ReceiptsRoot do belong to a specific block. So that I can verify without web3 that all the transactions and receipts actually belong to this ...
1
vote
1answer
24 views

How to get two points (x, y) from an encoded pubkey?

this gives a valid address from two points; address(uint256(keccak256(abi.encodePacked(point[0], point[1]))) & 0x00FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF); but does that mean that if you are ...
1
vote
1answer
111 views

Creating hash of a struct in Solidity and JavaScript

I have created a message hash in JavaScript using: let message = { 'message': 'Receiver closing signature', 'sender': sender, 'balance': value }; message = web3.utils.toHex(...
0
votes
1answer
20 views

Creating an Ethereum id Hash

I'm trying to understand how to convert my transaction data into the id hash before signing the transaction. Let's say I have this data: transaction = { 'to': to_address, 'from': ...
0
votes
1answer
24 views

Checksum vs. Hash: Differences and Similarities ? [closed]

What are similarities and differences between a "checksum" algorithm and a "hash" function? Can they be used instead of each other? Or their usage are different? For example, for verifying the ...
0
votes
2answers
29 views

retrieving an original data from a hash: is it reliable?

Normally, one of the purposes of hashing a string (such as a transaction) is summarizing the data to save the size because of the space limitation. If this proposition is true, now assume we need to ...
0
votes
1answer
59 views

messageHash hash function

In this example, by which algorithm is messageHash hashed by? web3.eth.accounts.sign("Hello, world!", '0x0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef') { message: 'Hello, world!', ...
4
votes
2answers
130 views

How is the keccak256(a, b) function implemented?

I need to understand how keccak256(a, b) is implemented and how it differs from keccak256(a || b). Is the content padded? I need this because I do not want to allow for vulnerabilities where a user ...
2
votes
1answer
45 views

How does knowing the root hash of a past world state help me to revert to this world state?

In section 4.1 of the Ethereum yellow-paper (http://gavwood.com/Paper.pdf) the following is written: The world state (state), is a mapping between addresses (160-bit identifiers) and account ...
1
vote
2answers
44 views

Common use cases for hashing functions? [closed]

I'm developing my first dapp with solidity and I was wondering in which cases should I use hashing functions like keccak. I know how they work but it is not clear to me when should I use them and to ...
8
votes
1answer
925 views

Why are Ethereum addresses hashes of public keys?

I understand how Ethereum addresses are generated. This thread has a great explanation: How are ethereum addresses generated? However, what this explanation is missing is why a hash is used. There ...
1
vote
0answers
38 views

are all bits of a keccak256 'uniformly distributed'? [closed]

If I have a truly random data source, and generate keccak256 hashes of the numbers of this source: N1 = keccak256(rnd1) N2 = keccak256(rnd2) N3 = keccak256(rnd3) ... are all 256 bits of the ...
1
vote
2answers
42 views

Is data stored in string form in smart contracts publicly readable?

As a beginner, I wrote the contract below for learning purposes, aiming to create a "Safe Messaging System": pragma solidity ^0.4.24; contract SafeMessage { string message; string password; string ...
0
votes
0answers
28 views

hash an array of structs

So what I am trying to do is create a keccak256 of an array of structs. pragma solidity ^0.4.24; pragma experimental ABIEncoderV2; contract Test { struct test1 { address test; ...
0
votes
1answer
22 views

Hash of address pair combination where order is irrelevant

I have a contract where I often set stuff for a combination of 2 addresses. Because the parameters addressA and addressB are interchangeable I currently save the information redundantly. Example: ...
0
votes
1answer
105 views

Keccak256 collision in function’s prototype

I was reading the github version of the upcoming book Mastering Ethereum, where the author defines the function selector as The first 4 bytes of the Keccak256 hash of the function’s prototype. This ...
0
votes
1answer
196 views

sha256() output

I used sha256() hash of a string and I got the following result 0x0de69f56365c10550d05e65ae8229dd0686f7894a807830daec8caa879731f4d for string Hello World2. Now I want to find out leading byte from the ...
0
votes
0answers
55 views

uncle block' hash

I want to know if the Uncle Hash hashes the entire block or just the Uncle block header. Also I want to know Structure of Ethereum's Uncle List,too.I would appreciate it if you let me know.
3
votes
1answer
817 views

Convert hash function hex to bytes32

The output of hash function SHA256 is a hex string of size 64. For example: 3ed54831f488a22b28398de0c567a3b064b937f54f81739ae9bd545967f3abab I want to call the function of a smart contract with the ...
-2
votes
1answer
181 views

Why does keccak256() return bytes32 instead of uint256 in Solidity?

A hashing function outputs an integer that is 256 bits long... so why not store it as such?
1
vote
0answers
31 views

Can one safely use a bitcoin block hash as a source of randomness in an ethereum contract?

This question here Why aren't block hashes a reliable source of randomness? explains why it is not a good idea to use an ethereum block hash as a source of randomness (SoR) for a contract C; the ...
0
votes
0answers
33 views

What hash algorithm makes the transaction anonymous ?

What hash algorithm makes the transaction anonymous ? Tried to google it and didn't find anything
1
vote
1answer
45 views

Is it possible to have a signature as the mapping key type?

If I have someone's signature and I want to use it in a mapping, is there a way to have it serve as the key in that mapping? Would I need to use mapping (string => uint), or mapping (bytes32 => ...
0
votes
1answer
211 views

Compare byte32 Keccak256 to the same Keccak256 stored in a byte32 array

I want my function to be able to accept an array of Hashed secrets as a parameter and since solidity doesn't allow for strings, I had to use a byte32[]. The string parameter is an intake for the user'...
0
votes
1answer
141 views

Transaction Signing & Hashing

I've been looking through EthereumJ, Trying to understand how transaction hashing and signing works. From what I can tell from the code, the signature is created by signing the hash of the RLP ...
0
votes
0answers
101 views

What's the Parent Hash in Uncle of Ethereum?

What's the Parent Hash in Uncle of Ethereum? Why I cannot locate the Parent Hash of an uncle block in Etherscan?
0
votes
0answers
38 views

How to get Transaction hash in a smart contract? [duplicate]

I am invoking contracts from node. I need to get the transaction hashes because the users want to confirm the txns really took place so they can actually check the blocks. Is there a way from within ...
3
votes
1answer
928 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 ...
2
votes
1answer
89 views

bytes32 same length hex strings cost different gas why?

I can not understand the difference in gas for the following problem. I generated a sha256 hash value and the output i chose to be lowercase hexadecimal. So the output value is hexadecimal string of ...
5
votes
1answer
409 views

Compare structs and arrays with keccak256 in order to save gas

Just working on a solidity code last day, I figured out that apart of comparing bytes, strings etc... The Keccak256 will be the perfect solution for comparing large arrays or big structs. Because as ...
1
vote
0answers
180 views

Hashing a struct

I'd like to digest a data structure (a struct) with keccak256, but solc (0.4.23) tells me "Error: This type cannot be encoded." Is there a good reason why can't solidity encode the struct? That looks ...
2
votes
3answers
899 views

How to recover public from tx signature(r,s) and verify signature?

My first question is how to verify signature using only r,s and elliptic curve paramete, and an address (which is hashed of public key, so cannot retrieve public key from the address)? Next question ...
2
votes
2answers
576 views

How to decode txn_hash from contract function call via Python web3.py, w3.eth.sendRawTransaction

Hi I am running Python web3.py(Not web3.js) to run this: txn = ctrtInstance.functions.setzString(zString).buildTransaction() print('\ntxn: '+ str(txn)) txn['nonce'] = 3643 txn['chainId'] = 3 ...
0
votes
1answer
22 views

Whats the difference between hash generated and hash generated after mine

I am seeing this portal https://anders.com/blockchain/block.html When i type some data hash changes and when i click on mine button, hash changes again. I guess hash after mine is final one. Whats ...
0
votes
0answers
35 views

What to do if I sent a coin to the wrong address?

I was hoping someone could help please? I have a metamask and I sent some Matrix Ai to the wallet from my Mist wallet- however I just checked and I forgot to add the Matrix Ai token address and my ...
1
vote
2answers
181 views

Executing contract function from another contract using it's hash

I am playing arround with smart contracts. I have 2 contracts: target and executer (don't mind the name, it's just testing stuff). target has just a simple function to change a string: contract ...
0
votes
0answers
27 views

transaction confirmation problem

I sent several times some transactions via a consortium established on ethereum (https://energyweb.org/), but none of are mined or confirmed (it is cheched from here : https://tobalaba.etherscan.com/)....