1

I would like to create a contract that holds references to 20 Ethereum addresses. Each address has some associated Ethereum value. I want to send the message to this contract later and call function "payBonus" which accepts the ordered array of addresses.

1st address in array gets 60% of total sum of Ethereum, 2nd - 30%, third - 10%. All other 17 addresses get nothing.

Imagine 20 people made bets and I decide who are the winners.

I have few questions

  1. It's really expensive to store data. Do I have to store 20 bytes (people who bet) * 20 addresses + byte_size_of_ethereum_type * 20?

  2. Do I have to pay for 20*3 bytes while sending the message to my contract "payBonus" function?

Thanks!

It's not clear why the other 17 addresses need to be stored?

The scenario is: I create betting contract. 20 people take part in it and deposit money to the contract. The idea is to record which user has put money on the contract.

If the contract already has the 3 address, you don't need to pay for the 20*3 bytes when calling payBonus

Contract knows who and how much deposited funds to it. The contract doesn't know who won. Contract owner (me) should send three top winner addresses. I should send a message to a contract with three addresses and it should cost a gas since message changes state of contract and transferred over

Ethereum Thanks!

  • 1
    Welcome to Ethereum Stack Exchange! It's not clear why the other 17 addresses need to be stored? Q1: Since each word in Solidity is 32 bytes, usually Solidity will use one word per address. Q2: If the contract already has the 3 address, you don't need to pay for the 20*3 bytes when calling payBonus. Also, the spelling is Ethereum :) – eth Jan 16 '18 at 5:11
  • Hi, thanks for your answer. I've added details to my post – Sergey Jan 16 '18 at 7:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.