0

In my smart contract which is lottery I generate a random number. Then I pick a user based on his sequential place in the list of all the participants. This sequential place gets assigned to every participant dynamically, in a function which picks random winner.

I want to make the process more transparent.

At the moment one's sequential place isn't revealed.

Will there be any downside to revealing it on blockchain? via logs, for instance. That is, it'd become:

wallet1 -> 1
wallet2 -> 2
....
wallet150 -> 150

Everyone would then become able to find out what the full list of the participants is, even if one may not be a participant himself.

It's not a lottery which operates with hundreds or millions of dollars, though.

update1

My question is about the mainnet of Ethereum, as well as custom-built and private Ethereum-based blockchains too. On those, the data may not be public. They may not even have a full-fledged Explorer that reveals the source code of a contract, but only a simple one.

With this in mind, my initial question remains.

update 2

Or, to put it other way:

if I had the list of all the participtants in a DB and then decided to move it to blockchain, as well as reveal it via a special method -- get_participants(lottery_id).... Would this create issues in terms of privacy, cheating or other things?

1 Answer 1

1

Let's first correct something:

At the moment one's sequential place isn't revealed.

This isn't correct in public blockchains. Any information in smart contracts is public, regardless of what kind of visibility modifiers the variables have. Even if the variable holding the data is marked as private the data can be retrieved from the contract - retrieving it just requires a bit more know-how.

So all your data is already public. You can of course choose whether to make it easier to access it. I don't see any reason not to.

So if you first gather participants and then close the lottery by generating the seed to choose the winner, your most vulnerable spot (except other contract bugs) is generating the randomness. This is far from trivial. As a rule of thumb, if the monetary incentive is big enough, any pseudo-randomness you use can be broken and the most secure way would be to use something like Chainlink VRF.

If your blockchain is private the above is also mostly true. If anyone can read the contract state and transactions they can deduce its storage layout and read also its internal storage data (although it might not be very easy to accomplish, depending on how much you know about the contract). You can only really prevent reading the data if you somehow block access to the contract state and transactions - in which case it becomes questionable what's the point of the contract.

7
  • This isn't correct. Any information in smart contracts is public.... Alright, for the public blockchain yes. However, if we slightly modified the question to include private or custom blockchains, this would no longer be the case. Suppose, we included those as well.
    – Kum
    Commented Nov 16, 2022 at 13:08
  • see my update..
    – Kum
    Commented Nov 16, 2022 at 13:11
  • very well. updated my answer. Commented Nov 16, 2022 at 13:16
  • Then my 2nd correction: let's say, the majority, if not all, of the participants would be non-technically knowlegable to the extent that you've described. I can't know this, but I make this assumption for this question. And my original questiion will then remain
    – Kum
    Commented Nov 16, 2022 at 13:26
  • See my update #2
    – Kum
    Commented Nov 16, 2022 at 16:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.