4

I have a Python program using stack operations and string concatenations. It runs in less than a minute on a particular input, doing about 100 million string operations. Doing this number of operations in Ethereum will today cost about $2 million in gas.

Why is execution in Ethereum so expensive?

Let's say there are 35000 nodes today and each node needs to execute the Ethereum port of the Python program. If we assume roughly the same speed,these are 35000 CPU-minutes = ca. 600 CPU hours = ca. $60 on Amazon. That is a lot less than $2 million.

Why such a big difference? Or is there a flaw in the estimates?

3

In the Ethereum network, every transaction is replicated and re-computed across every node in the network, so you're paying in some sense for the execution on every node, not just on a single server as in EC2. Additionally, the miners use a significant amount of compute power to secure the blockchain with their hashpower, so you are partially paying for that as well. The purpose of Ethereum is to run immutable, decentralized, trustless computation, not general purpose computation.

  • 1
    Thanks, but the independent re-computation on every node is already included in my calculation. If each node computes for 1 minute, it is 35000 minutes in total, i.e. 600 CPU hours for all nodes in total. The market price (e.g. on Amazon) of this is about $60. Is the "securing of the blockchain with hashpower" eating the remaining $1999940 ? Why? – Guest Jun 14 '17 at 5:28
  • Each block has a block limit of 4.7M gas. I'm guess your 100 million string operations consume on the order of tens of thousands of blocks worth of gas. The block reward is currently ~$1600, so let's say each block costs about ~$500 worth of hash power (in electricity and sunk costs) to secure. That should cover your $2M. – k26dr Jun 16 '17 at 18:23
  • Why are block gas limits so low and/or block rewards so high? Since the equivalent computation of all nodes together costs on Amazon only $60, why not set the block gas limits much higher? – Guest Jun 28 '17 at 20:21
  • The block gas limit has to be low enough that the contents of each block can be transmitted across the network in under 15 seconds with a moderate internet connection so that any peer can keep up with the network. Additionally, it prevents chain bloat. I tried running a full node for a month before my hard drive filled up and couldn't afford the space anymore. Scaling is a major issue with Ethereum. – k26dr Jul 18 '17 at 19:40
0

The parallel processing described implies a degree of trust between the nodes cooperating to solve the problem. Ethereum solves for accuracy in an environment where the nodes don't know or trust each other. It does so with redundancy. Basically, all 35,000 nodes solve it independently and compare.

The sort of high-compute operation you're talking about might be better suited to a different approach. If there's no need to lock in "truth" or the nodes all trust each other, you might not need a blockchain.

If you need inarguable records of the results of this operation, consider a trusted source ("Oracle") and locking in historical outputs using a hash. Another thought is to check out the ongoing work at Golem project that aims to introduce parallel processing with a binding to Ethereum's immutable records.

Hope it helps.

  • Thanks, but redundancy is already factored in my $60 calculation - see my comment to the answer by k26dr. – Guest Jun 14 '17 at 5:37

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.