syntax = "proto3"; package types; import "common.proto"; import "transaction.proto"; import "wallet.proto"; ////////////////////////////////////////////////////////////////////////////// // message for Privacy start///////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// message PrivacyAction { oneof value { Public2Privacy public2privacy = 1; Privacy2Privacy privacy2privacy = 2; Privacy2Public privacy2public = 3; } int32 ty = 4; } message Public2Privacy { string tokenname = 1; int64 amount = 2; string note = 5; PrivacyOutput output = 7; } message Privacy2Privacy { string tokenname = 1; int64 amount = 2; string note = 5; PrivacyInput input = 6; PrivacyOutput output = 7; } message Privacy2Public { string tokenname = 1; int64 amount = 2; string note = 3; PrivacyInput input = 4; PrivacyOutput output = 5; } message UTXOGlobalIndex { // int64 height = 1; // int32 txindex = 2; bytes txhash = 3; int32 outindex = 4; } // privacy input message KeyInput { int64 amount = 1; repeated UTXOGlobalIndex utxoGlobalIndex = 2; bytes keyImage = 3; } message PrivacyInput { repeated KeyInput keyinput = 1; } // privacy output message keyOutput { int64 amount = 1; bytes onetimepubkey = 2; } message PrivacyOutput { bytes RpubKeytx = 1; repeated keyOutput keyoutput = 2; } message GroupUTXOGlobalIndex { int64 amount = 1; repeated UTXOGlobalIndex utxoGlobalIndex = 2; } message LocalUTXOItem { int64 height = 1; int32 txindex = 2; int32 outindex = 3; bytes txhash = 4; bytes onetimepubkey = 5; } message ReqUTXOPubKeys { string tokenName = 1; repeated GroupUTXOGlobalIndex groupUTXOGlobalIndex = 2; } // 一个公钥信息 message PublicKeyData { repeated bytes data = 1; } message GroupUTXOPubKey { int64 amount = 1; // 输出签名的所有公钥 repeated bytes pubkey = 2; } message ResUTXOPubKeys { repeated GroupUTXOPubKey groupUTXOPubKeys = 1; } message ReqPrivacyToken { string token = 1; int64 amount = 2; } message AmountDetail { int64 amount = 1; int64 count = 2; } message ReplyPrivacyAmounts { repeated AmountDetail amountDetail = 1; } message replyUTXOsOfAmount { repeated LocalUTXOItem localUTXOItems = 1; } message ReceiptPrivacyOutput { string token = 1; repeated keyOutput keyoutput = 2; } //各种amount额度的UTXO在链上的数量 message AmountsOfUTXO { map amountMap = 1; } message TokenNamesOfUTXO { map tokensMap = 1; } // 用以转换成json后继续可见的结构 message UTXOGlobalIndex4Print { string txhash = 1; int32 outindex = 2; } message KeyInput4Print { int64 amount = 1; repeated UTXOGlobalIndex4Print utxoGlobalIndex = 2; string keyImage = 3; } message keyOutput4Print { int64 amount = 1; string onetimepubkey = 2; } message PrivacyInput4Print { repeated KeyInput4Print keyinput = 1; } message PrivacyOutput4Print { string RpubKeytx = 1; repeated keyOutput4Print keyoutput = 2; } message Public2Privacy4Print { string tokenname = 1; int64 amount = 2; string note = 5; PrivacyOutput4Print output = 7; } message Privacy2Privacy4Print { string tokenname = 1; int64 amount = 2; string note = 5; PrivacyInput4Print input = 6; PrivacyOutput4Print output = 7; } message Privacy2Public4Print { string tokenname = 1; int64 amount = 2; string note = 3; PrivacyInput4Print input = 4; PrivacyOutput4Print output = 5; } message PrivacyAction4Print { oneof value { Public2Privacy4Print public2privacy = 1; Privacy2Privacy4Print privacy2privacy = 2; Privacy2Public4Print privacy2public = 3; } int32 ty = 4; } message ReqPub2Pri { //接收人可见公钥A // string viewPublic = 1; //接收人花费公钥B // string spendPublic = 2; string tokenname = 3; int64 amount = 4; string note = 5; //发送人地址 string sender = 6; int32 mixin = 7; string pubkeypair = 8; int64 expire = 9; } message ReqPri2Pri { //接收人可见公钥A // string viewPublic = 1; //A //接收人花费公钥B // string spendPublic = 2; //B string tokenname = 3; int64 amount = 4; string note = 5; //隐私交易发起人地址 string sender = 6; int32 mixin = 7; // string txhash = 7; string pubkeypair = 8; int64 expire = 9; } message ReqPri2Pub { string receiver = 1; string tokenname = 2; int64 amount = 3; string note = 4; //隐私交易发起人地址 string sender = 5; int32 mixin = 6; // string txhash = 6; int64 expire = 7; } message ReqCreateUTXOs { // string viewPublic = 1; //接收人可见公钥A // string spendPublic = 2; //接收人花费公钥B string tokenname = 3; int64 amount = 4; string note = 5; string sender = 6; //发送人地址 int32 count = 7; string pubkeypair = 8; int64 expire = 9; } message ReplyPrivacyPkPair { bool showSuccessful = 1; // string viewPub = 2; // string spendPub = 3; string pubkeypair = 4; } message ReqPrivBal4AddrToken { string addr = 1; string token = 2; } message ReplyPrivacyBalance { string onetimeaddr = 1; int64 balance = 2; } message PrivacyDBStore { bytes txhash = 1; string tokenname = 2; int64 amount = 3; int32 outIndex = 4; bytes txPublicKeyR = 5; bytes onetimePublicKey = 6; string owner = 7; int64 height = 8; int32 txindex = 9; bytes blockhash = 10; } message UTXO { int64 amount = 1; UTXOBasic utxoBasic = 2; } message UTXOHaveTxHash { int64 amount = 1; string txHash = 2; UTXOBasic utxoBasic = 3; } message UTXOs { repeated UTXO utxos = 1; } message UTXOHaveTxHashs { repeated UTXOHaveTxHash utxoHaveTxHashs = 1; } message ReqUTXOGlobalIndex { string tokenname = 1; int32 mixCount = 2; repeated int64 amount = 3; } message UTXOBasic { UTXOGlobalIndex utxoGlobalIndex = 1; bytes onetimePubkey = 2; } message UTXOIndex4Amount { int64 amount = 1; repeated UTXOBasic utxos = 2; } message ResUTXOGlobalIndex { string tokenname = 1; int32 mixCount = 2; repeated UTXOIndex4Amount utxoIndex4Amount = 3; } message FTXOsSTXOsInOneTx { string tokenname = 1; string sender = 2; // FTXO的超期,设定原则与Transaction.expire一致 int64 expire = 3; string txhash = 4; repeated UTXO utxos = 5; } message RealKeyInput { int32 realinputkey = 1; bytes onetimeprivkey = 2; } message UTXOBasics { repeated UTXOBasic utxos = 1; } message CreateTransactionCache { bytes key = 1; // 记录创建时间,用以处理过期的交易 int64 createtime = 2; // 记录签名成功的时间,用以处理过期交易 int64 signtime = 3; // 缓存状态 // 0 - 创建状态 // 1 - 已经签名状态 int32 status = 4; // Transaction transaction = 5; string sender = 6; repeated RealKeyInput realkeyinput = 7; repeated UTXOBasics utxos = 8; string tokenname = 9; } message ReqCacheTxList { string addr = 1; string tokenname = 2; } message ReplyCacheTxList { repeated Transaction txs = 1; } message ReqPrivacyAccount { string tokenname = 1; string addr = 2; } message ReqPPrivacyAccount { string addr = 1; string token = 2; // 设定显示的数据类型信息 // 0: 只显示账户的数值信息 // 1: 显示UTXO明细 // 2: 显示FTXO明细 // 3: 全部显示 int32 displaymode = 3; } // 请求隐私账户信息的应答 message ReplyPrivacyAccount { // 未花费的UTXO UTXOs utxos = 1; // 冻结的UTXO UTXOs ftxos = 2; int32 displaymode = 3; } message ReqCreateCacheTxKey { string tokenname = 1; bytes hashkey = 2; } // get privacy transaction list in wallet message ReqPrivacyTransactionList { // support BTY string tokenname = 1; // 1:sendtx 2:recvtx int32 sendRecvFlag = 2; int32 direction = 3; int32 count = 4; string from = 5; string address = 6; bytes seedtxhash = 7; } message ReqRescanUtxos { repeated string addrs = 1; int32 flag = 2; } message RepRescanResult { string addr = 1; int32 flag = 2; } message RepRescanUtxos { int32 flag = 1; repeated RepRescanResult repRescanResults = 2; } message ReqEnablePrivacy { repeated string addrs = 2; } message PriAddrResult { string addr = 1; bool IsOK = 2; string msg = 3; } message RepEnablePrivacy { repeated PriAddrResult results = 1; } // 隐私交易三步发送时,临时存储签名需要的数据信息结构 message PrivacySignatureParam { int32 actionType = 1; repeated UTXOBasics utxobasics = 2; repeated RealKeyInput realKeyInputs = 3; } message WalletAccountPrivacy { bytes viewPubkey = 1; bytes viewPrivKey = 2; bytes spendPubkey = 3; bytes spendPrivKey = 4; } service privacy { // Privacy Trading // 显示指定地址的公钥对信息,可以作为后续交易参数 rpc ShowPrivacyKey(ReqString) returns (ReplyPrivacyPkPair) {} // 创建一系列UTXO rpc CreateUTXOs(ReqCreateUTXOs) returns (Reply) {} // 将资金从公开到隐私转移 rpc MakeTxPublic2Privacy(ReqPub2Pri) returns (Reply) {} // 将资产从隐私到隐私进行转移 rpc MakeTxPrivacy2Privacy(ReqPri2Pri) returns (Reply) {} // 将资产从隐私到公开进行转移 rpc MakeTxPrivacy2Public(ReqPri2Pub) returns (Reply) {} // 扫描UTXO以及获取扫描UTXO后的状态 rpc RescanUtxos(ReqRescanUtxos) returns (RepRescanUtxos) {} // 使能隐私账户 rpc EnablePrivacy(ReqEnablePrivacy) returns (RepEnablePrivacy) {} // 创建隐私交易 rpc CreateRawTransaction(ReqCreateTransaction) returns (Transaction) {} }