Skip to main content

OpCode Costs Tables

The following tables outline the cost, in motes, for a given operation on Casper's Mainnet. If you are building for a private network or other instance of Casper, you will need to verify these costs in the associated chainspec.toml.

More information on chainspecs for private networks can be found here

note

All costs in this table are in motes, not CSPR, and the corresponding chainspec is here.

Storage Costs

AttributeDescriptionCost
gas_per_byteGas charged per byte stored in global state.630,000

OpCode Costs

AttributeDescriptionCost
bitBit operations multiplier.300
addArithmetic add operations multiplier.210
mulMul operations multiplier.240
divDiv operations multiplier.320
loadMemory load operation multiplier.2_500
storeMemory store operation multiplier.4,700
constConst store operation multiplier.110
localLocal operations multiplier.390
globalGlobal operations multiplier.390
integer_comparisonInteger operations multiplier.250
conversionConversion operations multiplier.420
unreachableUnreachable operation multiplier.270
nopNop operation multiplier.200
current_memoryGet the current memory operation multiplier.290
grow_memoryGrow memory cost per page (64 kB).240,000

Control Flow Operation Costs

AttributeDescriptionCost
blockCost for block opcode.440
loopCost for loop opcode.440
ifCost for if opcode.440
elseCost for else opcode.440
endCost for end opcode.440
brCost for br opcode.35_000
br_ifCost for br_if opcode.35,000
returnCost for return opcode.440
selectCost for select opcode.440
callCost for call opcode.68_000
call_indirectCost for call_indirect opcode.68,000
dropCost for drop opcode.440

Br_Table OpCode Costs

AttributeDescriptionCost
costFixed cost per br_table opcode.35,000
size_multiplierSize of target labels in the br_table opcode will be multiplied by size_multiplier.100

External Function Costs

The following costs are for low-level bindings for host-side ("external") functions. More information on the Casper external FFI can be found here.

Host-Side FunctionCostArguments
add5,800[0, 0, 0, 0]
add_associated_key9,000[0, 0, 0]
add_contract_version200[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
blake2b200[0, 0, 0, 0]
call_contract4,500[0, 0, 0, 0, 0, 420, 0]
call_versioned_contract4,500[0, 0, 0, 0, 0, 0, 0, 420, 0]
create_contract_package_at_hash200[0, 0]
create_contract_user_group200[0, 0, 0, 0, 0, 0, 0, 0]
create_purse2,500,000,000[0, 0]
disable_contract_version200[0, 0, 0, 0]
get_balance3,800[0, 0, 0]
get_blocktime330[0]
get_caller380[0]
get_key2,000[0, 440, 0, 0, 0]
get_main_purse1,300[0]
get_named_arg200[0, 0, 0, 0]
get_named_arg_size200[0, 0, 0]
get_phase710[0]
get_system_contract1,100[0, 0, 0]
has_key1,500[0, 840]
is_valid_uref760[0, 0]
load_named_keys42,000[0, 0]
new_uref17,000[0, 0, 590]
random_bytes200[0, 0]
print20,000[0, 4,600]
provision_contract_user_group_uref200[0, 0, 0, 0, 0]
put_key38,000[0, 1,100, 0, 0]
read_host_buffer3,500[0, 310, 0]
read_value6,000[0, 0, 0]
read_value_local5,500[0, 590, 0]
remove_associated_key4,200[0, 0]
remove_contract_user_group200[0, 0, 0, 0]
remove_contract_user_group_urefs200[0, 0, 0, 0, 0, 0]
remove_key61,000[0, 3,200]
ret23,000[0, 420,000]
revert500[0]
set_action_threshold74,000[0, 0]
transfer_from_purse_to_account2,500,000,000[0, 0, 0, 0, 0, 0, 0, 0, 0]
transfer_from_purse_to_purse82,000[0, 0, 0, 0, 0, 0, 0, 0]
transfer_to_account2,500,000,000[0, 0, 0, 0, 0, 0, 0]
update_associated_key4,200[0, 0, 0]
write14,000[0, 0, 0, 980]
write_local9,500[0, 1,800, 0, 520]

Protocol Operating Costs

AttributeDescriptionCost
wasmless_transfer_costDefault gas cost for a wasmless transfer.100,000,000

Auction System Contract Costs

These are the costs of calling auction system contract entrypoints.

EntrypointDescriptionCost
get_era_validatorsCost of calling the get_era_validators entrypoint.10,000
read_seigniorage_recipientsCost of calling the read_seigniorage_recipients entrypoint.10,000
add_bidCost of calling the add_bid entrypoint.2,500,000,000
withdraw_bidCost of calling the withdraw_bid entrypoint.2,500,000,000
delegateCost of calling the delegate entrypoint.2,500,000,000
undelegateCost of calling the undelegate entrypoint.2,500,000,000
run_auctionCost of calling the run_auction entrypoint.10,000
slashCost of calling the slash entrypoint.10,000
distributeCost of calling the distribute entrypoint.10,000
withdraw_delegator_rewardCost of calling the withdraw_delegator_reward entrypoint.10,000
withdraw_validator_rewardCost of calling the withdraw_validator_reward entrypoint.10,000
read_era_idCost of calling the read_era_id entrypoint.10,000
activate_bidCost of calling the activate_bid entrypoint.10,000
redelegateCost of calling the redelegate entrypoint.2,500,000,000

Mint System Contract Costs

These are the costs of calling mint system contract entrypoints.

EntrypointDescriptionCost
mintCost of calling the mint entrypoint.2,500,000,000
reduce_total_supplyCost of calling the reduce_total_supply entrypoint.10,000
createCost of calling the create entrypoint.2,500,000,000
balanceCost of calling the balance entrypoint.10,000
transferCost of calling the transfer entrypoint.10,000
read_base_round_rewardCost of calling the read_base_round_reward entrypoint.10,000
mint_into_existing_purseCost of calling the mint_into_existing_purse entrypoint.2,500,000,000

Handle_Payment System Contract Costs

These are the costs of calling entrypoints on the handle_payment system contract.

EntrypointDescriptionCost
get_payment_purseCost of calling the get_payment_purse entrypoint.10,000
set_refund_purseCost of calling the set_refund_purse entrypoint.10,000
get_refund_purseCost of calling the get_refund_purse entrypoint.10,000
finalize_paymentCost of calling the finalize_payment entrypoint.10,000

Standard_Payment System Contract Costs

These settings manage the costs of calling entrypoints on the standard_payment system contract.

EntrypointDescriptionCost
payCost of calling the pay entrypoint and sending an amount to a payment purse.10,000