An Auditable and Trusted Lottery System in the Cloud
Abstract
1. Introduction
- Hybrid on-chain/off-chain architecture: We propose a scalable lottery system that stores millions of bets off-chain in a TP-Merkle tree, while committing only compact per-round Merkle roots to the public blockchain. This substantially reduces on-chain bandwidth and storage requirements without compromising auditability.
- Receipt-based verification protocol: We design a protocol in which each player receives a digitally signed receipt and a compact Merkle proof (Slice). This enables players and third-party auditors to verify inclusion of a bet and to check integrity of the committed ledger independently.
- Smart-contract-driven appeal mechanism: We introduce an automated appeal mechanism that accepts receipts and cryptographic evidence of service-provider misbehavior (e.g., data omission or manipulation). The smart contract adjudicates the claim and, when misconduct is proven, executes compensation automatically from a pre-deposited margin.
- Prototype implementation and evaluation: We implement a proof-of-concept prototype and conduct experiments on collision behavior, storage overhead, proof size, and gas consumption. The results indicate that the scheme can support tens of millions of bets per round with modest costs for both the service provider and players.
2. Related Work
2.1. Blockchain-Based Lottery Implementations
2.2. Regional Applications and Security Analysis
2.3. Authoritative Randomness Primitives and Scalability
3. Challenges in Current Blockchain-Based Lottery Games
4. The Proposed Auditable and Trusted Lottery System
4.1. System Architecture
4.2. Transaction Positioned Merkle Tree
4.3. Merkle Proof: Slice
4.4. The System Workflow
4.4.1. Phase I: Initialization and Betting
4.4.2. Phase II: Ledger Commitment and Data Availability
4.4.3. Phase III: Verification, Appeals, and Settlement
5. Experiment Results and Performance Analysis
6. Security Analysis and Discussion
6.1. Threat Model and Trust Premises
6.2. Integrity and Authenticity of Betting Receipts
6.3. Protection Against Censorship and Data Withholding
6.4. Resistance to Replay and Double-Spending
6.5. Robustness Against Denial-of-Service (DoS)
6.6. Summary of Security Guarantees
7. Conclusions
Author Contributions
Funding
Institutional Review Board Statement
Informed Consent Statement
Data Availability Statement
Conflicts of Interest
Appendix A. Implementation-Level Message Exchange Steps (For Figure 1)
Appendix A.1. Notation and Message Formats
Appendix A.2. Step-by-Step Message Exchanges
- SP deploys all related smart contracts to the public blockchain.
- SP publicly announces the randomness source/procedure for generating winning numbers for the upcoming round.
- SP locks a margin in the smart contract sufficient to cover compensation triggered by successful appeals.
- Player constructs Mrequest and signs it with Pri(Player).
- Player sends Mrequest to SP.
- Upon receipt, SP verifies the signature and parses Pub(Player), CO, IndexValue, Choose Number, and Time Stamp.
- Case A (Data omission: missing receipt in committed ledger): This case concerns a valid signed receipt that is missing from the committed TP-Merkle ledger for the round. The appellant submits (i) the signed receipt SR and (ii) the evidence package E = {[Slice, List of Key-Value Pairs, CO]Pri(SP)}. The smart contract verifies the signatures on SR and E, validates Slice against the on-chain committed root for round CO, and checks whether SR is present in the corresponding List of Key-Value Pairs. If SR is absent while the recomputed root derived from Slice (and the leaf content representation) still matches the on-chain root, the omission is proven and the appeal succeeds. The contract then executes the predefined compensation rule and records ReceiptID = H(SR) on-chain to prevent duplicate/replay appeals.
- Case B (SN discontinuity): This case concerns duplicated SNs or gaps (skipped SNs) across receipts, indicating a sequencing inconsistency within the round. The appellant submits two signed receipts SR(i−1) and SR(i) (typically adjacent receipts) that demonstrate the SN duplication or gap under the same round identifier CO. The smart contract verifies the signatures on both receipts and checks SN continuity/consistency constraints within the round. If the inconsistency is proven, the appeal succeeds, the predefined penalty/compensation rule is applied, and the contract records the involved ReceiptID values (ReceiptID(i−1) = H(SR(i−1)) and ReceiptID(i) = H(SR(i))) on-chain to prevent duplicate/replay appeals.
- Case C (IndexValue duplication): This case concerns multiple receipts carrying the same IndexValue within a round, violating the IndexValue uniqueness rule. The appellant submits the conflicting signed receipts SR(i) and SR(j) that contain the same IndexValue, together with the round identifier CO. The smart contract verifies the signatures on both receipts and confirms that the duplicated IndexValue occurs within the same round. If the uniqueness violation is proven, the appeal succeeds, the corresponding penalty/compensation rule is enforced, and the contract records the involved ReceiptID values (ReceiptID(i) = H(SR(i)) and ReceiptID(j) = H(SR(j))) on-chain to prevent duplicate/replay appeals.
- Case D (Insufficient bonus commitment): This case concerns a discrepancy between the on-chain committed bonus and the accumulated bet implied by signed receipts (e.g., the last receipt of the round). The appellant submits the relevant signed receipt(s) SR (typically the last receipt) together with the round identifier CO. The smart contract verifies the receipt signature(s) and compares the Accumulate Bet field in SR with the bonus metadata committed on-chain for round CO. If a discrepancy is demonstrated according to the contract’s verification rule, the appeal succeeds, the predefined compensation rule is applied, and the contract records ReceiptID = H(SR) (or the involved ReceiptID values if multiple receipts are used) on-chain to prevent duplicate/replay appeals.
- Case E (Accumulated bet record error): This case concerns an incorrect Accumulate Bet value recorded in receipts, detectable via inconsistencies in the expected progression across adjacent receipts. The appellant submits two signed receipts SR(i−1) and SR(i) (adjacent context) together with the round identifier CO. The smart contract verifies the signatures and validates Accumulate Bet progression/consistency constraints using the values contained in SR(i−1) and SR(i) under the same round. If the recorded value violates the expected progression, the appeal succeeds, the corresponding enforcement rule is applied, and the contract records the involved ReceiptID values (ReceiptID(i−1) = H(SR(i−1)) and ReceiptID(i) = H(SR(i))) on-chain to prevent duplicate/replay appeals.
- A winning player submits Mreply together with the corresponding evidence package E for registration.
- The smart contract verifies (i) receipt authenticity, (ii) consistency of E with the committed root for CO, and (iii) uniqueness of registration by checking/recording ReceiptID = H(SR).
- After the registration period ends, eligible winners can withdraw prizes according to the payout policy encoded in the contract.
References
- Hwang, G.-H.; Chen, H.-F. Efficient Real-Time Auditing and Proof of Violation for Cloud Storage Systems. In Proceedings of the 2016 IEEE 9th International Conference on Cloud Computing (CLOUD), San Francisco, CA, USA, 27 June–2 July 2016; pp. 132–139. [Google Scholar] [CrossRef]
- Hwang, G.-H.; Chen, P.-H.; Lu, C.-H.; Chiu, C.; Lin, H.-C.; Jheng, A.-J. InfiniteChain: A Multi-chain Architecture with Distributed Auditing of Sidechains for Public Blockchains. In Proceedings of the International Conference on Blockchain, Seattle, WA, USA, 25–30 June 2018; pp. 47–60. [Google Scholar]
- Nakamoto, S. Bitcoin: A Peer-to-Peer Electronic Cash System. 31 October 2008. Available online: https://ssrn.com/abstract=3440802 (accessed on 27 October 2025).
- Ethereum. The Ethereum Blockchain Explorer. Available online: https://etherscan.io/ (accessed on 27 October 2025).
- Proof of Stake (PoS). Available online: https://ethereum.org/en/developers/docs/consensus-mechanisms/pos/ (accessed on 27 October 2025).
- Quanta. White Paper. Available online: https://www.quanta.im/wp-content/uploads/2020/03/Quanta-whitepaper.pdf (accessed on 27 October 2025).
- ERC-20. Token Standard. Available online: https://ethereum.org/en/developers/docs/standards/tokens/erc-20/ (accessed on 27 October 2025).
- Li, J.; Zhang, Z.; Li, M. BanFEL: A Blockchain Based Smart Contract for Fair and Efficient Lottery Scheme. In Proceedings of the 2019 IEEE Conference on Dependable and Secure Computing (DSC), Hangzhou, China, 18–20 November 2019; pp. 1–8. [Google Scholar] [CrossRef]
- Saichua, P.; Khunthi, S.; Chomsiri, T. Design of Blockchain Lottery for Thai Government. In Proceedings of the 2019 Joint International Conference on Digital Arts, Media and Technology with ECTI Northern Section Conference on Electrical, Electronics, Computer and Telecommunications Engineering (ECTI DAMT-NCON), Nan, Thailand, 30 January–2 February 2019; pp. 9–12. [Google Scholar]
- Boonkrong, S. Designing a Blockchain-Based Thai Lottery System. In Proceedings of the 2025 11th International Conference on Computing and Artificial Intelligence (ICCAI), Kyoto, Japan, 28–31 March 2025; pp. 672–676. [Google Scholar]
- Liao, D.-Y.; Wang, X. Design of a Blockchain-Based Lottery System for Smart Cities Applications. In Proceedings of the 2017 IEEE 3rd International Conference on Collaboration and Internet Computing (CIC), San Jose, CA, USA, 15–17 October 2017; pp. 275–282. [Google Scholar]
- Jain, S.K.; Gujaran, S. Automated Lottery System Using Blockchain. 2024. [Google Scholar] [CrossRef]
- Long, X.; Wang, Y.; Li, X. From Fomo3D to Lottery DAPP: Analysis of Ethereum-Based Gambling Applications. arXiv 2025, arXiv:2508.12303. [Google Scholar]
- Datta, S.; Mondal, R.; Roy, R.; Banerjee, S.; Biswas, U. Blockchain-Enabled Secure and Fair Online Lottery Systems Using Smart Contracts. In Proceedings of the 2024 IEEE Silchar Subsection Conference (SILCON 2024), Agartala, India, 15–17 November 2024; pp. 1–6. [Google Scholar]
- Sun, X.; Kulicki, P.; Sopek, M. Lottery and Auction on Quantum Blockchain. Entropy 2020, 22, 1377. [Google Scholar] [CrossRef] [PubMed]
- Micali, S.; Rabin, M.; Vadhan, S. Verifiable Random Functions. In Proceedings of the Annual IEEE Symposium on Foundations of Computer Science, FOCS, New York, NY, USA, 17–19 October 1999; pp. 120–130. [Google Scholar]
- Dodis, Y.; Yampolskiy, A. A Verifiable Random Function with Short Proofs and Keys. In Public Key Cryptography (PKC’05), Proceedings of the 8th International Conference on Theory and Practice, Guimaraes, Portugal, 27–30 October 2014; Springer-Verlag: Berlin/Heidelberg, Germany, 2005; pp. 416–431. [Google Scholar]
- Raikwar, M.; Gligoroski, D. SoK: Decentralized Randomness Beacon Protocols. In Information Security and Privacy, Proceedings of the 27th Australasian Conference, ACISP 2022, Wollongong, NSW, Australia, 28–30 November 2022; Springer-Verlag: Berlin/Heidelberg, Germany, 2022; pp. 420–446. [Google Scholar]
- Drand Project. A Distributed Randomness Beacon Daemon. 2019. Available online: https://github.com/drand/drand (accessed on 27 October 2025).
- Boneh, D.; Bonneau, J.; Bünz, B.; Fisch, B. Verifiable Delay Functions. In Advances in Cryptology—CRYPTO 2018; Springer: Cham, Switzerland, 2018; pp. 757–788. [Google Scholar]
- Wesolowski, B. Efficient Verifiable Delay Functions. In Advances in Cryptology—EUROCRYPT 2019; Springer: Cham, Switzerland, 2019; pp. 379–407. [Google Scholar]
- Pietrzak, K. Simple Verifiable Delay Functions. In Proceedings of the 10th Innovations in Theoretical Computer Science Conference (ITCS 2019), San Diego, CA, USA, 10–12 January 2019; Schloss Dagstuhl-Leibniz-Zentrum fuer Informatik: Wadern, Germany, 2019; pp. 60:1–60:15. [Google Scholar]
- Jia, Z.; Chen, R.; Li, J. DeLottery: A Novel Decentralized Lottery System Based on Blockchain Technology. In Proceedings of the 2019 2nd International Conference on Blockchain Technology and Applications (ICBTA’19), Xi’an, China, 9–11 December 2019; Association for Computing Machinery: New York, NY, USA, 2020; pp. 20–25. [Google Scholar] [CrossRef]
- Jo, Y.; Park, C. BlockLot: Blockchain-based Verifiable Lottery. arXiv 2019, arXiv:1912.00642. [Google Scholar]
- Laurie, B.; Kasper, E. Revocation Transparency. Google Research. 2012. Available online: https://www.links.org/files/RevocationTransparency.pdf (accessed on 27 October 2025).
- Thibault, L.T.; Sarry, T.; Hafid, A.S. Blockchain Scaling using Rollups: A Comprehensive Survey. IEEE Access 2022, 10, 67544–67584. [Google Scholar] [CrossRef]
- TaiwanLottery. Available online: https://www.taiwanlottery.com/ (accessed on 27 October 2025).
- Mega Millions. Available online: https://www.megamillions.com/ (accessed on 27 October 2025).
- Merkle, R.C. Secrecy, Authentication, and Public Key Systems. Ph.D. Thesis, Stanford University, Stanford, CA, USA, 1979. [Google Scholar]
- Benet, J. IPFS—Content Addressed, Versioned, P2P File System. arXiv 2014, arXiv:1407.3561. [Google Scholar]




