1

We are implementing an ethereum payment for our customers and need to decide between deposits to a smart contract or individual customer addresses. What are pros and cons? Is it possible to hide our smart contract's balance if we use it for all payments? Why do some exchanges do not accept payments from smart contracts - is it because of missing customer tracking information?

1 Answer 1

3

It's different, but only slightly more complicated. Transactions from EOA (externally owned accounts, e.g. private key signs a transaction) have a destination and an amount. The exchange or service can monitor the mempool and see that the transaction is to their address and let you know "hey, we see your transaction, we're waiting for it to be mined and x confirmations to confirm it!".

Transactions from contracts are different though. Transactions from contracts aren't even transactions, they're "message calls". Since all transactions from contracts are started from EOA accounts, message calls from contracts don't show in the mempool and they aren't even included in blocks, only the initial transaction that caused the contract transaction is in the block. This is how payments from contracts would work in practice:

  1. I send a tx to my Multisig contract saying "send 1 ETH to this address"

  2. The Multisig, in the same transaction, sends a message call to the address I told it to with the amount of ETH I told it to send.

Since the transaction that causes the ETH to go to the service isn't actually to the service, it's to the Multisig, the service/exchange can't just monitor for transactions to their address. They'd have to run every transaction they see and see if it sends to their address. Additionally, it's possible that the transactions outcome could change in a future block. Say my Multisig says "if the current block number is odd, never send the ETH", but the exchange tested the transaction on an even block, they would be wrong about getting the ETH if it was mined in an odd block.

At the end of the day, the service/exchange can just ping for changes in their wallets balance instead of trying to listen for transactions to their address, but many just don't want to do this.

5
  • thanks, could you please provide more detailed information how to identify which payment came from which customer? If I just monitor my account balance changes - how do I proceed to find out what happened?
    – jeff
    Feb 22, 2018 at 16:49
  • There are a couple ways. The common way for exchanges is to have separate addresses for every user, and they just generate a new one for each user. They then know who is sending to the service. Another option is your receiving address being a contract that requires some type of identifier be passed to the payable function that is unique per person.
    – natewelch_
    Feb 22, 2018 at 16:59
  • Thanks - that's what I found out so far. In case of a smart contract what are the issues when they send from another smart contract? Is it likely that user's wallet do not support adding the identifier to the transaction data or in case they send from another exchange?
    – jeff
    Feb 22, 2018 at 17:10
  • If you were to go with the identifier in your smart contract method, then yes, people would be unable to send directly from an exchange since the exchange will have no idea about that identifier. If you want full interoperability, then you'll have to do the 1 address per user and process transfers from both EOA and contracts.
    – natewelch_
    Feb 22, 2018 at 17:18
  • so in case of individual addresses I would need to move funds to a cumulative account because unlike with bitcoin it's unhandy to deal with all those accounts. Is there a best practice for this?
    – jeff
    Feb 22, 2018 at 17:28

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.