Contract Development Cost

Introduction

Smart contract development on any blockchain carries development costs covering resource expenditure. However, developing smart contracts on the TRON blockchain is vastly less expensive than Ethereum and similar protocols. This guide presents the comparison in a user-friendly format. If you wish to estimate energy costs for developing smart contract, please go to Tron Station which has energy and bandwidth tools can help you.

Summary

The tables below contrasts the development costs of small-sized contracts, a medium-sized contract, and a large-sized contract between TRON and Ethereum. The two example small contracts are a Simple Storage contract and a Fibonacci contract. The medium-sized contract example is a modified crypto-zombie contract called zombiefactory, while the large-sized contract is another modified crypto-zombie contract called zombieownership. The three cases in which bandwidth and energy consumption occurs are summarized as TRON-1, TRON-2, and TRON-3:

Table Denotes

For examples of freezing TRX for bandwidth and energy gain, please see the example code. For detailed descriptions of the HTTP APIs and TronWeb API functions, please visit the API reference.

Comparison Tables

Table 1
Comparison of contract development costs between TRON & Ethereum in TRX

CASESmall Contract - aSmall Contract - bMedium ContractLarge ContractUnit
TRON-13.8346.71947.3123.118TRX
TRON-23.8286.71147.272123.046TRX
TRON-30000TRX
Ethereum9.75713.98373.600212.019TRX

_**Table 2**_ Comparison of contract development costs between TRON & Ethereum in USD

CASESmall Contract - aSmall Contract - bMedium ContractLarge ContractUnit
TRON-10.0880.1551.0882.831USD
TRON-20.0880.1541.0872.830USD
TRON-30000USD
Ethereum0.2240.3221.6934.876USD

_**Table 3**_ Comparison of contract development costs between TRON & Ethereum in Kwei

CASESmall Contract - aSmall Contract - bMedium ContractLarge ContractUnit
TRON-10.4410.7735.43914.158Kwei
TRON-20.4400.7725.43614.150Kwei
TRON-30000Kwei
Ethereum1.1221.6088.46424.382Kwei

The conversion rates used for the example calculations are from the average rates of 10/11/2018. The conversion rates are as follows:

TRX to USD0.023
ETH to USD200
Kwei to USD0.2
ETH to TRX8695.7

Tools

The following tools were used:

TRON

Compile & Deploy:
Converter:

Ethereum

Compile & Deploy:
Converter:

Small Contracts Examples

SimpleStorage

pragma solidity ^0.4.23;

contract SimpleStorage {
  uint storedData;
  
  function set(uint x) public {
    storedData = x;
  }
  
  function get() public view returns (uint) {
    return storedData;
  }
}

ByteCode:

608060405234801561001057600080fd5b5060bf8061001f6000396000f30060806040526004361060485763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166360fe47b18114604d5780636d4ce63c146064575b600080fd5b348015605857600080fd5b5060626004356088565b005b348015606f57600080fd5b506076608d565b60408051918252519081900360200190f35b600055565b600054905600a165627a7a72305820239acc7b4a09319cfdb7508ca7d60748d30152d2fcb8715af728b2e4d23ad7b90029

Byte Size: 444

Create & Deploy Contract Cost

TRON

  • Total Fee Charged: 3833820 sun (3.834 TRX)
  • Energy Usage: 0
  • Energy Fee: 3833820 sun
  • Origin Energy Usage: 0 sun
  • Energy Usage Total: 38281
  • Net Usage: 0
  • Net Fee: 5720 sun

Ethereum

  • Total Gas Cost: 1122130 Gwei (0.00112213 ETH)

Fibonacci

pragma solidity ^0.4.23;

contract Fibonacci {
  
  event Notify(uint input, uint result);
  
  function fibonacci(uint number) public constant returns(uint result) {
    if (number == 0) return 0;
    else if (number == 1) return 1;
    else return Fibonacci.fibonacci(number - 1) + Fibonacci.fibonacci(number - 2);
  }
  
  function fibonacciNotify(uint number) public returns(uint result) {
    result = fibonacci(number);
    emit Notify(number, result);
  }
}

