Show / Hide Table of Contents

Fees

Participants in Neo ecosystem need to pay network fees and system fees with GAS when using the Neo network.

System fees are the cost of resources consumed by the transaction execution in NeoVM. The execution of smart contracts, including the execution of its own scripts and the invocation of other contracts, requires system fees.

Network fee is the fee to pack transactions into a block. Transactions that deploy and invoke smart contracts on the blockchain and execute the Verify method requires network fees.

Therefore, a smart contract invocation transaction requires both system fee and network fee.

Fees in Neo3 can be dynamically changed. In this document we only introduce the basic fees.

System fees

System fees include:

  • Instruction fee (OpCode)

  • SysCall fee

  • CPU processing fee for native contracts

  • Storage fee

Instruction fee

Fee(GAS)OpCode
0.00032768CALLT
0.00008192APPEND, REVERSEITEMS, SETITEM, VALUES
0.00004096PUSHDATA4
0.00002048CAT, CONVERT, LEFT, MEMCPY, RIGHT, SUBSTR
0.00000512CALL, CALLL, CALLA, NEWARRAY, NEWARRAYT, NEWSTRUCT, PACK, PUSHDATA2, THROW, UNPACK
0.00000256NEWBUFFER
0.00000064HASKEY,INITSLOT,PICKITEM
0.00000032EQUAL,NOTEQUAL
0.00000016CLEAR, CLEARITEMS, INITSSLOT, KEYS, NEWARRAY0, NEWSTRUCT0, POPITEM, REMOVE, REVERSEN, ROLL, XDROP
0.00000008ADD, AND, BOOLAND, BOOLOR, DIV, GE, GT, LE, LT, MAX, MIN, MOD, MUL, NEWMAP, NUMEQUAL, NUMNOTEQUAL, OR, PUSHDATA1, SHL, SHR, SUB, WITHIN, XOR
0.00000004ABS, DEC, ENDFINALLY, ENDTRY, ENDTRYL, INC, INVERT, NEGATE, NOT, NZ, PUSHA, PUSHINT128, PUSHINT256, SIGN, SIZE, TRY, TRYL
0.00000002DEPTH, DROP, DUP, ISNULL, ISTYPE, JMP, JMPL, JMPEQ, JMPEQL, JMPGE, JMPGEL, JMPGT, JMPGTL, JMPIF, JMPIFL, JMPIFNOT, JMPIFNOTL, JMPLE, JMPLEL, JMPLT, JMPLTL, JMPNE, JMPNE_L, LDARG, LDARG0, LDARG1, LDARG2, LDARG3, LDARG4, LDARG5, LDARG6, LDLOC, LDLOC0, LDLOC1, LDLOC2, LDLOC3, LDLOC4, LDLOC5, LDLOC6, LDSFLD, LDSFLD0, LDSFLD1, LDSFLD2, LDSFLD3, LDSFLD4, LDSFLD5, LDSFLD6, NIP, OVER, PICK, REVERSE3, REVERSE4, ROT, STARG,STARG0,STARG1,STARG2,STARG3,STARG4,STARG5,STARG6,STLOC,STLOC0,STLOC1,STLOC2,STLOC3,STLOC4,STLOC5,STLOC6,STSFLD,STSFLD0,STSFLD1,STSFLD2,STSFLD3,STSFLD4,STSFLD5,STSFLD6,SWAP,TUCK
0.00000001ASSERT, NOP, PUSH0, PUSH1, PUSH10, PUSH11, PUSH12, PUSH13, PUSH14, PUSH15, PUSH16,PUSH2,PUSH3,PUSH4,PUSH5,PUSH6,PUSH7,PUSH8,PUSH9,PUSHINT16,PUSHINT32,PUSHINT64,PUSHINT8,PUSHM1,PUSHNULL
0ABORT, RET, SYSCALL

Reference: ApplicationEngine.OpCodePrices.cs

System call fee

