diff --git a/api/api.proto b/api/api.proto index 1cf2ef5a6..945fc7730 100644 --- a/api/api.proto +++ b/api/api.proto @@ -2,9 +2,17 @@ syntax = "proto3"; package protocol; import "core/Tron.proto"; -import "core/Contract.proto"; import "google/api/annotations.proto"; +import "core/contract/asset_issue_contract.proto"; +import "core/contract/account_contract.proto"; +import "core/contract/witness_contract.proto"; +import "core/contract/balance_contract.proto"; +import "core/contract/proposal_contract.proto"; +import "core/contract/storage_contract.proto"; +import "core/contract/exchange_contract.proto"; +import "core/contract/smart_contract.proto"; +import "core/contract/shield_contract.proto"; option java_package = "org.tron.api"; //Specify the name of the package that generated the Java file option java_outer_classname = "GrpcAPI"; //Specify the class name of the generated Java file @@ -142,6 +150,7 @@ service Wallet { //Use this function instead of CreateAccount. rpc CreateAccount2 (AccountCreateContract) returns (TransactionExtention) { } + //Please use CreateWitness2 instead of this function. rpc CreateWitness (WitnessCreateContract) returns (Transaction) { option (google.api.http) = { @@ -406,7 +415,7 @@ service Wallet { rpc TriggerConstantContract (TriggerSmartContract) returns (TransactionExtention) { } - + rpc ClearContractABI (ClearABIContract) returns (TransactionExtention) { } @@ -614,7 +623,6 @@ service Wallet { }; } - rpc AddSign (TransactionSign) returns (TransactionExtention) { } @@ -623,7 +631,7 @@ service Wallet { } - rpc GetTransactionApprovedList(Transaction) returns (TransactionApprovedList) { + rpc GetTransactionApprovedList (Transaction) returns (TransactionApprovedList) { } @@ -640,8 +648,71 @@ service Wallet { }; -}; + // for shiededTransaction + rpc CreateShieldedTransaction (PrivateParameters) returns (TransactionExtention) { + }; + + rpc GetMerkleTreeVoucherInfo (OutputPointInfo) returns (IncrementalMerkleVoucherInfo) { + } + + rpc ScanNoteByIvk (IvkDecryptParameters) returns (DecryptNotes) { + }; + + rpc ScanAndMarkNoteByIvk (IvkDecryptAndMarkParameters) returns (DecryptNotesMarked) { + }; + + rpc ScanNoteByOvk (OvkDecryptParameters) returns (DecryptNotes) { + }; + + rpc GetSpendingKey (EmptyMessage) returns (BytesMessage) { + } + + rpc GetExpandedSpendingKey (BytesMessage) returns (ExpandedSpendingKeyMessage) { + } + + rpc GetAkFromAsk (BytesMessage) returns (BytesMessage) { + } + + rpc GetNkFromNsk (BytesMessage) returns (BytesMessage) { + } + rpc GetIncomingViewingKey (ViewingKeyMessage) returns (IncomingViewingKeyMessage) { + } + + rpc GetDiversifier (EmptyMessage) returns (DiversifierMessage) { + } + + rpc GetNewShieldedAddress (EmptyMessage) returns (ShieldedAddressInfo) { + } + + rpc GetZenPaymentAddress (IncomingViewingKeyDiversifierMessage) returns (PaymentAddressMessage) { + } + + rpc GetRcm (EmptyMessage) returns (BytesMessage) { + } + + rpc IsSpend (NoteParameters) returns (SpendResult) { + } + + rpc CreateShieldedTransactionWithoutSpendAuthSig (PrivateParametersWithoutAsk) returns (TransactionExtention) { + }; + + rpc GetShieldTransactionHash (Transaction) returns (BytesMessage) { + }; + + rpc CreateSpendAuthSig (SpendAuthSigParameters) returns (BytesMessage) { + }; + + rpc CreateShieldNullifier (NfParameters) returns (BytesMessage) { + }; + // end for shiededTransaction + + rpc CreateCommonTransaction (Transaction) returns (TransactionExtention) { + }; + + rpc GetTransactionInfoByBlockNum (NumberMessage) returns (TransactionInfoList) { + } +}; service WalletSolidity { @@ -773,7 +844,19 @@ service WalletSolidity { }; } - rpc TriggerConstantContract (TriggerSmartContract) returns (TransactionExtention) { + rpc GetMerkleTreeVoucherInfo (OutputPointInfo) returns (IncrementalMerkleVoucherInfo) { + } + + rpc ScanNoteByIvk (IvkDecryptParameters) returns (DecryptNotes) { + } + + rpc ScanAndMarkNoteByIvk (IvkDecryptAndMarkParameters) returns (DecryptNotesMarked) { + } + + rpc ScanNoteByOvk (OvkDecryptParameters) returns (DecryptNotes) { + } + + rpc IsSpend (NoteParameters) returns (SpendResult) { } rpc GetRewardInfo (BytesMessage) returns (NumberMessage) { @@ -782,6 +865,12 @@ service WalletSolidity { rpc GetBrokerageInfo (BytesMessage) returns (NumberMessage) { }; + rpc TriggerConstantContract (TriggerSmartContract) returns (TransactionExtention) { + } + + rpc GetTransactionInfoByBlockNum (NumberMessage) returns (TransactionInfoList) { + } + }; service WalletExtension { @@ -998,7 +1087,7 @@ message EasyTransferAssetByPrivateMessage { message EasyTransferResponse { Transaction transaction = 1; Return result = 2; - bytes txid = 3; //transaction id = sha256(transaction.rowdata) + bytes txid = 3; //transaction id = sha256(transaction.raw_data) } message AddressPrKeyPairMessage { @@ -1008,7 +1097,7 @@ message AddressPrKeyPairMessage { message TransactionExtention { Transaction transaction = 1; - bytes txid = 2; //transaction id = sha256(transaction.rowdata) + bytes txid = 2; //transaction id = sha256(transaction.raw_data) repeated bytes constant_result = 3; Return result = 4; } @@ -1027,6 +1116,11 @@ message TransactionListExtention { repeated TransactionExtention transaction = 1; } +message BlockIncrementalMerkleTree { + int64 number = 1; + IncrementalMerkleTree merkleTree = 2; +} + message TransactionSignWeight { message Result { enum response_code { @@ -1063,4 +1157,158 @@ message TransactionApprovedList { repeated bytes approved_list = 2; Result result = 4; TransactionExtention transaction = 5; -} \ No newline at end of file +} + +message IvkDecryptParameters { + int64 start_block_index = 1; + int64 end_block_index = 2; + bytes ivk = 3; +} + +message IvkDecryptAndMarkParameters { + int64 start_block_index = 1; + int64 end_block_index = 2; + bytes ivk = 5; + bytes ak = 3; + bytes nk = 4; +} + +message OvkDecryptParameters { + int64 start_block_index = 1; + int64 end_block_index = 2; + bytes ovk = 3; +} + +message DecryptNotes { + message NoteTx { + Note note = 1; + bytes txid = 2; //transaction id = sha256(transaction.raw_data) + int32 index = 3; //the index of note in receive + } + repeated NoteTx noteTxs = 1; +} + +message DecryptNotesMarked { + message NoteTx { + Note note = 1; + bytes txid = 2; //transaction id = sha256(transaction.raw_data) + int32 index = 3; //the index of note in receive + bool is_spend = 4; + } + repeated NoteTx noteTxs = 1; +} + +message Note { + int64 value = 1; + string payment_address = 2; + bytes rcm = 3; // random 32 + bytes memo = 4; +} + +message SpendNote { + Note note = 3; + bytes alpha = 4; // random number for spend authority signature + IncrementalMerkleVoucher voucher = 5; + bytes path = 6; // path for cm from leaf to root in merkle tree +} + +message ReceiveNote { + Note note = 1; +} + +message PrivateParameters { + bytes transparent_from_address = 1; + bytes ask = 2; + bytes nsk = 3; + bytes ovk = 4; + int64 from_amount = 5; + repeated SpendNote shielded_spends = 6; + repeated ReceiveNote shielded_receives = 7; + bytes transparent_to_address = 8; + int64 to_amount = 9; +} + +message PrivateParametersWithoutAsk { + bytes transparent_from_address = 1; + bytes ak = 2; + bytes nsk = 3; + bytes ovk = 4; + int64 from_amount = 5; + repeated SpendNote shielded_spends = 6; + repeated ReceiveNote shielded_receives = 7; + bytes transparent_to_address = 8; + int64 to_amount = 9; +} + +message SpendAuthSigParameters { + bytes ask = 1; + bytes tx_hash = 2; + bytes alpha = 3; +} + +message NfParameters { + Note note = 1; + IncrementalMerkleVoucher voucher = 2; + bytes ak = 3; + bytes nk = 4; +} + +message ExpandedSpendingKeyMessage { + bytes ask = 1; + bytes nsk = 2; + bytes ovk = 3; +} + +message ViewingKeyMessage { + bytes ak = 1; + bytes nk = 2; +} + +message IncomingViewingKeyMessage { + bytes ivk = 1; +} + +message DiversifierMessage { + bytes d = 1; +} + +message IncomingViewingKeyDiversifierMessage { + IncomingViewingKeyMessage ivk = 1; + DiversifierMessage d = 2; +} + +message PaymentAddressMessage { + DiversifierMessage d = 1; + bytes pkD = 2; + string payment_address = 3; +} + +message ShieldedAddressInfo{ + bytes sk = 1; + bytes ask = 2; + bytes nsk = 3; + bytes ovk = 4; + bytes ak = 5; + bytes nk = 6; + bytes ivk = 7; + bytes d = 8; + bytes pkD = 9; + string payment_address = 10; +} + +message NoteParameters { + bytes ak = 1; + bytes nk = 2; + Note note = 3; + bytes txid = 4; + int32 index = 5; +} + +message SpendResult { + bool result = 1; + string message = 2; +} + +message TransactionInfoList { + repeated TransactionInfo transactionInfo = 1; +} diff --git a/api/zksnark.proto b/api/zksnark.proto new file mode 100644 index 000000000..91b985651 --- /dev/null +++ b/api/zksnark.proto @@ -0,0 +1,33 @@ +syntax = "proto3"; +package protocol; + +import "core/Tron.proto"; + +option java_package = "org.tron.api"; //Specify the name of the package that generated the Java file +option java_outer_classname = "ZksnarkGrpcAPI"; //Specify the class name of the generated Java file +option go_package = "github.com/tronprotocol/grpc-gateway/api"; + +service TronZksnark { + rpc CheckZksnarkProof (ZksnarkRequest) returns (ZksnarkResponse) { + } +}; + +message ZksnarkRequest { + Transaction transaction = 1; + bytes sighash = 2; + int64 valueBalance = 3; + string txId = 4; +} + +message ZksnarkResponse { + enum Code { + SUCCESS = 0; + FAILED = 1; + } + + Code code = 1; +} + + + + diff --git a/core/Contract.proto b/core/Contract.proto deleted file mode 100644 index e468c5bbd..000000000 --- a/core/Contract.proto +++ /dev/null @@ -1,261 +0,0 @@ -/* - * java-tron is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * java-tron is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -syntax = "proto3"; - -package protocol; - -option java_package = "org.tron.protos"; //Specify the name of the package that generated the Java file -option java_outer_classname = "Contract"; //Specify the class name of the generated Java file -option go_package = "github.com/tronprotocol/grpc-gateway/core"; - -import "core/Tron.proto"; - -message AccountCreateContract { - bytes owner_address = 1; - bytes account_address = 2; - AccountType type = 3; -} - -// Update account name. Account name is not unique now. -message AccountUpdateContract { - bytes account_name = 1; - bytes owner_address = 2; -} - -// Set account id if the account has no id. Account id is unique and case insensitive. -message SetAccountIdContract { - bytes account_id = 1; - bytes owner_address = 2; -} - -message TransferContract { - bytes owner_address = 1; - bytes to_address = 2; - int64 amount = 3; -} - -message TransferAssetContract { - bytes asset_name = 1; // this field is token name before the proposal ALLOW_SAME_TOKEN_NAME is active, otherwise it is token id and token is should be in string format. - bytes owner_address = 2; - bytes to_address = 3; - int64 amount = 4; -} - - -message VoteAssetContract { - bytes owner_address = 1; - repeated bytes vote_address = 2; - bool support = 3; - int32 count = 5; -} - -message VoteWitnessContract { - message Vote { - bytes vote_address = 1; - int64 vote_count = 2; - } - bytes owner_address = 1; - repeated Vote votes = 2; - bool support = 3; -} - -message UpdateSettingContract { - bytes owner_address = 1; - bytes contract_address = 2; - int64 consume_user_resource_percent = 3; -} - -message UpdateEnergyLimitContract { - bytes owner_address = 1; - bytes contract_address = 2; - int64 origin_energy_limit = 3; -} - -message ClearABIContract { - bytes owner_address = 1; - bytes contract_address = 2; -} - -message WitnessCreateContract { - bytes owner_address = 1; - bytes url = 2; -} - -message WitnessUpdateContract { - bytes owner_address = 1; - bytes update_url = 12; -} - -message AssetIssueContract { - string id = 41; - - message FrozenSupply { - int64 frozen_amount = 1; - int64 frozen_days = 2; - } - bytes owner_address = 1; - bytes name = 2; - bytes abbr = 3; - int64 total_supply = 4; - repeated FrozenSupply frozen_supply = 5; - int32 trx_num = 6; - int32 precision = 7; - int32 num = 8; - int64 start_time = 9; - int64 end_time = 10; - int64 order = 11; // useless - int32 vote_score = 16; - bytes description = 20; - bytes url = 21; - int64 free_asset_net_limit = 22; - int64 public_free_asset_net_limit = 23; - int64 public_free_asset_net_usage = 24; - int64 public_latest_free_net_time = 25; -} - -message ParticipateAssetIssueContract { - bytes owner_address = 1; - bytes to_address = 2; - bytes asset_name = 3; // this field is token name before the proposal ALLOW_SAME_TOKEN_NAME is active, otherwise it is token id and token is should be in string format. - int64 amount = 4; // the amount of drops -} - - -enum ResourceCode { - BANDWIDTH = 0x00; - ENERGY = 0x01; -} - -message FreezeBalanceContract { - bytes owner_address = 1; - int64 frozen_balance = 2; - int64 frozen_duration = 3; - - ResourceCode resource = 10; - bytes receiver_address = 15; -} - -message UnfreezeBalanceContract { - bytes owner_address = 1; - - ResourceCode resource = 10; - bytes receiver_address = 15; -} - -message UnfreezeAssetContract { - bytes owner_address = 1; -} - -message WithdrawBalanceContract { - bytes owner_address = 1; -} - -message UpdateAssetContract { - bytes owner_address = 1; - bytes description = 2; - bytes url = 3; - int64 new_limit = 4; - int64 new_public_limit = 5; -} - -message ProposalCreateContract { - bytes owner_address = 1; - map parameters = 2; -} - -message ProposalApproveContract { - bytes owner_address = 1; - int64 proposal_id = 2; - bool is_add_approval = 3; // add or remove approval -} - -message ProposalDeleteContract { - bytes owner_address = 1; - int64 proposal_id = 2; -} - -message CreateSmartContract { - bytes owner_address = 1; - SmartContract new_contract = 2; - int64 call_token_value = 3; - int64 token_id = 4; -} - -message TriggerSmartContract { - bytes owner_address = 1; - bytes contract_address = 2; - int64 call_value = 3; - bytes data = 4; - int64 call_token_value = 5; - int64 token_id = 6; -} - -message BuyStorageContract { - bytes owner_address = 1; - int64 quant = 2; // trx quantity for buy storage (sun) -} - -message BuyStorageBytesContract { - bytes owner_address = 1; - int64 bytes = 2; // storage bytes for buy -} - -message SellStorageContract { - bytes owner_address = 1; - int64 storage_bytes = 2; -} - -message ExchangeCreateContract { - bytes owner_address = 1; - bytes first_token_id = 2; - int64 first_token_balance = 3; - bytes second_token_id = 4; - int64 second_token_balance = 5; -} - -message ExchangeInjectContract { - bytes owner_address = 1; - int64 exchange_id = 2; - bytes token_id = 3; - int64 quant = 4; -} - -message ExchangeWithdrawContract { - bytes owner_address = 1; - int64 exchange_id = 2; - bytes token_id = 3; - int64 quant = 4; -} - -message ExchangeTransactionContract { - bytes owner_address = 1; - int64 exchange_id = 2; - bytes token_id = 3; - int64 quant = 4; - int64 expected = 5; -} - -message AccountPermissionUpdateContract { - bytes owner_address = 1; - Permission owner = 2; //Empty is invalidate - Permission witness = 3;//Can be empty - repeated Permission actives = 4;//Empty is invalidate -} - -message UpdateBrokerageContract { - bytes owner_address = 1; - int32 brokerage = 2; // 1 mean 1% -} \ No newline at end of file diff --git a/core/Tron.proto b/core/Tron.proto index e60d8844d..797273ce6 100644 --- a/core/Tron.proto +++ b/core/Tron.proto @@ -177,11 +177,11 @@ message Permission { Active = 2; } PermissionType type = 1; - int32 id = 2; //Owner id=0, Witness id=1, Active id start by 2 + int32 id = 2; //Owner id=0, Witness id=1, Active id start by 2 string permission_name = 3; int64 threshold = 4; int32 parent_id = 5; - bytes operations = 6; //1 bit 1 contract + bytes operations = 6; //1 bit 1 contract repeated Key keys = 7; } @@ -259,9 +259,6 @@ message Transaction { ProposalDeleteContract = 18; SetAccountIdContract = 19; CustomContract = 20; - // BuyStorageContract = 21; - // BuyStorageBytesContract = 22; - // SellStorageContract = 23; CreateSmartContract = 30; TriggerSmartContract = 31; GetContract = 32; @@ -274,6 +271,7 @@ message Transaction { AccountPermissionUpdateContract = 46; ClearABIContract = 48; UpdateBrokerageContract = 49; + ShieldedTransferContract = 51; } ContractType type = 1; google.protobuf.Any parameter = 2; @@ -315,6 +313,7 @@ message Transaction { int64 exchange_inject_another_amount = 19; int64 exchange_withdraw_another_amount = 20; int64 exchange_id = 21; + int64 shielded_transaction_fee = 22; } message raw { @@ -323,9 +322,9 @@ message Transaction { bytes ref_block_hash = 4; int64 expiration = 8; repeated authority auths = 9; - // data not used + // transaction note bytes data = 10; - //only support size = 1, repeated list here for extension + //only support size = 1, repeated list here for extension repeated Contract contract = 11; // scripts not used bytes scripts = 12; @@ -334,7 +333,7 @@ message Transaction { } raw raw_data = 1; - // only support size = 1, repeated list here for muti-sig extension + // only support size = 1, repeated list here for muti-sig extension repeated bytes signature = 2; repeated Result ret = 5; } @@ -368,6 +367,13 @@ message TransactionInfo { int64 exchange_inject_another_amount = 19; int64 exchange_withdraw_another_amount = 20; int64 exchange_id = 21; + int64 shielded_transaction_fee = 22; +} + +message TransactionRet { + int64 blockNumber = 1; + int64 blockTimeStamp = 2; + repeated TransactionInfo transactioninfo = 3; } message Transactions { @@ -500,53 +506,6 @@ message HelloMessage { BlockId headBlockId = 6; } -message SmartContract { - message ABI { - message Entry { - enum EntryType { - UnknownEntryType = 0; - Constructor = 1; - Function = 2; - Event = 3; - Fallback = 4; - } - message Param { - bool indexed = 1; - string name = 2; - string type = 3; - // SolidityType type = 3; - } - enum StateMutabilityType { - UnknownMutabilityType = 0; - Pure = 1; - View = 2; - Nonpayable = 3; - Payable = 4; - } - - bool anonymous = 1; - bool constant = 2; - string name = 3; - repeated Param inputs = 4; - repeated Param outputs = 5; - EntryType type = 6; - bool payable = 7; - StateMutabilityType stateMutability = 8; - } - repeated Entry entrys = 1; - } - bytes origin_address = 1; - bytes contract_address = 2; - ABI abi = 3; - bytes bytecode = 4; - int64 call_value = 5; - int64 consume_user_resource_percent = 6; - string name = 7; - int64 origin_energy_limit = 8; - bytes code_hash = 9; - bytes trx_hash = 10; -} - message InternalTransaction { // internalTransaction identity, the root InternalTransaction hash // should equals to root transaction id. @@ -669,4 +628,4 @@ message NodeInfo { string stackTrace = 7; } } -} \ No newline at end of file +} diff --git a/core/contract/account_contract.proto b/core/contract/account_contract.proto new file mode 100644 index 000000000..d3180048f --- /dev/null +++ b/core/contract/account_contract.proto @@ -0,0 +1,50 @@ +/* + * java-tron is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * java-tron is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +syntax = "proto3"; + +package protocol; + +option java_package = "org.tron.protos.contract"; //Specify the name of the package that generated the Java file +//option java_outer_classname = "Contract"; //Specify the class name of the generated Java file +option go_package = "github.com/tronprotocol/grpc-gateway/core"; + +import "core/Tron.proto"; + +message AccountCreateContract { + bytes owner_address = 1; + bytes account_address = 2; + AccountType type = 3; +} + +// Update account name. Account name is not unique now. +message AccountUpdateContract { + bytes account_name = 1; + bytes owner_address = 2; +} + +// Set account id if the account has no id. Account id is unique and case insensitive. +message SetAccountIdContract { + bytes account_id = 1; + bytes owner_address = 2; +} + +message AccountPermissionUpdateContract { + bytes owner_address = 1; + Permission owner = 2; //Empty is invalidate + Permission witness = 3; //Can be empty + repeated Permission actives = 4; //Empty is invalidate +} + diff --git a/core/contract/asset_issue_contract.proto b/core/contract/asset_issue_contract.proto new file mode 100644 index 000000000..cdd086a2b --- /dev/null +++ b/core/contract/asset_issue_contract.proto @@ -0,0 +1,60 @@ +syntax = "proto3"; + +package protocol; + +option java_package = "org.tron.protos.contract"; //Specify the name of the package that generated the Java file +//option java_outer_classname = "AssetIssueContract"; //Specify the class name of the generated Java file +option go_package = "github.com/tronprotocol/grpc-gateway/core"; + +message AssetIssueContract { + string id = 41; + + message FrozenSupply { + int64 frozen_amount = 1; + int64 frozen_days = 2; + } + bytes owner_address = 1; + bytes name = 2; + bytes abbr = 3; + int64 total_supply = 4; + repeated FrozenSupply frozen_supply = 5; + int32 trx_num = 6; + int32 precision = 7; + int32 num = 8; + int64 start_time = 9; + int64 end_time = 10; + int64 order = 11; // useless + int32 vote_score = 16; + bytes description = 20; + bytes url = 21; + int64 free_asset_net_limit = 22; + int64 public_free_asset_net_limit = 23; + int64 public_free_asset_net_usage = 24; + int64 public_latest_free_net_time = 25; +} + +message TransferAssetContract { + bytes asset_name = 1; // this field is token name before the proposal ALLOW_SAME_TOKEN_NAME is active, otherwise it is token id and token is should be in string format. + bytes owner_address = 2; + bytes to_address = 3; + int64 amount = 4; +} + +message UnfreezeAssetContract { + bytes owner_address = 1; +} + +message UpdateAssetContract { + bytes owner_address = 1; + bytes description = 2; + bytes url = 3; + int64 new_limit = 4; + int64 new_public_limit = 5; +} + +message ParticipateAssetIssueContract { + bytes owner_address = 1; + bytes to_address = 2; + bytes asset_name = 3; // this field is token name before the proposal ALLOW_SAME_TOKEN_NAME is active, otherwise it is token id and token is should be in string format. + int64 amount = 4; // the amount of drops +} diff --git a/core/contract/balance_contract.proto b/core/contract/balance_contract.proto new file mode 100644 index 000000000..07f7141f6 --- /dev/null +++ b/core/contract/balance_contract.proto @@ -0,0 +1,36 @@ +syntax = "proto3"; + +package protocol; + +option java_package = "org.tron.protos.contract"; //Specify the name of the package that generated the Java file +//option java_outer_classname = "FreezeBalanceContract"; //Specify the class name of the generated Java file +option go_package = "github.com/tronprotocol/grpc-gateway/core"; + +import "core/contract/common.proto"; + +message FreezeBalanceContract { + bytes owner_address = 1; + int64 frozen_balance = 2; + int64 frozen_duration = 3; + + ResourceCode resource = 10; + bytes receiver_address = 15; +} + + +message UnfreezeBalanceContract { + bytes owner_address = 1; + + ResourceCode resource = 10; + bytes receiver_address = 15; +} + +message WithdrawBalanceContract { + bytes owner_address = 1; +} + +message TransferContract { + bytes owner_address = 1; + bytes to_address = 2; + int64 amount = 3; +} diff --git a/core/contract/common.proto b/core/contract/common.proto new file mode 100644 index 000000000..933c5f5d0 --- /dev/null +++ b/core/contract/common.proto @@ -0,0 +1,12 @@ +syntax = "proto3"; + +package protocol; + +option java_package = "org.tron.protos.contract"; //Specify the name of the package that generated the Java file +//option java_outer_classname = "common"; //Specify the class name of the generated Java file +option go_package = "github.com/tronprotocol/grpc-gateway/core"; + +enum ResourceCode { + BANDWIDTH = 0x00; + ENERGY = 0x01; +} diff --git a/core/contract/exchange_contract.proto b/core/contract/exchange_contract.proto new file mode 100644 index 000000000..58d69cc2a --- /dev/null +++ b/core/contract/exchange_contract.proto @@ -0,0 +1,37 @@ +syntax = "proto3"; + +package protocol; + +option java_package = "org.tron.protos.contract"; //Specify the name of the package that generated the Java file +//option java_outer_classname = "ExchangeCreateContract"; //Specify the class name of the generated Java file +option go_package = "github.com/tronprotocol/grpc-gateway/core"; + +message ExchangeCreateContract { + bytes owner_address = 1; + bytes first_token_id = 2; + int64 first_token_balance = 3; + bytes second_token_id = 4; + int64 second_token_balance = 5; +} + +message ExchangeInjectContract { + bytes owner_address = 1; + int64 exchange_id = 2; + bytes token_id = 3; + int64 quant = 4; +} + +message ExchangeWithdrawContract { + bytes owner_address = 1; + int64 exchange_id = 2; + bytes token_id = 3; + int64 quant = 4; +} + +message ExchangeTransactionContract { + bytes owner_address = 1; + int64 exchange_id = 2; + bytes token_id = 3; + int64 quant = 4; + int64 expected = 5; +} diff --git a/core/contract/proposal_contract.proto b/core/contract/proposal_contract.proto new file mode 100644 index 000000000..1dc74d8f7 --- /dev/null +++ b/core/contract/proposal_contract.proto @@ -0,0 +1,23 @@ +syntax = "proto3"; + +package protocol; + +option java_package = "org.tron.protos.contract"; //Specify the name of the package that generated the Java file +//option java_outer_classname = "ProposalApproveContract"; //Specify the class name of the generated Java file +option go_package = "github.com/tronprotocol/grpc-gateway/core"; + +message ProposalApproveContract { + bytes owner_address = 1; + int64 proposal_id = 2; + bool is_add_approval = 3; // add or remove approval +} + +message ProposalCreateContract { + bytes owner_address = 1; + map parameters = 2; +} + +message ProposalDeleteContract { + bytes owner_address = 1; + int64 proposal_id = 2; +} diff --git a/core/contract/shield_contract.proto b/core/contract/shield_contract.proto new file mode 100644 index 000000000..9119a7aef --- /dev/null +++ b/core/contract/shield_contract.proto @@ -0,0 +1,81 @@ +syntax = "proto3"; + +package protocol; + +option java_package = "org.tron.protos.contract"; //Specify the name of the package that generated the Java file +//option java_outer_classname = "ShieldedTransferContract"; //Specify the class name of the generated Java file +option go_package = "github.com/tronprotocol/grpc-gateway/core"; + +// for shielded transaction + +message AuthenticationPath { + repeated bool value = 1; +} + +message MerklePath { + repeated AuthenticationPath authentication_paths = 1; + repeated bool index = 2; + bytes rt = 3; +} + +message OutputPoint { + bytes hash = 1; + int32 index = 2; +} + +message OutputPointInfo { + repeated OutputPoint out_points = 1; + int32 block_num = 2; +} + +message PedersenHash { + bytes content = 1; +} + +message IncrementalMerkleTree { + PedersenHash left = 1; + PedersenHash right = 2; + repeated PedersenHash parents = 3; +} + +message IncrementalMerkleVoucher { + IncrementalMerkleTree tree = 1; + repeated PedersenHash filled = 2; + IncrementalMerkleTree cursor = 3; + int64 cursor_depth = 4; + bytes rt = 5; + OutputPoint output_point = 10; +} + +message IncrementalMerkleVoucherInfo { + repeated IncrementalMerkleVoucher vouchers = 1; + repeated bytes paths = 2; +} + +message SpendDescription { + bytes value_commitment = 1; + bytes anchor = 2; // merkle root + bytes nullifier = 3; // used for check double spend + bytes rk = 4; // used for check spend authority signature + bytes zkproof = 5; + bytes spend_authority_signature = 6; +} + +message ReceiveDescription { + bytes value_commitment = 1; + bytes note_commitment = 2; + bytes epk = 3; // for Encryption + bytes c_enc = 4; // Encryption for incoming, decrypt it with ivk + bytes c_out = 5; // Encryption for audit, decrypt it with ovk + bytes zkproof = 6; +} + +message ShieldedTransferContract { + bytes transparent_from_address = 1; // transparent address + int64 from_amount = 2; + repeated SpendDescription spend_description = 3; + repeated ReceiveDescription receive_description = 4; + bytes binding_signature = 5; + bytes transparent_to_address = 6; // transparent address + int64 to_amount = 7; // the amount to transparent to_address +} diff --git a/core/contract/smart_contract.proto b/core/contract/smart_contract.proto new file mode 100644 index 000000000..739abdfba --- /dev/null +++ b/core/contract/smart_contract.proto @@ -0,0 +1,89 @@ +syntax = "proto3"; + +package protocol; + +option java_package = "org.tron.protos.contract"; //Specify the name of the package that generated the Java file +//option java_outer_classname = "CreateSmartContract"; //Specify the class name of the generated Java file +option go_package = "github.com/tronprotocol/grpc-gateway/core"; + +import "core/Tron.proto"; + +message SmartContract { + message ABI { + message Entry { + enum EntryType { + UnknownEntryType = 0; + Constructor = 1; + Function = 2; + Event = 3; + Fallback = 4; + } + message Param { + bool indexed = 1; + string name = 2; + string type = 3; + // SolidityType type = 3; + } + enum StateMutabilityType { + UnknownMutabilityType = 0; + Pure = 1; + View = 2; + Nonpayable = 3; + Payable = 4; + } + + bool anonymous = 1; + bool constant = 2; + string name = 3; + repeated Param inputs = 4; + repeated Param outputs = 5; + EntryType type = 6; + bool payable = 7; + StateMutabilityType stateMutability = 8; + } + repeated Entry entrys = 1; + } + bytes origin_address = 1; + bytes contract_address = 2; + ABI abi = 3; + bytes bytecode = 4; + int64 call_value = 5; + int64 consume_user_resource_percent = 6; + string name = 7; + int64 origin_energy_limit = 8; + bytes code_hash = 9; + bytes trx_hash = 10; +} + +message CreateSmartContract { + bytes owner_address = 1; + SmartContract new_contract = 2; + int64 call_token_value = 3; + int64 token_id = 4; +} + +message TriggerSmartContract { + bytes owner_address = 1; + bytes contract_address = 2; + int64 call_value = 3; + bytes data = 4; + int64 call_token_value = 5; + int64 token_id = 6; +} + +message ClearABIContract { + bytes owner_address = 1; + bytes contract_address = 2; +} + +message UpdateSettingContract { + bytes owner_address = 1; + bytes contract_address = 2; + int64 consume_user_resource_percent = 3; +} + +message UpdateEnergyLimitContract { + bytes owner_address = 1; + bytes contract_address = 2; + int64 origin_energy_limit = 3; +} diff --git a/core/contract/storage_contract.proto b/core/contract/storage_contract.proto new file mode 100644 index 000000000..666e6b11f --- /dev/null +++ b/core/contract/storage_contract.proto @@ -0,0 +1,27 @@ +syntax = "proto3"; + +package protocol; + +option java_package = "org.tron.protos.contract"; //Specify the name of the package that generated the Java file +//option java_outer_classname = "BuyStorageBytesContract"; //Specify the class name of the generated Java file +option go_package = "github.com/tronprotocol/grpc-gateway/core"; + +message BuyStorageBytesContract { + bytes owner_address = 1; + int64 bytes = 2; // storage bytes for buy +} + +message BuyStorageContract { + bytes owner_address = 1; + int64 quant = 2; // trx quantity for buy storage (sun) +} + +message SellStorageContract { + bytes owner_address = 1; + int64 storage_bytes = 2; +} + +message UpdateBrokerageContract { + bytes owner_address = 1; + int32 brokerage = 2; // 1 mean 1% +} diff --git a/core/contract/vote_asset_contract.proto b/core/contract/vote_asset_contract.proto new file mode 100644 index 000000000..522666e47 --- /dev/null +++ b/core/contract/vote_asset_contract.proto @@ -0,0 +1,14 @@ +syntax = "proto3"; + +package protocol; + +option java_package = "org.tron.protos.contract"; //Specify the name of the package that generated the Java file +//option java_outer_classname = "VoteAssetContract"; //Specify the class name of the generated Java file +option go_package = "github.com/tronprotocol/grpc-gateway/core"; + +message VoteAssetContract { + bytes owner_address = 1; + repeated bytes vote_address = 2; + bool support = 3; + int32 count = 5; +} diff --git a/core/contract/witness_contract.proto b/core/contract/witness_contract.proto new file mode 100644 index 000000000..115a2128e --- /dev/null +++ b/core/contract/witness_contract.proto @@ -0,0 +1,27 @@ +syntax = "proto3"; + +package protocol; + +option java_package = "org.tron.protos.contract"; //Specify the name of the package that generated the Java file +//option java_outer_classname = "WitnessCreateContract"; //Specify the class name of the generated Java file +option go_package = "github.com/tronprotocol/grpc-gateway/core"; + +message WitnessCreateContract { + bytes owner_address = 1; + bytes url = 2; +} + +message WitnessUpdateContract { + bytes owner_address = 1; + bytes update_url = 12; +} + +message VoteWitnessContract { + message Vote { + bytes vote_address = 1; + int64 vote_count = 2; + } + bytes owner_address = 1; + repeated Vote votes = 2; + bool support = 3; +} diff --git a/core/tron/account.proto b/core/tron/account.proto new file mode 100644 index 000000000..e69de29bb diff --git a/core/tron/block.proto b/core/tron/block.proto new file mode 100644 index 000000000..e69de29bb diff --git a/core/tron/delegated_resource.proto b/core/tron/delegated_resource.proto new file mode 100644 index 000000000..e69de29bb diff --git a/core/tron/p2p.proto b/core/tron/p2p.proto new file mode 100644 index 000000000..e69de29bb diff --git a/core/tron/proposal.proto b/core/tron/proposal.proto new file mode 100644 index 000000000..e69de29bb diff --git a/core/tron/transaction.proto b/core/tron/transaction.proto new file mode 100644 index 000000000..e69de29bb diff --git a/core/tron/vote.proto b/core/tron/vote.proto new file mode 100644 index 000000000..e69de29bb diff --git a/core/tron/witness.proto b/core/tron/witness.proto new file mode 100644 index 000000000..e69de29bb