What is relay in ethereum?For doing transactions, any difference? I am not sure the concept of relay, it looks like one account can pay gas for transaction on another account.
Relays are not part of the protocol. They are an emerging pattern for user-facing UI's that simplify user-onboarding by adding flexible payment options for the gas. Users can transfer tokens and interact with contracts without having any ether.
Suppose Alice wants to send a transaction to a Contract using Bob to relay the transaction.
- Alice signs the transaction.
- Alice sends the signed transaction to Bob, off-chain.
- Bob forms a new transaction, with Alice's transaction attached as
- Bob sends the signed transaction, with gas, to Ethereum.
The Contract could be constructed to expect this, and even though the message came from Bob, it can check the data payload's signature and see that the payload was signed by Alice.
It can also execute business logic such as sending Bob a certain about of Ether or Tokens, as authorized by Alice. In other words, Alice's transaction can include, implicitly, her authorization to draw funds from another source (other than her wallet, which has no money), and compensate Bob for his trouble.
That is the basis for a business model to incentivize operators to stand up relays.
Hope it helps.