# Deployment Cost

## Introduction

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

## Summary

The tables below contrasts the development costs of small-sized contracts, a medium-sized contract, and a large-sized contract between Vision 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 photon and entropy consumption occurs are summarized as Vision-1, Vision-2, and Vision-3:

**Table Denotes**

* Vision-1: not using any photon or entropy from frozen token
* Vision-1 = entropy Fee + photon Fee
* Vision-2: using free photon or photon from frozen token only
* Vision-2 = Vision-1 - Free photon Quota - Frozen photon Quota
* Vision-3: using photon and entropy from the frozen token
* Vision-3 = Vision-2 - Frozen entropy Quota

For detailed descriptions of the HTTP APIs and VisionWeb API functions, please visit the API reference.

**Comparison Tables**

_Table 1_

Comparison of contract development costs between Vision & Ethereum in VS

| CASE     | Small Contract-a | Smart Contract-b | Medium Contract | Large Contract | Unit |
| -------- | ---------------- | ---------------- | --------------- | -------------- | ---- |
| VISON-1  | 3.834            | 6.719            | 47.3            | 123.118        | VS   |
| VISON-2  | 3.828            | 6.711            | 47.272          | 123.046        | VS   |
| VISON-3  | 0                | 0                | 0               | 0              | VS   |
| Ethereum | 9.757            | 13.983           | 73.600          | 212.019        | VS   |

_Table 2_

Comparison of contract development costs between Vision & Ethereum in USD

| CASE     | Small Contract-a | Smart Contract-b | Medium Contract | Large Contract | Unit |
| -------- | ---------------- | ---------------- | --------------- | -------------- | ---- |
| VISON-1  | 0.088            | 0.155            | 1.088           | 2.831          | USD  |
| VISON-2  | 0.088            | 0.154            | 1.087           | 2.830          | USD  |
| VISON-3  | 0                | 0                | 0               | 0              | USD  |
| Ethereum | 0.224            | 0.322            | 1.693           | 4.876          | USD  |

_Table 3_

Comparison of contract development costs between Vision & Ethereum in Kwei

| CASE     | Small Contract-a | Smart Contract-b | Medium Contract | Large Contract | Unit |
| -------- | ---------------- | ---------------- | --------------- | -------------- | ---- |
| VISON-1  | 0.441            | 0.773            | 5.439           | 14.158         | Kwei |
| VISON-2  | 0.440            | 0.772            | 5.439           | 14.150         | Kwei |
| VISON-3  | 0                | 0                | 0               | 0              | Kwei |
| Ethereum | 1.122            | 1.608            | 8.464           | 24.382         | Kwei |

### Tools

The following tools were used:

**Vision**

Compile & Deploy:

* VisionBox\
  Converter:
* Vision convert tool

**Ethereum**

Compile & Deploy:

