Author

Topic: merkle root (Read 456 times)

sr. member
Activity: 690
Merit: 269
January 14, 2016, 01:47:57 PM
#7
for example when you have one transaction in a block, the transaction id is used as a merkle root.

when two just hash them
// block 170

   var a = "b1fea52486ce0c62bb442b530a3f0132b826c74e473d1f2c220bfa78111c5082"
   var b = "f4184fc596403b9d638783cf57adfe4c75c605f6356fbc91338530e9831e9e16"
   var c = merkle(a,b)



sr. member
Activity: 690
Merit: 269
January 14, 2016, 01:23:00 PM
#6
so we have:

TX1 + TX2, TX3 + TX4, TX5 + TX5

Then the next round:
TX1TX2 + TX3TX4, TX5TX5 + TX5TX5

Then,
TX1TX2TX3TX4 + TX5TX5TX5TX5

and finally the root is,
TX1TX2TX3TX4TX5TX5TX5TX5

Is this how to do it?

Thanks,
Ryan


Small correction: when there are an odd number of elements in a level, the last one is hashed after appending it to itself. So usually hash6 of one level is H(hash12+hash13) of the level below, but it can be H(hash12+hash12) if hash12 is the last one.
legendary
Activity: 1946
Merit: 1100
Leading Crypto Sports Betting & Casino Platform
January 14, 2016, 12:29:23 PM
#5
Contact Spoetnik https://bitcointalksearch.org/user/spoetnik-138471

He has reversed a lot of PC games in the past and can help you with launching altcoins but the more important factor is how many Bitcoins you have to pump your coin before launching another altcoin. We DO NOT have enough altcoins and smart developers like you are what we need to embrace cryptocurrency as a means of battling endless printing of fiat.

What's the name of the coin? I recommend PowerballCoin. (You are welcome)
legendary
Activity: 1064
Merit: 1020
January 14, 2016, 12:26:38 PM
#4
A little confusing but yes.

You self hash with odd amount of leaves until you get an even amount, from there you are good Smiley

newbie
Activity: 7
Merit: 0
January 14, 2016, 12:21:07 PM
#3
so we have:

TX1 + TX2, TX3 + TX4, TX5 + TX5

Then the next round:
TX1TX2 + TX3TX4, TX5TX5 + TX5TX5

Then,
TX1TX2TX3TX4 + TX5TX5TX5TX5

and finally the root is,
TX1TX2TX3TX4TX5TX5TX5TX5

Is this how to do it?

Thanks,
Ryan
legendary
Activity: 1064
Merit: 1020
January 14, 2016, 12:07:23 PM
#2
You hash the 5th transaction with itself to get the parent.

So, TX1 hashes with TX2, TX3 hashes with TX4, TX5 hashes with TX5.

See here:  https://en.bitcoin.it/wiki/Protocol_documentation#Merkle_Trees
newbie
Activity: 7
Merit: 0
January 14, 2016, 11:14:58 AM
#1
I'm working on an altcoin. I'm trying to figure out the merkle tree/root.

Everything that I've read has 2^n or 2^n - 1 (if odd number of nodes) nodes on the bottom of the tree. Does this have to be the case? What am I supposed to do if I have 5 transactions in the block?

Thanks,
Ryan
Jump to: