Bitcoin Forum
June 23, 2024, 05:09:22 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
  Home Help Search Login Register More  
  Show Posts
Pages: [1]
1  Alternate cryptocurrencies / Announcements (Altcoins) / Re: [ANN] [10X] 10X - an innovative gambling and trading game based on the Ethereum on: August 22, 2017, 09:28:38 AM
I had some thoughts about your password-protected functions.
The idea of securing your critical functions with additional password is very good, but the way you implemented it is not secure due to the publicity of all transaction input data:

- Once you call storePassword function to initialize your password, the data in this call is visible to anyone who runs full node.
- The data is also visible when looking at the contract transaction history (it needs to be disassembled but it is quite easy for hackers)
- Each time you call a function that is protected with password you also expose it in the transaction data and again it is visible

So i thought about how to have password protected functions in a secure way and here is what i came out with:
1. You need to set a password and calculate its hash offline. Then hard-code the hash value into the contract (or create a function to initialize the password hash)
2. Whenever you call a function that is password protected, you need to set a new password hash (since the function call data is visible to anyone). Therefore, you need to hold an offline list of passwords and their matching hashes and each password protected function needs to accept the next password hash parameter and replaces the current hash with the new one

* you may create a list of hashes and initialize the contract with the whole list. So you will not need to change the hash in each call, but just lookup the hash of the current password in the list and then remove it so it cannot be reused


Now there are some risks you need to consider:
1. Each password must be very different than the others to prevent guessing relying on previous passwords.
2. To prevent hash cracking you should also use a Salt value for the hashing - a long random string that you concatenate with the password before hashing. The Salt can be a single value stored in the contract (it will be visible but it anyway has its added value to prevent cracking the hashes with existing rainbow tables)
3. Since you need to have many passwords and make them complex and different from each other you will probably need to write them down somewhere, so there is also a risk you will lose access to the passwords and the risk of someone getting access to this list
4. There is also a race condition risk - when you submit a transaction to your contract with a password, before the transaction is confirmed in a block, the attacker (who has your private key, as this is the reason the password exists in the first place) can make a competing transaction with higher gas price, making it in higher priority for the miners. This way, the attacker use your hash to access the password protected function and if the function also replaces the hash the attacker can set the next password and now he is in control of the passwords and not you (this is why initializing the contract with a list of hashes is more secure)

And one idea i have regarding the case where your private key is stolen but you still have access to it as well:
- Create a kill-switch function with hard-coded password hash (that matches to a dedicated kill-switch password you have offline)
- This function will turn on a global boolean flag that indicates to all other functions that the contract is disabled forever (there is no function to set it back to false)
- Once you know your private was stolen call this function and the attacker cannot abuse his access to the contract (the race-condition attack is not a risk in this case as the attacker cannot use the password of the kill-switch function for any other functions and the kill-switch function will be called anyway)

2  Alternate cryptocurrencies / Announcements (Altcoins) / Re: [ANN] [10X] 10X - an innovative gambling and trading game based on the Ethereum on: August 20, 2017, 05:27:29 AM
One last thing I can suggest you is to promise to buy back tokens from users from time to time (according to your profits)
This does not require you to change the contract and it can definitely influence the token value. Maybe you need to mint less tokens in the first place and once the game tokens supply is over you buy more tokens from users from exchanges and move it to the contract
You will be the main first buyer that pushes the price up and when users will see it really happens they will gain more trust and start bidding for the tokens in the exchanges

Eran

Yes exactly I came to the exact same solution. I will open an account at one exchange partner (have many to choose from) and this account will be used to sell the ETH that are above the threshold value needed to run the game at current market price.
For example I could keep 200 ether to insure that the bank cannot be insolvable and the game can run as designed with a maximum bet of 1 ETH
Then all ETH above this number will be placed at buys at market price within this partner exchange.
Traders will then wait that I dump these ETH and make gains.. I am a day trader, I will be in the line to collect these bonuses!

I could add a "bonus delivery warning" in a mailing list and on the website with a counter, so that people rush trading when this happen. It is even more fun that it was designed before!


 Shocked What do you think? I think it will do the trick right?

I might need to consider changing the game into a x5 instead of 10x so more ETH will be collected more easily. X5 from 10 chance is still very high compared with the very popular local lottery here that are giving about the same but with a draw that can be 1-100.

Yes I guess this should work, just make sure your new strategy is well published so the ICO will be successful
good luck Smiley
3  Alternate cryptocurrencies / Announcements (Altcoins) / Re: [ANN] [10X] 10X - an innovative gambling and trading game based on the Ethereum on: August 19, 2017, 10:13:08 PM
One last thing I can suggest you is to promise to buy back tokens from users from time to time (according to your profits)
This does not require you to change the contract and it can definitely influence the token value. Maybe you need to mint less tokens in the first place and once the game tokens supply is over you buy more tokens from users from exchanges and move it to the contract
You will be the main first buyer that pushes the price up and when users will see it really happens they will gain more trust and start bidding for the tokens in the exchanges

Eran
4  Alternate cryptocurrencies / Announcements (Altcoins) / Re: [ANN] [10X] 10X - an innovative gambling and trading game based on the Ethereum on: August 19, 2017, 01:37:13 PM
I have few questions regarding the 10X game and contract:

1. You are saying that when a player looses and gets 10x tokens at 0.1 ETH rate, it is like an exchange order for buying 10x in 0.1 ETH price.
But this is not true, the contract is paying the tokens from the contract token supply and it has nothing to do with external exchange trading. I don't see how this affect trading prices (and really cannot see how your claim that if i place a sell order for 0.1ETH price in the exchange, when i lose the game i might buy my own sell order)

2. There is the case of the game mode is on and then the ETH supply is running out so the mode is switched back to ICO. When this happens players that are currently active may send bets without knowing that they are not betting but actually contributing more funds to the contract.  How do you prevent this from happening ?

3. Same question as 2 but the other way around - when ICO mode is switched to game mode, there might be contributors that still send ethers to the ICO but instead they will play the game without knowing - again how do you prevent this from happening ?



Your Answers.

1. you are right, the bet is not placed in the trading platform so the relation between the purchase and the sale is not as linked as I described it, I will fix that, my mistake, glad that someone read this Wink. But the fact that tokens are changing hands at 0.1 ether will show up in the buy wall in every exchanges, and will have an influence over the global value of the token per ether, if I am not mistaken. For example if you issue 1000 10X tokens at 0.1 eth per token (and none 10X token are minted of course) this should drive the price of the 10X up considerably, compare with a normal token which has no other traction than the buy/sales of the traders.

2. when we switch in crowdfunding (ICO is not really the word since it can happen anytime), in any case, the state of the game is displayed on the website (not yet, but it will of course). It is very important to place any bet from the website so that the player knows what is happening. The website also display the maximum bet possible which is 1/100 of the bank reserve. The second solution is that we are in manual mode and then we let the game going on at with whatever ETH are in the bank. In that case we might be in a situation that players cannot play more than 0.1 ETH (with 10 ETH in the bank).  All bets above that will be rejected.
If someone send ethers to the contract address blindly, he might get random results depending of the state of the contract. I have no idea how we could possibly warn the player apart from social medias, and our website.

3. same problem, if the player send money without checking our website first, he might be in the situation that you describe. I do not see how I can prevent that. It is a game that needs to be played from the game interface.
For example we can do a special event, where we sell for 1 day 5000 x 10X for 1 ether. Or we can do another event where we sell 500,000 10X max, with 10,000 per 10X, who knows, then of course the player always has to check what are the rules of the game at the time he sent his ethers to the game.

I can refund people in case of error, it is a pita to do, specially if there are many refund to do, but the player responsibility is to check the status of the token before sending anything since this token is a little bit more advanced and can morph into different modes.





Thanks for your answers
Regarding the 10x tokens I am doubt about its exchange value will be influenced by the game rate of 0.1 ETH per 1 10x - you need buyers to be willing to pay for these tokens but one of the disadvantages of your design is that the 10x token had no use in the game itself. I really think that you need to add some option to use 10x tokens in the game itself to get some benefits. For example you can add the option to bet on 10x tokens instead of ETH (in the rate of the exchanges) or maybe offer users the option to double their win by paying some 10x tokens in addition to the bet

Regarding the mode switching and preventing the users from doing mistakes, even when using the game UI, there is still a probability of race condition. I think a more appropriate solution will be to separate the payable functions - one for each mode and refuse the payment when the function is called when is corresponding mode is off. So the UI play and contribute buttons are actually calling different functions

>Regarding the 10x tokens I am doubt about its exchange value will be influenced by the game rate of 0.1 ETH per 1 10x - you need buyers to be willing to pay for these tokens but one of the disadvantages of your design is that the 10x token had no use in the game itself. I really think >that you need to add some option to use 10x tokens in the game itself to get some benefits. For example you can add the option to bet on 10x tokens instead of ETH (in the rate of the exchanges) or maybe offer users the option to double their win by paying some 10x tokens in addition >to the bet

I understand your point of view, since it is something that haven't been tested I agree that one can doubt about the relationship between the contract issuing tokens and its value on the market, I think that [https://www.cryptotraders.eu/what-is-the-erc20-ethereum-token-standard/](https://www.cryptotraders.eu/what-is-the-erc20-ethereum-token-standard/) is a good reading.
The standard ERC20 gives the possibility to check all the balances of a token and from that calculate the value of this token. Since the contract can add more address and new balances, these will be scanned by all the exchanges we will deal with, and if something change it will be reflected in their walls, and change the global value of the coin.
If it was not working like this, different exchanges would have different prices.
Even if no one trade this coin, every time the contract will have any activity it will be reflected in the exchanges as soon as it changes the balances inside the contract.

>Regarding the mode switching and preventing the users from doing mistakes, even when using the game UI, there is still a probability of race condition. I think a more appropriate solution will be to separate the payable functions - one for each mode and refuse the payment when the >function is called when is corresponding mode is off. So the UI play and contribute buttons are actually calling different functions

I cannot split the contract in 2 addresses (did I understand your question well?). The balances of the token owners must be attached to the contract itself. I cannot move the money of the shareholders elsewhere or it would disappear from their wallet, and I cannot duplicate it because the token is attached to the contract address. I have thought about this solution at the very beginning of the development of this project, but had quickly to forget it for the reasons I mention before.  Also think about this, if another contract on a different address could interfere with the 10X contract, and the source code is public, what could stop anyone to steal all the balances?
In the case of talk about 2 different contracts on the same address, then it seems that you suppose that the UI will generate the transfer with the press of a button, but this is not possible. The player needs to log into his wallet, we cannot do it for him. So he needs to send money the same way he would participate the an ICO.

>For example you can add the option to bet on 10x tokens instead of ETH
>
I thought about it too in the course of the development. Receiving payment in a token value is a complex task to do both for the player and for the contract. Sending 10X would add confusion to an already complicated lottery system. Also the contract is not interested in getting 10X back, it wants Ethers. The decision was taken to keep the lottery as simple as possible (bet 1 get 10 if you win) and use the exchange for dealing with the token.





I meant two different payable functions not two different contracts. I am not sure it is possible since I am quite new to Solidity, but i do see that your code already have two different payable functions in addition to the fallback one (the addEth() and makeTokens()) so it seems to me like it is possible

As for the tokens, I will not participate in the ICO as I am still not convinced the tokens will gain too much value over time but I am curious to see what will happen. I still think that it would be much better model if the tokens were useful or at least required in order to play, but I see how it makes the contract much more complicated due to the need to deal with both ETH and tokens transactions in the same contract
5  Alternate cryptocurrencies / Announcements (Altcoins) / Re: [ANN] [10X] 10X - an innovative gambling and trading game based on the Ethereum on: August 19, 2017, 05:08:20 AM
I have few questions regarding the 10X game and contract:

1. You are saying that when a player looses and gets 10x tokens at 0.1 ETH rate, it is like an exchange order for buying 10x in 0.1 ETH price.
But this is not true, the contract is paying the tokens from the contract token supply and it has nothing to do with external exchange trading. I don't see how this affect trading prices (and really cannot see how your claim that if i place a sell order for 0.1ETH price in the exchange, when i lose the game i might buy my own sell order)

2. There is the case of the game mode is on and then the ETH supply is running out so the mode is switched back to ICO. When this happens players that are currently active may send bets without knowing that they are not betting but actually contributing more funds to the contract.  How do you prevent this from happening ?

3. Same question as 2 but the other way around - when ICO mode is switched to game mode, there might be contributors that still send ethers to the ICO but instead they will play the game without knowing - again how do you prevent this from happening ?



Your Answers.

1. you are right, the bet is not placed in the trading platform so the relation between the purchase and the sale is not as linked as I described it, I will fix that, my mistake, glad that someone read this Wink. But the fact that tokens are changing hands at 0.1 ether will show up in the buy wall in every exchanges, and will have an influence over the global value of the token per ether, if I am not mistaken. For example if you issue 1000 10X tokens at 0.1 eth per token (and none 10X token are minted of course) this should drive the price of the 10X up considerably, compare with a normal token which has no other traction than the buy/sales of the traders.

2. when we switch in crowdfunding (ICO is not really the word since it can happen anytime), in any case, the state of the game is displayed on the website (not yet, but it will of course). It is very important to place any bet from the website so that the player knows what is happening. The website also display the maximum bet possible which is 1/100 of the bank reserve. The second solution is that we are in manual mode and then we let the game going on at with whatever ETH are in the bank. In that case we might be in a situation that players cannot play more than 0.1 ETH (with 10 ETH in the bank).  All bets above that will be rejected.
If someone send ethers to the contract address blindly, he might get random results depending of the state of the contract. I have no idea how we could possibly warn the player apart from social medias, and our website.

3. same problem, if the player send money without checking our website first, he might be in the situation that you describe. I do not see how I can prevent that. It is a game that needs to be played from the game interface.
For example we can do a special event, where we sell for 1 day 5000 x 10X for 1 ether. Or we can do another event where we sell 500,000 10X max, with 10,000 per 10X, who knows, then of course the player always has to check what are the rules of the game at the time he sent his ethers to the game.

I can refund people in case of error, it is a pita to do, specially if there are many refund to do, but the player responsibility is to check the status of the token before sending anything since this token is a little bit more advanced and can morph into different modes.





Thanks for your answers
Regarding the 10x tokens I am doubt about its exchange value will be influenced by the game rate of 0.1 ETH per 1 10x - you need buyers to be willing to pay for these tokens but one of the disadvantages of your design is that the 10x token has no value or use case in the game itself. I really think that you need to add some option to use 10x tokens in the game itself to get some benefits. For example you can add the option to bet on 10x tokens instead of ETH (in the rate of the exchanges) or maybe offer users the option to double their win by paying some 10x tokens in addition to the bet

Regarding the mode switching and preventing the users from doing mistakes, even when using the game UI, there is still a probability of race condition. I think a more appropriate solution will be to separate the payable functions - one for each mode - and refuse the payment when the function is called when its corresponding mode is off. So the UI play and contribute buttons are actually calling different functions
6  Alternate cryptocurrencies / Announcements (Altcoins) / Re: [ANN] [10X] 10X - an innovative gambling and trading game based on the Ethereum on: August 17, 2017, 11:59:58 PM
I have few questions regarding the 10X game and contract:

1. You are saying that when a player looses and gets 10x tokens at 0.1 ETH rate, it is like an exchange order for buying 10x in 0.1 ETH price.
But this is not true, the contract is paying the tokens from the contract token supply and it has nothing to do with external exchange trading. I don't see how this affect trading prices (and really cannot see how your claim that if i place a sell order for 0.1ETH price in the exchange, when i lose the game i might buy my own sell order)

2. There is the case of the game mode is on and then the ETH supply is running out so the mode is switched back to ICO. When this happens players that are currently active may send bets without knowing that they are not betting but actually contributing more funds to the contract.  How do you prevent this from happening ?

3. Same question as 2 but the other way around - when ICO mode is switched to game mode, there might be contributors that still send ethers to the ICO but instead they will play the game without knowing - again how do you prevent this from happening ?

7  Alternate cryptocurrencies / Announcements (Altcoins) / Re: [ANN] [10X] 10X - an innovative gambling and trading game based on the Ethereum on: August 17, 2017, 11:26:42 PM
Hi,
I have reviewed your contract and it seems fine except for one potential issue - the function addEth() is not onlyOwner - is this done intentionally ?
Pages: [1]
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!