ByteCode

608060405234801561001057600080fd5b5061014f806100206000396000f30060806040526004361061004b5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416633c7fdc70811461005057806361047ff41461007a575b600080fd5b34801561005c57600080fd5b50610068600435610092565b60408051918252519081900360200190f35b34801561008657600080fd5b506100686004356100e0565b600061009d826100e0565b604080518481526020810183905281519293507f71e71a8458267085d5ab16980fd5f114d2d37f232479c245d523ce8d23ca40ed929081900390910190a1919050565b60008115156100f15750600061011e565b81600114156101025750600161011e565b61010e600283036100e0565b61011a600184036100e0565b0190505b9190505600a165627a7a72305820b5d7a97b640c5a8dd2e1014ef53cc75c6b59888e23c306514125eebef96adc140029

Byte Size: 734

Create & Deploy Cost

TRON

  • Total Fee Charged: 6719410 sun (6.719 TRX)
  • Energy Usage: 0
  • Energy Fee: 6711100 sun
  • Origin Energy Usage: 0 sun
  • Energy Usage Total: 67111
  • Net Usage: 0
  • Net Fee: 8310 sun

Ethereum

  • Total Gas Cost: 1607850 Gwei (0.00160785 ETH)

Medium Contract Example

Access the zombiefactory solidity file here.

ByteCode

60806040526010600155662386f26fc100006002556201518060035560008054600160a060020a031916331790556107a98061003c6000396000f30060806040526004361061006c5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416632052465e8114610071578063528b7b8f146101355780637bff0a01146101695780638da5cb5b146101c4578063f2fde38b146101d9575b600080fd5b34801561007d57600080fd5b506100896004356101fa565b60408051602080820188905263ffffffff80881693830193909352918516606082015261ffff8085166080830152831660a082015260c080825288519082015287519091829160e08301918a019080838360005b838110156100f55781810151838201526020016100dd565b50505050905090810190601f1680156101225780820380516001836020036101000a031916815260200191505b5097505050505050505060405180910390f35b34801561014157600080fd5b5061014d6004356102eb565b60408051600160a060020a039092168252519081900360200190f35b34801561017557600080fd5b506040805160206004803580820135601f81018490048402850184019095528484526101c29436949293602493928401919081908401838280828437509497506103069650505050505050565b005b3480156101d057600080fd5b5061014d61033f565b3480156101e557600080fd5b506101c2600160a060020a036004351661034e565b600480548290811061020857fe5b60009182526020918290206003919091020180546040805160026001841615610100026000190190931692909204601f8101859004850283018501909152808252919350918391908301828280156102a15780601f10610276576101008083540402835291602001916102a1565b820191906000526020600020905b81548152906001019060200180831161028457829003601f168201915b505050600184015460029094015492939263ffffffff8082169350640100000000820416915061ffff6801000000000000000082048116916a010000000000000000000090041686565b600560205260009081526040902054600160a060020a031681565b336000908152600660205260408120541561032057600080fd5b610329826103e2565b905060648106900361033b82826104c3565b5050565b600054600160a060020a031681565b600054600160a060020a0316331461036557600080fd5b600160a060020a038116151561037a57600080fd5b60008054604051600160a060020a03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600080826040516020018082805190602001908083835b602083106104185780518252601f1990920191602091820191016103f9565b6001836020036101000a0380198251168184511680821785525050505050509050019150506040516020818303038152906040526040518082805190602001908083835b6020831061047b5780518252601f19909201916020918201910161045c565b6001836020036101000a0380198251168184511680821785525050505050509050019150506040518091039020600190049050600254818115156104bb57fe5b069392505050565b6040805160c0810182528381526020808201849052600192820183905260038054420163ffffffff16606084015260006080840181905260a08401819052600480548087018083559183528551805193979692959294919091027f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b019261054d92849201906106e2565b50602082810151600183810191909155604080850151600290940180546060808801516080808a015160a0909a015163ffffffff1990941663ffffffff998a161767ffffffff00000000191664010000000099909216989098021769ffff000000000000000019166801000000000000000061ffff998a1602176bffff0000000000000000000019166a010000000000000000000098909216979097021790559590940360008181526005835286812080543373ffffffffffffffffffffffffffffffffffffffff1990911681179091558152600683528681208054909601909555855181815295860188905285820184815289519487019490945288519096507f88f026aacbbecc90c18411df4b1185fd8d9be2470f1962f192bf84a27d0704b79587958a958a959294909392850192908701918190849084905b838110156106a1578181015183820152602001610689565b50505050905090810190601f1680156106ce5780820380516001836020036101000a031916815260200191505b5094505050505060405180910390a1505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061072357805160ff1916838001178555610750565b82800160010185558215610750579182015b82811115610750578251825591602001919060010190610735565b5061075c929150610760565b5090565b61077a91905b8082111561075c5760008155600101610766565b905600a165627a7a72305820fb15fb70eb38f8ef38faa6e94485a3f2c3bbbe0aed82f59b2a0bd13c492432890029

