0

I am trying to better understand how the ethereum network works but I didn't find a clear answer to that question yet.

If I am correct, the two points above imply that resources allowing dApps to run are not provided by full nodes. They are not provided by miners either (miners just submit hashes in order to validate transactions AFAIK). So concretely where do dApps run, and who gets ETH for that? Can I do it?

  • It's what gas is for. Gas is paid in ether. Yes, all full nodes would have to run your tx, but only the miner who finds the block gets paid for the work. – libertylocked Nov 14 '17 at 17:17
1

Whatever your transaction is (calling a function on a contract, deploying a contract, or simply sending a payment), you have to pay gas for it.

Who are spending their computing power to run your transaction?

Before the TX is put in a block, every miner spends their computing power to run your TX. Once your TX arrives in the txpool, miners would grab it, check if it's valid, run it through, get the output, and attempt to put it in a block. (This is where the proof-of-work comes in)

Once it is in a block, every full node must validate the blocks they hear on the P2P network before accepting it. Part of the validation process requires running every single TX and comparing it against the output they see in the published block. If they match, the block is accepted by the node.

So in summary: every blockchain participant (miners + full nodes) eventually spends their computing power to run your TX.

Who's getting the payout (your tx fee)?

Only the miner who successfully finds the block that includes your TX gets your TX fee.

Bitcoin works the same way.

  • I did not know that calling a function was treated the same as a TX. "Bitcoin works the same way", except the ethereum network has something more AFAIK: smart contracts or dapps (I don't know if it's really different). Most of my question was about dapps and most of your answer is about TX: does it mean that miners run the dapps? I had never heard of that. – Georg Nov 14 '17 at 18:27
  • "DApp" is a pretty broad term. It means a decentralized app. Typically you'd have your client slide files hosted on some decentralized filesystem like IPFS or Swarm (they are not blockchains, just a DHT), and your app talks to one or more smart contracts. You craft and send a tx when you call a smart contract function. – libertylocked Nov 14 '17 at 18:34
0

where do dApps run, and who gets ETH for that?

It's important to understand that every node keeps an exact copy of the same Ethereum Blockchain, ledger and that everything in Ethereum is designed to be deterministic.

In order for a node to remain in-sync with the rest of the Ethereum network, they must see the same transactions as the rest of the network and execute these deterministic transactions at around the same times as the rest of the nodes on the network.

What this means that every node* when it receives a new, latest & valid block is processing every transaction (balance transfer, every smart contract function call etc.) to apply these changes to their local copy of the Blockchain..

Only the miners, however, are receiving the block reward and the transaction fees included in every, successfully integrated block.

A great thing about Ethereum is that it is an open, public network - you may run a node and participate in the network operation. You can even set your node to try mining a new block; without a substantial amount of hashing power, it is unlikely that you would be able to mine a block on the main network though.

Bonus, extended answer

I like to think of a Dapp (decentralised application) as more than just the, Ethereum, smart contracts - @Eth provides a very good overview of what a Dapp is:

A DApp can have frontend code and user interfaces written in any language (just like an app) that can make calls to its [Ethereum smart contract] backend. Furthermore, its frontend can be hosted on decentralized storage such as Swarm or IPFS.

In the case of the front-end code be hosted by a decentralised file system such as Swarm, Storj etc. then there are other nodes providing resources (in this case file storage) and receiving payment in Ether or tokens for this service.

Depending on the complexity of your DApp, it may also need to provide an incentive mechanism to operate in a truly decentralised manner. For example, BTC Relay requires - and incentivises - Bitcoin block headers to be submitted to a contract:

Relayers are those who submit block headers to BTC Relay. To incentivize the community to be relayers, and thus allow BTC Relay to be autonomous and up-to-date with the Bitcoin blockchain, Relayers can submit block headers to BTC Relay. When any transaction is verified in the block, or the header is retrieved, Relayers will be rewarded a fee

0

After researching on this, I think the actual answer is that dapps will rely on something like iExec to provide them the necessary computing resources. So payments/earnings actually won't be in ETH but in tokens such as RLC.

Gas is just a nickname for the cost (paid in ETH) of a transaction. For example, when sending Ether, a small portion of your ETH balance is used. The miners pick up that "gas" (ether) as a transaction fee. That is a different topic than "where do dApps run", which was the question.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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