From d2b883b84baecf0dd4a9ff2082b93ebea548f542 Mon Sep 17 00:00:00 2001 From: Georgi Georgiev Date: Thu, 13 Oct 2022 17:51:39 +0300 Subject: [PATCH 1/2] changed types from uints to ints following the changes to the hedera token service interface and contract changes Signed-off-by: Georgi Georgiev --- services/BasicTypes.proto | 8 ++++---- services/SchedulableTransactionBody.proto | 2 +- services/TokenBurn.proto | 2 +- services/TokenCreate.proto | 4 ++-- services/TokenGetInfo.proto | 4 ++-- services/TokenMint.proto | 2 +- services/TokenWipeAccount.proto | 2 +- services/TransactionBody.proto | 2 +- services/TransactionReceipt.proto | 2 +- services/TransactionRecord.proto | 2 +- services/TransactionResponse.proto | 2 +- 11 files changed, 16 insertions(+), 16 deletions(-) diff --git a/services/BasicTypes.proto b/services/BasicTypes.proto index 2d7b4ee5..a2c5ee5a 100644 --- a/services/BasicTypes.proto +++ b/services/BasicTypes.proto @@ -455,10 +455,10 @@ message ServicesConfigurationList { message TokenRelationship { TokenID tokenId = 1; // The ID of the token string symbol = 2; // The Symbol of the token - uint64 balance = 3; // For token of type FUNGIBLE_COMMON - the balance that the Account holds in the smallest denomination. For token of type NON_FUNGIBLE_UNIQUE - the number of NFTs held by the account + int64 balance = 3; // For token of type FUNGIBLE_COMMON - the balance that the Account holds in the smallest denomination. For token of type NON_FUNGIBLE_UNIQUE - the number of NFTs held by the account TokenKycStatus kycStatus = 4; // The KYC status of the account (KycNotApplicable, Granted or Revoked). If the token does not have KYC key, KycNotApplicable is returned TokenFreezeStatus freezeStatus = 5; // The Freeze status of the account (FreezeNotApplicable, Frozen or Unfrozen). If the token does not have Freeze key, FreezeNotApplicable is returned - uint32 decimals = 6; // Tokens divide into 10decimals pieces + int32 decimals = 6; // Tokens divide into 10decimals pieces } /* A number of transferable units of a certain token. @@ -468,8 +468,8 @@ The transferable unit of a token is its smallest denomination, as given by the t Transferable units are not directly comparable across different tokens. */ message TokenBalance { TokenID tokenId = 1; // A unique token id - uint64 balance = 2; // Number of transferable units of the identified token. For token of type FUNGIBLE_COMMON - balance in the smallest denomination. For token of type NON_FUNGIBLE_UNIQUE - the number of NFTs held by the account - uint32 decimals = 3; // Tokens divide into 10decimals pieces + int64 balance = 2; // Number of transferable units of the identified token. For token of type FUNGIBLE_COMMON - balance in the smallest denomination. For token of type NON_FUNGIBLE_UNIQUE - the number of NFTs held by the account + int32 decimals = 3; // Tokens divide into 10decimals pieces } /* A sequence of token balances */ diff --git a/services/SchedulableTransactionBody.proto b/services/SchedulableTransactionBody.proto index 41f2b184..c69050f0 100644 --- a/services/SchedulableTransactionBody.proto +++ b/services/SchedulableTransactionBody.proto @@ -70,7 +70,7 @@ import "ScheduleDelete.proto"; In Hedera Services 0.13.0, it will include only CryptoTransfer and ConsensusSubmitMessage functions. */ message SchedulableTransactionBody { - uint64 transactionFee = 1; // The maximum transaction fee the client is willing to pay + int64 transactionFee = 1; // The maximum transaction fee the client is willing to pay string memo = 2; // A memo to include the execution record; the UTF-8 encoding may be up to 100 bytes and must not include the zero byte oneof data { ContractCallTransactionBody contractCall = 3; // Calls a function of a contract instance diff --git a/services/TokenBurn.proto b/services/TokenBurn.proto index 320edc9b..e87bbf20 100644 --- a/services/TokenBurn.proto +++ b/services/TokenBurn.proto @@ -35,6 +35,6 @@ Token A has 2 decimals. In order to burn 100 tokens, one must provide amount of */ message TokenBurnTransactionBody { TokenID token = 1; // The token for which to burn tokens. If token does not exist, transaction results in INVALID_TOKEN_ID - uint64 amount = 2; // Applicable to tokens of type FUNGIBLE_COMMON. The amount to burn from the Treasury Account. Amount must be a positive non-zero number, not bigger than the token balance of the treasury account (0; balance], represented in the lowest denomination. + int64 amount = 2; // Applicable to tokens of type FUNGIBLE_COMMON. The amount to burn from the Treasury Account. Amount must be a positive non-zero number, not bigger than the token balance of the treasury account (0; balance], represented in the lowest denomination. repeated int64 serialNumbers = 3; // Applicable to tokens of type NON_FUNGIBLE_UNIQUE. The list of serial numbers to be burned. } diff --git a/services/TokenCreate.proto b/services/TokenCreate.proto index fa4d4b28..4ee64c81 100644 --- a/services/TokenCreate.proto +++ b/services/TokenCreate.proto @@ -44,8 +44,8 @@ Note that a created token is immutable if the adminKey is omitte message TokenCreateTransactionBody { string name = 1; // The publicly visible name of the token, limited to a UTF-8 encoding of length tokens.maxSymbolUtf8Bytes. string symbol = 2; // The publicly visible token symbol, limited to a UTF-8 encoding of length tokens.maxTokenNameUtf8Bytes. - uint32 decimals = 3; // For tokens of type FUNGIBLE_COMMON - the number of decimal places a token is divisible by. For tokens of type NON_FUNGIBLE_UNIQUE - value must be 0 - uint64 initialSupply = 4; // Specifies the initial supply of tokens to be put in circulation. The initial supply is sent to the Treasury Account. The supply is in the lowest denomination possible. In the case for NON_FUNGIBLE_UNIQUE Type the value must be 0 + int32 decimals = 3; // For tokens of type FUNGIBLE_COMMON - the number of decimal places a token is divisible by. For tokens of type NON_FUNGIBLE_UNIQUE - value must be 0 + int64 initialSupply = 4; // Specifies the initial supply of tokens to be put in circulation. The initial supply is sent to the Treasury Account. The supply is in the lowest denomination possible. In the case for NON_FUNGIBLE_UNIQUE Type the value must be 0 AccountID treasury = 5; // The account which will act as a treasury for the token. This account will receive the specified initial supply or the newly minted NFTs in the case for NON_FUNGIBLE_UNIQUE Type Key adminKey = 6; // The key which can perform update/delete operations on the token. If empty, the token can be perceived as immutable (not being able to be updated/deleted) Key kycKey = 7; // The key which can grant or revoke KYC of an account for the token's transactions. If empty, KYC is not required, and KYC grant or revoke operations are not possible. diff --git a/services/TokenGetInfo.proto b/services/TokenGetInfo.proto index 9f2e5736..994f26b7 100644 --- a/services/TokenGetInfo.proto +++ b/services/TokenGetInfo.proto @@ -42,8 +42,8 @@ message TokenInfo { TokenID tokenId = 1; // ID of the token instance string name = 2; // The name of the token. It is a string of ASCII only characters string symbol = 3; // The symbol of the token. It is a UTF-8 capitalized alphabetical string - uint32 decimals = 4; // The number of decimal places a token is divisible by. Always 0 for tokens of type NON_FUNGIBLE_UNIQUE - uint64 totalSupply = 5; // For tokens of type FUNGIBLE_COMMON - the total supply of tokens that are currently in circulation. For tokens of type NON_FUNGIBLE_UNIQUE - the number of NFTs created of this token instance + int32 decimals = 4; // The number of decimal places a token is divisible by. Always 0 for tokens of type NON_FUNGIBLE_UNIQUE + int64 totalSupply = 5; // For tokens of type FUNGIBLE_COMMON - the total supply of tokens that are currently in circulation. For tokens of type NON_FUNGIBLE_UNIQUE - the number of NFTs created of this token instance AccountID treasury = 6; // The ID of the account which is set as Treasury Key adminKey = 7; // The key which can perform update/delete operations on the token. If empty, the token can be perceived as immutable (not being able to be updated/deleted) Key kycKey = 8; // The key which can grant or revoke KYC of an account for the token's transactions. If empty, KYC is not required, and KYC grant or revoke operations are not possible. diff --git a/services/TokenMint.proto b/services/TokenMint.proto index 756b7021..388ffc11 100644 --- a/services/TokenMint.proto +++ b/services/TokenMint.proto @@ -35,6 +35,6 @@ Token A has 2 decimals. In order to mint 100 tokens, one must provide amount of */ message TokenMintTransactionBody { TokenID token = 1; // The token for which to mint tokens. If token does not exist, transaction results in INVALID_TOKEN_ID - uint64 amount = 2; // Applicable to tokens of type FUNGIBLE_COMMON. The amount to mint to the Treasury Account. Amount must be a positive non-zero number represented in the lowest denomination of the token. The new supply must be lower than 2^63. + int64 amount = 2; // Applicable to tokens of type FUNGIBLE_COMMON. The amount to mint to the Treasury Account. Amount must be a positive non-zero number represented in the lowest denomination of the token. The new supply must be lower than 2^63. repeated bytes metadata = 3; // Applicable to tokens of type NON_FUNGIBLE_UNIQUE. A list of metadata that are being created. Maximum allowed size of each metadata is 100 bytes } diff --git a/services/TokenWipeAccount.proto b/services/TokenWipeAccount.proto index 7d7941f2..3e877b1f 100644 --- a/services/TokenWipeAccount.proto +++ b/services/TokenWipeAccount.proto @@ -43,6 +43,6 @@ import "BasicTypes.proto"; message TokenWipeAccountTransactionBody { TokenID token = 1; // The token for which the account will be wiped. If token does not exist, transaction results in INVALID_TOKEN_ID AccountID account = 2; // The account to be wiped - uint64 amount = 3; // Applicable to tokens of type FUNGIBLE_COMMON. The amount of tokens to wipe from the specified account. Amount must be a positive non-zero number in the lowest denomination possible, not bigger than the token balance of the account (0; balance] + int64 amount = 3; // Applicable to tokens of type FUNGIBLE_COMMON. The amount of tokens to wipe from the specified account. Amount must be a positive non-zero number in the lowest denomination possible, not bigger than the token balance of the account (0; balance] repeated int64 serialNumbers = 4; // Applicable to tokens of type NON_FUNGIBLE_UNIQUE. The list of serial numbers to be wiped. } diff --git a/services/TransactionBody.proto b/services/TransactionBody.proto index 43b2c288..7398902a 100644 --- a/services/TransactionBody.proto +++ b/services/TransactionBody.proto @@ -77,7 +77,7 @@ import "ScheduleSign.proto"; message TransactionBody { TransactionID transactionID = 1; // The ID for this transaction, which includes the payer's account (the account paying the transaction fee). If two transactions have the same transactionID, they won't both have an effect AccountID nodeAccountID = 2; // The account of the node that submits the client's transaction to the network - uint64 transactionFee = 3; // The maximum transaction fee the client is willing to pay + int64 transactionFee = 3; // The maximum transaction fee the client is willing to pay Duration transactionValidDuration = 4; //The transaction is invalid if consensusTimestamp > transactionID.transactionValidStart + transactionValidDuration bool generateRecord = 5 [deprecated = true]; // Should a record of this transaction be generated? (A receipt is always generated, but the record is optional) string memo = 6; // Any notes or descriptions that should be put into the record (max length 100) diff --git a/services/TransactionReceipt.proto b/services/TransactionReceipt.proto index ebee2ad3..b1800231 100644 --- a/services/TransactionReceipt.proto +++ b/services/TransactionReceipt.proto @@ -102,7 +102,7 @@ message TransactionReceipt { TokenID tokenID = 10; // In the receipt of TokenMint, TokenWipe, TokenBurn, the current total supply of this token - uint64 newTotalSupply = 11; + int64 newTotalSupply = 11; // In the receipt of a ScheduleCreate, the id of the newly created Scheduled Entity ScheduleID scheduleID = 12; diff --git a/services/TransactionRecord.proto b/services/TransactionRecord.proto index 36f207f2..9d810a52 100644 --- a/services/TransactionRecord.proto +++ b/services/TransactionRecord.proto @@ -38,7 +38,7 @@ message TransactionRecord { Timestamp consensusTimestamp = 3; // The consensus timestamp (or null if didn't reach consensus yet) TransactionID transactionID = 4; // The ID of the transaction this record represents string memo = 5; // The memo that was submitted as part of the transaction (max 100 bytes) - uint64 transactionFee = 6; // The actual transaction fee charged, not the original transactionFee value from TransactionBody + int64 transactionFee = 6; // The actual transaction fee charged, not the original transactionFee value from TransactionBody oneof body { ContractFunctionResult contractCallResult = 7; // Record of the value returned by the smart contract function (if it completed and didn't fail) from ContractCallTransaction ContractFunctionResult contractCreateResult = 8; // Record of the value returned by the smart contract constructor (if it completed and didn't fail) from ContractCreateTransaction diff --git a/services/TransactionResponse.proto b/services/TransactionResponse.proto index 542e261d..17973270 100644 --- a/services/TransactionResponse.proto +++ b/services/TransactionResponse.proto @@ -31,5 +31,5 @@ import "ResponseCode.proto"; /* When the client sends the node a transaction of any kind, the node replies with this, which simply says that the transaction passed the precheck (so the node will submit it to the network) or it failed (so it won't). If the fee offered was insufficient, this will also contain the amount of the required fee. To learn the consensus result, the client should later obtain a receipt (free), or can buy a more detailed record (not free). */ message TransactionResponse { ResponseCodeEnum nodeTransactionPrecheckCode = 1; // The response code that indicates the current status of the transaction. - uint64 cost = 2; // If the response code was INSUFFICIENT_TX_FEE, the actual transaction fee that would be required to execute the transaction. + int64 cost = 2; // If the response code was INSUFFICIENT_TX_FEE, the actual transaction fee that would be required to execute the transaction. } From a9a50039da55595581fcc234e76eca14617d8b3a Mon Sep 17 00:00:00 2001 From: Georgi Georgiev Date: Thu, 13 Oct 2022 18:38:17 +0300 Subject: [PATCH 2/2] deleting excessive basic types file Signed-off-by: Georgi Georgiev --- services/BasicTypes.proto | 478 -------------------------------------- 1 file changed, 478 deletions(-) delete mode 100644 services/BasicTypes.proto diff --git a/services/BasicTypes.proto b/services/BasicTypes.proto deleted file mode 100644 index a2c5ee5a..00000000 --- a/services/BasicTypes.proto +++ /dev/null @@ -1,478 +0,0 @@ -syntax = "proto3"; - -package proto; - -/*- - * ‌ - * Hedera Network Services Protobuf - * ​ - * Copyright (C) 2018 - 2021 Hedera Hashgraph, LLC - * ​ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ‍ - */ - -import "Timestamp.proto"; - -option java_package = "com.hederahashgraph.api.proto.java"; -option java_multiple_files = true; - -/* Each shard has a nonnegative shard number. Each realm within a given shard has a nonnegative realm number (that number might be reused in other shards). And each account, file, and smart contract instance within a given realm has a nonnegative number (which might be reused in other realms). Every account, file, and smart contract instance is within exactly one realm. So a FileID is a triplet of numbers, like 0.1.2 for entity number 2 within realm 1 within shard 0. Each realm maintains a single counter for assigning numbers, so if there is a file with ID 0.1.2, then there won't be an account or smart contract instance with ID 0.1.2. - - Everything is partitioned into realms so that each Solidity smart contract can access everything in just a single realm, locking all those entities while it's running, but other smart contracts could potentially run in other realms in parallel. So realms allow Solidity to be parallelized somewhat, even though the language itself assumes everything is serial. */ -message ShardID { - int64 shardNum = 1; //the shard number (nonnegative) -} - -/* The ID for a realm. Within a given shard, every realm has a unique ID. Each account, file, and contract instance belongs to exactly one realm. */ -message RealmID { - int64 shardNum = 1; //The shard number (nonnegative) - int64 realmNum = 2; //The realm number (nonnegative) -} - -/* The ID for an a cryptocurrency account */ -message AccountID { - int64 shardNum = 1; //The shard number (nonnegative) - int64 realmNum = 2; //The realm number (nonnegative) - int64 accountNum = 3; //A nonnegative account number unique within its realm -} - -/* The ID for a file */ -message FileID { - int64 shardNum = 1; //The shard number (nonnegative) - int64 realmNum = 2; //The realm number (nonnegative) - int64 fileNum = 3; //A nonnegative File number unique within its realm -} - -/* The ID for a smart contract instance */ -message ContractID { - int64 shardNum = 1; //The shard number (nonnegative) - int64 realmNum = 2; //The realm number (nonnegative) - int64 contractNum = 3; //A nonnegative number unique within its realm -} - -/* -The ID for a transaction. This is used for retrieving receipts and records for a transaction, for appending to a file right after creating it, for instantiating a smart contract with bytecode in a file just created, and internally by the network for detecting when duplicate transactions are submitted. A user might get a transaction processed faster by submitting it to N nodes, each with a different node account, but all with the same TransactionID. Then, the transaction will take effect when the first of all those nodes submits the transaction and it reaches consensus. The other transactions will not take effect. So this could make the transaction take effect faster, if any given node might be slow. However, the full transaction fee is charged for each transaction, so the total fee is N times as much if the transaction is sent to N nodes. -Applicable to Scheduled Transactions: -- The ID of a Scheduled Transaction has transactionValidStart and accountIDs inherited from the ScheduleCreate transaction that created it. That is to say that they are equal -- The scheduled property is true for Scheduled Transactions -- transactionValidStart, accountID and scheduled properties should be omitted -*/ -message TransactionID { - Timestamp transactionValidStart = 1; // The transaction is invalid if consensusTimestamp < transactionID.transactionStartValid - AccountID accountID = 2; // The Account ID that paid for this transaction - bool scheduled = 3; // Whether the Transaction is of type Scheduled or no -} - -/* An account, and the amount that it sends or receives during a cryptocurrency or token transfer. */ -message AccountAmount { - AccountID accountID = 1; // The Account ID that sends/receives cryptocurrency or tokens - sint64 amount = 2; // The amount of tinybars (for Crypto transfers) or in the lowest denomination (for Token transfers) that the account sends(negative) or receives(positive) -} - -/* A list of accounts and amounts to transfer out of each account (negative) or into it (positive). */ -message TransferList { - repeated AccountAmount accountAmounts = 1; // Multiple list of AccountAmount pairs, each of which has an account and an amount to transfer into it (positive) or out of it (negative) -} - -/* A sender account, a receiver account, and the serial number of an NFT of a Token with NON_FUNGIBLE_UNIQUE type. */ -message NftTransfer { - AccountID senderAccountID = 1; // The accountID of the sender - AccountID receiverAccountID = 2; // The accountID of the receiver - int64 serialNumber = 3; // The serial number of the NFT -} - -/* A list of token IDs and amounts representing the transferred out (negative) or into (positive) amounts, represented in the lowest denomination of the token */ -message TokenTransferList { - TokenID token = 1; // The ID of the token - repeated AccountAmount transfers = 2; // Applicable to tokens of type FUNGIBLE_COMMON. Multiple list of AccountAmounts, each of which has an account and amount - repeated NftTransfer nftTransfers = 3; // Applicable to tokens of type NON_FUNGIBLE_UNIQUE. Multiple list of NftTransfers, each of which has a sender and receiver account, including the serial number of the NFT -} - -/* Unique identifier for a topic (used by the consensus service) */ -message TopicID { - int64 shardNum = 1; // The shard number (nonnegative) - int64 realmNum = 2; // The realm number (nonnegative) - int64 topicNum = 3; // Unique topic identifier within a realm (nonnegative). -} - -/* Unique identifier for a token */ -message TokenID { - int64 shardNum = 1; // A nonnegative shard number - int64 realmNum = 2; // A nonnegative realm number - int64 tokenNum = 3; // A nonnegative token number -} - -/* Unique identifier for a Schedule */ -message ScheduleID { - int64 shardNum = 1; // A nonnegative shard number - int64 realmNum = 2; // A nonnegative realm number - int64 scheduleNum = 3; // A nonnegative schedule number -} - -/** - * Possible Token Types (IWA Compatibility). - * Apart from fungible and non-fungible, Tokens can have either a common or unique representation. This distinction might seem subtle, but it is important when considering - * how tokens can be traced and if they can have isolated and unique properties. - */ -enum TokenType { - /** - * Interchangeable value with one another, where any quantity of them has the same value as another equal quantity if they are in the same class. - * Share a single set of properties, not distinct from one another. Simply represented as a balance or quantity to a given Hedera account. - */ - FUNGIBLE_COMMON = 0; - /** - * Unique, not interchangeable with other tokens of the same type as they typically have different values. - * Individually traced and can carry unique properties (e.g. serial number). - */ - NON_FUNGIBLE_UNIQUE = 1; -} - - -/** - * Possible FeeData Object SubTypes. Supplementary to the main HederaFunctionality Type. - * When not explicitly specified, DEFAULT is used. - */ -enum SubType { - DEFAULT = 0; - TOKEN_FUNGIBLE_COMMON = 1; - TOKEN_NON_FUNGIBLE_UNIQUE = 2; -} - -/** - * Possible Token Supply Types (IWA Compatibility). - * Indicates how many tokens can have during its lifetime. - */ -enum TokenSupplyType { - INFINITE = 0; // Indicates that tokens of that type have an upper bound of Long.MAX_VALUE. - FINITE = 1; // Indicates that tokens of that type have an upper bound of maxSupply, provided on token creation. -} - -/* Possible Freeze statuses returned on TokenGetInfoQuery or CryptoGetInfoResponse in TokenRelationship */ -enum TokenFreezeStatus { - FreezeNotApplicable = 0; - Frozen = 1; - Unfrozen = 2; -} - -/* Possible KYC statuses returned on TokenGetInfoQuery or CryptoGetInfoResponse in TokenRelationship */ -enum TokenKycStatus { - KycNotApplicable = 0; - Granted = 1; - Revoked = 2; -} - -/* A Key can be a public key from one of the three supported systems (ed25519, RSA-3072, ECDSA with p384). Or, it can be the ID of a smart contract instance, which is authorized to act as if it had a key. If an account has an ed25519 key associated with it, then the corresponding private key must sign any transaction to transfer cryptocurrency out of it. And similarly for RSA and ECDSA. - * - * A Key can be a smart contract ID, which means that smart contract is to authorize operations as if it had signed with a key that it owned. The smart contract doesn't actually have a key, and doesn't actually sign a transaction. But it's as if a virtual transaction were created, and the smart contract signed it with a private key. - * - * A Key can be a "threshold key", which means a list of M keys, any N of which must sign in order for the threshold signature to be considered valid. The keys within a threshold signature may themselves be threshold signatures, to allow complex signature requirements. - * - *A Key can be a "key list" where all keys in the list must sign unless specified otherwise in the documentation for a specific transaction type (e.g. FileDeleteTransactionBody). Their use is dependent on context. For example, a Hedera file is created with a list of keys, where all of them must sign a transaction to create or modify the file, but only one of them is needed to sign a transaction to delete the file. So it's a single list that sometimes acts as a 1-of-M threshold key, and sometimes acts as an M-of-M threshold key. A key list is always an M-of-M, unless specified otherwise in documentation. A key list can have nested key lists or threshold keys. Nested key lists are always M-of-M. A key list can have repeated Ed25519 public keys, but all repeated keys are only required to sign once. - * - * A Key can contain a ThresholdKey or KeyList, which in turn contain a Key, so this mutual recursion would allow nesting arbitrarily deep. A ThresholdKey which contains a list of primitive keys (e.g., ed25519) has 3 levels: ThresholdKey -> KeyList -> Key. A KeyList which contains several primitive keys (e.g., ed25519) has 2 levels: KeyList -> Key. A Key with 2 levels of nested ThresholdKeys has 7 levels: Key -> ThresholdKey -> KeyList -> Key -> ThresholdKey -> KeyList -> Key. - * - * Each Key should not have more than 46 levels, which implies 15 levels of nested ThresholdKeys. Only ed25519 primitive keys are currently supported. - */ -message Key { - oneof key { - ContractID contractID = 1; // smart contract instance that is authorized as if it had signed with a key - bytes ed25519 = 2; // ed25519 public key bytes - bytes RSA_3072 = 3; // RSA-3072 public key bytes - bytes ECDSA_384 = 4; // ECDSA with the p-384 curve public key bytes - ThresholdKey thresholdKey = 5; // a threshold N followed by a list of M keys, any N of which are required to form a valid signature - KeyList keyList = 6; // A list of Keys of the Key type. - } -} - -/* A set of public keys that are used together to form a threshold signature. If the threshold is N and there are M keys, then this is an N of M threshold signature. If an account is associated with ThresholdKeys, then a transaction to move cryptocurrency out of it must be signed by a list of M signatures, where at most M-N of them are blank, and the other at least N of them are valid signatures corresponding to at least N of the public keys listed here. */ -message ThresholdKey { - uint32 threshold = 1; // A valid signature set must have at least this many signatures - KeyList keys = 2; // List of all the keys that can sign -} - -/* A list of keys that requires all keys (M-of-M) to sign unless otherwise specified in documentation. A KeyList may contain repeated keys, but all repeated keys are only required to sign once. */ -message KeyList { - repeated Key keys = 1; // list of keys -} - -/* A Signature corresponding to a Key. It is a sequence of bytes holding a public key signature from one of the three supported systems (ed25519, RSA-3072, ECDSA with p384). Or, it can be a list of signatures corresponding to a single threshold key. Or, it can be the ID of a smart contract instance, which is authorized to act as if it had a key. If an account has an ed25519 key associated with it, then the corresponding private key must sign any transaction to transfer cryptocurrency out of it. If it has a smart contract ID associated with it, then that smart contract is allowed to transfer cryptocurrency out of it. The smart contract doesn't actually have a key, and doesn't actually sign a transaction. But it's as if a virtual transaction were created, and the smart contract signed it with a private key. A key can also be a "threshold key", which means a list of M keys, any N of which must sign in order for the threshold signature to be considered valid. The keys within a threshold signature may themselves be threshold signatures, to allow complex signature requirements (this nesting is not supported in the currently, but will be supported in a future version of API). If a Signature message is missing the "signature" field, then this is considered to be a null signature. That is useful in cases such as threshold signatures, where some of the signatures can be null. - * The definition of Key uses mutual recursion, so it allows nesting that is arbitrarily deep. But the current API only accepts Key messages up to 3 levels deep, such as a list of threshold keys, each of which is a list of primitive keys. Therefore, the matching Signature will have the same limitation. This restriction may be relaxed in future versions of the API, to allow deeper nesting. - * This message is deprecated and succeeded by SignaturePair and SignatureMap messages. - */ -message Signature { - option deprecated = true; - oneof signature { - bytes contract = 1; // smart contract virtual signature (always length zero) - bytes ed25519 = 2; // ed25519 signature bytes - bytes RSA_3072 = 3; //RSA-3072 signature bytes - bytes ECDSA_384 = 4; //ECDSA p-384 signature bytes - ThresholdSignature thresholdSignature = 5; // A list of signatures for a single N-of-M threshold Key. This must be a list of exactly M signatures, at least N of which are non-null. - SignatureList signatureList = 6; // A list of M signatures, each corresponding to a Key in a KeyList of the same length. - } -} - -/* -A signature corresponding to a ThresholdKey. For an N-of-M threshold key, this is a list of M signatures, at least N of which must be non-null. -This message is deprecated and succeeded by SignaturePair and SignatureMap messages. -*/ -message ThresholdSignature { - option deprecated = true; - SignatureList sigs = 2; // for an N-of-M threshold key, this is a list of M signatures, at least N of which must be non-null -} - -/* -The signatures corresponding to a KeyList of the same length. -This message is deprecated and succeeded by SignaturePair and SignatureMap messages. -*/ -message SignatureList { - option deprecated = true; - repeated Signature sigs = 2; // each signature corresponds to a Key in the KeyList -} - -/* -The client may use any number of bytes from 0 to the whole length of the public key for pubKeyPrefix. -If 0 bytes is used, then it is assumed that only one public key is used to sign. Only ed25519 -keys and hence signatures are currently supported. */ -message SignaturePair { - bytes pubKeyPrefix = 1; // First few bytes of the public key - oneof signature { - bytes contract = 2; // smart contract virtual signature (always length zero) - bytes ed25519 = 3; // ed25519 signature - bytes RSA_3072 = 4; //RSA-3072 signature - bytes ECDSA_384 = 5; //ECDSA p-384 signature - } -} - -/* -A set of signatures corresponding to every unique public key used to sign a given transaction. If one public key matches more than one prefixes on the signature map, the transaction containing the map will fail immediately with the response code KEY_PREFIX_MISMATCH. -*/ -message SignatureMap { - repeated SignaturePair sigPair = 1; // Each signature pair corresponds to a unique Key required to sign the transaction. -} - -/* -The transactions and queries supported by Hedera Hashgraph. -*/ -enum HederaFunctionality { - NONE = 0; // UNSPECIFIED - Need to keep first value as unspecified because first element is ignored and not parsed (0 is ignored by parser) - CryptoTransfer = 1; // crypto transfer - CryptoUpdate = 2; // crypto update account - CryptoDelete = 3; // crypto delete account - // Add a livehash to a crypto account - CryptoAddLiveHash = 4; - // Delete a livehash from a crypto account - CryptoDeleteLiveHash = 5; - ContractCall = 6; // Smart Contract Call - ContractCreate = 7; // Smart Contract Create Contract - ContractUpdate = 8; // Smart Contract update contract - FileCreate = 9; // File Operation create file - FileAppend = 10; // File Operation append file - FileUpdate = 11; // File Operation update file - FileDelete = 12; // File Operation delete file - CryptoGetAccountBalance = 13; // crypto get account balance - CryptoGetAccountRecords = 14; // crypto get account record - CryptoGetInfo = 15; // Crypto get info - ContractCallLocal = 16; // Smart Contract Call - ContractGetInfo = 17; // Smart Contract get info - ContractGetBytecode = 18; // Smart Contract, get the byte code - GetBySolidityID = 19; // Smart Contract, get by solidity ID - GetByKey = 20; // Smart Contract, get by key - // Get a live hash from a crypto account - CryptoGetLiveHash = 21; - CryptoGetStakers = 22; // Crypto, get the stakers for the node - FileGetContents = 23; // File Operations get file contents - FileGetInfo = 24; // File Operations get the info of the file - TransactionGetRecord = 25; // Crypto get the transaction records - ContractGetRecords = 26; // Contract get the transaction records - CryptoCreate = 27; // crypto create account - SystemDelete = 28; // system delete file - SystemUndelete = 29; // system undelete file - ContractDelete = 30; // delete contract - Freeze = 31; // freeze - CreateTransactionRecord = 32; // Create Tx Record - CryptoAccountAutoRenew = 33; // Crypto Auto Renew - ContractAutoRenew = 34; // Contract Auto Renew - GetVersionInfo = 35; //Get Version - TransactionGetReceipt = 36; // Transaction Get Receipt - ConsensusCreateTopic = 50; // Create Topic - ConsensusUpdateTopic = 51; // Update Topic - ConsensusDeleteTopic = 52; // Delete Topic - ConsensusGetTopicInfo = 53; // Get Topic information - ConsensusSubmitMessage = 54; // Submit message to topic - UncheckedSubmit = 55; - TokenCreate = 56; // Create Token - TokenGetInfo = 58; // Get Token information - TokenFreezeAccount = 59; // Freeze Account - TokenUnfreezeAccount = 60; // Unfreeze Account - TokenGrantKycToAccount = 61; // Grant KYC to Account - TokenRevokeKycFromAccount = 62; // Revoke KYC from Account - TokenDelete = 63; // Delete Token - TokenUpdate = 64; // Update Token - TokenMint = 65; // Mint tokens to treasury - TokenBurn = 66; // Burn tokens from treasury - TokenAccountWipe = 67; // Wipe token amount from Account holder - TokenAssociateToAccount = 68; // Associate tokens to an account - TokenDissociateFromAccount = 69; // Dissociate tokens from an account - ScheduleCreate = 70; // Create Scheduled Transaction - ScheduleDelete = 71; // Delete Scheduled Transaction - ScheduleSign = 72; // Sign Scheduled Transaction - ScheduleGetInfo = 73; // Get Scheduled Transaction Information - TokenGetAccountNftInfo = 74; // Get Token Account Nft Information - TokenGetNftInfo = 75; // Get Token Nft Information - TokenGetNftInfos = 76; // Get Token Nft List Information -} - -/* -A set of prices the nodes use in determining transaction and query fees, and constants involved in fee calculations. -Nodes multiply the amount of resources consumed by a transaction or query by the corresponding price to calculate the -appropriate fee. Units are one-thousandth of a tinyCent.*/ -message FeeComponents { - int64 min = 1; // A minimum, the calculated fee must be greater than this value - int64 max = 2; // A maximum, the calculated fee must be less than this value - int64 constant = 3; // A constant contribution to the fee - int64 bpt = 4; // The price of bandwidth consumed by a transaction, measured in bytes - int64 vpt = 5; // The price per signature verification for a transaction - int64 rbh = 6; // The price of RAM consumed by a transaction, measured in byte-hours - int64 sbh = 7; // The price of storage consumed by a transaction, measured in byte-hours - int64 gas = 8; // The price of computation for a smart contract transaction, measured in gas - int64 tv = 9; // The price per hbar transferred for a transfer - int64 bpr = 10; // The price of bandwidth for data retrieved from memory for a response, measured in bytes - int64 sbpr = 11; // The price of bandwidth for data retrieved from disk for a response, measured in bytes -} - -/* The fees for a specific transaction or query based on the fee data. */ -message TransactionFeeSchedule { - // A particular transaction or query - HederaFunctionality hederaFunctionality = 1; - // Resource price coefficients - FeeData feeData = 2 [deprecated=true]; - // Resource price coefficients. Supports subtype price definition. - repeated FeeData fees = 3; -} - -/* -The total fee charged for a transaction. It is composed of three components – a node fee that compensates the specific node that submitted the transaction, a network fee that compensates the network for assigning the transaction a consensus timestamp, and a service fee that compensates the network for the ongoing maintenance of the consequences of the transaction. -*/ -message FeeData { - // Fee paid to the submitting node - FeeComponents nodedata = 1; - // Fee paid to the network for processing a transaction into consensus - FeeComponents networkdata = 2; - // Fee paid to the network for providing the service associated with the transaction; for instance, storing a file - FeeComponents servicedata = 3; - // SubType distinguishing between different types of FeeData, correlating to the same HederaFunctionality - SubType subType = 4; -} - -/* -A list of resource prices fee for different transactions and queries and the time period at which this fee schedule will expire. Nodes use the prices to determine the fees for all transactions based on how much of those resources each transaction uses. -*/ -message FeeSchedule { - // List of price coefficients for network resources - repeated TransactionFeeSchedule transactionFeeSchedule = 1; - // FeeSchedule expiry time - TimestampSeconds expiryTime = 2; -} - -/* This contains two Fee Schedules with expiry timestamp. */ -message CurrentAndNextFeeSchedule { - FeeSchedule currentFeeSchedule = 1; // Contains current Fee Schedule - FeeSchedule nextFeeSchedule = 2; // Contains next Fee Schedule -} - -/* -Contains the IP address and the port representing a service endpoint of a Node in a network. Used to reach the Hedera API and submit transactions to the network. -*/ -message ServiceEndpoint { - bytes ipAddressV4 = 1; // The 32-bit IPv4 address of the node encoded in left to right order (e.g. 127.0.0.1 has 127 as its first byte) - int32 port = 2; // The port of the node -} - -/* -The data about a node, including its service endpoints and the Hedera account to be paid for services -provided by the node (that is, queries answered and transactions submitted.) - -If the serviceEndpoint list is not set, or empty, then the endpoint given by the (deprecated) -ipAddress and portno fields should be used. - -All fields are populated in the 0.0.102 address book file while only fields that start with # are populated in the 0.0.101 address book file. -*/ -message NodeAddress { - bytes ipAddress = 1 [deprecated=true]; // The IP address of the Node with separator & octets encoded in UTF-8. Usage is deprecated, ServiceEndpoint is preferred to retrieve a node's list of IP addresses and ports - int32 portno = 2 [deprecated=true]; // The port number of the grpc server for the node. Usage is deprecated, ServiceEndpoint is preferred to retrieve a node's list of IP addresses and ports - bytes memo = 3 [deprecated=true]; // Usage is deprecated, nodeAccountId is preferred to retrieve a node's account ID - string RSA_PubKey = 4; // The node's hex-encoded X509 RSA public key - int64 nodeId = 5; // # A non-sequential identifier for the node - AccountID nodeAccountId = 6; // # The account to be paid for queries and transactions sent to this node - bytes nodeCertHash = 7; // # The hex-encoded SHA-384 hash of the X509 cert used to encrypt gRPC traffic to the node - repeated ServiceEndpoint serviceEndpoint = 8; // # A node's service IP addresses and ports - string description = 9; // A description of the node, with UTF-8 encoding up to 100 bytes - int64 stake = 10; // The amount of tinybars staked to the node -} - -/* -A list of nodes and their metadata that contains all details of the nodes for the network. - -Used to parse the contents of system files 0.0.101 and 0.0.102. -*/ -message NodeAddressBook { - repeated NodeAddress nodeAddress = 1; // Metadata of all nodes in the network -} - -/* Hedera follows semantic versioning (https://semver.org/) for both the HAPI protobufs and the Services software. -This type allows the getVersionInfo query in the NetworkService to return the deployed versions -of both protobufs and software on the node answering the query. */ -message SemanticVersion { - int32 major = 1; // Increases with incompatible API changes - int32 minor = 2; // Increases with backwards-compatible new functionality - int32 patch = 3; // Increases with backwards-compatible bug fixes - string pre = 4; // A pre-release version MAY be denoted by appending a hyphen and a series of dot separated identifiers (https://semver.org/#spec-item-9); so given a semver 0.14.0-alpha.1+21AF26D3, this field would contain 'alpha.1' - string build = 5; // Build metadata MAY be denoted by appending a plus sign and a series of dot separated identifiers immediately following the patch or pre-release version (https://semver.org/#spec-item-10); so given a semver 0.14.0-alpha.1+21AF26D3, this field would contain '21AF26D3' -} - -message Setting { - string name = 1; // name of the property - string value = 2; // value of the property - bytes data = 3; // any data associated with property -} - -message ServicesConfigurationList { - repeated Setting nameValue = 1; // list of name value pairs of the application properties -} - -/* Token's information related to the given Account */ -message TokenRelationship { - TokenID tokenId = 1; // The ID of the token - string symbol = 2; // The Symbol of the token - int64 balance = 3; // For token of type FUNGIBLE_COMMON - the balance that the Account holds in the smallest denomination. For token of type NON_FUNGIBLE_UNIQUE - the number of NFTs held by the account - TokenKycStatus kycStatus = 4; // The KYC status of the account (KycNotApplicable, Granted or Revoked). If the token does not have KYC key, KycNotApplicable is returned - TokenFreezeStatus freezeStatus = 5; // The Freeze status of the account (FreezeNotApplicable, Frozen or Unfrozen). If the token does not have Freeze key, FreezeNotApplicable is returned - int32 decimals = 6; // Tokens divide into 10decimals pieces -} - -/* A number of transferable units of a certain token. - -The transferable unit of a token is its smallest denomination, as given by the token's decimals property---each minted token contains 10decimals transferable units. For example, we could think of the cent as the transferable unit of the US dollar (decimals=2); and the tinybar as the transferable unit of hbar (decimals=8). - -Transferable units are not directly comparable across different tokens. */ -message TokenBalance { - TokenID tokenId = 1; // A unique token id - int64 balance = 2; // Number of transferable units of the identified token. For token of type FUNGIBLE_COMMON - balance in the smallest denomination. For token of type NON_FUNGIBLE_UNIQUE - the number of NFTs held by the account - int32 decimals = 3; // Tokens divide into 10decimals pieces -} - -/* A sequence of token balances */ -message TokenBalances { - repeated TokenBalance tokenBalances = 1; -}