ContractCreate

ContractCreateTransactionBody

Start a new smart contract instance. After the instance is created, the ContractID for it is in the receipt, or can be retrieved with a GetByKey query, or by asking for a Record of the transaction to be created, and retrieving that. The instance will run the bytecode stored in the given file, referenced either by FileID or by the transaction ID of the transaction that created the file. The constructor will be executed using the given amount of gas, and any unspent gas will be refunded to the paying account. Constructor inputs come from the given constructorParameters.

Field

Type

Description

fileID

FileID

the file containing the smart contract byte code. A copy will be made and held by the contract instance, and have the same expiration time as the instance. The file is referenced one of two ways:

adminKey

Key

the state of the instance and its fields can be modified arbitrarily if this key signs a transaction to modify it. If this is null, then such modifications are not possible, and there is no administrator that can override the normal operation of this smart contract instance. Note that if it is created with no admin keys, then there is no administrator to authorize changing the admin keys, so there can never be any admin keys for that instance.

gas

int64

gas to run the constructor

initialBalance

int64

initial number of tinybars to put into the cryptocurrency account associated with and owned by the smart contract

proxyAccountID

AccountID

ID of the account to which this account is proxy staked. If proxyAccountID is null, or is an invalid account, or is an account that isn't a node, then this account is automatically proxy staked to a node chosen by the network, but without earning payments. If the proxyAccountID account refuses to accept proxy staking , or if it is not currently running a node, then it will behave as if proxyAccountID was null.

autoRenewPeriod

Duration

the instance will charge its account every this many seconds to renew for this long

constructorParameters

bytes

parameters to pass to the constructor

shardID

ShardID

shard in which to create this

realmID

RealmID

realm in which to create this (leave this null to create a new realm)

newRealmAdminKey

Key

if realmID is null, then this the admin key for the new realm that will be created

memo

string

the memo that was submitted as part of the contract (max 100 bytes)