Questions tagged [merkle-tree]

Merkle tree is a tree in which every leaf node is labelled with the hash of a data block and every non-leaf node is labelled with the cryptographic hash of the labels of its child nodes. Hash trees allow efficient and secure verification of the contents of large data structures. Hash trees are a generalization of hash lists and hash chains.

73 questions
8
votes
1 answer

Fastest Hash algorithm in Java for Strings

To make it simple, my question is: how to hash a String (about 200 characters) as quickly as possible. Security is not important, but collisions ARE a big deal. Note: After a quick investigation, it seems like MurmurHash3 might be the best choice. I…
HLP
  • 2,142
  • 5
  • 19
  • 20
6
votes
1 answer

Merkle tree for difference comparison, in Cassandra

I'm reading an document about repair in Cassandra, it says The comparison begins with the top node of the Merkle tree. If no difference is detected, the process proceeds to the left child node and compares and then the right child node. However,…
snowmantw
  • 1,611
  • 1
  • 13
  • 25
5
votes
2 answers

How to get the roothash or a proof from a child trie in substrate?

According to the example here, I see one could use the srml_support::storage::child API to create a merkle sub trie out of arbitrary data. But how can we get the merkle root or a proof for a particular leaf using this? I see the API doesn't provide…
vim
  • 1,098
  • 9
  • 21
4
votes
2 answers

How to improve the speed of merkle root calculation?

My implementation in Python calculates the merkle root hash for ~1500 input hashes: import numpy as np from binascii import unhexlify, hexlify from hashlib import sha256 txids = np.loadtxt("txids.txt", dtype=str) def double_sha256(a, b): inp =…
Andy
  • 1,072
  • 2
  • 19
  • 33
3
votes
0 answers

How to use multiple leaves with one proof in merkletreejs & solidity?

I am trying to use merkletreejs in node to create a hexproof - using one it works fine but I also need it to be able to generate one proof for multiple leaves. My current js code: const { MerkleTree } = require('merkletreejs'); const keccak256 =…
730wavy
  • 944
  • 1
  • 19
  • 57
3
votes
2 answers

Merkle Proof in python using Keccak256

I'm trying to create a whitelist for an NFT using a Merkle tree to save on gas costs. I saw a great implementation here, in javascript, but I would like to do it in Python. Doesn't seem like I'm able to create a merkle tree using keccak hashing,…
frankied003
  • 466
  • 6
  • 26
3
votes
1 answer

How the get value function works in sparse merkle trees?

I have just started reading about sparse merkle trees and I came across a function(get value) which is used to find value for the specified key. I can't find an explanation on the internet which can explain how the get value function works. My…
Ashwani
  • 53
  • 1
  • 5
3
votes
2 answers

How to improve the speed of merkle root calculation in C++?

I am trying to optimise the merkle root calculation as much as possible. So far, I implemented it in Python which resulted in this question and the suggestion to rewrite it in C++. #include #include #include #include…
Andy
  • 1,072
  • 2
  • 19
  • 33
3
votes
0 answers

Is there a hash tree designed for complex data structures?

I have a JSON object with private data. It has the following (complex!) structure: { name: "JB", age: 35, children: [ { name: "Alice", age: "5", favColor: "pink" }, { …
nervous-energy
  • 367
  • 6
  • 10
3
votes
1 answer

I'm trying to implement a merkle tree consistency proof, but I'm stuck at understanding the algorithm

I'm trying to implement a merkle tree consistency algorithm with this paper: https://books.google.de/books?id=CokSDQAAQBAJ&lpg=PA147&dq=merkle%20consistency%20proof&hl=de&pg=PA148#v=onepage&q&f=false However, I am kinda stuck on the consistency…
Sossenbinder
  • 4,852
  • 5
  • 35
  • 78
2
votes
2 answers

How to know if hash is part of merkle root?

There is an arbitrary hash and a merkle root. Actually the question itself is how to find out if the desired hash is part of the merkle root? Without looking up the tree, exactly was our hash previously included in the merkle root or not? Is there a…
manu
  • 21
  • 3
2
votes
4 answers

keccak.js Uncaught ReferenceError: Buffer is not defined

I have a little script in ReactJS : import './App.css'; import { useState, useEffect } from 'react'; //Import de la librairie ethers (comme web3.js) import { ethers } from 'ethers'; const { MerkleTree } = require('merkletreejs') const keccak256 =…
Ben BK
  • 154
  • 2
  • 11
2
votes
1 answer

How can I convert/transform a JSON tree structure to a merkle tree

I'm running a web server, where I receive data in JSON format and planning to store it in a NoSQL database. Here is an example: data_example = { "key1": "val1", "key2": [1, 2, 3], "key3": { "subkey1": "subval1", . …
basilisk
  • 1,156
  • 1
  • 14
  • 34
2
votes
1 answer

A simple merkle-tree implementation in java

I am attempting to write a very simple merkle-tree implementation in Java. I am using the values of the txids in block 170 on the bitcoin blockchain for reference, so I can see what the correct result should be. The txids corresponding with that…
apt-getschwifty
  • 199
  • 2
  • 12
2
votes
1 answer

How can merkle trees help validate the content of a block in a blockchain

To my understanding the merkle-tree can be used to separate the actual transactions (or other content) of a block and its validation process, by recursively applying hash functions to the blocks content. This makes it possible to implement…
User12547645
  • 6,955
  • 3
  • 38
  • 69
1
2 3 4 5