Timeline for Help looping over two digit chunks from uint
Current License: CC BY-SA 3.0
10 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jan 18, 2018 at 21:30 | history | edited | jhkuperus | CC BY-SA 3.0 |
added 840 characters in body
|
Jan 18, 2018 at 21:22 | comment | added | jhkuperus | Well, that actually depends on the number you have. Each right shift basically divides the number by two. So at some point, you will reach 0. If you want to guard the operation, you could check to see if the number is < 100. If it is, you may no longer be able to reliably get 2-digit numbers from it after shifting. | |
Jan 17, 2018 at 20:44 | comment | added | blackops | Is there a max amount of times you can shift? I'm wondering how many 2 digit numbers I can generate from with this method. If I can generate as many as possible off a single uint that is ideal and only loop and create a new hash when I need more digits to fulfill x amount of model properties. | |
Jan 17, 2018 at 20:28 | comment | added | blackops | I need to look more into shifting because that seems to be a simple solution to creating the 2 digit chunks for a larger number | |
Jan 17, 2018 at 14:10 | comment | added | Stephen Cleary | See more here: blog.keep.network/miners-arent-your-friends-cde9b6e0e9ac | |
Jan 17, 2018 at 14:08 | comment | added | Stephen Cleary |
Consider a situation where there's a random selection of a "winner" of Ether, say, where a miner's address is one of ten contestants. This random number code is run by the contract owner, and is used to select the winner. When the owner submits the chooseWinner transaction, the miner can calculate the block, determine they did not win, and then mine the block without that transaction. And then try again on the next block. Eventually, the miner can force the "random" number to declare themselves the winner, at which point the transaction is included in their mined block.
|
|
Jan 17, 2018 at 12:58 | comment | added | jhkuperus | Can you explain a bit how miners could manipulate this randomness? The hash is what is calculated based on the contents of the block and the proof-of-work right? | |
Jan 17, 2018 at 11:46 | comment | added | Stephen Cleary | This solution may allow miners to manipulate the randomness to their own benefit. If the random number has "value" of any kind, using a block hash isn't recommended. | |
Jan 17, 2018 at 11:28 | review | First posts | |||
Jan 17, 2018 at 15:54 | |||||
Jan 17, 2018 at 11:24 | history | answered | jhkuperus | CC BY-SA 3.0 |