0

When we are requested for some ethers in Faucet we are not paid the gas, how can that method works?

if you can give me some example of code it'll makes me easier to understand :)

1 Answer 1

3

When you request ether you are not sending a transaction to the blockchain to mint that ether. When you are using the faucet then you are asking the owner of that faucet to send you some ether.

It is usually a normal program that run on the cloud and has a private key stored somewhere inside it. And the user send only a normal http request to that backend with his/her public key. The backend checks then if the sender is allowed or has permission to get ether (e.g. you can only request once a day) and then that program create and sign a transaction to send the ether to the public key of the sender.

In other words, the owner of the faucet is paying for the transaction. He can do that because the ether on a testnet doesn't have a real value. – Stanislav Svědiroh

7
  • In other words, the owner of the faucet is paying for the transaction. He can do that because the ether on a testnet doesn't have a real value. Feb 13, 2022 at 17:55
  • do you have any article or example of codes, how to transfer ether automatically in solidity?
    – Irwan
    Feb 14, 2022 at 2:00
  • what do you mean with automatically? a smart contract cannot run itself, someone should send a transaction and trigger it. And to send ether you don't need a smart contract , it is the native currency and it can be transferred with a normal transaction @Irwan
    – Majd TL
    Feb 14, 2022 at 8:24
  • i meant when someone request the owner ether, the owner automatically approve and send it to the user
    – Irwan
    Feb 14, 2022 at 9:06
  • @Irwan it is a simple transaction , no need for a smart contract or solidity. The faucet's owner writes a normal application with javascript or java and use some of the web3 libraries to create and send the transaction docs.ethers.io/v5/getting-started/#getting-started--sending docs.web3j.io/4.8.7/transactions/transfer_eth
    – Majd TL
    Feb 14, 2022 at 10:09

Your Answer

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

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