Create a file
File Properties
Field
Description
Methods
Constructor
Description
new FileCreateTransaction()Method
Type
Description
Requirement
//Create the transaction
FileCreateTransaction transaction = new FileCreateTransaction()
.addkey(fileKey)
.setContents(fileContents);
//Change the default max transaction fee to 2 hbars
FileCreateTransaction modifyMaxTransactionFee = transaction.setMaxTransactionFee(new Hbar(2));
//Prepare transaction for signing, sign with the key on the file, sign with the client operator key and submit to a Hedera network
TransactionId txId = modifyMaxTransactionFee.build(client).sign(fileKey).execute(client);
//Request the receipt
TransactionReceipt receipt = txId.getReceipt(client);
//Get the file ID
FileId newFileId = receipt.getFileId();
System.out.println("The new file ID is: " + newFileId);
//v1.3.2Get transaction values
Method
Type
Requirement
Last updated