Implementing Giveaways in Blockchain

0 votes
I'm building a project that does a giveaway everytime the counter reaches 100k.

There are many people that can get the giveaways. It is not that only one person out of all gets the giveaway.

Every person has a Unique ID and I am randomly giving different types of gifts to them.
I dont understand how to implement this.
Aug 17, 2018 in Blockchain by sabby
• 4,370 points

edited Aug 17, 2018 by Omkar 724 views

1 answer to this question.

0 votes
I have found a similar question. The solution mentioned there was:

int(hashlib.sha256(block_header + userID).hexdigest(), 16) / float(2**256)

You conver the hash into an integer, then divide that integer by 2**256. This gives you a decimal from 0 to 1 that can be compared to a random.random() to get the prize.
answered Aug 17, 2018 by digger
• 26,740 points

Related Questions In Blockchain

0 votes
1 answer

How to make sure transactions take no fee in a private Ethereum blockchain?

In a private ethereum network you have ...READ MORE

answered Mar 26, 2018 in Blockchain by Christine
• 15,790 points

edited Mar 26, 2018 by Christine 1,594 views
0 votes
1 answer

How can i read headers of blockchain in multichain?

You could use a recent feature known ...READ MORE

answered Mar 26, 2018 in Blockchain by Perry
• 17,100 points
749 views
+1 vote
1 answer

Can Blocks be reorganized in the blockchain?

In practical applications, invalid transactions can not ...READ MORE

answered Jul 18, 2018 in Blockchain by Varun

edited Aug 3, 2018 by Omkar 721 views
+1 vote
1 answer

Can a data be altered in a blockchain without changing its hash?

Yes, it should work. The authentication practice ...READ MORE

answered Apr 8, 2018 in Blockchain by Shashank
• 10,400 points
938 views
0 votes
1 answer

Truffle tests not running after truffle init

This was a bug. They've fixed it. ...READ MORE

answered Sep 11, 2018 in Blockchain by Christine
• 15,790 points
1,947 views
0 votes
1 answer

Hyperledger Sawtooth vs Quorum in concurrency and speed Ask

Summary: Both should provide similar reliability of ...READ MORE

answered Sep 26, 2018 in IoT (Internet of Things) by Upasana
• 8,620 points
1,472 views
+1 vote
1 answer

Protocols used in a distributed/dlt system for the nodes to establish communication

yes all are over TCP/IP connections secured ...READ MORE

answered Aug 6, 2018 in Blockchain by aryya
• 7,460 points
1,461 views
+1 vote
1 answer

What problem does pow(proof of work) solves in blockchain?

Proof of Work: When a miner gets a ...READ MORE

answered Aug 6, 2018 in Blockchain by digger
• 26,740 points
1,220 views
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP