ContractCreateTransaction - Test specification
Description:
This test specification for ContractCreateTransaction
is part of comprehensive testing for Hiero SDKs. The SDK under test will leverage the JSON-RPC server responses to drive and validate the test outcomes.
Design:
Each test within the test specification is linked to one of the properties within ContractCreateTransaction. Each property is tested using a mix of boundary conditions. The inputs for each test include a range of valid, minimum, maximum, negative, and invalid values for the method. The expected response of a passed test can be either a specific error code or confirmation that the transaction succeeded through network state changes.
A successful contract creation transaction (i.e., the transaction reached consensus and the contract was deployed) can be confirmed by retrieving a TransactionReceipt or TransactionRecord, or by issuing a ContractInfoQuery to verify the existence of the new contract. The Mirror Node REST API can also be used to verify transaction status and associated entity creation. Error codes are derived from the Hedera ResponseCode.proto definitions and reflect both network-level and contract-level execution outcomes.
Transaction Properties:
Response Codes:
ContractCreate protobuf:
Mirror Node APIs:
- Contract info: https://mainnet.mirrornode.hedera.com/api/v1/docs/#/contracts/getContract
- Create results: https://mainnet.mirrornode.hedera.com/api/v1/docs/#/contracts/getContractResultsByContractId
Smart Contracts:
- contracts: https://github.com/hashgraph/hedera-smart-contracts/tree/main/contracts
- system contracts: https://github.com/hashgraph/hedera-smart-contracts/tree/main/contracts/system-contracts
JSON-RPC API Endpoint Documentation
Method Name
createContract
Input Parameters
Parameter Name | Type | Required/Optional | Description/Notes |
---|---|---|---|
bytecodeFileId | string | optional | ID of file containing contract bytecode |
adminKey | string | optional | Key controlling contract (updatable/delete) |
gas | int64 | optional | Gas limit for contract creation |
initialBalance | string | optional | Tinybar amount to send to the contract account at creation |
constructorParameters | hex string | optional | ABI‑encoded constructor params |
autoRenewPeriod | string | optional | Seconds until the contract is renewed |
autoRenewAccountId | string | optional | Account to fund contract renewals |
memo | string | optional | UTF‑8 memo for contract |
stakedAccountId | string | optional | Account to stake the contract account to |
stakedNodeId | string | optional | Node to stake to the contract account to |
declineStakingReward | bool | optional | Decline reward on staking the contract account |
maxAutomaticTokenAssociation | int32 | optional | The number of automatic token associations for the contract account |
initcode | string | optional | The source for the smart contract EVM bytecode |
commonTransactionParams | json object | optional | Standard fields: payer, signers, maxFee, etc. |
Output Parameters
Parameter Name | Type | Description/Notes |
---|---|---|
contractId | string | The ID of the created contract (x.y.z) |
status | string | Hedera network response code from TransactionReceipt |
Property Tests
Bytecode File ID
- The file ID that contains the bytecode for the smart contract. The bytecode must be deployed to a file via FileCreateTransaction and the resulting file ID would be used as a valid file ID.
Test no | Name | Input | Expected Response | Implemented (Y/N) |
---|---|---|---|---|
1 | Create a contract with valid file containing bytecode | bytecodeFileId=<VALID_FILE_ID> | Transaction succeeds, contract exists via ContractInfoQuery . | Y |
2 | Create a contract with bytecodeFileId which contains incorrect bytecode (0x60006000fe ) | bytecodeFileId=<VALID_FILE_ID> | Fails with CONTRACT_EXECUTION_EXCEPTION from network. | Y |
3 | Create a contract with bytecodeFileId which does not exist | bytecodeFileId="0.0.9999999" | Fails with INVALID_FILE_ID . | Y |
4 | Create a contract with a valid file ID but no content | bytecodeFileId=<VALID_FILE_ID> | Fails with CONTRACT_FILE_EMPTY . | Y |
5 | Create and deploy a valid ERC-20 contract | bytecodeFileId=<VALID_FILE_ID> | Succeeds with expected result | Y |
6 | Create and deploy a valid ERC-721 contract | bytecodeFileId=<VALID_FILE_ID> | Succeeds with expected result | Y |
7 | Create and deploy a valid contract that uses the Hiero account service system contract | bytecodeFileId=<VALID_FILE_ID> | Succeeds, returns contract ID | Y |
8 | Create and deploy a valid contract that uses the Hiero token service system contract | bytecodeFileId=<VALID_FILE_ID> | Succeeds, returns contract ID | Y |
9 | Create and deploy a valid contract that uses the Hiero schedule service system contract | bytecodeFileId=<VALID_FILE_ID> | Succeeds, returns contract ID | Y |
10 | Create and deploy a valid contract that uses the the Hiero exchange rate system contract | bytecodeFileId=<VALID_FILE_ID> | Succeeds, returns contract ID | Y |
11 | Create and deploy a valid contract that uses the Hiero psuedo random number generator system contract | bytecodeFileId=<VALID_FILE_ID> | Succeeds, returns contract ID | Y |
12 | Create and deploy a valid contract and set the payer account that does not have sufficient funds | bytecodeFileId=<VALID_FILE_ID> | Fails with 'INSUFFICIENT_PAYER_BALANCE` | Y |
13 | Create and deploy a valid contract and set the file ID to be a system file for exchange rate - 0.0.112 | bytecodeFileId=<0.0.112> | Fails with INVALID_FILE_ID | Y |
14 | Create and deploy a valid contract and set the file ID to be a deleted file ID | bytecodeFileId=<VALID_FILE_ID> | Fails with FILE_DELETED | Y |
Initcode
- Initcode represents the raw bytes of the smart contract creation logic that are directly included in the transaction.
Test no | Name | Input | Expected Response | Implemented (Y/N) |
---|---|---|---|---|
1 | Create a contract with valid initcode under the transaction size limit | initcode=<VALID_INITCODE_HEX> | Transaction succeeds; contract is created and bytecode recorded in state. | Y |
2 | Create a contract with missing initcode AND missing bytecodeFileId | Transaction fails with CONTRACT_BYTECODE_EMPTY . | Y | |
3 | Create a contract with both valid initcode and valid bytecodeFileId supplied | initcode=<VALID_INITCODE_HEX>, bytecodeFileId=<VALID_FILE_ID> | Transaction succeeds. | Y |
4 | Create a contract with an invalid initcode hex string | initcode="0xZZ" | Fails with an SDK internal error. | Y |
5 | Create a contract with a valid initcode with constructorParameters | initcode=<VALID_INITCODE_HEX>, constructorParameters=<VALID_ABI_ENCODED_HEX> | Transaction succeeds; constructor runs with provided params (verify via ContractFunctionResult on mirror node). | Y |
6 | Create a contract with a valid initcode but insufficient gas | initcode=<VALID_INITCODE_HEX>, gas="0" | Transaction fails with INSUFFICIENT_GAS . | Y |
7 | Create a contract with empty bytecode | bytecodeFileId=<VALID_FILE_ID> | Fails with CONTRACT_BYTECODE_EMPTY . | Y |
Admin Key
- Admin Key is an optional key that grants administrative control over the smart contract.
Test no | Name | Input | Expected Response | Implemented |
---|---|---|---|---|
1 | Create a contract with a valid ED25519 public key as its admin key | adminKey=<VALID_ED25519_PUBLIC_KEY>, commonTransactionParams.signers=[<CORRESPONDING_VALID_ED25519_PRIVATE_KEY>] | Transaction succeeds, adminKey reflected in getContract . | Y |
2 | Create a contract with a valid ECDSA key as its admin key | adminKey=<VALID_ECDSA_PUBLIC_KEY>, commonTransactionParams.signers=[<CORRESPONDING_VALID_ECDSA_PRIVATE_KEY>] | Transaction succeeds, adminKey reflected in getContract . | Y |
3 | Create a contract wtith an Invalid key format | adminKey=<INVALID_PUBLIC_KEY> | Fails with SDK error. | Y |
4 | Create a contract with no adminKey | initcode=<VALID_INITCODE_HEX> | Transaction succeeds, the admin key is the to the contractID of the created contract. Contract is immutable | Y |
5 | Create a contract with an admin key too large | adminKey=<OVERSIZED_KEY> | Fails with an SDK internal error. | Y |
6 | Create a contract with an ED25519 complex admin key structure | ED25519 adminKey= 13/26 each with 3 keys in its sub threshold | Transaction suceeds with SUCCESS | Y |
7 | Create a contract with an ECDSA complex admin key structure | ECDSA adminKey= 13/26 each with 3 keys in its sub threshold | Transaction suceeds with SUCCESS | Y |
8 | Create a contract with an ED25519 private key as the admin key | ED25519 adminKey=<VALID_ED25519_PRIVATE_KEY> | Transaction succeeds | Y |
9 | Create a contract with an ECDSA private key as the admin key | ECDSA adminKey=<VALID_ECDSA_PRIVATE_KEY> | Transaction succeeds | Y |
10 | Create a contract with valid KeyList of ED25519 and ECDSAsecp256k1 private and public keys as its admin key | adminKey=<VALID_KEYLIST>, commonTransactionParams.signers=[<KEYS_IN_KEYLIST>] | Transaction suceeds | Y |
11 | Create a contract with a valid ThresholdKey of ED25519 and ECDSAsecp256k1 private and public keys as its admin key | adminKey=<VALID_THRESHOLD_KEY>, commonTransactionParams.signers=[<KEYS_IN_THRESHOLD_KEY>] | Transaction succeeds | Y |
12 | Create a contract with a valid key as the admin key but do not sign with it | adminKey=<VALID_KEY> | The token creation fails with an INVALID_SIGNATURE response code from the network. | Y |
Gas
- Gas is the amount of computational effort (measured in gas units) allocated for contract creation and constructor execution within the EVM.
Test no | Name | Input | Expected Response | Implemented |
---|---|---|---|---|
1 | Create contract with admin key and reasonable gas | adminKey=<VALID_ADMIN_KEY>, gas="1000000", commonTransactionParams.signers=[<VALID_ADMIN_KEY>] | Transaction succeeds, contract deployed. | Y |
2 | Create contract without admin key and reasonable gas | gas="1000000" | Transaction succeeds, contract deployed. | Y |
3 | Create contract with admin key and zero gas | adminKey=<VALID_ADMIN_KEY>, gas="0", commonTransactionParams.signers=[<VALID_ADMIN_KEY>] | Fails with INSUFFICIENT_GAS . | Y |
4 | Create contract without admin key and zero gas | gas="0" | Fails with INSUFFICIENT_GAS . | Y |
5 | Create contract with admin key and negative gas | adminKey=<VALID_ADMIN_KEY>, gas="-1", commonTransactionParams.signers=[<VALID_ADMIN_KEY>] | Fails with internal SDK error. | Y |
6 | Create contract without admin key and negative gas | gas="-1" | Fails with internal SDK error. | Y |
7 | Create contract with admin key and gas -9,223,372,036,854,775,808 (int64 min) | adminKey=<VALID_ADMIN_KEY>, gas="-9,223,372,036,854,775,808", commonTransactionParams.signers=[<VALID_ADMIN_KEY>] | The transaction fails | Y |
8 | Create contract without admin key and gas -9,223,372,036,854,775,808 (int64 min) | gas="-9,223,372,036,854,775,808" | The transaction fails | Y |
9 | Create contract with admin key and gas -9,223,372,036,854,775,807 (int64 min + 1) | adminKey=<VALID_ADMIN_KEY>, gas="-9,223,372,036,854,775,807", commonTransactionParams.signers=[<VALID_ADMIN_KEY>] | The transaction fails | Y |
10 | Create contract without admin key and gas -9,223,372,036,854,775,807 (int64 min + 1) | gas="-9,223,372,036,854,775,807" | The transaction fails | Y |
Initial Balance
- The initial balance of the contract in HBAR.
Test no | Name | Input | Expected Response | Implemented |
---|---|---|---|---|
1 | Create a contract with an admin key and valid initial balance | adminKey=<VALID_ADMIN_KEY>, initialBalance="1000", commonTransactionParams.signers=[<VALID_ADMIN_KEY>] | Transaction succeeds; ContractInfo.balance reflects change. | Y |
2 | Create a contract with no admin key and valid initial balance | initialBalance="1000" | Transaction succeeds; ContractInfo.balance reflects change. | Y |
3 | Create a contract with an admin key and with zero initial balance | adminKey=<VALID_ADMIN_KEY>, initialBalance="0", commonTransactionParams.signers=[<VALID_ADMIN_KEY>] | Succeeds, balance remains zero. | Y |
4 | Create a contract with no admin key and with zero initial balance | initialBalance="0" | Succeeds, balance remains zero. | Y |
5 | Create a contract with an admin key and negative balance | adminKey=<VALID_ADMIN_KEY>, initialBalance="-100", commonTransactionParams.signers=[<VALID_ADMIN_KEY>] | Fails with CONTRACT_NEGATIVE_VALUE . | Y |
6 | Create a contract with no admin key and negative balance | initialBalance="-100" | Fails with CONTRACT_NEGATIVE_VALUE . | Y |
7 | Create a contract with an admin key and greater than payer balance | adminKey=<VALID_ADMIN_KEY>, initialBalance=<PAYER_BALANCE>+1, commonTransactionParams.signers=[<VALID_ADMIN_KEY>] | Fails with INSUFFICIENT_PAYER_BALANCE . | Y |
8 | Create a contract with no admin key and greater than payer balance | initialBalance=<PAYER_BALANCE>+1 | Fails with INSUFFICIENT_PAYER_BALANCE . | Y |
9 | Create contract with admin key and initial balance = int64 min | adminKey=<VALID_ADMIN_KEY>, initialBalance="-9223372036854775808", commonTransactionParams.signers=[<VALID_ADMIN_KEY>] | Fails with CONTRACT_NEGATIVE_VALUE . | Y |
10 | Create contract without admin key and initial balance = int64 min | initialBalance="-9223372036854775808" | Fails with CONTRACT_NEGATIVE_VALUE . | Y |
11 | Create contract with admin key and initial balance = int64 min + 1 | adminKey=<VALID_ADMIN_KEY>, initialBalance="-9223372036854775807", commonTransactionParams.signers=[<VALID_ADMIN_KEY>] | Fails with CONTRACT_NEGATIVE_VALUE . | Y |
12 | Create contract without admin key and initial balance = int64 min + 1 | initialBalance="-9223372036854775807" | Fails with CONTRACT_NEGATIVE_VALUE . | Y |
13 | Create contract with admin key and initial balance = int64 max - 1 | adminKey=<VALID_ADMIN_KEY>, initialBalance="9223372036854775806", commonTransactionParams.signers=[<VALID_ADMIN_KEY>] | Fails with INSUFFICIENT_PAYER_BALANCE . | Y |
14 | Create contract without admin key and initial balance = int64 max - 1 | initialBalance="9223372036854775806" | Fails with INSUFFICIENT_PAYER_BALANCE . | Y |
15 | Create contract with admin key and initial balance = int64 max | adminKey=<VALID_ADMIN_KEY>, initialBalance="9223372036854775807", commonTransactionParams.signers=[<VALID_ADMIN_KEY>] | Fails with INSUFFICIENT_PAYER_BALANCE . | Y |
16 | Create contract without admin key and initial balance = int64 max | initialBalance="9223372036854775807" | Fails with INSUFFICIENT_PAYER_BALANCE . | Y |
Constructor Parameters
- Constructor Parameters are the ABI-encoded arguments passed to the contract's constructor during deployment.
Test no | Name | Input | Expected Response | Implemented |
---|---|---|---|---|
1 | Create contract with admin key and valid ABI‑encoded parameters | adminKey=<VALID_ADMIN_KEY>, constructorParameters=<VALID_HEX>, commonTransactionParams.signers=[<VALID_ADMIN_KEY>] | Succeeds, bytecode's constructor invoked correctly. | Y |
2 | Create contract without admin key and valid ABI‑encoded parameters | constructorParameters=<VALID_HEX> | Succeeds, bytecode's constructor invoked correctly. | Y |
3 | Create contract with admin key and invalid hex string | adminKey=<VALID_ADMIN_KEY>, constructorParameters="0xZZ", commonTransactionParams.signers=[<VALID_ADMIN_KEY>] | Fails with SDK error | Y |
4 | Create contract without admin key and invalid hex string | constructorParameters="0xZZ" | Fails with SDK error | Y |
5 | Create contract with admin key and oversized constructor parameters | adminKey=<VALID_ADMIN_KEY>, constructorParameters=oversize, commonTransactionParams.signers=[<VALID_ADMIN_KEY>] | Fails with CONTRACT_REVERT_EXECUTED . | Y |
6 | Create contract without admin key and oversized constructor parameters | constructorParameters=oversize | Fails with CONTRACT_REVERT_EXECUTED . | Y |
Auto-Renew Period
- The period at which the auto renew account should be charged for the contract's rent.
Test no | Name | Input | Expected Response | Implemented |
---|---|---|---|---|
1 | Creates a contract with valid auto renew period | adminKey=<VALID_ADMIN_KEY>, autoRenewPeriod="7000000", commonTransactionParams.signers=[<VALID_ADMIN_KEY>] | Transaction succeeds, auto renew period reflected in contract info. | Y |
2 | Creates a contract with minimum auto renew period | adminKey=<VALID_ADMIN_KEY>, autoRenewPeriod="2592000", commonTransactionParams.signers=[<VALID_ADMIN_KEY>] | Transaction succeeds, auto renew period reflected in contract info. | Y |
3 | Creates a contract with maximum auto renew period | adminKey=<VALID_ADMIN_KEY>, autoRenewPeriod="8000001", commonTransactionParams.signers=[<VALID_ADMIN_KEY>] | Transaction succeeds, auto renew period reflected in contract info. | Y |
4 | Creates a contract with auto renew period below minimum | adminKey=<VALID_ADMIN_KEY>, autoRenewPeriod="2591999", commonTransactionParams.signers=[<VALID_ADMIN_KEY>] | Fails with AUTORENEW_DURATION_NOT_IN_RANGE . | Y |
5 | Creates a contract with auto renew period above maximum | adminKey=<VALID_ADMIN_KEY>, autoRenewPeriod="300000", commonTransactionParams.signers=[<VALID_ADMIN_KEY>] | Fails with AUTORENEW_DURATION_NOT_IN_RANGE . | Y |
6 | Creates a contract with auto renew period of zero | adminKey=<VALID_ADMIN_KEY>, autoRenewPeriod="0", commonTransactionParams.signers=[<VALID_ADMIN_KEY>] | Fails with INVALID_RENEWAL_PERIOD . | Y |
7 | Creates a contract with negative auto renew period | adminKey=<VALID_ADMIN_KEY>, autoRenewPeriod="-1", commonTransactionParams.signers=[<VALID_ADMIN_KEY>] | Fails with INVALID_RENEWAL_PERIOD . | Y |
8 | Creates a contract with auto renew period of int64 max | adminKey=<VALID_ADMIN_KEY>, autoRenewPeriod="9223372036854775807", commonTransactionParams.signers=[<VALID_ADMIN_KEY>] | Fails with AUTORENEW_DURATION_NOT_IN_RANGE . | Y |
9 | Creates a contract with auto renew period of int64 min | adminKey=<VALID_ADMIN_KEY>, autoRenewPeriod="-9223372036854775808", commonTransactionParams.signers=[<VALID_ADMIN_KEY>] | Fails with INVALID_RENEWAL_PERIOD . | Y |
10 | Creates a contract without auto renew period | adminKey=<VALID_ADMIN_KEY>, commonTransactionParams.signers=[<VALID_ADMIN_KEY>] | Transaction succeeds, default auto renew period applied. | Y |
Autorenew Account ID
- The account that will be charged for renewing the contract's auto-renewal period.
Test no | Name | Input | Expected Response | Implemented |
---|---|---|---|---|
1 | Create a contract with valid auto renew account | autoRenewAccountId=<VALID_ACCOUNT_ID>, commonTransactionParams.signers=[<AUTO_RENEW_ACCOUNT_PRIVATE_KEY>] | Transaction succeeds, reflected in contract info. | Y |
2 | Create a contract with non-existent auto renew account | autoRenewAccountId="0.0.999999" | Fails with INVALID_AUTORENEW_ACCOUNT . | Y |
3 | Create a contract with deleted auto renew account | autoRenewAccountId=<DELETED_ACCOUNT_ID> | Fails with INVALID_SIGNATURE . | Y |
4 | Create a contract with no auto renew account | (no autoRenewAccountId field) | Transaction succeeds, default behavior applied. | Y |
5 | Create a contract with invalid auto renew account format | autoRenewAccountId="invalid" | Fails with SDK internal error. | Y |
Memo
- A short text description that lives with the contract entity on is visable on a network explorer.
Test no | Name | Input | Expected Response | Implemented |
---|---|---|---|---|
1 | Create a contract with an admin key and valid short memo | adminKey=<VALID_ADMIN_KEY>, memo="contract test", commonTransactionParams.signers=[<VALID_ADMIN_KEY>] | Succeeds, memo stored. | Y |
2 | Create a contract without an admin key and valid short memo | memo="contract test" | Succeeds, memo stored. | Y |
3 | Create a contract with an admin key and empty memo | adminKey=<VALID_ADMIN_KEY>, memo="", commonTransactionParams.signers=[<VALID_ADMIN_KEY>] | Succeeds, memo is empty. | Y |
4 | Create a contract without an admin key and empty memo | memo="" | Succeeds, memo is empty. | Y |
5 | Create a contract with an admin key and max-length (100 bytes) | adminKey=<VALID_ADMIN_KEY>, memo=<100‑byte string>, commonTransactionParams.signers=[<VALID_ADMIN_KEY>] | Succeeds, memo stored. | Y |
6 | Create a contract without an admin key and max-length (100 bytes) | memo=<100‑byte string> | Succeeds, memo stored. | Y |
7 | Create a contract without an admin key and exceeds memo length | memo=<101‑byte string> | Fails with MEMO_TOO_LONG . | Y |
8 | Create a contract with an admin key and exceeds memo length | adminKey=<VALID_ADMIN_KEY>, memo=<101‑byte string>, commonTransactionParams.signers=[<VALID_ADMIN_KEY>] | Fails with MEMO_TOO_LONG . | Y |
9 | Create a contract with an admin key and invalid character (e.g. null byte) | adminKey=<VALID_ADMIN_KEY>, memo="bad\0memo", commonTransactionParams.signers=[<VALID_ADMIN_KEY>] | Fails with INVALID_ZERO_BYTE_IN_STRING . | Y |
10 | Create a contract without an admin key and invalid character (e.g. null byte) | memo="bad\0memo" | Fails with INVALID_ZERO_BYTE_IN_STRING . | Y |
Staked Account/Node ID
- The account ID or node ID you would stake the contract account to earn staking rewards.
Test no | Name | Input | Expected Response | Implemented |
---|---|---|---|---|
1 | Create a contract that does not have an admin key and is staked to valid account ID | stakedAccountId="<ACCOUNT_ID>" | Succeeds, contract staking reflected. | Y |
2 | Create a contract that does not have an admin key and staked to valid node ID | stakedNodeId="<VALID_NODE_ID>" | Succeeds, staking reflected. | Y |
3 | Create a contract that does not have an admin key and that has an invalid stakedAccountId | stakedAccountId="0.0.99999" | Fails with INVALID_STAKING_ID . | Y |
4 | Create a contract that does not have an admin key and has an invalid stakedNodeId | stakedNodeId="9999999" | Fails with INVALID_STAKING_ID . | Y |
5 | Create a contract that does not have an admin key and that tries to set both stakedAccountId and stakedNodeId present | both fields set | Succeeds. | Y |
6 | Create a contract that does have an admin key and is staked to valid account ID | adminKey=<VALID_ADMIN_KEY>, stakedAccountId="<ACCOUNT_ID>", commonTransactionParams.signers=[<VALID_ADMIN_KEY>] | Succeeds, contract staking reflected. | Y |
7 | Create a contract that does have an admin key and staked to valid node ID | adminKey=<VALID_ADMIN_KEY>, stakedNodeId="<VALID_NODE_ID>", commonTransactionParams.signers=[<VALID_ADMIN_KEY>] | Succeeds, staking reflected. | Y |
8 | Create a contract that does have an admin key and that has an invalid stakedAccountId | adminKey=<VALID_ADMIN_KEY>, stakedAccountId="0.0.99999", commonTransactionParams.signers=[<VALID_ADMIN_KEY>] | Fails with INVALID_STAKING_ID . | Y |
9 | Create a contract that does have an admin key and has an invalid stakedNodeId | adminKey=<VALID_ADMIN_KEY>, stakedNodeId="9999999", commonTransactionParams.signers=[<VALID_ADMIN_KEY>] | Fails with INVALID_STAKING_ID . | Y |
10 | Create a contract that does have an admin key and that tries to set both stakedAccountId and stakedNodeId present | adminKey=<VALID_ADMIN_KEY>, both fields set, commonTransactionParams.signers=[<VALID_ADMIN_KEY>] | Succeeds. | Y |
11 | Create a contract that does have an admin key and that tries to stake to a deleted account ID | adminKey=<VALID_ADMIN_KEY>, stakedAccountId = "<VALID_ACCOUNT_ID>", commonTransactionParams.signers=[<VALID_ADMIN_KEY>] | Fails | Y |
Decline Staking Reward
- A flag indicating that this smart contract declines to receive any reward for staking its HBAR balance to help secure the network.
Test no | Name | Input | Expected Response | Implemented |
---|---|---|---|---|
1 | Create a contract with an admin key that decline staking rewards | adminKey=<VALID_ADMIN_KEY>, declineStakingReward=true, commonTransactionParams.signers=[<VALID_ADMIN_KEY>] | Succeeds; contract staking reward declined. | Y |
2 | Create a contract with no admin key that decline staking rewards | declineStakingReward=true | Succeeds; contract staking reward declined. | Y |
3 | Create a contract with an admin key that that accept staking rewards | adminKey=<VALID_ADMIN_KEY>, declineStakingReward=false, commonTransactionParams.signers=[<VALID_ADMIN_KEY>] | Succeeds; contract eligible for staking reward. | Y |
4 | Create a contract with no admin key that accept staking rewards | declineStakingReward=false | Succeeds; contract eligible for staking reward. | Y |
Max Automatic Associations
- The maximum number of tokens that can be auto-associated with this smart contract.
Test no | Name | Input | Expected Response | Implemented |
---|---|---|---|---|
1 | Create contract with admin key and maxAutomaticTokenAssociations = 0 | adminKey=<VALID_ADMIN_KEY>, maxAutomaticTokenAssociations=0, commonTransactionParams.signers=[<VALID_ADMIN_KEY>] | Transaction succeeds; contract created with no auto associations | Y |
2 | Create contract without admin key and maxAutomaticTokenAssociations = 0 | adminKey=none, maxAutomaticTokenAssociations=0 | Transaction succeeds; contract created with no auto associations | Y |
3 | Create contract with admin key and maxAutomaticTokenAssociations = 10 | adminKey=<VALID_ADMIN_KEY>, maxAutomaticTokenAssociations=10, commonTransactionParams.signers=[<VALID_ADMIN_KEY>] | Transaction succeeds; contract allows up to 10 auto associations | Y |
4 | Create contract without admin key and maxAutomaticTokenAssociations = 10 | adminKey=none, maxAutomaticTokenAssociations=10 | Transaction succeeds; contract allows up to 10 auto associations | Y |
5 | Create contract with admin key and maxAutomaticTokenAssociations = 1000 | adminKey=<VALID_ADMIN_KEY>, maxAutomaticTokenAssociations=1000, commonTransactionParams.signers=[<VALID_ADMIN_KEY>] | Transaction succeeds; contract allows up to 1000 auto associations | Y |
6 | Create contract without admin key and maxAutomaticTokenAssociations = 1000 | adminKey=none, maxAutomaticTokenAssociations=1000 | Transaction succeeds; contract allows up to 1000 auto associations | Y |
7 | Create contract with admin key and maxAutomaticTokenAssociations = -1 (no-limit per HIP-904) | adminKey=<VALID_ADMIN_KEY>, maxAutomaticTokenAssociations=-1, commonTransactionParams.signers=[<VALID_ADMIN_KEY>] | Transaction succeeds; no limit on auto associations | Y |
8 | Create contract without admin key and maxAutomaticTokenAssociations = -1 (no-limit per HIP-904) | adminKey=none, maxAutomaticTokenAssociations=-1 | Transaction succeeds; no limit on auto associations | Y |
9 | Create contract with admin key and invalid negative maxAutomaticTokenAssociations = -2 | adminKey=<VALID_ADMIN_KEY>, maxAutomaticTokenAssociations=-2, commonTransactionParams.signers=[<VALID_ADMIN_KEY>] | Transaction fails with INVALID_AUTOMATIC_ASSOCIATION_LIMIT | Y |
10 | Create contract without admin key and invalid negative maxAutomaticTokenAssociations = -2 | adminKey=none, maxAutomaticTokenAssociations=-2 | Transaction fails with INVALID_AUTOMATIC_ASSOCIATION_LIMIT | Y |
11 | Create contract with admin key and maxAutomaticTokenAssociations equal to used_auto_associations (3) | adminKey=<VALID_ADMIN_KEY>, maxAutomaticTokenAssociations=3, commonTransactionParams.signers=[<VALID_ADMIN_KEY>] | Transaction succeeds; must manually associate additional tokens | Y |
12 | Create contract without admin key and maxAutomaticTokenAssociations equal to used_auto_associations | adminKey=none, maxAutomaticTokenAssociations=3 | Transaction succeeds; must manually associate additional tokens | Y |
13 | Create contract with admin key and maxAutomaticTokenAssociations < used_auto_associations (1 < 3) | adminKey=<VALID_ADMIN_KEY>, maxAutomaticTokenAssociations=1, commonTransactionParams.signers=[<VALID_ADMIN_KEY>] | Transaction succeeds; must manually associate additional tokens | Y |
14 | Create contract without admin key and maxAutomaticTokenAssociations < used_auto_associations (1 < 3) | adminKey=none, maxAutomaticTokenAssociations=1 | Transaction succeeds; must manually associate additional tokens | Y |
15 | Create contract without admin key and maxAutomaticTokenAssociations = 2,147,483,647 | adminKey=none, maxAutomaticTokenAssociations=2147483647 | Transaction fails with REQUESTED_NUM_AUTOMATIC_ASSOCIATIONS_EXCEEDS_ASSOCIATION_LIMIT | Y |
16 | Create contract with admin key and maxAutomaticTokenAssociations = 2,147,483,647 | adminKey=<VALID_ADMIN_KEY>, maxAutomaticTokenAssociations=2147483647, commonTransactionParams.signers=[<VALID_ADMIN_KEY>] | Transaction fails with REQUESTED_NUM_AUTOMATIC_ASSOCIATIONS_EXCEEDS_ASSOCIATION_LIMIT | Y |
17 | Create contract without admin key and maxAutomaticTokenAssociations = -2,147,483,647 | adminKey=none, maxAutomaticTokenAssociations=-2147483647 | Transaction fails with INVALID_MAX_AUTO_ASSOCIATIONS | Y |
18 | Create contract with admin key and maxAutomaticTokenAssociations = -2,147,483,647 | adminKey=<VALID_ADMIN_KEY>, maxAutomaticTokenAssociations=-2147483647, commonTransactionParams.signers=[<VALID_ADMIN_KEY>] | Transaction fails with INVALID_MAX_AUTO_ASSOCIATIONS | Y |
JSON Request Example
{
"jsonrpc": "2.0",
"id": 1,
"method": "conractCreate",
"params": {
"byteCodeFileId": "0.0.1234",
"adminKey": "302E020100300506032B657004220420DE6788D0A09F20DED806F446C02FB929D8CD8D17022374AFB3739A1D50BA72C8",
"gas": "2000000000000000000000",
"initialBalance": 100,
"commonTransactionParams": {
"signers": [
"302E020100300506032B657004220420DE6788D0A09F20DED806F446C02FB929D8CD8D17022374AFB3739A1D50BA72C8"
]
}
}
}
JSON Response Example
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"status": "SUCCESS",
"contractId": "0.0.1234",
}
}