From dc9b460fc602cae762589215da822bda29ef6441 Mon Sep 17 00:00:00 2001 From: zergweak Date: Tue, 30 Oct 2018 20:53:53 +0800 Subject: [PATCH 01/99] add zksnarkV0TransferTrx --- api/api.proto | 4 ++++ core/Contract.proto | 49 +++++++++++++++++++++++++++++++++++++++++++++ core/Tron.proto | 20 ++++++++++++++++++ 3 files changed, 73 insertions(+) diff --git a/api/api.proto b/api/api.proto index 85dd21649..cb11dc385 100644 --- a/api/api.proto +++ b/api/api.proto @@ -46,6 +46,9 @@ service Wallet { rpc CreateTransaction2 (TransferContract) returns (TransactionExtention) { }; + rpc ZksnarkV0TransferTrx(ZksnarkV0TransferContract) returns(TransactionExtention) { + }; + rpc BroadcastTransaction (Transaction) returns (Return) { option (google.api.http) = { post: "/wallet/broadcasttransaction" @@ -138,6 +141,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) = { diff --git a/core/Contract.proto b/core/Contract.proto index 18eafded8..507f0767d 100644 --- a/core/Contract.proto +++ b/core/Contract.proto @@ -47,6 +47,55 @@ message TransferContract { int64 amount = 3; } + +message BN128G1 { + bytes x = 1; + bytes y = 2; +} + +message BN128G2 { + bytes x1 = 1; + bytes x2 = 2; + bytes y1 = 3; + bytes y2 = 4; +} + +message zkv0proof { + BN128G1 a = 1; + BN128G1 a_p = 2; + BN128G2 b = 3; + BN128G1 b_p = 4; + BN128G1 c = 5; + BN128G1 c_p = 6; + BN128G1 k = 7; + BN128G1 h = 8; +} + +message MerkelRoot { + int64 blocknum = 1; + bytes rt = 2; +} + +message ZksnarkV0TransferContract { + bytes owner_address = 1; + bytes to_address = 2; + int64 v_from_pub = 3; + int64 v_to_pub = 4; + MerkelRoot rt = 5; + bytes nf1 = 6; + bytes nf2 = 7; + bytes cm1 = 8; + bytes cm2 = 9; + bytes pksig = 10; + bytes randomSeed = 11; + bytes epk = 12; + bytes h1 = 20; + bytes h2 = 21; + bytes C1 = 22; + bytes C2 = 23; + zkv0proof proof = 30; +} + message TransferAssetContract { bytes asset_name = 1; bytes owner_address = 2; diff --git a/core/Tron.proto b/core/Tron.proto index 38c4f3a93..15d7ab14a 100644 --- a/core/Tron.proto +++ b/core/Tron.proto @@ -227,6 +227,7 @@ message Transaction { ExchangeInjectContract = 42; ExchangeWithdrawContract = 43; ExchangeTransactionContract = 44; + ZksnarkV0TransferContract = 45; } ContractType type = 1; google.protobuf.Any parameter = 2; @@ -282,6 +283,7 @@ message Transaction { raw raw_data = 1; // only support size = 1, repeated list here for muti-sig extension repeated bytes signature = 2; + repeated bytes signature_zk = 3; repeated Result ret = 5; } @@ -308,6 +310,7 @@ message TransactionInfo { int64 withdraw_amount = 15; int64 unfreeze_amount = 16; + repeated InternalTransaction internal_transactions = 17; } message Transactions { @@ -482,4 +485,21 @@ message SmartContract { int64 consume_user_resource_percent = 6; string name = 7; +} + +message InternalTransaction { + // internalTransaction identity, the root InternalTransaction hash + // should equals to root transaction id. + bytes hash = 1; + // the one send trx (TBD: or token) via function + bytes caller_address = 2; + // the one recieve trx (TBD: or token) via function + bytes transferTo_address = 3; + message CallValueInfo { + // trx (TBD: or token) value + int64 callValue = 1; + // TBD: tokenName, trx should be empty + bytes tokenName = 2; + } + repeated CallValueInfo callValueInfo = 4; } \ No newline at end of file From 8ebf3afd366b6a16db754d80544f0c43c6b53b12 Mon Sep 17 00:00:00 2001 From: sean-liu55 Date: Fri, 2 Nov 2018 14:48:05 +0800 Subject: [PATCH 02/99] add proto for merkleTree --- api/api.proto | 6 ++++++ core/Contract.proto | 19 +++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/api/api.proto b/api/api.proto index cb11dc385..20580ecb4 100644 --- a/api/api.proto +++ b/api/api.proto @@ -689,6 +689,12 @@ service WalletSolidity { } }; } + + rpc GetMerkleRoot (BytesMessage) returns (MerkelRoot) { + } + + rpc GetMerklePath (BytesMessage) returns (MerklePath) { + } }; service WalletExtension { diff --git a/core/Contract.proto b/core/Contract.proto index 507f0767d..965e111de 100644 --- a/core/Contract.proto +++ b/core/Contract.proto @@ -76,6 +76,25 @@ message MerkelRoot { bytes rt = 2; } +message AuthenticationPath{ + repeated bool value = 1; +} + +message MerklePath { + repeated AuthenticationPath authentication_paths= 1; + repeated bool index = 2; +} + +message SHA256Compress{ + bytes value = 1; +} + +message MerkleTree{ + bytes left = 1; + bytes right = 2; + repeated bytes parents = 3; +} + message ZksnarkV0TransferContract { bytes owner_address = 1; bytes to_address = 2; From 5f9d1c18def8ddd2b231b8a8e8cc28c7439d73ac Mon Sep 17 00:00:00 2001 From: Wenhua Zhang Date: Fri, 2 Nov 2018 17:09:50 +0800 Subject: [PATCH 03/99] feat(nf_storage): add storage and rpc for nullifier --- api/api.proto | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/api/api.proto b/api/api.proto index 85dd21649..c1b7e276a 100644 --- a/api/api.proto +++ b/api/api.proto @@ -576,6 +576,16 @@ service Wallet { } }; } + + rpc GetNullifier (BytesMessage) returns (BytesMessage) { + option (google.api.http) = { + post: "/wallet/getnullifier" + body: "*" + additional_bindings { + get: "/wallet/getnullifier" + } + }; + } }; From f899f89e0fdcae9ded8ce06bb91947a8cf15c646 Mon Sep 17 00:00:00 2001 From: sean-liu55 Date: Mon, 5 Nov 2018 10:47:15 +0800 Subject: [PATCH 04/99] add rpc proto , GetBestMerkleRoot() --- api/api.proto | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/api/api.proto b/api/api.proto index 20580ecb4..6d2ceac14 100644 --- a/api/api.proto +++ b/api/api.proto @@ -694,7 +694,10 @@ service WalletSolidity { } rpc GetMerklePath (BytesMessage) returns (MerklePath) { - } + } + + rpc GetBestMerkleRoot (EmptyMessage) returns (MerklePath) { + } }; service WalletExtension { From b799bb4a63a0c8bf86e37cef61609730b1c99362 Mon Sep 17 00:00:00 2001 From: zergweak Date: Mon, 5 Nov 2018 11:39:27 +0800 Subject: [PATCH 05/99] modify merkle root --- api/api.proto | 18 +++++++++--------- core/Contract.proto | 7 +------ 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/api/api.proto b/api/api.proto index b7f90a67c..ba19c763a 100644 --- a/api/api.proto +++ b/api/api.proto @@ -46,7 +46,7 @@ service Wallet { rpc CreateTransaction2 (TransferContract) returns (TransactionExtention) { }; - rpc ZksnarkV0TransferTrx(ZksnarkV0TransferContract) returns(TransactionExtention) { + rpc ZksnarkV0TransferTrx (ZksnarkV0TransferContract) returns (TransactionExtention) { }; rpc BroadcastTransaction (Transaction) returns (Return) { @@ -419,15 +419,15 @@ service Wallet { } }; }; - rpc GetPaginatedProposalList (PaginatedMessage) returns (ProposalList) { - option (google.api.http) = { + rpc GetPaginatedProposalList (PaginatedMessage) returns (ProposalList) { + option (google.api.http) = { post: "/wallet/getpaginatedproposallist" body: "*" additional_bindings { get: "/wallet/getpaginatedproposallist" } }; - } + } rpc GetProposalById (BytesMessage) returns (Proposal) { option (google.api.http) = { post: "/wallet/getproposalbyid" @@ -448,14 +448,14 @@ service Wallet { }; }; rpc GetPaginatedExchangeList (PaginatedMessage) returns (ExchangeList) { - option (google.api.http) = { + option (google.api.http) = { post: "/wallet/getpaginatedexchangelist" body: "*" additional_bindings { get: "/wallet/getpaginatedexchangelist" } }; - } + } rpc GetExchangeById (BytesMessage) returns (Exchange) { option (google.api.http) = { post: "/wallet/getexchangebyid" @@ -700,7 +700,7 @@ service WalletSolidity { }; } - rpc GetMerkleRoot (BytesMessage) returns (MerkelRoot) { + rpc GetMerkleRoot (BytesMessage) returns (BytesMessage) { } rpc GetMerklePath (BytesMessage) returns (MerklePath) { @@ -901,7 +901,7 @@ message EasyTransferByPrivateMessage { message EasyTransferResponse { Transaction transaction = 1; Return result = 2; - bytes txid = 3; //transaction id = sha256(transaction.rowdata) + bytes txid = 3; //transaction id = sha256(transaction.rowdata) } message AddressPrKeyPairMessage { @@ -911,7 +911,7 @@ message AddressPrKeyPairMessage { message TransactionExtention { Transaction transaction = 1; - bytes txid = 2; //transaction id = sha256(transaction.rowdata) + bytes txid = 2; //transaction id = sha256(transaction.rowdata) repeated bytes constant_result = 3; Return result = 4; } diff --git a/core/Contract.proto b/core/Contract.proto index 965e111de..5f9794f70 100644 --- a/core/Contract.proto +++ b/core/Contract.proto @@ -71,11 +71,6 @@ message zkv0proof { BN128G1 h = 8; } -message MerkelRoot { - int64 blocknum = 1; - bytes rt = 2; -} - message AuthenticationPath{ repeated bool value = 1; } @@ -100,7 +95,7 @@ message ZksnarkV0TransferContract { bytes to_address = 2; int64 v_from_pub = 3; int64 v_to_pub = 4; - MerkelRoot rt = 5; + bytes rt = 5; bytes nf1 = 6; bytes nf2 = 7; bytes cm1 = 8; From d6a3f41d9ad3bb841a7416dea8373ec19b31dfd6 Mon Sep 17 00:00:00 2001 From: zergweak Date: Mon, 5 Nov 2018 11:58:13 +0800 Subject: [PATCH 06/99] add GetMerklePath --- api/api.proto | 15 ++++++++------- core/Contract.proto | 1 + 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/api/api.proto b/api/api.proto index ba19c763a..57c3e4532 100644 --- a/api/api.proto +++ b/api/api.proto @@ -581,14 +581,15 @@ service Wallet { }; } + // rpc GetMerkleRoot (BytesMessage) returns (BytesMessage) { + // } + // input rt[] + rpc GetMerklePath (BytesMessage) returns (MerklePath) { + } + // get last merkle + rpc GetBestMerkleRoot (EmptyMessage) returns (MerklePath) { + } rpc GetNullifier (BytesMessage) returns (BytesMessage) { - option (google.api.http) = { - post: "/wallet/getnullifier" - body: "*" - additional_bindings { - get: "/wallet/getnullifier" - } - }; } }; diff --git a/core/Contract.proto b/core/Contract.proto index 5f9794f70..ab3a4f8ea 100644 --- a/core/Contract.proto +++ b/core/Contract.proto @@ -78,6 +78,7 @@ message AuthenticationPath{ message MerklePath { repeated AuthenticationPath authentication_paths= 1; repeated bool index = 2; + bytes rt = 3; } message SHA256Compress{ From 40f07321644927771ae192d7bc6720c955413d77 Mon Sep 17 00:00:00 2001 From: sean-liu55 Date: Mon, 5 Nov 2018 17:22:22 +0800 Subject: [PATCH 07/99] add rpc for merkleWitness --- api/api.proto | 3 +++ core/Contract.proto | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/api/api.proto b/api/api.proto index 57c3e4532..6bc38eb3a 100644 --- a/api/api.proto +++ b/api/api.proto @@ -707,6 +707,9 @@ service WalletSolidity { rpc GetMerklePath (BytesMessage) returns (MerklePath) { } + rpc GetMerkleTreeWitness (OutputPoint) returns (MerkleWitness) { + } + rpc GetBestMerkleRoot (EmptyMessage) returns (MerklePath) { } }; diff --git a/core/Contract.proto b/core/Contract.proto index ab3a4f8ea..9b84545b0 100644 --- a/core/Contract.proto +++ b/core/Contract.proto @@ -85,6 +85,15 @@ message SHA256Compress{ bytes value = 1; } +message MerkleWitness{ + bytes value = 1; +} + +message OutputPoint{ + bytes txHash = 1; + bytes index = 2; +} + message MerkleTree{ bytes left = 1; bytes right = 2; From 10d7223e5180ad42f6a4a2d6feb710b0d4440263 Mon Sep 17 00:00:00 2001 From: Wenhua Zhang Date: Mon, 5 Nov 2018 19:01:13 +0800 Subject: [PATCH 08/99] feat: add get_merkle_path rpc --- api/api.proto | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/api/api.proto b/api/api.proto index 57c3e4532..7fbaf75ea 100644 --- a/api/api.proto +++ b/api/api.proto @@ -585,11 +585,27 @@ service Wallet { // } // input rt[] rpc GetMerklePath (BytesMessage) returns (MerklePath) { + option (google.api.http) = { + post: "/wallet/getmerklepath" + body: "*" + additional_bindings { + get: "/wallet/getmerklepath" + } + }; } + // get last merkle rpc GetBestMerkleRoot (EmptyMessage) returns (MerklePath) { } + rpc GetNullifier (BytesMessage) returns (BytesMessage) { + option (google.api.http) = { + post: "/wallet/getnullifier" + body: "*" + additional_bindings { + get: "/wallet/getnullifier" + } + }; } }; From b4f428f8ad4250deedecbbde9f65cb3483037c6c Mon Sep 17 00:00:00 2001 From: Wenhua Zhang Date: Tue, 6 Nov 2018 10:59:18 +0800 Subject: [PATCH 09/99] feat(merkle_rpc): add get_best_merkle_root rpc --- api/api.proto | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/api/api.proto b/api/api.proto index cf7d07ce2..e57282afc 100644 --- a/api/api.proto +++ b/api/api.proto @@ -585,13 +585,6 @@ service Wallet { // } // input rt[] rpc GetMerklePath (BytesMessage) returns (MerklePath) { - option (google.api.http) = { - post: "/wallet/getmerklepath" - body: "*" - additional_bindings { - get: "/wallet/getmerklepath" - } - }; } // get last merkle @@ -599,13 +592,6 @@ service Wallet { } rpc GetNullifier (BytesMessage) returns (BytesMessage) { - option (google.api.http) = { - post: "/wallet/getnullifier" - body: "*" - additional_bindings { - get: "/wallet/getnullifier" - } - }; } }; From 77dd7376f1e3b675e743935070036a0bda0804ef Mon Sep 17 00:00:00 2001 From: sean-liu55 Date: Tue, 6 Nov 2018 15:53:27 +0800 Subject: [PATCH 10/99] refractor merkleWitness --- api/api.proto | 2 +- core/Contract.proto | 25 +++++++++++++++---------- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/api/api.proto b/api/api.proto index 6bc38eb3a..6fb649f02 100644 --- a/api/api.proto +++ b/api/api.proto @@ -707,7 +707,7 @@ service WalletSolidity { rpc GetMerklePath (BytesMessage) returns (MerklePath) { } - rpc GetMerkleTreeWitness (OutputPoint) returns (MerkleWitness) { + rpc GetMerkleTreeWitness (OutputPoint) returns (IncrementalMerkleWitness) { } rpc GetBestMerkleRoot (EmptyMessage) returns (MerklePath) { diff --git a/core/Contract.proto b/core/Contract.proto index 9b84545b0..dc0cc40f0 100644 --- a/core/Contract.proto +++ b/core/Contract.proto @@ -81,23 +81,28 @@ message MerklePath { bytes rt = 3; } -message SHA256Compress{ - bytes value = 1; -} -message MerkleWitness{ - bytes value = 1; -} message OutputPoint{ bytes txHash = 1; bytes index = 2; } -message MerkleTree{ - bytes left = 1; - bytes right = 2; - repeated bytes parents = 3; +message SHA256Compress{ + bytes content = 1; +} + +message IncrementalMerkleTree{ + SHA256Compress left = 1; + SHA256Compress right = 2; + repeated SHA256Compress parents = 3; +} + +message IncrementalMerkleWitness{ + IncrementalMerkleTree tree = 1; + repeated SHA256Compress filled = 2; + IncrementalMerkleTree cursor = 3; + int64 cursor_depth = 4; } message ZksnarkV0TransferContract { From 3cc1eb541f80e31e6f4f04500489948a2fbe4a7f Mon Sep 17 00:00:00 2001 From: zergweak Date: Tue, 6 Nov 2018 18:13:02 +0800 Subject: [PATCH 11/99] modify getbestmerkleroot --- api/api.proto | 21 ++++++++------------- core/Contract.proto | 2 -- 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/api/api.proto b/api/api.proto index f0f8079e5..b835e54a6 100644 --- a/api/api.proto +++ b/api/api.proto @@ -588,11 +588,18 @@ service Wallet { } // get last merkle - rpc GetBestMerkleRoot (EmptyMessage) returns (MerklePath) { + rpc GetBestMerkleRoot (EmptyMessage) returns (BytesMessage) { } rpc GetNullifier (BytesMessage) returns (BytesMessage) { } + + + rpc GetMerkleRoot (BytesMessage) returns (BytesMessage) { + } + + rpc GetMerkleTreeWitness (OutputPoint) returns (IncrementalMerkleWitness) { + } }; @@ -702,18 +709,6 @@ service WalletSolidity { } }; } - - rpc GetMerkleRoot (BytesMessage) returns (BytesMessage) { - } - - rpc GetMerklePath (BytesMessage) returns (MerklePath) { - } - - rpc GetMerkleTreeWitness (OutputPoint) returns (IncrementalMerkleWitness) { - } - - rpc GetBestMerkleRoot (EmptyMessage) returns (MerklePath) { - } }; service WalletExtension { diff --git a/core/Contract.proto b/core/Contract.proto index dc0cc40f0..cc5bb38a4 100644 --- a/core/Contract.proto +++ b/core/Contract.proto @@ -81,8 +81,6 @@ message MerklePath { bytes rt = 3; } - - message OutputPoint{ bytes txHash = 1; bytes index = 2; From 4ac24b5df4a4fb078e3bf51eea40f0c55c8fdfba Mon Sep 17 00:00:00 2001 From: sean-liu55 Date: Wed, 7 Nov 2018 15:16:15 +0800 Subject: [PATCH 12/99] use OutputPoint as witnessKey --- core/Contract.proto | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/Contract.proto b/core/Contract.proto index cc5bb38a4..cdebfcbb7 100644 --- a/core/Contract.proto +++ b/core/Contract.proto @@ -83,7 +83,7 @@ message MerklePath { message OutputPoint{ bytes txHash = 1; - bytes index = 2; + int32 index = 2; } message SHA256Compress{ @@ -101,6 +101,7 @@ message IncrementalMerkleWitness{ repeated SHA256Compress filled = 2; IncrementalMerkleTree cursor = 3; int64 cursor_depth = 4; + OutputPoint output_point = 10; } message ZksnarkV0TransferContract { From 25651ea0842824062bd12431f18de4e128308091 Mon Sep 17 00:00:00 2001 From: Wenhua Zhang Date: Wed, 7 Nov 2018 16:08:59 +0800 Subject: [PATCH 13/99] feat(zksnark_rpc): add getMerkleTreeWitness rpc --- api/api.proto | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/api/api.proto b/api/api.proto index b835e54a6..a29fe13ab 100644 --- a/api/api.proto +++ b/api/api.proto @@ -581,13 +581,10 @@ service Wallet { }; } - // rpc GetMerkleRoot (BytesMessage) returns (BytesMessage) { - // } - // input rt[] rpc GetMerklePath (BytesMessage) returns (MerklePath) { } - // get last merkle + rpc GetBestMerkleRoot (EmptyMessage) returns (BytesMessage) { } From 41bff161fcb6a64e2605fa1a362c4ed50b7a827a Mon Sep 17 00:00:00 2001 From: sean-liu55 Date: Tue, 13 Nov 2018 11:16:40 +0800 Subject: [PATCH 14/99] change outPoint --- api/api.proto | 1 + core/Contract.proto | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/api/api.proto b/api/api.proto index a29fe13ab..1c6319842 100644 --- a/api/api.proto +++ b/api/api.proto @@ -1,3 +1,4 @@ + syntax = "proto3"; package protocol; diff --git a/core/Contract.proto b/core/Contract.proto index cdebfcbb7..d79034939 100644 --- a/core/Contract.proto +++ b/core/Contract.proto @@ -82,7 +82,7 @@ message MerklePath { } message OutputPoint{ - bytes txHash = 1; + bytes hash = 1; int32 index = 2; } From d422fb4594317a0b5e067cb791981e953866ba3b Mon Sep 17 00:00:00 2001 From: sean-liu55 Date: Tue, 13 Nov 2018 11:32:52 +0800 Subject: [PATCH 15/99] add rt into IncrementalMerkleWitness --- core/Contract.proto | 1 + 1 file changed, 1 insertion(+) diff --git a/core/Contract.proto b/core/Contract.proto index d79034939..322a5a504 100644 --- a/core/Contract.proto +++ b/core/Contract.proto @@ -101,6 +101,7 @@ message IncrementalMerkleWitness{ repeated SHA256Compress filled = 2; IncrementalMerkleTree cursor = 3; int64 cursor_depth = 4; + bytes rt = 5; OutputPoint output_point = 10; } From b81e204156235181c125b7ffc460bbaf69792bdb Mon Sep 17 00:00:00 2001 From: Wenhua Zhang Date: Tue, 27 Nov 2018 10:53:49 +0800 Subject: [PATCH 16/99] feat(generate_shield_address): add generateShieldAddress http api --- core/Contract.proto | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core/Contract.proto b/core/Contract.proto index 322a5a504..ade6ecb62 100644 --- a/core/Contract.proto +++ b/core/Contract.proto @@ -125,6 +125,11 @@ message ZksnarkV0TransferContract { zkv0proof proof = 30; } +message ShieldAddress { + bytes private_key = 1; + bytes public_key = 2; +} + message TransferAssetContract { bytes asset_name = 1; bytes owner_address = 2; From 4d54938541334cd1b738dbd1a6895cc39910d0de Mon Sep 17 00:00:00 2001 From: Wenhua Zhang Date: Tue, 27 Nov 2018 11:29:29 +0800 Subject: [PATCH 17/99] feat(generateshieldaddress): update contract --- core/Contract.proto | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/Contract.proto b/core/Contract.proto index ade6ecb62..048381c95 100644 --- a/core/Contract.proto +++ b/core/Contract.proto @@ -126,8 +126,8 @@ message ZksnarkV0TransferContract { } message ShieldAddress { - bytes private_key = 1; - bytes public_key = 2; + bytes private_address = 1; + bytes public_address = 2; } message TransferAssetContract { From 33d964b91b17423dfa888579769f0a18d8dde0cb Mon Sep 17 00:00:00 2001 From: Wenhua Zhang Date: Wed, 28 Nov 2018 16:41:49 +0800 Subject: [PATCH 18/99] feat(generateshieldaddress): add generateshieldaddress rpc --- api/api.proto | 3 +++ 1 file changed, 3 insertions(+) diff --git a/api/api.proto b/api/api.proto index 1c6319842..a856c5682 100644 --- a/api/api.proto +++ b/api/api.proto @@ -598,6 +598,9 @@ service Wallet { rpc GetMerkleTreeWitness (OutputPoint) returns (IncrementalMerkleWitness) { } + + rpc GenerateShieldAddress (EmptyMessage) returns (ShieldAddress) { + } }; From 91926b48228ea7fad33fcf8444da15a90b8bb1b4 Mon Sep 17 00:00:00 2001 From: Hou Date: Mon, 3 Dec 2018 15:49:07 +0800 Subject: [PATCH 19/99] add GRPC GetZKBlockByLimitNext and GetMerkleTreeOfBlock --- api/api.proto | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/api/api.proto b/api/api.proto index a856c5682..a9fcd1df1 100644 --- a/api/api.proto +++ b/api/api.proto @@ -601,6 +601,14 @@ service Wallet { rpc GenerateShieldAddress (EmptyMessage) returns (ShieldAddress) { } + + //Get zero-snark blockExtention list + rpc GetZKBlockByLimitNext (BlockLimit) returns (BlockListExtention) { + } + + //Get the specified height block merkleTree + rpc GetMerkleTreeOfBlock ( NumberMessage ) returns ( BlockIncrementalMerkleTree ) { } + }; @@ -930,4 +938,9 @@ message BlockListExtention { message TransactionListExtention { repeated TransactionExtention transaction = 1; +} + +message BlockIncrementalMerkleTree { + int64 number = 1; + IncrementalMerkleTree merkleTree = 2; } \ No newline at end of file From 93d8722f7287795c1f347e4efa0ce105f7aefb57 Mon Sep 17 00:00:00 2001 From: sean-liu55 Date: Tue, 4 Dec 2018 12:12:36 +0800 Subject: [PATCH 20/99] add getMerkleTreeWitnessInfo --- api/api.proto | 3 +++ core/Contract.proto | 12 ++++++++++++ 2 files changed, 15 insertions(+) diff --git a/api/api.proto b/api/api.proto index a9fcd1df1..522003fe3 100644 --- a/api/api.proto +++ b/api/api.proto @@ -599,6 +599,9 @@ service Wallet { rpc GetMerkleTreeWitness (OutputPoint) returns (IncrementalMerkleWitness) { } + rpc GetMerkleTreeWitnessInfo (OutputPointInfo) returns (IncrementalMerkleWitnessInfo) { + } + rpc GenerateShieldAddress (EmptyMessage) returns (ShieldAddress) { } diff --git a/core/Contract.proto b/core/Contract.proto index 048381c95..9396a088c 100644 --- a/core/Contract.proto +++ b/core/Contract.proto @@ -86,6 +86,12 @@ message OutputPoint{ int32 index = 2; } +message OutputPointInfo{ + OutputPoint out_point_1 = 1; + OutputPoint out_point_2 = 2; + int32 block_num = 3; +} + message SHA256Compress{ bytes content = 1; } @@ -105,6 +111,12 @@ message IncrementalMerkleWitness{ OutputPoint output_point = 10; } +message IncrementalMerkleWitnessInfo{ + IncrementalMerkleWitness witness1 = 1; + IncrementalMerkleWitness witness2 = 2; + int32 block_num = 3; +} + message ZksnarkV0TransferContract { bytes owner_address = 1; bytes to_address = 2; From d701e714302f5c1b393dae374a0c6d807ffef0e2 Mon Sep 17 00:00:00 2001 From: nanfengpo Date: Wed, 12 Dec 2018 23:32:25 +0800 Subject: [PATCH 21/99] minor change --- core/Contract.proto | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/core/Contract.proto b/core/Contract.proto index 9396a088c..b8579f475 100644 --- a/core/Contract.proto +++ b/core/Contract.proto @@ -81,28 +81,28 @@ message MerklePath { bytes rt = 3; } -message OutputPoint{ +message OutputPoint { bytes hash = 1; int32 index = 2; } -message OutputPointInfo{ +message OutputPointInfo { OutputPoint out_point_1 = 1; OutputPoint out_point_2 = 2; int32 block_num = 3; } -message SHA256Compress{ +message SHA256Compress { bytes content = 1; } -message IncrementalMerkleTree{ +message IncrementalMerkleTree { SHA256Compress left = 1; SHA256Compress right = 2; repeated SHA256Compress parents = 3; } -message IncrementalMerkleWitness{ +message IncrementalMerkleWitness { IncrementalMerkleTree tree = 1; repeated SHA256Compress filled = 2; IncrementalMerkleTree cursor = 3; @@ -111,7 +111,7 @@ message IncrementalMerkleWitness{ OutputPoint output_point = 10; } -message IncrementalMerkleWitnessInfo{ +message IncrementalMerkleWitnessInfo { IncrementalMerkleWitness witness1 = 1; IncrementalMerkleWitness witness2 = 2; int32 block_num = 3; From 7b0d46fc22ed4e931c0babe9903732f15210c027 Mon Sep 17 00:00:00 2001 From: nanfengpo Date: Thu, 13 Dec 2018 11:08:56 +0800 Subject: [PATCH 22/99] minor change --- core/Contract.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/Contract.proto b/core/Contract.proto index b8579f475..bc5243877 100644 --- a/core/Contract.proto +++ b/core/Contract.proto @@ -71,7 +71,7 @@ message zkv0proof { BN128G1 h = 8; } -message AuthenticationPath{ +message AuthenticationPath { repeated bool value = 1; } From 905e8d5003273f1562a6a3c8a95d473cc95e5067 Mon Sep 17 00:00:00 2001 From: Hou Date: Tue, 18 Dec 2018 16:05:51 +0800 Subject: [PATCH 23/99] 1 Add ZKSanrk transaction fee, currently 1TRX 2 Add proposals open ZKSanrk transactions and modify ZKSanrk transaction fees --- core/Contract.proto | 1 + 1 file changed, 1 insertion(+) diff --git a/core/Contract.proto b/core/Contract.proto index bc5243877..e77cb55ea 100644 --- a/core/Contract.proto +++ b/core/Contract.proto @@ -130,6 +130,7 @@ message ZksnarkV0TransferContract { bytes pksig = 10; bytes randomSeed = 11; bytes epk = 12; + int64 fee = 13; bytes h1 = 20; bytes h2 = 21; bytes C1 = 22; From 3d196a7f845a8895dcd1bfe3d796301ef27107ee Mon Sep 17 00:00:00 2001 From: zergweak Date: Tue, 18 Dec 2018 17:59:30 +0800 Subject: [PATCH 24/99] merge config --- core/Tron.proto | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/Tron.proto b/core/Tron.proto index 688ce17e6..b57b56b0d 100644 --- a/core/Tron.proto +++ b/core/Tron.proto @@ -254,7 +254,10 @@ message Transaction { ExchangeWithdrawContract = 43; ExchangeTransactionContract = 44; UpdateEnergyLimitContract = 45; - ZksnarkV0TransferContract = 48; + PermissionAddKeyContract = 46; + PermissionUpdateKeyContract = 47; + PermissionDeleteKeyContract = 48; + ZksnarkV0TransferContract = 49; } ContractType type = 1; google.protobuf.Any parameter = 2; From 7315288975e1aa229530a41be687e784015df3cc Mon Sep 17 00:00:00 2001 From: sean-liu55 Date: Mon, 18 Mar 2019 17:04:38 +0800 Subject: [PATCH 25/99] fix conflict --- core/Tron.proto | 3 --- 1 file changed, 3 deletions(-) diff --git a/core/Tron.proto b/core/Tron.proto index ee6e96843..ffd2ece7f 100644 --- a/core/Tron.proto +++ b/core/Tron.proto @@ -273,9 +273,6 @@ message Transaction { ExchangeTransactionContract = 44; UpdateEnergyLimitContract = 45; AccountPermissionUpdateContract = 46; - PermissionAddKeyContract = 47; - PermissionUpdateKeyContract = 48; - PermissionDeleteKeyContract = 49; ZksnarkV0TransferContract = 50; } ContractType type = 1; From fe28f2e5553f511977d92e57f41ee253567dcd1e Mon Sep 17 00:00:00 2001 From: sean-liu55 Date: Mon, 18 Mar 2019 18:57:08 +0800 Subject: [PATCH 26/99] change class name --- api/api.proto | 4 ++-- core/Contract.proto | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/api/api.proto b/api/api.proto index e5bb720de..71607f816 100644 --- a/api/api.proto +++ b/api/api.proto @@ -617,10 +617,10 @@ service Wallet { rpc GetMerkleRoot (BytesMessage) returns (BytesMessage) { } - rpc GetMerkleTreeWitness (OutputPoint) returns (IncrementalMerkleWitness) { + rpc GetMerkleTreeWitness (OutputPoint) returns (IncrementalMerkleVoucher) { } - rpc GetMerkleTreeWitnessInfo (OutputPointInfo) returns (IncrementalMerkleWitnessInfo) { + rpc GetMerkleTreeWitnessInfo (OutputPointInfo) returns (IncrementalMerkleVoucherInfo) { } rpc GenerateShieldAddress (EmptyMessage) returns (ShieldAddress) { diff --git a/core/Contract.proto b/core/Contract.proto index 7f1cc28f9..571c05988 100644 --- a/core/Contract.proto +++ b/core/Contract.proto @@ -102,7 +102,7 @@ message IncrementalMerkleTree { repeated SHA256Compress parents = 3; } -message IncrementalMerkleWitness { +message IncrementalMerkleVoucher { IncrementalMerkleTree tree = 1; repeated SHA256Compress filled = 2; IncrementalMerkleTree cursor = 3; @@ -111,9 +111,9 @@ message IncrementalMerkleWitness { OutputPoint output_point = 10; } -message IncrementalMerkleWitnessInfo { - IncrementalMerkleWitness witness1 = 1; - IncrementalMerkleWitness witness2 = 2; +message IncrementalMerkleVoucherInfo { + IncrementalMerkleVoucher voucher1 = 1; + IncrementalMerkleVoucher voucher2 = 2; int32 block_num = 3; } From 8eb93007e7407b79746d31f0600a49c4c7d9600a Mon Sep 17 00:00:00 2001 From: renchenchang Date: Tue, 9 Apr 2019 21:02:32 +0800 Subject: [PATCH 27/99] add proto about shielded tx --- core/ShieldedTX.proto | 78 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 core/ShieldedTX.proto diff --git a/core/ShieldedTX.proto b/core/ShieldedTX.proto new file mode 100644 index 000000000..d54ba3aa3 --- /dev/null +++ b/core/ShieldedTX.proto @@ -0,0 +1,78 @@ +/* + * 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 = "ShieldedTX"; //Specify the class name of the generated Java file +option go_package = "github.com/tronprotocol/grpc-gateway/core"; + +message Note { + bytes value = 1; + bytes d = 2; + bytes pk_d = 3; + bytes r = 4; +} + +message SpendStatement { + bytes ak = 1; + bytes nsk = 2; + Note note = 3; + bytes alpha = 4; + bytes anchor = 5; + bytes witness = 6; +} + +message OutputStatement { + bytes esk = 1; + Note note = 2; +} + +message SpendStatement { + bytes ak = 1; + bytes nsk = 2; + Note note = 3; + bytes alpha = 4; + bytes anchor = 5; + bytes witness = 6; +} + +message SpendDescription { + bytes cv = 1; + bytes anchor = 2; + bytes nullifier = 3; + bytes rk = 4; + bytes zkproof = 5; + bytes spendAuthSig = 6; +} + +message OutputDescription { + bytes cv = 1; + bytes cm = 2; + bytes ephemeralKey = 3; + bytes encCiphertext = 4; + bytes outCiphertext = 5; + bytes zkproof = 6; +} + +message ShieldedTransaction { + repeated SpendDescription vShieldedSpend = 1; + repeated OutputDescription vShieldedOutput = 2; + bytes bindingSig = 3; + bytes tFromAddress = 4; + bytes tToAddress = 5; +} From 94e63af9d29c786c8e684979ecbfa8a7e63a2b38 Mon Sep 17 00:00:00 2001 From: renchenchang Date: Tue, 9 Apr 2019 21:12:03 +0800 Subject: [PATCH 28/99] rename OutputDescription --- core/ShieldedTX.proto | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/ShieldedTX.proto b/core/ShieldedTX.proto index d54ba3aa3..0b8f44c29 100644 --- a/core/ShieldedTX.proto +++ b/core/ShieldedTX.proto @@ -63,9 +63,9 @@ message SpendDescription { message OutputDescription { bytes cv = 1; bytes cm = 2; - bytes ephemeralKey = 3; - bytes encCiphertext = 4; - bytes outCiphertext = 5; + bytes epk = 3; + bytes c_enc = 4; + bytes c_out = 5; bytes zkproof = 6; } From a1165c5ef295053e165e2521d1cb8caa27562941 Mon Sep 17 00:00:00 2001 From: renchenchang Date: Wed, 10 Apr 2019 11:52:33 +0800 Subject: [PATCH 29/99] proto re defination --- core/Contract.proto | 64 +++++++++++++++++++++++++++++++---- core/ShieldedTX.proto | 78 ------------------------------------------- core/Tron.proto | 8 ++--- 3 files changed, 62 insertions(+), 88 deletions(-) delete mode 100644 core/ShieldedTX.proto diff --git a/core/Contract.proto b/core/Contract.proto index 571c05988..ad190caf2 100644 --- a/core/Contract.proto +++ b/core/Contract.proto @@ -72,11 +72,11 @@ message zkv0proof { } message AuthenticationPath { - repeated bool value = 1; + repeated bool value = 1; } message MerklePath { - repeated AuthenticationPath authentication_paths= 1; + repeated AuthenticationPath authentication_paths = 1; repeated bool index = 2; bytes rt = 3; } @@ -341,7 +341,59 @@ message ExchangeTransactionContract { 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 -} \ No newline at end of file + Permission owner = 2; //Empty is invalidate + Permission witness = 3; //Can be empty + repeated Permission actives = 4; //Empty is invalidate +} + +// for shielded transaction +message Note { + bytes value = 1; + bytes d = 2; + bytes pk_d = 3; + bytes r = 4; +} + +//message SpendStatement { +// bytes ak = 1; +// bytes nsk = 2; +// Note note = 3; +// bytes alpha = 4; +// bytes anchor = 5; +// bytes witness = 6; +//} +// +//message OutputStatement { +// bytes esk = 1; +// Note note = 2; +//} + +message SpendDescription { + bytes cv = 1; + bytes anchor = 2; + bytes nullifier = 3; + bytes rk = 4; + bytes zkproof = 5; + bytes spendAuthSig = 6; +} + +message OutputDescription { + bytes cv = 1; + bytes cm = 2; + bytes epk = 3; + bytes c_enc = 4; + bytes c_out = 5; + bytes zkproof = 6; +} + +message ShieldedTransactionContract { + bytes t_from_address = 1; //transparent address + bytes from_amount = 2; + repeated SpendDescription shieldedSpend = 3; + repeated OutputDescription shieldedOutput = 4; + bytes bindingSig = 5; + bytes valueBalance = 6; + bytes t_to_address = 7; //transparent address + bytes to_amount = 8; //the amount to transparent to_address +} +// end shielded transaction \ No newline at end of file diff --git a/core/ShieldedTX.proto b/core/ShieldedTX.proto deleted file mode 100644 index 0b8f44c29..000000000 --- a/core/ShieldedTX.proto +++ /dev/null @@ -1,78 +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 = "ShieldedTX"; //Specify the class name of the generated Java file -option go_package = "github.com/tronprotocol/grpc-gateway/core"; - -message Note { - bytes value = 1; - bytes d = 2; - bytes pk_d = 3; - bytes r = 4; -} - -message SpendStatement { - bytes ak = 1; - bytes nsk = 2; - Note note = 3; - bytes alpha = 4; - bytes anchor = 5; - bytes witness = 6; -} - -message OutputStatement { - bytes esk = 1; - Note note = 2; -} - -message SpendStatement { - bytes ak = 1; - bytes nsk = 2; - Note note = 3; - bytes alpha = 4; - bytes anchor = 5; - bytes witness = 6; -} - -message SpendDescription { - bytes cv = 1; - bytes anchor = 2; - bytes nullifier = 3; - bytes rk = 4; - bytes zkproof = 5; - bytes spendAuthSig = 6; -} - -message OutputDescription { - bytes cv = 1; - bytes cm = 2; - bytes epk = 3; - bytes c_enc = 4; - bytes c_out = 5; - bytes zkproof = 6; -} - -message ShieldedTransaction { - repeated SpendDescription vShieldedSpend = 1; - repeated OutputDescription vShieldedOutput = 2; - bytes bindingSig = 3; - bytes tFromAddress = 4; - bytes tToAddress = 5; -} diff --git a/core/Tron.proto b/core/Tron.proto index ffd2ece7f..dab60eb6e 100644 --- a/core/Tron.proto +++ b/core/Tron.proto @@ -66,7 +66,6 @@ message ChainParameters { } } - /* Account */ message Account { /* frozen balance */ @@ -178,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; } @@ -274,6 +273,7 @@ message Transaction { UpdateEnergyLimitContract = 45; AccountPermissionUpdateContract = 46; ZksnarkV0TransferContract = 50; + ShieldedTransactionContract = 51; } ContractType type = 1; google.protobuf.Any parameter = 2; @@ -335,7 +335,7 @@ message Transaction { raw raw_data = 1; // only support size = 1, repeated list here for muti-sig extension repeated bytes signature = 2; - repeated bytes signature_zk = 3; + // repeated bytes signature_zk = 3; repeated Result ret = 5; } From db7a738f591a6a359ae3bbb5334c437a53477f6c Mon Sep 17 00:00:00 2001 From: renchenchang Date: Wed, 10 Apr 2019 12:19:48 +0800 Subject: [PATCH 30/99] add stament defination --- core/Contract.proto | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/core/Contract.proto b/core/Contract.proto index ad190caf2..34070f78f 100644 --- a/core/Contract.proto +++ b/core/Contract.proto @@ -354,19 +354,19 @@ message Note { bytes r = 4; } -//message SpendStatement { -// bytes ak = 1; -// bytes nsk = 2; -// Note note = 3; -// bytes alpha = 4; -// bytes anchor = 5; -// bytes witness = 6; -//} -// -//message OutputStatement { -// bytes esk = 1; -// Note note = 2; -//} +message SpendStatement { + bytes ak = 1; + bytes nsk = 2; + Note note = 3; + bytes alpha = 4; + bytes anchor = 5; + bytes witness = 6; +} + +message OutputStatement { + bytes esk = 1; + Note note = 2; +} message SpendDescription { bytes cv = 1; From f7f523b0a908876654cd56f540a58adb3a15a87e Mon Sep 17 00:00:00 2001 From: renchenchang Date: Wed, 10 Apr 2019 12:29:07 +0800 Subject: [PATCH 31/99] add api for ShieldedTransaction --- api/api.proto | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/api/api.proto b/api/api.proto index 71607f816..adc134de2 100644 --- a/api/api.proto +++ b/api/api.proto @@ -659,6 +659,17 @@ service Wallet { rpc GetNodeInfo (EmptyMessage) returns (NodeInfo) { }; + + // for shiededTransaction + rpc CreateSpendProof (SpendStatement) returns (SpendDescription) { + }; + + rpc CreateOutPutProof (OutputStatement) returns (OutputDescription) { + }; + + rpc CreateShieldedTransaction(ShieldedTransactionContract) returns (TransactionExtention) { + }; + // end for shiededTransaction }; From dfe5b7cc15357b5cf5f09097f5c5d5429a8f0516 Mon Sep 17 00:00:00 2001 From: renchenchang Date: Wed, 10 Apr 2019 14:35:35 +0800 Subject: [PATCH 32/99] api for shielded tx --- api/api.proto | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/api/api.proto b/api/api.proto index adc134de2..16650d41e 100644 --- a/api/api.proto +++ b/api/api.proto @@ -1,4 +1,3 @@ - syntax = "proto3"; package protocol; @@ -631,7 +630,8 @@ service Wallet { } //Get the specified height block merkleTree - rpc GetMerkleTreeOfBlock ( NumberMessage ) returns ( BlockIncrementalMerkleTree ) { } + rpc GetMerkleTreeOfBlock (NumberMessage) returns (BlockIncrementalMerkleTree) { + } rpc AccountPermissionUpdate (AccountPermissionUpdateContract) returns (TransactionExtention) { @@ -653,7 +653,7 @@ service Wallet { } - rpc GetTransactionApprovedList(Transaction) returns (TransactionApprovedList) { + rpc GetTransactionApprovedList (Transaction) returns (TransactionApprovedList) { } @@ -667,7 +667,7 @@ service Wallet { rpc CreateOutPutProof (OutputStatement) returns (OutputDescription) { }; - rpc CreateShieldedTransaction(ShieldedTransactionContract) returns (TransactionExtention) { + rpc CreateShieldedTransaction (ShieldedTransactionContract) returns (TransactionExtention) { }; // end for shiededTransaction }; @@ -906,7 +906,6 @@ message DelegatedResourceList { repeated DelegatedResource delegatedResource = 1; } - // Gossip node list message NodeList { repeated Node nodes = 1; From 7a9fdb8644f9fd2ed29f9e0b65c89e4c8466b6a6 Mon Sep 17 00:00:00 2001 From: renchenchang Date: Wed, 10 Apr 2019 18:54:12 +0800 Subject: [PATCH 33/99] rename the fields in shielded transaction --- core/Contract.proto | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/core/Contract.proto b/core/Contract.proto index 34070f78f..1496beb3a 100644 --- a/core/Contract.proto +++ b/core/Contract.proto @@ -351,7 +351,7 @@ message Note { bytes value = 1; bytes d = 2; bytes pk_d = 3; - bytes r = 4; + bytes rcm = 4; } message SpendStatement { @@ -360,7 +360,7 @@ message SpendStatement { Note note = 3; bytes alpha = 4; bytes anchor = 5; - bytes witness = 6; + bytes path = 6; } message OutputStatement { @@ -369,31 +369,31 @@ message OutputStatement { } message SpendDescription { - bytes cv = 1; + bytes value_commitment = 1; bytes anchor = 2; bytes nullifier = 3; bytes rk = 4; bytes zkproof = 5; - bytes spendAuthSig = 6; + bytes spend_authority_sign = 6; } message OutputDescription { - bytes cv = 1; - bytes cm = 2; + bytes value_commitment = 1; + bytes note_commitment = 2; bytes epk = 3; bytes c_enc = 4; bytes c_out = 5; bytes zkproof = 6; } -message ShieldedTransactionContract { - bytes t_from_address = 1; //transparent address +message ShieldedTransferContract { + bytes transparent_from_address = 1; //transparent address bytes from_amount = 2; - repeated SpendDescription shieldedSpend = 3; - repeated OutputDescription shieldedOutput = 4; - bytes bindingSig = 5; - bytes valueBalance = 6; - bytes t_to_address = 7; //transparent address + repeated SpendDescription spend_description = 3; + repeated OutputDescription output_description = 4; + bytes binding_sign = 5; + bytes value_balance = 6; + bytes transparent_to_address = 7; //transparent address bytes to_amount = 8; //the amount to transparent to_address } // end shielded transaction \ No newline at end of file From 6b0027c51d061429e3d2f0463ae1ce59233cbf2b Mon Sep 17 00:00:00 2001 From: renchenchang Date: Thu, 11 Apr 2019 11:17:03 +0800 Subject: [PATCH 34/99] rename sign in proto --- core/Contract.proto | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/Contract.proto b/core/Contract.proto index 1496beb3a..870724128 100644 --- a/core/Contract.proto +++ b/core/Contract.proto @@ -374,7 +374,7 @@ message SpendDescription { bytes nullifier = 3; bytes rk = 4; bytes zkproof = 5; - bytes spend_authority_sign = 6; + bytes spend_authority_signature = 6; } message OutputDescription { @@ -391,7 +391,7 @@ message ShieldedTransferContract { bytes from_amount = 2; repeated SpendDescription spend_description = 3; repeated OutputDescription output_description = 4; - bytes binding_sign = 5; + bytes binding_signature = 5; bytes value_balance = 6; bytes transparent_to_address = 7; //transparent address bytes to_amount = 8; //the amount to transparent to_address From 1a98c32bcd3b29de69ef951d7b14d024306b878e Mon Sep 17 00:00:00 2001 From: renchenchang Date: Thu, 11 Apr 2019 11:23:58 +0800 Subject: [PATCH 35/99] annotation for proto --- core/Contract.proto | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/core/Contract.proto b/core/Contract.proto index 870724128..d18169f3b 100644 --- a/core/Contract.proto +++ b/core/Contract.proto @@ -358,21 +358,21 @@ message SpendStatement { bytes ak = 1; bytes nsk = 2; Note note = 3; - bytes alpha = 4; - bytes anchor = 5; - bytes path = 6; + bytes alpha = 4; // random number for spend authority signature + bytes anchor = 5; // merkle root + bytes path = 6; // path for cm to root in merkle tree } message OutputStatement { - bytes esk = 1; + bytes esk = 1; // for Encryption Note note = 2; } message SpendDescription { bytes value_commitment = 1; - bytes anchor = 2; - bytes nullifier = 3; - bytes rk = 4; + 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; } @@ -380,9 +380,9 @@ message SpendDescription { message OutputDescription { bytes value_commitment = 1; bytes note_commitment = 2; - bytes epk = 3; - bytes c_enc = 4; - bytes c_out = 5; + 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; } From 4348559aa78c4472510b82c5986118b569521b6f Mon Sep 17 00:00:00 2001 From: renchenchang Date: Thu, 11 Apr 2019 11:24:31 +0800 Subject: [PATCH 36/99] annotation for proto --- core/Contract.proto | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/core/Contract.proto b/core/Contract.proto index d18169f3b..d9201e73e 100644 --- a/core/Contract.proto +++ b/core/Contract.proto @@ -370,9 +370,9 @@ message OutputStatement { 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 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; } @@ -380,20 +380,20 @@ message SpendDescription { message OutputDescription { 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 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 + bytes transparent_from_address = 1; // transparent address bytes from_amount = 2; repeated SpendDescription spend_description = 3; repeated OutputDescription output_description = 4; bytes binding_signature = 5; bytes value_balance = 6; - bytes transparent_to_address = 7; //transparent address - bytes to_amount = 8; //the amount to transparent to_address + bytes transparent_to_address = 7; // transparent address + bytes to_amount = 8; // the amount to transparent to_address } // end shielded transaction \ No newline at end of file From b904ff07c1878a77e48a91a6d3548da9e266cff1 Mon Sep 17 00:00:00 2001 From: renchenchang Date: Thu, 11 Apr 2019 11:25:34 +0800 Subject: [PATCH 37/99] annotation for proto --- core/Contract.proto | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/core/Contract.proto b/core/Contract.proto index d9201e73e..5fa66a510 100644 --- a/core/Contract.proto +++ b/core/Contract.proto @@ -370,9 +370,9 @@ message OutputStatement { 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 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; } @@ -380,20 +380,20 @@ message SpendDescription { message OutputDescription { 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 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 + bytes transparent_from_address = 1; // transparent address bytes from_amount = 2; repeated SpendDescription spend_description = 3; repeated OutputDescription output_description = 4; bytes binding_signature = 5; bytes value_balance = 6; - bytes transparent_to_address = 7; // transparent address - bytes to_amount = 8; // the amount to transparent to_address + bytes transparent_to_address = 7; // transparent address + bytes to_amount = 8; // the amount to transparent to_address } // end shielded transaction \ No newline at end of file From 23a0b5b75b56a240c99b862d4708a359104d8cc9 Mon Sep 17 00:00:00 2001 From: sean-liu55 Date: Thu, 11 Apr 2019 11:32:58 +0800 Subject: [PATCH 38/99] fix proto error --- api/api.proto | 2 +- core/Tron.proto | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/api/api.proto b/api/api.proto index 16650d41e..f1b883064 100644 --- a/api/api.proto +++ b/api/api.proto @@ -667,7 +667,7 @@ service Wallet { rpc CreateOutPutProof (OutputStatement) returns (OutputDescription) { }; - rpc CreateShieldedTransaction (ShieldedTransactionContract) returns (TransactionExtention) { + rpc CreateShieldedTransaction (ShieldedTransferContract) returns (TransactionExtention) { }; // end for shiededTransaction }; diff --git a/core/Tron.proto b/core/Tron.proto index 3911fe5cb..a0f1968ce 100644 --- a/core/Tron.proto +++ b/core/Tron.proto @@ -273,7 +273,7 @@ message Transaction { UpdateEnergyLimitContract = 45; AccountPermissionUpdateContract = 46; ZksnarkV0TransferContract = 50; - ShieldedTransactionContract = 51; + ShieldedTransferContract = 51; } ContractType type = 1; google.protobuf.Any parameter = 2; From c0ec51158f56421a7eeeb15876124b47f21eb8fc Mon Sep 17 00:00:00 2001 From: sean-liu55 Date: Thu, 11 Apr 2019 11:53:29 +0800 Subject: [PATCH 39/99] add capsule --- core/Contract.proto | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/core/Contract.proto b/core/Contract.proto index 5fa66a510..10884ee77 100644 --- a/core/Contract.proto +++ b/core/Contract.proto @@ -368,12 +368,17 @@ message OutputStatement { Note note = 2; } + +message GrothProof { + bytes values= 1; +} + 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; + GrothProof zkproof = 5; bytes spend_authority_signature = 6; } @@ -383,7 +388,7 @@ message OutputDescription { 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; + GrothProof zkproof = 6; } message ShieldedTransferContract { From d6dbbaa214995440cbd1b501b818c4ecac7ce066 Mon Sep 17 00:00:00 2001 From: renchenchang Date: Fri, 12 Apr 2019 17:17:54 +0800 Subject: [PATCH 40/99] rename field in proto --- api/api.proto | 2 +- core/Contract.proto | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/api/api.proto b/api/api.proto index f1b883064..531163c94 100644 --- a/api/api.proto +++ b/api/api.proto @@ -664,7 +664,7 @@ service Wallet { rpc CreateSpendProof (SpendStatement) returns (SpendDescription) { }; - rpc CreateOutPutProof (OutputStatement) returns (OutputDescription) { + rpc CreateReceiveProof (ReceiveStatement) returns (ReceiveDescription) { }; rpc CreateShieldedTransaction (ShieldedTransferContract) returns (TransactionExtention) { diff --git a/core/Contract.proto b/core/Contract.proto index 10884ee77..b997e7b4f 100644 --- a/core/Contract.proto +++ b/core/Contract.proto @@ -363,14 +363,14 @@ message SpendStatement { bytes path = 6; // path for cm to root in merkle tree } -message OutputStatement { +message ReceiveStatement { bytes esk = 1; // for Encryption Note note = 2; } message GrothProof { - bytes values= 1; + bytes values = 1; } message SpendDescription { @@ -382,7 +382,7 @@ message SpendDescription { bytes spend_authority_signature = 6; } -message OutputDescription { +message ReceiveDescription { bytes value_commitment = 1; bytes note_commitment = 2; bytes epk = 3; // for Encryption @@ -395,7 +395,7 @@ message ShieldedTransferContract { bytes transparent_from_address = 1; // transparent address bytes from_amount = 2; repeated SpendDescription spend_description = 3; - repeated OutputDescription output_description = 4; + repeated ReceiveDescription receive_description = 4; bytes binding_signature = 5; bytes value_balance = 6; bytes transparent_to_address = 7; // transparent address From 20378ed5dc4a3be0c370f669a86457dcd3123f48 Mon Sep 17 00:00:00 2001 From: sean-liu55 Date: Mon, 15 Apr 2019 11:39:46 +0800 Subject: [PATCH 41/99] debug create spendProof --- core/Contract.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/Contract.proto b/core/Contract.proto index b997e7b4f..cffa348ae 100644 --- a/core/Contract.proto +++ b/core/Contract.proto @@ -350,7 +350,7 @@ message AccountPermissionUpdateContract { message Note { bytes value = 1; bytes d = 2; - bytes pk_d = 3; + bytes pkD = 3; bytes rcm = 4; } From 187566a363965dca071d8bfaa2d0d4cf32213d35 Mon Sep 17 00:00:00 2001 From: Wenhua Zhang Date: Mon, 15 Apr 2019 17:08:55 +0800 Subject: [PATCH 42/99] feat(pedersen_hash): modify 256hash to perdersen --- core/Contract.proto | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/core/Contract.proto b/core/Contract.proto index cffa348ae..3b513a824 100644 --- a/core/Contract.proto +++ b/core/Contract.proto @@ -92,19 +92,19 @@ message OutputPointInfo { int32 block_num = 3; } -message SHA256Compress { +message PedersenHash { bytes content = 1; } message IncrementalMerkleTree { - SHA256Compress left = 1; - SHA256Compress right = 2; - repeated SHA256Compress parents = 3; + PedersenHash left = 1; + PedersenHash right = 2; + repeated PedersenHash parents = 3; } message IncrementalMerkleVoucher { IncrementalMerkleTree tree = 1; - repeated SHA256Compress filled = 2; + repeated PedersenHash filled = 2; IncrementalMerkleTree cursor = 3; int64 cursor_depth = 4; bytes rt = 5; From 186d9059d98d501aaa262379c06489c6bc87d1b0 Mon Sep 17 00:00:00 2001 From: renchenchang Date: Mon, 15 Apr 2019 17:17:33 +0800 Subject: [PATCH 43/99] update desc for path in proto --- core/Contract.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/Contract.proto b/core/Contract.proto index cffa348ae..f0aec0bd8 100644 --- a/core/Contract.proto +++ b/core/Contract.proto @@ -360,7 +360,7 @@ message SpendStatement { Note note = 3; bytes alpha = 4; // random number for spend authority signature bytes anchor = 5; // merkle root - bytes path = 6; // path for cm to root in merkle tree + bytes path = 6; // path for cm from leaf to root in merkle tree } message ReceiveStatement { From b91c921eb4d3795fa47e72f7c0dff266a4ec08be Mon Sep 17 00:00:00 2001 From: renchenchang Date: Tue, 16 Apr 2019 13:55:23 +0800 Subject: [PATCH 44/99] rm unless lines --- core/Contract.proto | 1 - 1 file changed, 1 deletion(-) diff --git a/core/Contract.proto b/core/Contract.proto index 07f2124d1..8a42772b4 100644 --- a/core/Contract.proto +++ b/core/Contract.proto @@ -368,7 +368,6 @@ message ReceiveStatement { Note note = 2; } - message GrothProof { bytes values = 1; } From 98669eb7de92ae9b3170d76bac8df3b7e104c0cd Mon Sep 17 00:00:00 2001 From: Matt Date: Tue, 16 Apr 2019 14:19:32 +0800 Subject: [PATCH 45/99] valuebalance byte[] to long --- core/Contract.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/Contract.proto b/core/Contract.proto index 07f2124d1..9401500d5 100644 --- a/core/Contract.proto +++ b/core/Contract.proto @@ -397,7 +397,7 @@ message ShieldedTransferContract { repeated SpendDescription spend_description = 3; repeated ReceiveDescription receive_description = 4; bytes binding_signature = 5; - bytes value_balance = 6; + int64 value_balance = 6; bytes transparent_to_address = 7; // transparent address bytes to_amount = 8; // the amount to transparent to_address } From 0ec2c19ce2ddb23a50da431c6ccd98560d674d04 Mon Sep 17 00:00:00 2001 From: olivier Date: Tue, 16 Apr 2019 17:11:55 +0800 Subject: [PATCH 46/99] modify ammount data type --- core/Contract.proto | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/Contract.proto b/core/Contract.proto index 5a21f7896..1fc944a38 100644 --- a/core/Contract.proto +++ b/core/Contract.proto @@ -392,12 +392,12 @@ message ReceiveDescription { message ShieldedTransferContract { bytes transparent_from_address = 1; // transparent address - bytes from_amount = 2; + int64 from_amount = 2; repeated SpendDescription spend_description = 3; repeated ReceiveDescription receive_description = 4; bytes binding_signature = 5; int64 value_balance = 6; bytes transparent_to_address = 7; // transparent address - bytes to_amount = 8; // the amount to transparent to_address + int64 to_amount = 8; // the amount to transparent to_address } // end shielded transaction \ No newline at end of file From d25f1f46db7a2431ea17d35896bef185d6728fb0 Mon Sep 17 00:00:00 2001 From: jiangyuanshu <317787106@qq.com> Date: Sun, 28 Apr 2019 12:28:50 +0800 Subject: [PATCH 47/99] test scan --- api/api.proto | 5 +++++ core/Contract.proto | 14 ++++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/api/api.proto b/api/api.proto index 531163c94..5e9492b5c 100644 --- a/api/api.proto +++ b/api/api.proto @@ -670,6 +670,11 @@ service Wallet { rpc CreateShieldedTransaction (ShieldedTransferContract) returns (TransactionExtention) { }; // end for shiededTransaction + + //protocol p47 + rpc GetCommitmentsByBlockRange(BlockIvkDecrypt) returns(IvkDecryptResult){ + }; + }; diff --git a/core/Contract.proto b/core/Contract.proto index 1fc944a38..90dd47c52 100644 --- a/core/Contract.proto +++ b/core/Contract.proto @@ -348,7 +348,7 @@ message AccountPermissionUpdateContract { // for shielded transaction message Note { - bytes value = 1; + int64 value = 1; bytes d = 2; bytes pkD = 3; bytes rcm = 4; @@ -400,4 +400,14 @@ message ShieldedTransferContract { bytes transparent_to_address = 7; // transparent address int64 to_amount = 8; // the amount to transparent to_address } -// end shielded transaction \ No newline at end of file +// end shielded transaction + +message BlockIvkDecrypt{ + int64 start_block_index = 1; + int64 end_block_index = 2; + bytes ivk = 3; +} + +message IvkDecryptResult{ + repeated Note notes = 1; +} \ No newline at end of file From f3164739e5f3274a2dea5597898f3601e20bb3df Mon Sep 17 00:00:00 2001 From: renchenchang Date: Sun, 28 Apr 2019 14:51:08 +0800 Subject: [PATCH 48/99] rm chinese desc --- api/api.proto | 12 +++++++++++- core/Contract.proto | 9 --------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/api/api.proto b/api/api.proto index 5e9492b5c..66612eb65 100644 --- a/api/api.proto +++ b/api/api.proto @@ -672,7 +672,7 @@ service Wallet { // end for shiededTransaction //protocol p47 - rpc GetCommitmentsByBlockRange(BlockIvkDecrypt) returns(IvkDecryptResult){ + rpc GetCommitmentsByBlockRange (BlockIvkDecrypt) returns (IvkDecryptResult) { }; }; @@ -1091,4 +1091,14 @@ message TransactionApprovedList { repeated bytes approved_list = 2; Result result = 4; TransactionExtention transaction = 5; +} + +message BlockIvkDecrypt { + int64 start_block_index = 1; + int64 end_block_index = 2; + bytes ivk = 3; +} + +message IvkDecryptResult { + repeated Note notes = 1; } \ No newline at end of file diff --git a/core/Contract.proto b/core/Contract.proto index 90dd47c52..40b1a3e65 100644 --- a/core/Contract.proto +++ b/core/Contract.proto @@ -402,12 +402,3 @@ message ShieldedTransferContract { } // end shielded transaction -message BlockIvkDecrypt{ - int64 start_block_index = 1; - int64 end_block_index = 2; - bytes ivk = 3; -} - -message IvkDecryptResult{ - repeated Note notes = 1; -} \ No newline at end of file From 93f9551f90b20995741f2c1bf1b03152d6c9d362 Mon Sep 17 00:00:00 2001 From: jiangyuanshu <317787106@qq.com> Date: Sun, 28 Apr 2019 17:47:03 +0800 Subject: [PATCH 49/99] test encrypt and decrypt after push transaction. --- api/api.proto | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/api/api.proto b/api/api.proto index 66612eb65..5d4139a84 100644 --- a/api/api.proto +++ b/api/api.proto @@ -672,7 +672,10 @@ service Wallet { // end for shiededTransaction //protocol p47 - rpc GetCommitmentsByBlockRange (BlockIvkDecrypt) returns (IvkDecryptResult) { + rpc ScanNoteByBlockRangeAndIvk (IvkDecryptParameters) returns (DecryptNotes) { + }; + + rpc ScanNoteByBlockRangeAndOvk (OvkDecryptParameters) returns (DecryptNotes) { }; }; @@ -1093,12 +1096,18 @@ message TransactionApprovedList { TransactionExtention transaction = 5; } -message BlockIvkDecrypt { +message IvkDecryptParameters { int64 start_block_index = 1; int64 end_block_index = 2; bytes ivk = 3; } -message IvkDecryptResult { +message OvkDecryptParameters { + int64 start_block_index = 1; + int64 end_block_index = 2; + bytes ovk = 3; +} + +message DecryptNotes { repeated Note notes = 1; -} \ No newline at end of file +} From fe624e3fc8d872d92b588a70c52a70fd7b016dd4 Mon Sep 17 00:00:00 2001 From: renchenchang Date: Mon, 29 Apr 2019 15:35:52 +0800 Subject: [PATCH 50/99] refactor proto for shielded transaction --- api/api.proto | 38 +++++++++++++++++++++++++++++++------- core/Contract.proto | 22 +--------------------- 2 files changed, 32 insertions(+), 28 deletions(-) diff --git a/api/api.proto b/api/api.proto index 5d4139a84..807c11664 100644 --- a/api/api.proto +++ b/api/api.proto @@ -661,13 +661,7 @@ service Wallet { }; // for shiededTransaction - rpc CreateSpendProof (SpendStatement) returns (SpendDescription) { - }; - - rpc CreateReceiveProof (ReceiveStatement) returns (ReceiveDescription) { - }; - - rpc CreateShieldedTransaction (ShieldedTransferContract) returns (TransactionExtention) { + rpc CreateShieldedTransaction (PrivateParameters) returns (TransactionExtention) { }; // end for shiededTransaction @@ -1111,3 +1105,33 @@ message OvkDecryptParameters { message DecryptNotes { repeated Note notes = 1; } + +message Note { + int64 value = 1; + bytes d = 2; + bytes pkD = 3; + bytes rcm = 4; +} + +message SpendNote { + Note note = 3; + bytes alpha = 4; // random number for spend authority signature + bytes anchor = 5; // merkle root + bytes path = 6; // path for cm from leaf to root in merkle tree +} + +message ReceiveNote { + bytes esk = 1; // for Encryption + Note note = 2; +} + +message PrivateParameters { + bytes from_address = 1; + bytes ak = 2; + bytes nsk = 3; + int64 from_amount = 4; + repeated SpendNote shieldedSpends = 5; + repeated ReceiveNote shieldedReceives = 6; + bytes transparent_to_address = 7; + bytes to_amount = 8; +} diff --git a/core/Contract.proto b/core/Contract.proto index 40b1a3e65..6e8888c48 100644 --- a/core/Contract.proto +++ b/core/Contract.proto @@ -347,27 +347,6 @@ message AccountPermissionUpdateContract { } // for shielded transaction -message Note { - int64 value = 1; - bytes d = 2; - bytes pkD = 3; - bytes rcm = 4; -} - -message SpendStatement { - bytes ak = 1; - bytes nsk = 2; - Note note = 3; - bytes alpha = 4; // random number for spend authority signature - bytes anchor = 5; // merkle root - bytes path = 6; // path for cm from leaf to root in merkle tree -} - -message ReceiveStatement { - bytes esk = 1; // for Encryption - Note note = 2; -} - message GrothProof { bytes values = 1; } @@ -399,6 +378,7 @@ message ShieldedTransferContract { int64 value_balance = 6; bytes transparent_to_address = 7; // transparent address int64 to_amount = 8; // the amount to transparent to_address + int64 fee = 9; } // end shielded transaction From 3ed7cf8e0d293ff6a916aec64abae8bd0b49b728 Mon Sep 17 00:00:00 2001 From: renchenchang Date: Mon, 29 Apr 2019 16:19:43 +0800 Subject: [PATCH 51/99] rm value_balance in ShieldedTransferContract --- core/Contract.proto | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/core/Contract.proto b/core/Contract.proto index 6e8888c48..f8b40eff5 100644 --- a/core/Contract.proto +++ b/core/Contract.proto @@ -375,10 +375,9 @@ message ShieldedTransferContract { repeated SpendDescription spend_description = 3; repeated ReceiveDescription receive_description = 4; bytes binding_signature = 5; - int64 value_balance = 6; - bytes transparent_to_address = 7; // transparent address - int64 to_amount = 8; // the amount to transparent to_address - int64 fee = 9; + bytes transparent_to_address = 6; // transparent address + int64 to_amount = 7; // the amount to transparent to_address + int64 fee = 8; } // end shielded transaction From aa508660f5e11e88d66f3b7eb39f22d34e2815de Mon Sep 17 00:00:00 2001 From: Wenhua Zhang Date: Sun, 5 May 2019 16:23:30 +0800 Subject: [PATCH 52/99] feat(zen_api): add some msg structs --- api/api.proto | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/api/api.proto b/api/api.proto index 807c11664..947e9e271 100644 --- a/api/api.proto +++ b/api/api.proto @@ -672,6 +672,11 @@ service Wallet { rpc ScanNoteByBlockRangeAndOvk (OvkDecryptParameters) returns (DecryptNotes) { }; + rpc GetExpandedSpendingKey (BytesMessage) returns (ExpandedSpendingKeyMessage) { + } + + rpc GetProofAuthorizingKey (ExpandedSpendingKeyMessage) returns (ProofAuthorizingKeyMessage) { + } }; @@ -1135,3 +1140,42 @@ message PrivateParameters { bytes transparent_to_address = 7; bytes to_amount = 8; } + +message ExpandedSpendingKeyMessage { + bytes ask = 1; + bytes nsk = 2; + bytes ovk = 3; +} + +message ProofAuthorizingKeyMessage { + bytes ak = 1; + bytes nsk = 2; +} + +message FullViewingKeyMessage { + bytes ak = 1; + bytes nk = 2; + bytes ovk = 3; +} + +message IncomingViewingKeyMessage { + bytes ivk = 1; +} + +message DiversifierMessage { + bytes d = 1; +} + +message TransmissionKeyMessage { + bytes pkD = 1; +} + +message IncomingViewingKeyDiversifierMessage { + IncomingViewingKeyMessage ivk =1; + DiversifierMessage d = 2; +} + +message SaplingPaymentAddressMessage { + DiversifierMessage d = 1; + bytes pkD =2; +} \ No newline at end of file From 0b7ef19e84a9305496236eec7c8cc429f325e5f0 Mon Sep 17 00:00:00 2001 From: Wenhua Zhang Date: Mon, 6 May 2019 10:57:22 +0800 Subject: [PATCH 53/99] feat(zen_api): add api definition --- api/api.proto | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/api/api.proto b/api/api.proto index 947e9e271..db98a2384 100644 --- a/api/api.proto +++ b/api/api.proto @@ -677,8 +677,19 @@ service Wallet { rpc GetProofAuthorizingKey (ExpandedSpendingKeyMessage) returns (ProofAuthorizingKeyMessage) { } -}; + rpc GetFullViewingKey (ProofAuthorizingKeyMessage) returns (FullViewingKeyMessage) { + } + + rpc GetIncomingViewingKey (FullViewingKeyMessage) returns (IncomingViewingKeyMessage) { + } + + rpc GetDiversifier (EmptyMessage) returns (DiversifierMessage) { + } + + rpc GetSaplingPaymentAddress (IncomingViewingKeyDiversifierMessage) returns (SaplingPaymentAddressMessage) { + } +}; service WalletSolidity { @@ -1166,10 +1177,6 @@ message DiversifierMessage { bytes d = 1; } -message TransmissionKeyMessage { - bytes pkD = 1; -} - message IncomingViewingKeyDiversifierMessage { IncomingViewingKeyMessage ivk =1; DiversifierMessage d = 2; From c03b25f09a084b94380b3f4a817f928661f7a1e3 Mon Sep 17 00:00:00 2001 From: Wenhua Zhang Date: Mon, 6 May 2019 15:36:21 +0800 Subject: [PATCH 54/99] feat(gen_api): update proto --- api/api.proto | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/api/api.proto b/api/api.proto index db98a2384..f06c3d6db 100644 --- a/api/api.proto +++ b/api/api.proto @@ -675,13 +675,13 @@ service Wallet { rpc GetExpandedSpendingKey (BytesMessage) returns (ExpandedSpendingKeyMessage) { } - rpc GetProofAuthorizingKey (ExpandedSpendingKeyMessage) returns (ProofAuthorizingKeyMessage) { + rpc GetAkFromAsk (BytesMessage) returns (BytesMessage) { } - rpc GetFullViewingKey (ProofAuthorizingKeyMessage) returns (FullViewingKeyMessage) { + rpc GetNkFromNsk (BytesMessage) returns (BytesMessage) { } - rpc GetIncomingViewingKey (FullViewingKeyMessage) returns (IncomingViewingKeyMessage) { + rpc GetIncomingViewingKey (ViewingKeyMessage) returns (IncomingViewingKeyMessage) { } rpc GetDiversifier (EmptyMessage) returns (DiversifierMessage) { @@ -1163,10 +1163,9 @@ message ProofAuthorizingKeyMessage { bytes nsk = 2; } -message FullViewingKeyMessage { +message ViewingKeyMessage { bytes ak = 1; bytes nk = 2; - bytes ovk = 3; } message IncomingViewingKeyMessage { From e82e45fd398c97dd8ab0885c3362c73ac4344b8f Mon Sep 17 00:00:00 2001 From: Wenhua Zhang Date: Mon, 6 May 2019 17:28:05 +0800 Subject: [PATCH 55/99] feat(gen_api): add four zen api: sk, esk, ak, nk --- api/api.proto | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/api/api.proto b/api/api.proto index f06c3d6db..a666ae1d3 100644 --- a/api/api.proto +++ b/api/api.proto @@ -672,6 +672,9 @@ service Wallet { rpc ScanNoteByBlockRangeAndOvk (OvkDecryptParameters) returns (DecryptNotes) { }; + rpc GetSpendingKey (EmptyMessage) returns (BytesMessage) { + } + rpc GetExpandedSpendingKey (BytesMessage) returns (ExpandedSpendingKeyMessage) { } @@ -1158,11 +1161,6 @@ message ExpandedSpendingKeyMessage { bytes ovk = 3; } -message ProofAuthorizingKeyMessage { - bytes ak = 1; - bytes nsk = 2; -} - message ViewingKeyMessage { bytes ak = 1; bytes nk = 2; From 585e03ef3454e55e4b35532bf7d4288a8f578bad Mon Sep 17 00:00:00 2001 From: renchenchang Date: Tue, 7 May 2019 11:24:23 +0800 Subject: [PATCH 56/99] add fee in PrivateParameters --- api/api.proto | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/api/api.proto b/api/api.proto index a666ae1d3..331f56672 100644 --- a/api/api.proto +++ b/api/api.proto @@ -1153,6 +1153,7 @@ message PrivateParameters { repeated ReceiveNote shieldedReceives = 6; bytes transparent_to_address = 7; bytes to_amount = 8; + int64 fee = 9; } message ExpandedSpendingKeyMessage { @@ -1175,11 +1176,11 @@ message DiversifierMessage { } message IncomingViewingKeyDiversifierMessage { - IncomingViewingKeyMessage ivk =1; + IncomingViewingKeyMessage ivk = 1; DiversifierMessage d = 2; } message SaplingPaymentAddressMessage { DiversifierMessage d = 1; - bytes pkD =2; + bytes pkD = 2; } \ No newline at end of file From f5bf93802e14a7782eb474dbdda9ed8689610734 Mon Sep 17 00:00:00 2001 From: Wenhua Zhang Date: Wed, 8 May 2019 17:00:36 +0800 Subject: [PATCH 57/99] feat(createshieldedtransaction): add createshieldedtransaction api --- api/api.proto | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/api/api.proto b/api/api.proto index 331f56672..ef4212c21 100644 --- a/api/api.proto +++ b/api/api.proto @@ -1129,7 +1129,7 @@ message Note { int64 value = 1; bytes d = 2; bytes pkD = 3; - bytes rcm = 4; + bytes rcm = 4; // random 32 } message SpendNote { @@ -1140,20 +1140,19 @@ message SpendNote { } message ReceiveNote { - bytes esk = 1; // for Encryption - Note note = 2; + Note note = 1; } message PrivateParameters { bytes from_address = 1; - bytes ak = 2; + bytes ask = 2; bytes nsk = 3; - int64 from_amount = 4; - repeated SpendNote shieldedSpends = 5; - repeated ReceiveNote shieldedReceives = 6; - bytes transparent_to_address = 7; - bytes to_amount = 8; - int64 fee = 9; + bytes ovk = 4; + int64 from_amount = 5; + repeated SpendNote shieldedSpends = 6; + repeated ReceiveNote shieldedReceives = 7; + bytes transparent_to_address = 8; + int64 to_amount = 9; } message ExpandedSpendingKeyMessage { From 0e9458de96539b8d3590d68ae40a7d5aeeb2a011 Mon Sep 17 00:00:00 2001 From: jiangyuanshu <317787106@qq.com> Date: Thu, 9 May 2019 15:25:42 +0800 Subject: [PATCH 58/99] add two column in DecryptNotes proto --- api/api.proto | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/api/api.proto b/api/api.proto index ef4212c21..dd0261f75 100644 --- a/api/api.proto +++ b/api/api.proto @@ -1122,7 +1122,12 @@ message OvkDecryptParameters { } message DecryptNotes { - repeated Note notes = 1; + message NoteTx{ + Note note = 1; + bytes txid = 2; //transaction id = sha256(transaction.rowdata) + int32 index = 3; //the index of note in receive + } + repeated NoteTx noteTxs = 1; } message Note { @@ -1182,4 +1187,4 @@ message IncomingViewingKeyDiversifierMessage { message SaplingPaymentAddressMessage { DiversifierMessage d = 1; bytes pkD = 2; -} \ No newline at end of file +} From ce185a1f3b8418d7b716ac7c64e7e821e9a6268d Mon Sep 17 00:00:00 2001 From: Wenhua Zhang Date: Thu, 9 May 2019 16:06:42 +0800 Subject: [PATCH 59/99] feat(zen_api): update createshieldedtransaction, add api for rcm --- api/api.proto | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/api/api.proto b/api/api.proto index ef4212c21..7635b57d7 100644 --- a/api/api.proto +++ b/api/api.proto @@ -692,6 +692,9 @@ service Wallet { rpc GetSaplingPaymentAddress (IncomingViewingKeyDiversifierMessage) returns (SaplingPaymentAddressMessage) { } + + rpc GetRcm (EmptyMessage) returns (BytesMessage) { + } }; service WalletSolidity { @@ -1144,7 +1147,7 @@ message ReceiveNote { } message PrivateParameters { - bytes from_address = 1; + bytes transparent_from_address = 1; bytes ask = 2; bytes nsk = 3; bytes ovk = 4; From 12bbabba510db63d84aa29d6ce1d0a0a4aca25bb Mon Sep 17 00:00:00 2001 From: jiangyuanshu <317787106@qq.com> Date: Thu, 9 May 2019 16:17:13 +0800 Subject: [PATCH 60/99] modify two function name --- api/api.proto | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/api.proto b/api/api.proto index dd0261f75..bcacac114 100644 --- a/api/api.proto +++ b/api/api.proto @@ -666,10 +666,10 @@ service Wallet { // end for shiededTransaction //protocol p47 - rpc ScanNoteByBlockRangeAndIvk (IvkDecryptParameters) returns (DecryptNotes) { + rpc ScanNoteByIvk (IvkDecryptParameters) returns (DecryptNotes) { }; - rpc ScanNoteByBlockRangeAndOvk (OvkDecryptParameters) returns (DecryptNotes) { + rpc ScanNoteByOvk (OvkDecryptParameters) returns (DecryptNotes) { }; rpc GetSpendingKey (EmptyMessage) returns (BytesMessage) { From 5dcfdb9b0424a52cdfafb3aebb998aea6d69443e Mon Sep 17 00:00:00 2001 From: sean-liu55 Date: Thu, 9 May 2019 17:37:12 +0800 Subject: [PATCH 61/99] add path into IncrementalMerkleVoucherInfo --- core/Contract.proto | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/core/Contract.proto b/core/Contract.proto index f8b40eff5..21c40e795 100644 --- a/core/Contract.proto +++ b/core/Contract.proto @@ -113,8 +113,10 @@ message IncrementalMerkleVoucher { message IncrementalMerkleVoucherInfo { IncrementalMerkleVoucher voucher1 = 1; - IncrementalMerkleVoucher voucher2 = 2; - int32 block_num = 3; + bytes path1 = 2; + IncrementalMerkleVoucher voucher2 = 3; + bytes path2 = 4; + int32 block_num = 5; } message ZksnarkV0TransferContract { From 1e70ff524891390713b90f829bda38d3a1213464 Mon Sep 17 00:00:00 2001 From: sean-liu55 Date: Fri, 10 May 2019 13:36:45 +0800 Subject: [PATCH 62/99] change OutputPointInfo proto --- core/Contract.proto | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/core/Contract.proto b/core/Contract.proto index 21c40e795..40e232629 100644 --- a/core/Contract.proto +++ b/core/Contract.proto @@ -87,9 +87,8 @@ message OutputPoint { } message OutputPointInfo { - OutputPoint out_point_1 = 1; - OutputPoint out_point_2 = 2; - int32 block_num = 3; + repeated OutputPoint out_points = 1; + int32 block_num = 2; } message PedersenHash { From d8bcdd10d9fc65272b592dd3b16e0a0e34cb582b Mon Sep 17 00:00:00 2001 From: sean-liu55 Date: Fri, 10 May 2019 14:30:05 +0800 Subject: [PATCH 63/99] fix test conflict --- core/Contract.proto | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/core/Contract.proto b/core/Contract.proto index 40e232629..2002f0168 100644 --- a/core/Contract.proto +++ b/core/Contract.proto @@ -111,10 +111,8 @@ message IncrementalMerkleVoucher { } message IncrementalMerkleVoucherInfo { - IncrementalMerkleVoucher voucher1 = 1; - bytes path1 = 2; - IncrementalMerkleVoucher voucher2 = 3; - bytes path2 = 4; + repeated IncrementalMerkleVoucher vouchers = 1; + repeated bytes paths = 2; int32 block_num = 5; } From 16c19f73633d14f713ded75723e4a8ac43189da1 Mon Sep 17 00:00:00 2001 From: Wenhua Zhang Date: Fri, 10 May 2019 19:15:02 +0800 Subject: [PATCH 64/99] feat(zn_api): update createshieldedtransaction process --- api/api.proto | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/api/api.proto b/api/api.proto index e2871326b..f75b1f6b5 100644 --- a/api/api.proto +++ b/api/api.proto @@ -1143,7 +1143,8 @@ message Note { message SpendNote { Note note = 3; bytes alpha = 4; // random number for spend authority signature - bytes anchor = 5; // merkle root +// bytes anchor = 5; // merkle root + IncrementalMerkleVoucher voucher = 5; bytes path = 6; // path for cm from leaf to root in merkle tree } From 1dc8d3bb5d44b49276d226192319394092f1449a Mon Sep 17 00:00:00 2001 From: sean-liu55 Date: Mon, 13 May 2019 17:15:51 +0800 Subject: [PATCH 65/99] rename class --- api/api.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/api.proto b/api/api.proto index f75b1f6b5..2702ba214 100644 --- a/api/api.proto +++ b/api/api.proto @@ -690,7 +690,7 @@ service Wallet { rpc GetDiversifier (EmptyMessage) returns (DiversifierMessage) { } - rpc GetSaplingPaymentAddress (IncomingViewingKeyDiversifierMessage) returns (SaplingPaymentAddressMessage) { + rpc GetZenPaymentAddress (IncomingViewingKeyDiversifierMessage) returns (SaplingPaymentAddressMessage) { } rpc GetRcm (EmptyMessage) returns (BytesMessage) { From 3059353c8bbcee08d6e1a8f19dce1e78d85e1529 Mon Sep 17 00:00:00 2001 From: sean-liu55 Date: Wed, 15 May 2019 11:00:16 +0800 Subject: [PATCH 66/99] rm useless code && rename class --- api/api.proto | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/api/api.proto b/api/api.proto index 2702ba214..4e83af607 100644 --- a/api/api.proto +++ b/api/api.proto @@ -616,10 +616,7 @@ service Wallet { rpc GetMerkleRoot (BytesMessage) returns (BytesMessage) { } - rpc GetMerkleTreeWitness (OutputPoint) returns (IncrementalMerkleVoucher) { - } - - rpc GetMerkleTreeWitnessInfo (OutputPointInfo) returns (IncrementalMerkleVoucherInfo) { + rpc GetMerkleTreeVoucherInfo (OutputPointInfo) returns (IncrementalMerkleVoucherInfo) { } rpc GenerateShieldAddress (EmptyMessage) returns (ShieldAddress) { From c1f8b60bb0fc689784cceb00ec8ec58b0540d57d Mon Sep 17 00:00:00 2001 From: sean-liu55 Date: Wed, 15 May 2019 12:27:35 +0800 Subject: [PATCH 67/99] rm useless code --- core/Contract.proto | 1 - 1 file changed, 1 deletion(-) diff --git a/core/Contract.proto b/core/Contract.proto index 2002f0168..1b0639311 100644 --- a/core/Contract.proto +++ b/core/Contract.proto @@ -113,7 +113,6 @@ message IncrementalMerkleVoucher { message IncrementalMerkleVoucherInfo { repeated IncrementalMerkleVoucher vouchers = 1; repeated bytes paths = 2; - int32 block_num = 5; } message ZksnarkV0TransferContract { From 8602875b969cae563746e23444f6b0e9893bd31c Mon Sep 17 00:00:00 2001 From: sean-liu55 Date: Wed, 15 May 2019 14:41:30 +0800 Subject: [PATCH 68/99] rm useless code --- api/api.proto | 3 --- core/Contract.proto | 43 ------------------------------------------- 2 files changed, 46 deletions(-) diff --git a/api/api.proto b/api/api.proto index 4e83af607..1c6a542de 100644 --- a/api/api.proto +++ b/api/api.proto @@ -46,9 +46,6 @@ service Wallet { rpc CreateTransaction2 (TransferContract) returns (TransactionExtention) { }; - rpc ZksnarkV0TransferTrx (ZksnarkV0TransferContract) returns (TransactionExtention) { - }; - rpc BroadcastTransaction (Transaction) returns (Return) { option (google.api.http) = { post: "/wallet/broadcasttransaction" diff --git a/core/Contract.proto b/core/Contract.proto index 1b0639311..e64251d44 100644 --- a/core/Contract.proto +++ b/core/Contract.proto @@ -48,29 +48,6 @@ message TransferContract { } -message BN128G1 { - bytes x = 1; - bytes y = 2; -} - -message BN128G2 { - bytes x1 = 1; - bytes x2 = 2; - bytes y1 = 3; - bytes y2 = 4; -} - -message zkv0proof { - BN128G1 a = 1; - BN128G1 a_p = 2; - BN128G2 b = 3; - BN128G1 b_p = 4; - BN128G1 c = 5; - BN128G1 c_p = 6; - BN128G1 k = 7; - BN128G1 h = 8; -} - message AuthenticationPath { repeated bool value = 1; } @@ -115,26 +92,6 @@ message IncrementalMerkleVoucherInfo { repeated bytes paths = 2; } -message ZksnarkV0TransferContract { - bytes owner_address = 1; - bytes to_address = 2; - int64 v_from_pub = 3; - int64 v_to_pub = 4; - bytes rt = 5; - bytes nf1 = 6; - bytes nf2 = 7; - bytes cm1 = 8; - bytes cm2 = 9; - bytes pksig = 10; - bytes randomSeed = 11; - bytes epk = 12; - int64 fee = 13; - bytes h1 = 20; - bytes h2 = 21; - bytes C1 = 22; - bytes C2 = 23; - zkv0proof proof = 30; -} message ShieldAddress { bytes private_address = 1; From 777b09fd068a196acf9bc26d0decb1b7138f6e28 Mon Sep 17 00:00:00 2001 From: renchenchang Date: Thu, 16 May 2019 14:48:03 +0800 Subject: [PATCH 69/99] refactor proto --- api/api.proto | 9 +++-- core/Contract.proto | 91 +++++++++++++++++++++++---------------------- 2 files changed, 51 insertions(+), 49 deletions(-) diff --git a/api/api.proto b/api/api.proto index 1c6a542de..a9bd15c84 100644 --- a/api/api.proto +++ b/api/api.proto @@ -613,9 +613,6 @@ service Wallet { rpc GetMerkleRoot (BytesMessage) returns (BytesMessage) { } - rpc GetMerkleTreeVoucherInfo (OutputPointInfo) returns (IncrementalMerkleVoucherInfo) { - } - rpc GenerateShieldAddress (EmptyMessage) returns (ShieldAddress) { } @@ -657,7 +654,9 @@ service Wallet { // for shiededTransaction rpc CreateShieldedTransaction (PrivateParameters) returns (TransactionExtention) { }; - // end for shiededTransaction + + rpc GetMerkleTreeVoucherInfo (OutputPointInfo) returns (IncrementalMerkleVoucherInfo) { + } //protocol p47 rpc ScanNoteByIvk (IvkDecryptParameters) returns (DecryptNotes) { @@ -689,6 +688,8 @@ service Wallet { rpc GetRcm (EmptyMessage) returns (BytesMessage) { } + + // end for shiededTransaction }; service WalletSolidity { diff --git a/core/Contract.proto b/core/Contract.proto index e64251d44..44858915b 100644 --- a/core/Contract.proto +++ b/core/Contract.proto @@ -48,51 +48,6 @@ message TransferContract { } -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 ShieldAddress { bytes private_address = 1; bytes public_address = 2; @@ -302,6 +257,52 @@ message AccountPermissionUpdateContract { } // 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 GrothProof { bytes values = 1; } From c5f70b55356e4e5bdbef973907a5a24ae325e460 Mon Sep 17 00:00:00 2001 From: Wenhua Zhang Date: Thu, 16 May 2019 17:50:33 +0800 Subject: [PATCH 70/99] typo: remove unused codes --- api/api.proto | 1 - 1 file changed, 1 deletion(-) diff --git a/api/api.proto b/api/api.proto index 1c6a542de..96833103e 100644 --- a/api/api.proto +++ b/api/api.proto @@ -1137,7 +1137,6 @@ message Note { message SpendNote { Note note = 3; bytes alpha = 4; // random number for spend authority signature -// bytes anchor = 5; // merkle root IncrementalMerkleVoucher voucher = 5; bytes path = 6; // path for cm from leaf to root in merkle tree } From e53b4b0632e40647cfee866d94562f667847a7b4 Mon Sep 17 00:00:00 2001 From: sean-liu55 Date: Tue, 21 May 2019 15:07:27 +0800 Subject: [PATCH 71/99] rm message-GrothProof and format code --- core/Contract.proto | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/core/Contract.proto b/core/Contract.proto index 44858915b..9da6b53a3 100644 --- a/core/Contract.proto +++ b/core/Contract.proto @@ -302,17 +302,12 @@ message IncrementalMerkleVoucherInfo { repeated bytes paths = 2; } - -message GrothProof { - bytes values = 1; -} - 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 - GrothProof zkproof = 5; + bytes zkproof = 5; bytes spend_authority_signature = 6; } @@ -322,7 +317,7 @@ message ReceiveDescription { 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 - GrothProof zkproof = 6; + bytes zkproof = 6; } message ShieldedTransferContract { From ce1e91c622307adeb105072b392019bc61dd2b3e Mon Sep 17 00:00:00 2001 From: Wenhua Zhang Date: Tue, 21 May 2019 17:18:24 +0800 Subject: [PATCH 72/99] feat(zen_api): add api isspend to check if a note has been spent --- api/api.proto | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/api/api.proto b/api/api.proto index ae23f5c7c..568ffaba8 100644 --- a/api/api.proto +++ b/api/api.proto @@ -689,6 +689,9 @@ service Wallet { rpc GetRcm (EmptyMessage) returns (BytesMessage) { } + rpc IsSpend (NoteParameters) returns (SpendResult) { + } + // end for shiededTransaction }; @@ -1186,3 +1189,15 @@ message SaplingPaymentAddressMessage { DiversifierMessage d = 1; bytes pkD = 2; } + +message NoteParameters { + bytes ak = 1; + bytes nk = 2; + Note note = 3; + IncrementalMerkleVoucher voucher = 4; +} + +message SpendResult { + bool result = 1; + string message = 2; +} \ No newline at end of file From 9fbb817543e6cfa3208c305d8d5d1fefb1a00556 Mon Sep 17 00:00:00 2001 From: renchenchang Date: Thu, 23 May 2019 11:10:56 +0800 Subject: [PATCH 73/99] rm sprout api --- api/api.proto | 54 +++++++++++++++++++++++++-------------------------- 1 file changed, 26 insertions(+), 28 deletions(-) diff --git a/api/api.proto b/api/api.proto index 568ffaba8..d075f4c8f 100644 --- a/api/api.proto +++ b/api/api.proto @@ -599,31 +599,30 @@ service Wallet { }; } - rpc GetMerklePath (BytesMessage) returns (MerklePath) { - } - - - rpc GetBestMerkleRoot (EmptyMessage) returns (BytesMessage) { - } - - rpc GetNullifier (BytesMessage) returns (BytesMessage) { - } - - - rpc GetMerkleRoot (BytesMessage) returns (BytesMessage) { - } - - rpc GenerateShieldAddress (EmptyMessage) returns (ShieldAddress) { - } - - //Get zero-snark blockExtention list - rpc GetZKBlockByLimitNext (BlockLimit) returns (BlockListExtention) { - } - - //Get the specified height block merkleTree - rpc GetMerkleTreeOfBlock (NumberMessage) returns (BlockIncrementalMerkleTree) { - } - + // rpc GetMerklePath (BytesMessage) returns (MerklePath) { + // } + // + // + // rpc GetBestMerkleRoot (EmptyMessage) returns (BytesMessage) { + // } + // + // rpc GetNullifier (BytesMessage) returns (BytesMessage) { + // } + // + // + // rpc GetMerkleRoot (BytesMessage) returns (BytesMessage) { + // } + // + // rpc GenerateShieldAddress (EmptyMessage) returns (ShieldAddress) { + // } + // + // //Get zero-snark blockExtention list + // rpc GetZKBlockByLimitNext (BlockLimit) returns (BlockListExtention) { + // } + // + // //Get the specified height block merkleTree + // rpc GetMerkleTreeOfBlock (NumberMessage) returns (BlockIncrementalMerkleTree) { + // } rpc AccountPermissionUpdate (AccountPermissionUpdateContract) returns (TransactionExtention) { option (google.api.http) = { @@ -658,7 +657,6 @@ service Wallet { rpc GetMerkleTreeVoucherInfo (OutputPointInfo) returns (IncrementalMerkleVoucherInfo) { } - //protocol p47 rpc ScanNoteByIvk (IvkDecryptParameters) returns (DecryptNotes) { }; @@ -1123,7 +1121,7 @@ message OvkDecryptParameters { } message DecryptNotes { - message NoteTx{ + message NoteTx { Note note = 1; bytes txid = 2; //transaction id = sha256(transaction.rowdata) int32 index = 3; //the index of note in receive @@ -1135,7 +1133,7 @@ message Note { int64 value = 1; bytes d = 2; bytes pkD = 3; - bytes rcm = 4; // random 32 + bytes rcm = 4; // random 32 } message SpendNote { From 9c2ef37ba8f78f181be28ab4efd39dcbcfc8602c Mon Sep 17 00:00:00 2001 From: sean-liu55 Date: Fri, 24 May 2019 11:15:17 +0800 Subject: [PATCH 74/99] Remove ZksnarkV0TransferContract and optimize code in bandwidthProcessor --- core/Tron.proto | 1 - 1 file changed, 1 deletion(-) diff --git a/core/Tron.proto b/core/Tron.proto index a0f1968ce..1e48e8e51 100644 --- a/core/Tron.proto +++ b/core/Tron.proto @@ -272,7 +272,6 @@ message Transaction { ExchangeTransactionContract = 44; UpdateEnergyLimitContract = 45; AccountPermissionUpdateContract = 46; - ZksnarkV0TransferContract = 50; ShieldedTransferContract = 51; } ContractType type = 1; From 6a3666f465862e01a1e5dbdc65bb7f89e7cd179e Mon Sep 17 00:00:00 2001 From: olivier Date: Fri, 24 May 2019 18:16:20 +0800 Subject: [PATCH 75/99] remove fee from ShieldedTransferContract --- core/Contract.proto | 1 - 1 file changed, 1 deletion(-) diff --git a/core/Contract.proto b/core/Contract.proto index 9da6b53a3..209f1792a 100644 --- a/core/Contract.proto +++ b/core/Contract.proto @@ -328,7 +328,6 @@ message ShieldedTransferContract { bytes binding_signature = 5; bytes transparent_to_address = 6; // transparent address int64 to_amount = 7; // the amount to transparent to_address - int64 fee = 8; } // end shielded transaction From dd4bbe89bcae6f298094f73500aa20d2717fdf50 Mon Sep 17 00:00:00 2001 From: renchenchang Date: Sat, 25 May 2019 12:11:28 +0800 Subject: [PATCH 76/99] add api for spend auth sig --- api/api.proto | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/api/api.proto b/api/api.proto index 7476d4418..fc35ee2e8 100644 --- a/api/api.proto +++ b/api/api.proto @@ -407,7 +407,7 @@ service Wallet { rpc TriggerConstantContract (TriggerSmartContract) returns (TransactionExtention) { } - + rpc ClearContractABI (ClearABIContract) returns (TransactionExtention) { } @@ -696,6 +696,16 @@ service Wallet { rpc IsSpend (NoteParameters) returns (SpendResult) { } + rpc CreateShieldedTransactionWithoutSpendAuthSig (PrivateParametersWithoutAsk) returns (TransactionExtention) { + }; + + rpc CreateSpendAuthSig (SpendAuthSigParameters) returns (BytesMessage) { + }; + + rpc GetNullifier (nfParameters) returns (BytesMessage) { + + } + // end for shiededTransaction }; @@ -1167,6 +1177,30 @@ message PrivateParameters { int64 to_amount = 9; } +message PrivateParametersWithoutAsk { + bytes transparent_from_address = 1; + bytes nsk = 3; + bytes ovk = 4; + int64 from_amount = 5; + repeated SpendNote shieldedSpends = 6; + repeated ReceiveNote shieldedReceives = 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; From be55dd5c06e97f8030331a2b2d01dfaf7ddc433d Mon Sep 17 00:00:00 2001 From: renchenchang Date: Sat, 25 May 2019 12:18:41 +0800 Subject: [PATCH 77/99] api getShieldTransactionHash --- api/api.proto | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/api/api.proto b/api/api.proto index fc35ee2e8..246d4b92e 100644 --- a/api/api.proto +++ b/api/api.proto @@ -699,13 +699,16 @@ service Wallet { rpc CreateShieldedTransactionWithoutSpendAuthSig (PrivateParametersWithoutAsk) returns (TransactionExtention) { }; + rpc getShieldTransactionHash (TransactionExtention) returns (BytesMessage) { + + } + rpc CreateSpendAuthSig (SpendAuthSigParameters) returns (BytesMessage) { }; rpc GetNullifier (nfParameters) returns (BytesMessage) { } - // end for shiededTransaction }; From 60d1f67deb0566df0749b91dfec03795374aad0d Mon Sep 17 00:00:00 2001 From: renchenchang Date: Sat, 25 May 2019 12:19:22 +0800 Subject: [PATCH 78/99] api getShieldTransactionHash --- api/api.proto | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/api/api.proto b/api/api.proto index 246d4b92e..b427d0dfc 100644 --- a/api/api.proto +++ b/api/api.proto @@ -700,8 +700,7 @@ service Wallet { }; rpc getShieldTransactionHash (TransactionExtention) returns (BytesMessage) { - - } + }; rpc CreateSpendAuthSig (SpendAuthSigParameters) returns (BytesMessage) { }; From 1d3eb2355e9205cb4ef85724db02c383c9de5850 Mon Sep 17 00:00:00 2001 From: renchenchang Date: Sat, 25 May 2019 12:19:50 +0800 Subject: [PATCH 79/99] api getShieldTransactionHash --- api/api.proto | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/api/api.proto b/api/api.proto index b427d0dfc..d9479bdbc 100644 --- a/api/api.proto +++ b/api/api.proto @@ -706,8 +706,7 @@ service Wallet { }; rpc GetNullifier (nfParameters) returns (BytesMessage) { - - } + }; // end for shiededTransaction }; From 3d51d2fb6e34d4ff946f5c2ce9532ef97683e0d3 Mon Sep 17 00:00:00 2001 From: renchenchang Date: Sat, 25 May 2019 12:20:17 +0800 Subject: [PATCH 80/99] api getShieldTransactionHash --- api/api.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/api.proto b/api/api.proto index d9479bdbc..10b1a5649 100644 --- a/api/api.proto +++ b/api/api.proto @@ -699,7 +699,7 @@ service Wallet { rpc CreateShieldedTransactionWithoutSpendAuthSig (PrivateParametersWithoutAsk) returns (TransactionExtention) { }; - rpc getShieldTransactionHash (TransactionExtention) returns (BytesMessage) { + rpc GetShieldTransactionHash (TransactionExtention) returns (BytesMessage) { }; rpc CreateSpendAuthSig (SpendAuthSigParameters) returns (BytesMessage) { From cb00cc3c9af0a20a299d4dd3db1736504ec66f55 Mon Sep 17 00:00:00 2001 From: renchenchang Date: Sat, 25 May 2019 12:20:57 +0800 Subject: [PATCH 81/99] api getShieldTransactionHash --- api/api.proto | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/api.proto b/api/api.proto index 10b1a5649..1210082c7 100644 --- a/api/api.proto +++ b/api/api.proto @@ -705,7 +705,7 @@ service Wallet { rpc CreateSpendAuthSig (SpendAuthSigParameters) returns (BytesMessage) { }; - rpc GetNullifier (nfParameters) returns (BytesMessage) { + rpc GetNullifier (NfParameters) returns (BytesMessage) { }; // end for shiededTransaction }; @@ -1195,7 +1195,7 @@ message SpendAuthSigParameters { bytes alpha = 3; } -message nfParameters { +message NfParameters { Note note = 1; IncrementalMerkleVoucher voucher = 2; bytes ak = 3; From 593acacce072da472be59fa21610742c96c7c22f Mon Sep 17 00:00:00 2001 From: renchenchang Date: Mon, 27 May 2019 10:55:27 +0800 Subject: [PATCH 82/99] rm zk-sign in transaction --- core/Tron.proto | 1 - 1 file changed, 1 deletion(-) diff --git a/core/Tron.proto b/core/Tron.proto index 1e91defbc..37c0b2557 100644 --- a/core/Tron.proto +++ b/core/Tron.proto @@ -336,7 +336,6 @@ message Transaction { raw raw_data = 1; // only support size = 1, repeated list here for muti-sig extension repeated bytes signature = 2; - repeated bytes signature_zk = 3; repeated Result ret = 5; } From 9b0898c3d3e187c9f643759b6519eb5b42233130 Mon Sep 17 00:00:00 2001 From: jiangyuanshu <317787106@qq.com> Date: Mon, 27 May 2019 13:02:23 +0800 Subject: [PATCH 83/99] add two interface to grpc and http --- api/api.proto | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/api.proto b/api/api.proto index 1210082c7..269c48371 100644 --- a/api/api.proto +++ b/api/api.proto @@ -705,7 +705,7 @@ service Wallet { rpc CreateSpendAuthSig (SpendAuthSigParameters) returns (BytesMessage) { }; - rpc GetNullifier (NfParameters) returns (BytesMessage) { + rpc CreateShieldNullifier (NfParameters) returns (BytesMessage) { }; // end for shiededTransaction }; @@ -1241,4 +1241,4 @@ message NoteParameters { message SpendResult { bool result = 1; string message = 2; -} \ No newline at end of file +} From d5e15cf75c4ba2082060ae985b66c04fb1e884e1 Mon Sep 17 00:00:00 2001 From: Wenhua Zhang Date: Mon, 27 May 2019 14:32:05 +0800 Subject: [PATCH 84/99] typo: add sign check when build zen_transaction --- api/api.proto | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/api/api.proto b/api/api.proto index 1210082c7..073012f2a 100644 --- a/api/api.proto +++ b/api/api.proto @@ -1180,13 +1180,13 @@ message PrivateParameters { message PrivateParametersWithoutAsk { bytes transparent_from_address = 1; - bytes nsk = 3; - bytes ovk = 4; - int64 from_amount = 5; - repeated SpendNote shieldedSpends = 6; - repeated ReceiveNote shieldedReceives = 7; - bytes transparent_to_address = 8; - int64 to_amount = 9; + bytes nsk = 2; + bytes ovk = 3; + int64 from_amount = 4; + repeated SpendNote shieldedSpends = 5; + repeated ReceiveNote shieldedReceives = 6; + bytes transparent_to_address = 7; + int64 to_amount = 8; } message SpendAuthSigParameters { From 1088234ca2158e3906627a7c11b957dca8dfd1b7 Mon Sep 17 00:00:00 2001 From: Wenhua Zhang Date: Mon, 27 May 2019 18:09:31 +0800 Subject: [PATCH 85/99] feat: add api createshieldedtransactionwithoutspendauthsig --- api/api.proto | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/api/api.proto b/api/api.proto index 42e086139..f5bc69c56 100644 --- a/api/api.proto +++ b/api/api.proto @@ -1180,13 +1180,14 @@ message PrivateParameters { message PrivateParametersWithoutAsk { bytes transparent_from_address = 1; - bytes nsk = 2; - bytes ovk = 3; - int64 from_amount = 4; - repeated SpendNote shieldedSpends = 5; - repeated ReceiveNote shieldedReceives = 6; - bytes transparent_to_address = 7; - int64 to_amount = 8; + bytes ak = 2; + bytes nsk = 3; + bytes ovk = 4; + int64 from_amount = 5; + repeated SpendNote shieldedSpends = 6; + repeated ReceiveNote shieldedReceives = 7; + bytes transparent_to_address = 8; + int64 to_amount = 9; } message SpendAuthSigParameters { From ccd5848f3dc0e962b2b38fc41e0d7d7360d1c836 Mon Sep 17 00:00:00 2001 From: jiangyuanshu <317787106@qq.com> Date: Tue, 28 May 2019 17:15:48 +0800 Subject: [PATCH 86/99] modify interface GetShieldTransactionHash --- api/api.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/api.proto b/api/api.proto index f5bc69c56..3b8b78356 100644 --- a/api/api.proto +++ b/api/api.proto @@ -699,7 +699,7 @@ service Wallet { rpc CreateShieldedTransactionWithoutSpendAuthSig (PrivateParametersWithoutAsk) returns (TransactionExtention) { }; - rpc GetShieldTransactionHash (TransactionExtention) returns (BytesMessage) { + rpc GetShieldTransactionHash (Transaction) returns (BytesMessage) { }; rpc CreateSpendAuthSig (SpendAuthSigParameters) returns (BytesMessage) { From 94ca02a477b4499bfd0677e804223944de0a2317 Mon Sep 17 00:00:00 2001 From: olivier Date: Tue, 28 May 2019 17:39:46 +0800 Subject: [PATCH 87/99] add zen transfer actuator for TRC10 token shielded transfer --- core/Contract.proto | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/core/Contract.proto b/core/Contract.proto index 1fb59291e..961dcd2c5 100644 --- a/core/Contract.proto +++ b/core/Contract.proto @@ -334,5 +334,15 @@ message ShieldedTransferContract { bytes transparent_to_address = 6; // transparent address int64 to_amount = 7; // the amount to transparent to_address } + +message ZenTransferContract { + 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 +} // end shielded transaction From c415fabc89486a38ef95fda1cb1ead9a66157fac Mon Sep 17 00:00:00 2001 From: Wenhua Zhang Date: Thu, 30 May 2019 11:03:34 +0800 Subject: [PATCH 88/99] feat: update note proto --- api/api.proto | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/api/api.proto b/api/api.proto index 3b8b78356..893aa7b5a 100644 --- a/api/api.proto +++ b/api/api.proto @@ -1150,9 +1150,9 @@ message DecryptNotes { message Note { int64 value = 1; - bytes d = 2; - bytes pkD = 3; - bytes rcm = 4; // random 32 + string payment_address = 2; + bytes rcm = 3; // random 32 + bytes memo = 4; } message SpendNote { @@ -1230,6 +1230,7 @@ message IncomingViewingKeyDiversifierMessage { message SaplingPaymentAddressMessage { DiversifierMessage d = 1; bytes pkD = 2; + string payment_address = 3; } message NoteParameters { From 9f374651a4d4aa25b149ee590e32c5523efee9fb Mon Sep 17 00:00:00 2001 From: renchenchang Date: Thu, 30 May 2019 11:44:24 +0800 Subject: [PATCH 89/99] rafactor note in proto --- api/api.proto | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/api/api.proto b/api/api.proto index 893aa7b5a..738566860 100644 --- a/api/api.proto +++ b/api/api.proto @@ -1172,8 +1172,8 @@ message PrivateParameters { bytes nsk = 3; bytes ovk = 4; int64 from_amount = 5; - repeated SpendNote shieldedSpends = 6; - repeated ReceiveNote shieldedReceives = 7; + repeated SpendNote shielded_spends = 6; + repeated ReceiveNote shielded_receives = 7; bytes transparent_to_address = 8; int64 to_amount = 9; } @@ -1184,8 +1184,8 @@ message PrivateParametersWithoutAsk { bytes nsk = 3; bytes ovk = 4; int64 from_amount = 5; - repeated SpendNote shieldedSpends = 6; - repeated ReceiveNote shieldedReceives = 7; + repeated SpendNote shielded_spends = 6; + repeated ReceiveNote shielded_receives = 7; bytes transparent_to_address = 8; int64 to_amount = 9; } From 5a091e04471fdf31f51d6326c0868b8e290b566a Mon Sep 17 00:00:00 2001 From: renchenchang Date: Thu, 30 May 2019 12:25:28 +0800 Subject: [PATCH 90/99] refactor function name --- api/api.proto | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/api.proto b/api/api.proto index 738566860..ee4763e6d 100644 --- a/api/api.proto +++ b/api/api.proto @@ -687,7 +687,7 @@ service Wallet { rpc GetDiversifier (EmptyMessage) returns (DiversifierMessage) { } - rpc GetZenPaymentAddress (IncomingViewingKeyDiversifierMessage) returns (SaplingPaymentAddressMessage) { + rpc GetZenPaymentAddress (IncomingViewingKeyDiversifierMessage) returns (PaymentAddressMessage) { } rpc GetRcm (EmptyMessage) returns (BytesMessage) { @@ -1227,7 +1227,7 @@ message IncomingViewingKeyDiversifierMessage { DiversifierMessage d = 2; } -message SaplingPaymentAddressMessage { +message PaymentAddressMessage { DiversifierMessage d = 1; bytes pkD = 2; string payment_address = 3; From 0020b5c32418b947bc1e0291ef08f74fb7f5b15e Mon Sep 17 00:00:00 2001 From: Matt Date: Thu, 30 May 2019 20:14:56 +0800 Subject: [PATCH 91/99] add zksnarkclient --- api/zksnark.proto | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 api/zksnark.proto diff --git a/api/zksnark.proto b/api/zksnark.proto new file mode 100644 index 000000000..66538d6ad --- /dev/null +++ b/api/zksnark.proto @@ -0,0 +1,34 @@ +syntax = "proto3"; +package protocol; + +import "core/Tron.proto"; +import "core/Contract.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; +} + + + + From aa80e6d90290491b7dce2820d1750b93de69043f Mon Sep 17 00:00:00 2001 From: Wenhua Zhang Date: Mon, 3 Jun 2019 14:36:52 +0800 Subject: [PATCH 92/99] feat: add 4 query api to solidity node --- api/api.proto | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/api/api.proto b/api/api.proto index ee4763e6d..88fb8b536 100644 --- a/api/api.proto +++ b/api/api.proto @@ -839,6 +839,18 @@ service WalletSolidity { } }; } + + rpc GetMerkleTreeVoucherInfo (OutputPointInfo) returns (IncrementalMerkleVoucherInfo) { + } + + rpc ScanNoteByIvk (IvkDecryptParameters) returns (DecryptNotes) { + } + + rpc ScanNoteByOvk (OvkDecryptParameters) returns (DecryptNotes) { + } + + rpc IsSpend (NoteParameters) returns (SpendResult) { + } }; service WalletExtension { From 6fad36cc24ae57df42d8e8f5ea87480802857c3b Mon Sep 17 00:00:00 2001 From: renchenchang Date: Thu, 13 Jun 2019 19:50:21 +0800 Subject: [PATCH 93/99] rm zenShieldedTransferContract --- core/Contract.proto | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/core/Contract.proto b/core/Contract.proto index 961dcd2c5..bf8023c85 100644 --- a/core/Contract.proto +++ b/core/Contract.proto @@ -334,15 +334,4 @@ message ShieldedTransferContract { bytes transparent_to_address = 6; // transparent address int64 to_amount = 7; // the amount to transparent to_address } - -message ZenTransferContract { - 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 -} // end shielded transaction - From c079ec6d22b5a58cef2d415a18e54a14748a28c3 Mon Sep 17 00:00:00 2001 From: renchenchang Date: Thu, 13 Jun 2019 19:56:10 +0800 Subject: [PATCH 94/99] rm useless api --- api/api.proto | 26 -------------------------- 1 file changed, 26 deletions(-) diff --git a/api/api.proto b/api/api.proto index 88fb8b536..e67908209 100644 --- a/api/api.proto +++ b/api/api.proto @@ -605,31 +605,6 @@ service Wallet { }; } - // rpc GetMerklePath (BytesMessage) returns (MerklePath) { - // } - // - // - // rpc GetBestMerkleRoot (EmptyMessage) returns (BytesMessage) { - // } - // - // rpc GetNullifier (BytesMessage) returns (BytesMessage) { - // } - // - // - // rpc GetMerkleRoot (BytesMessage) returns (BytesMessage) { - // } - // - // rpc GenerateShieldAddress (EmptyMessage) returns (ShieldAddress) { - // } - // - // //Get zero-snark blockExtention list - // rpc GetZKBlockByLimitNext (BlockLimit) returns (BlockListExtention) { - // } - // - // //Get the specified height block merkleTree - // rpc GetMerkleTreeOfBlock (NumberMessage) returns (BlockIncrementalMerkleTree) { - // } - rpc AccountPermissionUpdate (AccountPermissionUpdateContract) returns (TransactionExtention) { option (google.api.http) = { post: "/wallet/accountpermissionupdate" @@ -640,7 +615,6 @@ service Wallet { }; } - rpc AddSign (TransactionSign) returns (TransactionExtention) { } From 0cd602afcc4c14ea74de1bd7ff67805ff45493ce Mon Sep 17 00:00:00 2001 From: Wenhua Zhang Date: Wed, 19 Jun 2019 19:12:59 +0800 Subject: [PATCH 95/99] feat: update shielded fee to new param --- core/Tron.proto | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/Tron.proto b/core/Tron.proto index b93905c4f..2be9aa29a 100644 --- a/core/Tron.proto +++ b/core/Tron.proto @@ -315,6 +315,7 @@ message Transaction { int64 exchange_inject_another_amount = 19; int64 exchange_withdraw_another_amount = 20; int64 exchange_id = 21; + int64 shieldedTransactionFee = 22; } message raw { @@ -368,6 +369,7 @@ message TransactionInfo { int64 exchange_inject_another_amount = 19; int64 exchange_withdraw_another_amount = 20; int64 exchange_id = 21; + int64 shieldedTransactionFee = 22; } message TransactionRet { From 1d9d2521460df092e88c5f75aed3935f50aaccb7 Mon Sep 17 00:00:00 2001 From: Wenhua Zhang Date: Wed, 19 Jun 2019 20:44:58 +0800 Subject: [PATCH 96/99] typo: update param with '-' --- core/Tron.proto | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/Tron.proto b/core/Tron.proto index 2be9aa29a..57a634b59 100644 --- a/core/Tron.proto +++ b/core/Tron.proto @@ -315,7 +315,7 @@ message Transaction { int64 exchange_inject_another_amount = 19; int64 exchange_withdraw_another_amount = 20; int64 exchange_id = 21; - int64 shieldedTransactionFee = 22; + int64 shielded_transaction_fee = 22; } message raw { @@ -369,8 +369,8 @@ message TransactionInfo { int64 exchange_inject_another_amount = 19; int64 exchange_withdraw_another_amount = 20; int64 exchange_id = 21; - int64 shieldedTransactionFee = 22; -} + int64 shielded_transaction_fee = 22; + message TransactionRet { int64 blockNumber = 1; From bff46ede81459e92e272b2de89f479ddcb1b7093 Mon Sep 17 00:00:00 2001 From: Wenhua Zhang Date: Wed, 19 Jun 2019 20:50:40 +0800 Subject: [PATCH 97/99] fix: fix typo error --- core/Tron.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/Tron.proto b/core/Tron.proto index 57a634b59..a60ef718d 100644 --- a/core/Tron.proto +++ b/core/Tron.proto @@ -370,7 +370,7 @@ message TransactionInfo { int64 exchange_withdraw_another_amount = 20; int64 exchange_id = 21; int64 shielded_transaction_fee = 22; - +} message TransactionRet { int64 blockNumber = 1; From 8a5c127c0c924bd53bf24655d33d87b4adbfb6ac Mon Sep 17 00:00:00 2001 From: jiangyuanshu <317787106@qq.com> Date: Tue, 25 Jun 2019 21:10:38 +0800 Subject: [PATCH 98/99] add wallet api scanandmarknotebyivk and modify api IsSpendServlet --- api/api.proto | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/api/api.proto b/api/api.proto index e67908209..167cb69a1 100644 --- a/api/api.proto +++ b/api/api.proto @@ -640,6 +640,9 @@ service Wallet { rpc ScanNoteByIvk (IvkDecryptParameters) returns (DecryptNotes) { }; + rpc ScanAndMarkNoteByIvk (IvkDecryptAndMarkParameters) returns (DecryptNotesMarked) { + }; + rpc ScanNoteByOvk (OvkDecryptParameters) returns (DecryptNotes) { }; @@ -1119,6 +1122,14 @@ message IvkDecryptParameters { 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; @@ -1134,6 +1145,16 @@ message DecryptNotes { repeated NoteTx noteTxs = 1; } +message DecryptNotesMarked { + message NoteTx { + Note note = 1; + bytes txid = 2; //transaction id = sha256(transaction.rowdata) + 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; @@ -1223,7 +1244,8 @@ message NoteParameters { bytes ak = 1; bytes nk = 2; Note note = 3; - IncrementalMerkleVoucher voucher = 4; + bytes txid = 4; + int32 index = 5; } message SpendResult { From 18cf4ce0272f8e7b92cd8b96d2051ce6f5aca2a5 Mon Sep 17 00:00:00 2001 From: jiangyuanshu <317787106@qq.com> Date: Wed, 26 Jun 2019 12:06:25 +0800 Subject: [PATCH 99/99] add scanAndMarkNoteByIvk to rpc api --- api/api.proto | 3 +++ 1 file changed, 3 insertions(+) diff --git a/api/api.proto b/api/api.proto index 167cb69a1..89e8bcf8e 100644 --- a/api/api.proto +++ b/api/api.proto @@ -823,6 +823,9 @@ service WalletSolidity { rpc ScanNoteByIvk (IvkDecryptParameters) returns (DecryptNotes) { } + rpc ScanAndMarkNoteByIvk (IvkDecryptAndMarkParameters) returns (DecryptNotesMarked) { + } + rpc ScanNoteByOvk (OvkDecryptParameters) returns (DecryptNotes) { }