* [Truffle Framework](https://truffleframework.com/)

Converter:

* [Official Convert Rate](https://ethdocs.org/en/latest/ether.html)

### Small Contracts Examples

#### SimpleStorage.sol

```js
pragma solidity ^0.5.8;

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

ByteCode

```shell
608060405234801561001057600080fd5b5060bf8061001f6000396000f30060806040526004361060485763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166360fe47b18114604d5780636d4ce63c146064575b600080fd5b348015605857600080fd5b5060626004356088565b005b348015606f57600080fd5b506076608d565b60408051918252519081900360200190f35b600055565b600054905600a165627a7a72305820239acc7b4a09319cfdb7508ca7d60748d30152d2fcb8715af728b2e4d23ad7b90029
```

Byte Size: 444

#### Create & Deploy Contract Cost

**Vision**

* **Total Fee Charged**: **47299680** vdt _(47.3 VS)_
* Entropy Usage: 0
* Entropy Fee: 47272000 vdt
* Origin Entropy Usage: 0 vdt
* Entropy Usage Total: 472720
* Photon Usage: 0
* Photon Fee: 27680 vdt

**Ethereum**

* **Total Gas Cost**: **8464150** Gwei _(0.00846415 ETH)_

***

### Medium Contract Example

zombiefactory solidity file [here](https://github.com/wxue/solidity-cryptozombies/blob/master/contracts/zombiefactory.sol).

***

### Large Contract Example

Access the zombieownership solidity file [here](https://github.com/wxue/solidity-cryptozombies/blob/master/contracts/zombieownership.sol).

```
60806040526010600155662386f26fc100006002556201518060035560008054600160a060020a03191633179055610ba38061003c6000396000f3006080604052600436106100825763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166317a7f4cc81146100875780632052465e146100a4578063528b7b8f146101685780635f4623f11461019c5780637bff0a01146101bd5780638da5cb5b14610216578063f2fde38b1461022b575b600080fd5b34801561009357600080fd5b506100a260043560243561024c565b005b3480156100b057600080fd5b506100bc60043561032d565b60408051602080820188905263ffffffff80881693830193909352918516606082015261ffff8085166080830152831660a082015260c080825288519082015287519091829160e08301918a019080838360005b83811015610128578181015183820152602001610110565b50505050905090810190601f1680156101555780820380516001836020036101000a031916815260200191505b5097505050505050505060405180910390f35b34801561017457600080fd5b5061018060043561041e565b60408051600160a060020a039092168252519081900360200190f35b3480156101a857600080fd5b506100a2600160a060020a0360043516610439565b3480156101c957600080fd5b506040805160206004803580820135601f81018490048402850184019095528484526100a294369492936024939284019190819084018382808284375094975061047f9650505050505050565b34801561022257600080fd5b506101806104b8565b34801561023757600080fd5b506100a2600160a060020a03600435166104c7565b600754604080517fe98b7f4d000000000000000000000000000000000000000000000000000000008152600481018490529051600092600160a060020a03169163e98b7f4d9160248083019261014092919082900301818787803b1580156102b357600080fd5b505af11580156102c7573d6000803e3d6000fd5b505050506040513d6101408110156102de57600080fd5b50610120015160408051808201909152600581527f6b697474790000000000000000000000000000000000000000000000000000006020820152909150610328908490839061055b565b505050565b600480548290811061033b57fe5b60009182526020918290206003919091020180546040805160026001841615610100026000190190931692909204601f8101859004850283018501909152808252919350918391908301828280156103d45780601f106103a9576101008083540402835291602001916103d4565b820191906000526020600020905b8154815290600101906020018083116103b757829003601f168201915b505050600184015460029094015492939263ffffffff8082169350640100000000820416915061ffff6801000000000000000082048116916a010000000000000000000090041686565b600560205260009081526040902054600160a060020a031681565b600054600160a060020a0316331461045057600080fd5b6007805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b336000908152600660205260408120541561049957600080fd5b6104a282610799565b90506064810690036104b4828261087a565b5050565b600054600160a060020a031681565b600054600160a060020a031633146104de57600080fd5b600160a060020a03811615156104f357600080fd5b60008054604051600160a060020a03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60008381526005602052604081205481908590600160a060020a0316331461058257600080fd5b600480548790811061059057fe5b906000526020600020906003020192506105a983610a99565b15156105b457600080fd5b600254858115156105c157fe5b0694506002858460010154018115156105d657fe5b04915060405160200180807f6b6974747900000000000000000000000000000000000000000000000000000081525060050190506040516020818303038152906040526040518082805190602001908083835b602083106106485780518252601f199092019160209182019101610629565b51815160209384036101000a60001901801990921691161790526040519190930181900381208951909550899450908301928392508401908083835b602083106106a35780518252601f199092019160209182019101610684565b6001836020036101000a0380198251168184511680821785525050505050509050019150506040516020818303038152906040526040518082805190602001908083835b602083106107065780518252601f1990920191602091820191016106e7565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390206000191614156107495760648206820360630191505b6107886040805190810160405280600681526020017f4e6f4e616d6500000000000000000000000000000000000000000000000000008152508361087a565b61079183610ab2565b505050505050565b600080826040516020018082805190602001908083835b602083106107cf5780518252601f1990920191602091820191016107b0565b6001836020036101000a0380198251168184511680821785525050505050509050019150506040516020818303038152906040526040518082805190602001908083835b602083106108325780518252601f199092019160209182019101610813565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390206001900490506002548181151561087257fe5b069392505050565b6040805160c0810182528381526020808201849052600192820183905260038054420163ffffffff16606084015260006080840181905260a08401819052600480548087018083559183528551805193979692959294919091027f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b01926109049284920190610adc565b50602082810151600183810191909155604080850151600290940180546060808801516080808a015160a0909a015163ffffffff1990941663ffffffff998a161767ffffffff00000000191664010000000099909216989098021769ffff000000000000000019166801000000000000000061ffff998a1602176bffff0000000000000000000019166a010000000000000000000098909216979097021790559590940360008181526005835286812080543373ffffffffffffffffffffffffffffffffffffffff1990911681179091558152600683528681208054909601909555855181815295860188905285820184815289519487019490945288519096507f88f026aacbbecc90c18411df4b1185fd8d9be2470f1962f192bf84a27d0704b79587958a958a959294909392850192908701918190849084905b83811015610a58578181015183820152602001610a40565b50505050905090810190601f168015610a855780820380516001836020036101000a031916815260200191505b5094505050505060405180910390a1505050565b600201544264010000000090910463ffffffff16111590565b60035442018160020160046101000a81548163ffffffff021916908363ffffffff16021790555050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10610b1d57805160ff1916838001178555610b4a565b82800160010185558215610b4a579182015b82811115610b4a578251825591602001919060010190610b2f565b50610b56929150610b5a565b5090565b610b7491905b80821115610b565760008155600101610b60565b905600a165627a7a72305820056f8fea1ac313d13c4e7f1d9ab97dd7885b2a8b08b63e5b684dcf7fbbd7dc2d0029
```

Byte Size: 6078

#### Create & Deploy Contract Cost

**Vision**

* **Total Fee Charged**: **123117850** vdt _(123.118 VS)_
* Entropy Usage: 0
* Entropy Fee: 123045800 vdt
* Origin Entropy Usage: 0 vdt
* Entropy Usage Total: 1230458
* Photon Usage: 0
* Photon Fee: 72050 vdt

**Ethereum**

* **Total Gas Cost**: **24381820** Gwei _(0.02438182 ETH)_

### How much VS is needed to freeze to be free to deploy on Vision Network?

Below number got from a test on the date of 01/20/2021, which TotalEntropyWeight was 2,127,263.

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

Entropy obtained = the VS frozen for gaining Entropy / the total VS frozen for gaining Entropy 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 VS to be free;
* for a medium contract, 5-20 VS used to freeze would be enough to be free deploy;
* for a large contract, the number would be around 50 VS.

**Please notice that the Entropy obtains (EntropyLimit) is dynamic based on the totalEntropyWeight.**
