Skip to main content
Version: Next

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.1_117_587

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_key1_200_000[0, 0, 0]
add_contract_version200[0, 0, 0, 0, 120_000, 0, 0, 0, 30_000, 0, 0]
blake2b1_200_000[0, 120_000, 0, 0]
call_contract300_000_000[0, 0, 0, 120_000, 0, 120_000, 0]
call_versioned_contract300_000_000[0, 0, 0, 0, 120_000, 0, 120_000, 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_000_000[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, 120_000, 0, 120_000]
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_key100_000_000[0, 120_000, 0, 120_000]
read_host_buffer3_500[0, 310, 0]
read_value60_000[0, 120_000, 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, 120_000]
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_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]
dictionary_put9_500[0, 1_800, 0, 520]
enable_contract_version200[0, 0, 0, 0]
manage_message_topic200[0, 30_000, 0, 0]
emit_message200[0, 30_000, 0, 120_000]
cost_increase_per_message50

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
change_bid_public_keyCost of calling the change_bid_public_key entrypoint.5_000_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
burnCost of calling the burn 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