Byte Size: 4042

Create & Deploy Cost

TRON

  • Total Fee Charged: 47299680 sun (47.3 TRX)
  • Energy Usage: 0
  • Energy Fee: 47272000 sun
  • Origin Energy Usage: 0 sun
  • Energy Usage Total: 472720
  • Net Usage: 0
  • Net Fee: 27680 sun

Ethereum

  • Total Gas Cost: 8464150 Gwei (0.00846415 ETH)

Large Contract Example

Access the zombieownership solidity file here.

ByteCode

60806040526010600155662386f26fc100006002556201518060035560008054600160a060020a03191633179055610ba38061003c6000396000f3006080604052600436106100825763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166317a7f4cc81146100875780632052465e146100a4578063528b7b8f146101685780635f4623f11461019c5780637bff0a01146101bd5780638da5cb5b14610216578063f2fde38b1461022b575b600080fd5b34801561009357600080fd5b506100a260043560243561024c565b005b3480156100b057600080fd5b506100bc60043561032d565b60408051602080820188905263ffffffff80881693830193909352918516606082015261ffff8085166080830152831660a082015260c080825288519082015287519091829160e08301918a019080838360005b83811015610128578181015183820152602001610110565b50505050905090810190601f1680156101555780820380516001836020036101000a031916815260200191505b5097505050505050505060405180910390f35b34801561017457600080fd5b5061018060043561041e565b60408051600160a060020a039092168252519081900360200190f35b3480156101a857600080fd5b506100a2600160a060020a0360043516610439565b3480156101c957600080fd5b506040805160206004803580820135601f81018490048402850184019095528484526100a294369492936024939284019190819084018382808284375094975061047f9650505050505050565b34801561022257600080fd5b506101806104b8565b34801561023757600080fd5b506100a2600160a060020a03600435166104c7565b600754604080517fe98b7f4d000000000000000000000000000000000000000000000000000000008152600481018490529051600092600160a060020a03169163e98b7f4d9160248083019261014092919082900301818787803b1580156102b357600080fd5b505af11580156102c7573d6000803e3d6000fd5b505050506040513d6101408110156102de57600080fd5b50610120015160408051808201909152600581527f6b697474790000000000000000000000000000000000000000000000000000006020820152909150610328908490839061055b565b505050565b600480548290811061033b57fe5b60009182526020918290206003919091020180546040805160026001841615610100026000190190931692909204601f8101859004850283018501909152808252919350918391908301828280156103d45780601f106103a9576101008083540402835291602001916103d4565b820191906000526020600020905b8154815290600101906020018083116103b757829003601f168201915b505050600184015460029094015492939263ffffffff8082169350640100000000820416915061ffff6801000000000000000082048116916a010000000000000000000090041686565b600560205260009081526040902054600160a060020a031681565b600054600160a060020a0316331461045057600080fd5b6007805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b336000908152600660205260408120541561049957600080fd5b6104a282610799565b90506064810690036104b4828261087a565b5050565b600054600160a060020a031681565b600054600160a060020a031633146104de57600080fd5b600160a060020a03811615156104f357600080fd5b60008054604051600160a060020a03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60008381526005602052604081205481908590600160a060020a0316331461058257600080fd5b600480548790811061059057fe5b906000526020600020906003020192506105a983610a99565b15156105b457600080fd5b600254858115156105c157fe5b0694506002858460010154018115156105d657fe5b04915060405160200180807f6b6974747900000000000000000000000000000000000000000000000000000081525060050190506040516020818303038152906040526040518082805190602001908083835b602083106106485780518252601f199092019160209182019101610629565b51815160209384036101000a60001901801990921691161790526040519190930181900381208951909550899450908301928392508401908083835b602083106106a35780518252601f199092019160209182019101610684565b6001836020036101000a0380198251168184511680821785525050505050509050019150506040516020818303038152906040526040518082805190602001908083835b602083106107065780518252601f1990920191602091820191016106e7565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390206000191614156107495760648206820360630191505b6107886040805190810160405280600681526020017f4e6f4e616d6500000000000000000000000000000000000000000000000000008152508361087a565b61079183610ab2565b505050505050565b600080826040516020018082805190602001908083835b602083106107cf5780518252601f1990920191602091820191016107b0565b6001836020036101000a0380198251168184511680821785525050505050509050019150506040516020818303038152906040526040518082805190602001908083835b602083106108325780518252601f199092019160209182019101610813565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390206001900490506002548181151561087257fe5b069392505050565b6040805160c0810182528381526020808201849052600192820183905260038054420163ffffffff16606084015260006080840181905260a08401819052600480548087018083559183528551805193979692959294919091027f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b01926109049284920190610adc565b50602082810151600183810191909155604080850151600290940180546060808801516080808a015160a0909a015163ffffffff1990941663ffffffff998a161767ffffffff00000000191664010000000099909216989098021769ffff000000000000000019166801000000000000000061ffff998a1602176bffff0000000000000000000019166a010000000000000000000098909216979097021790559590940360008181526005835286812080543373ffffffffffffffffffffffffffffffffffffffff1990911681179091558152600683528681208054909601909555855181815295860188905285820184815289519487019490945288519096507f88f026aacbbecc90c18411df4b1185fd8d9be2470f1962f192bf84a27d0704b79587958a958a959294909392850192908701918190849084905b83811015610a58578181015183820152602001610a40565b50505050905090810190601f168015610a855780820380516001836020036101000a031916815260200191505b5094505050505060405180910390a1505050565b600201544264010000000090910463ffffffff16111590565b60035442018160020160046101000a81548163ffffffff021916908363ffffffff16021790555050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10610b1d57805160ff1916838001178555610b4a565b82800160010185558215610b4a579182015b82811115610b4a578251825591602001919060010190610b2f565b50610b56929150610b5a565b5090565b610b7491905b80821115610b565760008155600101610b60565b905600a165627a7a72305820056f8fea1ac313d13c4e7f1d9ab97dd7885b2a8b08b63e5b684dcf7fbbd7dc2d0029

Byte Size: 6078

Create & Deploy Cost

TRON

  • Total Fee Charged: 123117850 sun (123.118 TRX)
  • Energy Usage: 0
  • Energy Fee: 123045800 sun
  • Origin Energy Usage: 0 sun
  • Energy Usage Total: 1230458
  • Net Usage: 0
  • Net Fee: 72050 sun

Ethereum

  • Total Gas Cost: 24381820 Gwei (0.02438182 ETH)

How much TRX is needed to freeze to be free to deploy on main net?

Below number got from a test on the date of 10/23/2018, which TotalEnergyWeight was 2,127,263.

The energy we can get from freezing 100 TRX is = (100/2127263)*50,000,000,0000 = 23504380.

Energy obtained = the TRX frozen for gaining Energy / the total TRX frozen for gaining Energy in the entire network * 50,000,000,000

Based such amount of frozen token pool size,

  • to deploy a small contract we need to freeze 2-2.5 TRX to be free;

  • for a medium contract, 5-20 TRX used to freeze would be enough to be free deploy;

  • for a large contract, the number would be around 50 TRX.

Please notice that the energy obtains (energyLimit) is dynamic based on the totalEnergyWeight.


What’s Next