FileCreate

FileCreateTransactionBody

‌Create a new file, containing the given contents. After the file is created, the FileID for it can be found in the receipt, or record, or retrieved with a GetByKey query. The file contains the specified contents (possibly empty). The file will automatically disappear at the expirationTime, unless its expiration is extended by another transaction before that time. If the file is deleted, then its contents will become empty and it will be marked as deleted until it expires, and then it will cease to exist.

The keys field is a list of keys. All the keys on the list must sign to create or modify a file, but only one of them needs to sign in order to delete the file. Each of those “keys” may itself be threshold key containing other keys (including other threshold keys). In other words, the behavior is an AND for create/modify, OR for delete. This is useful for acting as a revocation server. If it is desired to have the behavior be AND for all 3 operations (or OR for all 3), then the list should have only a single Key, which is a threshold key, with N=1 for OR, N=M for AND. If a file is created without ANY keys in the keys field, the file is immutable and ONLY the expirationTime of the file can be changed with a FileUpdate transaction. The file contents or its keys cannot be changed.

An entity (account, file, or smart contract instance) must be created in a particular realm. If the realmID is left null, then a new realm will be created with the given admin key. If a new realm has a null adminKey, then anyone can create/modify/delete entities in that realm. But if an admin key is given, then any transaction to create/modify/delete an entity in that realm must be signed by that key, though anyone can still call functions on smart contract instances that exist in that realm. A realm ceases to exist when everything within it has expired and no longer exists. The current API ignores shardID, realmID, and newRealmAdminKey, and creates everything in shard 0 and realm 0, with a null key. Future versions of the API will support multiple realms and multiple shards.

FieldTypeDescription

expirationTime

Timestamp

The time at which this file should expire (unless FileUpdateTransaction is used before then to extend its life)

keys

KeyList

All these keys must sign to create or modify the file. Any one of them can sign to delete the file.

contents

​Content

The bytes that are the contents of the file

shardID

ShardID

Shard in which this file is created

realmID

RealmID

The Realm in which to the file is created (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 associated with the file (UTF-8 encoding max 100 bytes)

Last updated