This repository contains Ethereum and Hyperledger design in process diagram.
Ethereum Lottery
Simple Lottery
Recurring Lottery
RNG Lottery
Powerball
Hyperledger Lottery
Simple Lottery
Recurring Lottery
RNG Lottery
Powerball
Ethereum Lottery with UI
Simple Lottery
Recurring Lottery
RNG Lottery
Powerball
- Clone this repository git clone https://github.com/ssvergara/ethereum-hyperledger-lottery.git
- Go to this link https://www.draw.io/
- Drag the XML file to draw.io to view the process diagram.
Simple Lottery Ethereum
- The user will initiate the contract.
- The System will Set lottery duration and save to world state the total duration.
- The user will load contract address.
- The user will buy ticket.
- When user successfully bought a ticket, System add users addresss to ticket list in world state.
- When duration will lapsed,
- User will draw the winner if he/she will be the winner.
- When user draw the winner, the system will generate random unsigned integer.
- After that, system will Use the generated integer to select an adress to Ticket list in world state.
- After that, system will Assign winner's address that will retrieved in world state.
- When the address verified successfully, the user will withdraw the prize.
- When withdrawing the prize the system will transfer balance to winner's address. END
Recurring Lottery Ethereum
- The user will initiate the contract
- System will provide new round
- The System will Set lottery duration and save to world state the total duration
- The user will load contract address
- The user will buy ticket
- The System will end the time or duration lapsed
- User will draw the winner
- When user draw the winner, the system will generate random unsigned integer
- After that, system will Use the generated integer to select an adress to Ticket list in world state
- After that, system will Assign winner's address that will retrieved in world state
- When the address verified successfully, the user will withdraw the prize.
- When withdrawing the prize the system will transfer balance to winner's address
- Add 1 to round counts
- The system will initiate new rounds
- If the round counts is less than or equal to 100, the system will be deleted 1 round
RNG Lottery Ethereum
- Every buyer submits a commitment hash when they buy a ticket.
- Users is generating their number which they want to submit.
- Users secret number and address will be added to ticket list.
- Ticketing period is over. Tickets cannot be purchased after this period.
- Users must reveal their own secret number. All reveals must occur after the ticket deadline and before the reveal deadline.
- Verifying of commitment hash and must match the commitment submitted with the ticket.
- If failed to submit their own number and address, dropped from the lottery.
- Draw winner and Withdraw are nearly identical to SimpleLottery.
- Draw winner
- Generate random number, it will enable to select the users address to ticketlist.
- Generate random seed for picking a winner, this is random seed to determine the winner. Each time a secret number is revealed, the seed is modified to incorporate the reveal.
- Withdraw
- Balance will be added to users address and will added to world state to verify the address of the user.
Powerball Ethereum
- Initiate the contract.
- Set the time to determine the duration for the lottery.
- Participants buys a ticket.
- Users must enter a 6 digit of number limited to 1-69.
- Users address will be added to the ticket list in the Lottery System.
- Draw winner
- Generate random number, it will enable to select the users address to ticket list.
- Lottery System will assign the winner's user address.
- Users will checked the round details.
- Claim
- Lottery system will check the balance of users address and will transfer the balance to the address .
- Users received the prize.
Simple Lottery Hyperledger
- Users must register first and run the application.
- Set the time to determine the duration for the lottery.
- Users buys a ticket.
- Lottery System will get the identity of the user.
- After that it will be added to the ID list.
- Draw winner
- Generate new hash from block hash.
- Get the modulo of unsigned integer by the length of ID list, it will enable to select the users address to ticket list.
- Set the modulo to select the index of ID. This will determine who won.
- Lottery system will set the winner's ID.
- Withdraw
- Balance will be added to users address and will added to world state to verify the address of the user.
- Winner's wallet will be updated. END
Recurring Lottery Hyperledger
- Users must register first and run the application.
- Set the time to determine the duration for the lottery.
- Users buys a ticket.
- Lottery System will get the identity of the user.
- After that it will be added to the ID list.
- Draw winner
- Generate new hash from block hash.
- Get the modulo of unsigned integer by the length of ID list, it will enable to select the users address to ticket list.
- Set the modulo to select the index of ID. This will determine who won.
- Lottery system will set the winner's ID.
- Withdraw
- Balance will be added to users address and will added to world state to verify the address of the user.
- Winner's wallet will be updated. END
PS. Simple Lottery and Recurring Lottery in Hyperledger are nearly identical.
RNG Lottery Hyperledger
- Users must register first and run the application.
- Every buyer submits a commitment hash when they buy a ticket.
- Users is generating their number which they want to submit.
- Users secret number and address will be added to ID list..
- Ticketing period is over. Tickets cannot be purchased after this period.
- Users must reveal their own secret number. All reveals must occur after the ticket deadline and before the reveal deadline.
- Verifying of commitment hash and must match the commitment submitted with the ID.
- If failed to submit their own number and address, dropped from the lottery.
Draw winner and Withdraw are nearly identical to Simple Lottery.
- Draw winner 10 Generate new hash from block hash, it will enable to select the users address to ID list. 11 Generate random seed for picking a winner, this is random seed to determine the winner. Each time a secret number is revealed, the sed is modified to incorporate the reveal. 12 Withdraw
- Balance will be added to users ID and will added to the world state and verify the users ID
- Users wallet will be updated.
Powerball Hyperledger
- Users must register first and run the application.
- Set the time to determine the duration for the lottery.
- Users buys a ticket.
- Users must enter a 6 digit of number limited to 1-99.
- Lottery System will get the identity of the user.
- After that it will be added to the ID list.
- Draw winner
- Generate new hash from block hash.
- Get the modulo of unsigned integer by the length of ID list, it will enable to select the users address to ticket list.
- Set the modulo to select the index of ID. This will determine who won.
- Lottery system will set the winner's ID.
- Withdraw
- Balance will be added to users address and will added to world state to verify the address of the user.
- Winner's wallet will be updated. END