I am working on a dapp based on hotel bookings. I have a refund function in my smart contract. The smart contract can receive transactions from a single EOA of a component (contract manager) in the backend that collects all booking requests from the frontend. Can the contract manager send the customer id and the booking payment (no ether) to the smart contract? Can the payment be saved on the blockchain? Does this make sense?
Only EOAs can initiate transactions, and each transaction requires gas that is paid in Ether.
You can use a relayer so your EOA doesn’t need to hold Ether, though you need Ether for the Relayer.
You could use OpenZeppelin Defender to relay transactions: https://docs.openzeppelin.com/defender/relay#meta-transactions
You may want to look at a lower cost blockchain (depending on the value of the transactions), such as the xDAI sidechain.
I apologize, but I have recently started studying ethereum and my knowledge is scarce.
I rewrite my question more clearly.
After reading and searching online, I still have many doubts about how EOAs work and their relationship with smart contracts. The idea behind my dapp is to allow users to make reservations. It also offers a refund of the payment if certain conditions are not met. I know that I have to implement a component in web3.js that sends the transactions (which I decided to call contract manager) and the smart contract in solidity. I have doubts about how to start the process. My idea is that there is only one EOA (which I assume is in the contract manager (?)) that collects customer data (customer id and payment) and sends it via transaction to the smart contract.
My questions are:
- Is it possible to have only one EOA that collects all the front-end requests (customer id + payment)? Is this id the customer’s EOA? So an EOA (contract manager) that collects many EOA + payment?
- Must the payment of each client (which is collected by the contract manager) be in ether or in real money?
- Is it correct to say that my contract manager (implemented with web3.js) owns the only EOA that sends transactions to the smart contract?
- If all this can be done, are the users paying the contract manager for gas? Or is it the contract manager who does it?
EOAs are externally owned accounts and have a private key.
Each user of your system will have an EOA and they would need to pay for gas to create a transaction that interacts with your smart contract.
Alternatively, you could use meta transactions, where each user signs a message with their EOA and you have a relayer that submits the transaction.
You may want to sign up for the workshop next week which will cover meta transactions and how you can implement using OpenZeppelin Defender: Workshop: Gasless MetaTransactions with OpenZeppelin Defender - Thursday 11 February 2021
You could use a relayer (as described above)
If the client is creating a transaction then they will need to pay gas in Ether for the transaction and any fee you are charging, this could be in Ether or a token (including stable tokens).
If you are relaying the transactions for your clients, then you could charge your clients using Fiat, or Ether or a token.
No, it depends how you architect your system.
Whoever initiates the transaction pays gas, either the clients directly, or if using meta transactions via the relayer, it is the relayer.