Author

Topic: Transaction Hash (Read 3130 times)

legendary
Activity: 4326
Merit: 3041
Vile Vixen and Miss Bitcointalk 2021-2023
August 09, 2012, 10:14:26 PM
#10
Oh by the way, does satoshi dice use encrypted keys so that they won't have to wait for a block to be confirmed to make everything faster? After submitting a transaction, how much time does the block appear in the network on average?

satoshi dice and the double spending problem would be an interesting topic

Satoshi Dice uses a neat trick to accept transactions without waiting for confirmations while avoiding the risk of a double-spend. They simply include the output of the user's bet transaction as one of the inputs for the payout transaction. In other words, part of the payout consists of the exact same coins the user originally paid with. Since it is impossible to invalidate only part of a transaction, if the original bet transaction later turns out to be a double spend, or is invalid for any other reason, the entire payout transaction is also invalid.
legendary
Activity: 1600
Merit: 1014
August 09, 2012, 08:50:28 PM
#9
satoshi dice and the double spending problem would be an interesting topic
full member
Activity: 196
Merit: 100
August 09, 2012, 05:56:38 PM
#8
Oh by the way, does satoshi dice use encrypted keys so that they won't have to wait for a block to be confirmed to make everything faster? After submitting a transaction, how much time does the block appear in the network on average?
full member
Activity: 196
Merit: 100
August 09, 2012, 05:51:08 PM
#7
Thanks Tangible. You've been a great help. Smiley
sr. member
Activity: 476
Merit: 250
Tangible Cryptography LLC
August 09, 2012, 10:32:19 AM
#6
Yes the block hash.
http://blockchain.info/block-index/259311/00000000000003bb229c98bf628e57ce55104cda625c9b82b88dcc27a8901cd0

Right hand side "hash".    When a user creates a tx, wait for it to be hashed into a block.  You now have the block hash and transaction hash.  Block hash won't be unique for multiple tx in the same block (there is only 1 block hash) so likely you will want to combine both hashes  (xor,  SHA-256(transactionhash + blockhash), etc). 

In order to manipulate the output user would need to control the output of both the transaction and the block.  The transaction is trivial but the block would require massive amounts of computing power.  While a miner with enough hashing power "could" throw away valid block hashes which don't produce the output he wants (and wait for a block/tx combo which produces the output that "wins") block he/she wants that would be expensive as each block is worth 50 BTC.  Unless you prize is many magnitudes larger than the block reward it is unlikely that attack would be economical.

Satoshi Dice uses a slightly different system which doesn't require confirmation (they use a secret which is revealed later).  You may want to visit their site and see how they do it.   
full member
Activity: 196
Merit: 100
August 09, 2012, 10:13:30 AM
#5
A semi-random source of data is the block hash.

While it can be manipulated by the miner producing a block any change to the block will require looking for another block hash.  Since a solved block is worth ~$500 right now there is an economic disincentive for a miner to try and "game" the block hash.  Obviously you need to consider that risk vs the cost of an attack.  Using a block hash to protect a game where max prize is $2,000 is probably fine.  Using a block hash to determine the winner of the next power ball ($150 mil) is probably not a good idea. Smiley

Remember the higher order bytes of a block hash are not random (mostly zero to meet difficulty target) so you should use the low order ones.

I'm sorry I don't quite understand. Please elaborate. Let's say a user sends a coin to an address, is there some value that I can use either based on that transaction or on that transaction's block that the user can't predict in advance?
sr. member
Activity: 476
Merit: 250
Tangible Cryptography LLC
August 09, 2012, 10:03:19 AM
#4
A semi-random source of data is the block hash.

While it can be manipulated by the miner producing a block any change to the block will require looking for another block hash.  Since a solved block is worth ~$500 right now there is an economic disincentive for a miner to try and "game" the block hash.  Obviously you need to consider that risk vs the cost of an attack.  Using a block hash to protect a game where max prize is $2,000 is probably fine.  Using a block hash to determine the winner of the next power ball ($150 mil) is probably not a good idea. Smiley

Remember the higher order bytes of a block hash are not random (mostly zero to meet difficulty target) so you should use the low order ones.
full member
Activity: 196
Merit: 100
August 09, 2012, 09:52:28 AM
#3
Thanks for the reply. I understand it now. What I wanted to achieve is to get some random value through the transaction hash. I guess I can't get it like that since if it will be predictable, it won't be purely random anymore.

Is there a way to get some purely random data that a btc sender can't control the outcome through the transaction hash? For example if I create a gambling site that needs to roll a random dice, and the outcome will depend on the transaction hash, but I want it to be purely unpredictable but unchangeable and verifiable, can it be done?
legendary
Activity: 4326
Merit: 3041
Vile Vixen and Miss Bitcointalk 2021-2023
August 09, 2012, 03:31:44 AM
#2
It depends on what you mean by "predict". If you mean can he calculate the hash after creating the transaction, but before transmitting it to the network, then yes. If you mean can he somehow construct a transaction to have specific hash, for example, to create a transaction with the same hash as a previous transaction, then no. Hashes are essentially random and (unless the algorithm is completely broken) the only way to get a specific hash is by brute force (i.e. try all possible permutations of the data until you happen to find one with the hash you're looking for). Brute forcing hashes is "computationally infeasible", meaning that it would take a computer with 100% thermodynamic efficiency more energy than exists in the known universe to do so.
full member
Activity: 196
Merit: 100
August 08, 2012, 10:52:16 PM
#1
I'm new to bitcoin and web development. I want to know if someone plans to send bitcoins, will he be able to predict the transaction hash before the actual transaction?
Jump to: