1

I'm trying to create a contract that behaves differently based on the user's selection. I, however, have no idea how to let the user "select" the option. Currently I have a basic fallback function that does the basic logic, but this logic has 2 important variables which I'd like if the user could change. What's the best approach to accomplish this? I know I can create a payable function with 2 inputs that will modify this behavior, but how would people use this function at all? No wallet (except MyEtherWallet) supports functions and even with MEW you need to know ABI. Is there a workaround or something?

Thanks, SEnergy

1 Answer 1

0

In reality, basically nobody gives the contracts as-is to the end users. There are almost always some more old-fashioned interface layers between the user and your smart contract(s) such as web3. So the user uses an easy-to-use interface and in the background web3 and a selected node take care of the smart contract interactions.

However, if this is more of a theoretical question or you really really want your end users to connect directly to the smart contracts:

Direct connection to your contracts without easy-to-use layers

If you don't want to require end-users to use a wallet which supports custom contracts (or don't want them to go through the setup and all) you don't have very many options left.

The only thing I could think of is to determine the selection based on the amount of Ether sent. For example the last digit could be the selection - if user sends 5003 or 4239082482390482903 weis, it means selection 3. The monetary difference is insignificant when talking about weis.

Another (dumb) idea is to require them to send the required amount of transactions. If only one transaction, it means selection 1 and so on.

2
  • I believe the typical solution is to build your own front end (DApp with web3.js).
    – user19510
    Aug 16, 2018 at 20:43
  • Of course. I hoped this was more of a theoretical question. Anyway, will include that also "just in case" Aug 17, 2018 at 4:29

Your Answer

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

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