| Scenario (A–E) | Description of Inconsistency | Evidence Submitted by Appellant | Smart-Contract Adjudication Logic (High Level) |
|---|---|---|---|
| (A) Data omission (missing receipt in committed ledger) | A valid signed receipt exists but is missing from the committed TP-Merkle ledger for the round. | SR; E = {[Slice, List of Key-Value Pairs, CO]Pri(SP)}; and CO. | Verify signatures on SR and E; validate Slice against the on-chain root for CO; confirm that ReceiptID = H(SR) is not present in the corresponding List of Key-Value Pairs while the recomputed root matches the on-chain root; record ReceiptID on-chain to prevent duplicate appeals. |
| (B) SN discontinuity | Receipts show duplicated SNs or gaps (skipped SNs) within the round. | Two signed receipts SR(i−1) and SR(i) demonstrating the duplication/gap; and CO. | Verify signatures; check SN continuity/consistency between SR(i−1) and SR(i) under CO; enforce penalty/compensation if inconsistency is proven; record the involved ReceiptID values on-chain to prevent replay appeals. |
| (C) IndexValue duplication | Multiple receipts carry the same IndexValue within a round, violating the IndexValue uniqueness rule. | Conflicting signed receipts SR(i) and SR(j) with the same IndexValue; and CO. | Verify signatures; confirm duplicated IndexValue within CO; enforce the uniqueness rule and associated penalty/compensation; record the involved ReceiptID values on-chain to prevent repeated appeals. |
| (D) Insufficient bonus commitment | The on-chain committed bonus is inconsistent with the accumulated bet implied by signed receipts (e.g., the last receipt of the round). | Relevant signed receipt(s) SR (typically the last receipt); and CO. | Verify signatures; compare Accumulate Bet in SR with the bonus metadata committed on-chain for CO; accept the appeal if a discrepancy is demonstrated; record ReceiptID on-chain to prevent repeated submissions. |
| (E) Accumulated bet record error | Accumulate Bet values recorded in receipts violate the expected progression across adjacent receipts. | Two signed receipts SR(i−1) and SR(i) (adjacent context); and CO. | Verify signatures; validate Accumulate Bet progression/consistency constraints using SR(i−1) and SR(i) under CO; accept the appeal when the recorded value violates expected progression; record the involved ReceiptID values on-chain to prevent replay appeals. |
| Height | Number of Leaf Nodes | The Average Number of Collisions | The Smallest Number of Collisions | The Largest Number of Collisions |
|---|---|---|---|---|
| 17 | 65,536 | 152 | 107 | 209 |
| 18 | 131,072 | 76 | 44 | 120 |
| 19 | 262,144 | 38 | 14 | 72 |
| 20 | 524,288 | 19 | 3 | 43 |
| 21 | 1,048,576 | 10 | 0 | 30 |
| 22 | 2,097,152 | 5 | 0 | 19 |
| 23 | 4,194,304 | 3 | 0 | 13 |
| 24 | 8,388,608 | 2 | 0 | 10 |
| 25 | 16,777,216 | 1 | 0 | 8 |
| Height | Player | SP |
|---|---|---|
| 17 | 24,199 Bytes | 1519 MB |
| 18 | 14,473 Bytes | 1534 MB |
| 19 | 9257 Bytes | 1564 MB |
| 20 | 6131 Bytes | 1625 MB |
| 21 | 4765 Bytes | 1747 MB |
| 22 | 3619 Bytes | 1990 MB |
| 23 | 3023 Bytes | 2476 MB |
| 24 | 2757 Bytes | 3452 MB |
| 25 | 2601 Bytes | 5372 MB |
| Function | Gas Use | Gas Price (Gwei) | ETH | USD | |
|---|---|---|---|---|---|
| Deploy | 4,133,255 | Max | 10 | 0.04133255 | 4.133255 |
| Avg | 4 | 0.01653302 | 1.653302 | ||
| Min | 3 | 0.012399765 | 1.2399765 | ||
| Upload bonus | 25,900 | Max | 10 | 0.000259 | 0.0259 |
| Avg | 4 | 0.0001036 | 0.01036 | ||
| Min | 3 | 0.0000777 | 0.00777 | ||
| Upload root hash | 47,467 | Max | 10 | 0.00047467 | 0.047467 |
| Avg | 4 | 0.000189868 | 0.0189868 | ||
| Min | 3 | 0.000142401 | 0.0142401 | ||
| Upload the winning numbers | 129,535 | Max | 10 | 0.00129535 | 0.129535 |
| Avg | 4 | 0.00051814 | 0.051814 | ||
| Min | 3 | 0.000388605 | 0.0388605 | ||
| Auditing announce | 68,844 | Max | 10 | 0.00068844 | 0.068844 |
| Avg | 4 | 0.000275376 | 0.0275376 | ||
| Min | 3 | 0.000206532 | 0.0206532 | ||
| Receive the award | 39,832 | Max | 10 | 0.00039832 | 0.039832 |
| Avg | 4 | 0.000159328 | 0.0159328 | ||
| Min | 3 | 0.000119496 | 0.0119496 | ||
| Function | Gas Use | Gas Price (Gwei) | ETH | USD | |
|---|---|---|---|---|---|
| The receipt disappears from the TP-Merkle tree | 333,992 | Max | 10 | 0.00333992 | 0.333992 |
| Avg | 4 | 0.001335968 | 0.1335968 | ||
| Min | 3 | 0.001001976 | 0.1001976 | ||
| Insufficient bonuses | 70,480 | Max | 10 | 0.0007048 | 0.07048 |
| Avg | 4 | 0.00028192 | 0.028192 | ||
| Min | 3 | 0.00021144 | 0.021144 | ||
| IndexValue duplicate | 137,734 | Max | 10 | 0.00137734 | 0.137734 |
| Avg | 4 | 0.000550936 | 0.0550936 | ||
| Min | 3 | 0.000413202 | 0.0413202 | ||
| IndexValue skips number | 306,408 | Max | 10 | 0.00306408 | 0.306408 |
| Avg | 4 | 0.001225632 | 0.1225632 | ||
| Min | 3 | 0.000919224 | 0.0919224 | ||
| SN duplicate | 109,826 | Max | 10 | 0.00109826 | 0.109826 |
| Avg | 4 | 0.000439304 | 0.0439304 | ||
| Min | 3 | 0.000329478 | 0.0329478 | ||
| SN skips number | 114,967 | Max | 10 | 0.00114967 | 0.114967 |
| Avg | 4 | 0.000459868 | 0.0459868 | ||
| Min | 3 | 0.000344901 | 0.0344901 | ||
| Accumulated bet record error | 144,399 | Max | 10 | 0.00144399 | 0.144399 |
| Avg | 4 | 0.000577596 | 0.0577596 | ||
| Min | 3 | 0.000433197 | 0.0433197 | ||
| Function | Our Proposed Scheme | BanFEL [8] |
|---|---|---|
| Betting | X | 1,000,000 |
| Random number selection | X | 1,000,000 + 1 |
| Upload the margin | 1 | X |
| Upload the bonus | 1 | X |
| Upload the root hash | 1 | X |
| Upload the last receipt | 1 | X |
| Announce auditing the correctness of the game | 1 | X |
| Make appeals | 0 | X |
| Upload the winning numbers | 1 | X |
| Receive award | K | K |
| Total | K + 6 | K + 2,000,000 + 1 |
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2026 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license.
Share and Cite
Hwang, G.-H.; Chang, T.-K.; Lu, Y.-S. An Auditable and Trusted Lottery System in the Cloud. Appl. Sci. 2026, 16, 741. https://doi.org/10.3390/app16020741
Hwang G-H, Chang T-K, Lu Y-S. An Auditable and Trusted Lottery System in the Cloud. Applied Sciences. 2026; 16(2):741. https://doi.org/10.3390/app16020741
Chicago/Turabian StyleHwang, Gwan-Hwan, Tao-Ku Chang, and Yi-Syuan Lu. 2026. "An Auditable and Trusted Lottery System in the Cloud" Applied Sciences 16, no. 2: 741. https://doi.org/10.3390/app16020741
APA StyleHwang, G.-H., Chang, T.-K., & Lu, Y.-S. (2026). An Auditable and Trusted Lottery System in the Cloud. Applied Sciences, 16(2), 741. https://doi.org/10.3390/app16020741