Interop Service Fee(GAS)
System.Contract.Call0.00032768
System.Contract.CallNativeRefer to native contract fee
System.Contract.IsStandard0.00001024
System.Contract.GetCallFlags0.00001024
System.Contract.CreateStandardAccount0.00000256
System.Contract.CreateMultisigAccount0.00000256
Neo.Crypto.CheckSig0.00032768
Neo.Crypto.CheckMultisigDynamically calculated based on the number of signatures
System.Iterator.Create0.00000016
System.Iterator.Next0.00032768
System.Iterator.Value0.00000016
System.Runtime.Platform0.00000008
System.Runtime.GetTrigger0.00000008
System.Runtime.GetTime0.00000008
System.Runtime.GetScriptContainer0.00000008
System.Runtime.GetExecutingScriptHash0.00000016
System.Runtime.GetCallingScriptHash0.00000016
System.Runtime.GetEntryScriptHash0.00000016
System.Runtime.CheckWitness0.00001024
System.Runtime.GetInvocationCounter0.00000016
System.Runtime.Log0.00032768
System.Runtime.Notify0.00032768
System.Runtime.GetNotifications0.00000256
System.Runtime.GasLeft0.00000016

Reference:

ApplicationEngine.Contract.cs

ApplicationEngine.Crypto.cs

ApplicationEngine.Contract.cs

ApplicationEngine.Iterator.cs

ApplicationEngine.Runtime.cs

ApplicationEngine.Storage.cs

Native contract execution fee

Native ContractMethodFee(GAS)
ContractManagementDeployRefer to storage fee. Minimum is 10 GAS.
ContractManagementUpdateRefer to storage fee
LedgerContractGetTransactionFromBlock0.00065536
NeoTokenUnclaimedGas0.00131072
NeoTokenRegisterCandidateCalculated dynamically. Default is 1000 GAS
NeoTokenUnregisterCandidate0.00065536
NeoTokenVote0.00065536
NeoTokenGetCandidates0.04194304
NeoTokenGetCommittee0.04194304
NeoTokenGetNextBlockValidators0.04194304
NeoToken、GasTokenTransfer0.00131072
OracleContractRequestCalculated dynamically. The user specifies the fee when invoking.
StdLibDeserialize0.00008192
StdLibJsonDeserialize0.00008192
StdLibOther0.00002048

The fee for other native contract methods not listed is 0.00032768 GAS.

Reference: neo/SmartContract/Native

Storage fee

The storage fee is charged according to the written byte. The default unit price is 0.001 GAS / Byte. Committee members can dynamically adjust the fee, and the upper limit is 1 GAS / Byte.

For the key data written to the storage, the fee charged for the first time write-in and the subsequent write-in are different. See the following table for details.

ScenariosCharging RuleExampleFee
(Based on unit price 0.001)
First-time write in(key.Length + value.Length) × unit pricekey = key , value= hello world , totally 14 bytes 0.014 GAS
Subsequent write in. New data size ≤ Old data sizeNo fee for key. The first byte of the value is normally charged, and the remaining bytes are charged at a 75% discountThe value modified as hello neo3 , totally 10 bytes(1+(10-1)/4 )×0.001 = 0.003 GAS
Subsequent write in. New data size > Old data sizeThe previous fee plus the new data byte fee (i.e. new data byte × unit price)The value modified as hello neo3.0 , totally 12 bytes0.003 + (12-10)×0.001 = 0.005 GAS
Subsequent write in. New data size > Old data sizeThe same as above lineThe value modified as hello neo3.0 preview5 , totally 21 bytes0.005 + (21-12)×0.001 = 0.014 GAS
The value removed0The value removed 0 GAS

Reference: ApplicationEngine.Storage.cs

Network fee

The network fee includes:

  • Network byte fee

  • Script verification fee

Network byte fee

By default the network byte fee is 0.00001 GAS / Byte. Committee members can dynamically adjust the fee.

Reference:

PolicyContract.cs

Transaction.cs#L302

Script verification fee

The script verification fee is limit to 0.5 GAS. Its formula is:

Script verification fee = Execution fee of script verification * multiple

Where,

Execution fee of script verification = OpCode execution fee + SysCall fee + CPU processing fee for native contracts + Storage fee

The multiple for script verification fee defaults to 30, which can be dynamically adjusted by committee with the upper limit of 1000.

Developers can use the API InvokeContractVerify to evaluate the fee for script verification.

For example:

The script verification fee for a standard address is (OpCode.PUSHDATA1 + OpCode.PUSHDATA1 + OpCode.SYSCALL + Neo.Crypto.CheckSig) ×30 = 0.0098352 GAS.

Reference:

PolicyContract.cs

Transaction.cs#L302