github.com/turingchain2020/turingchain@v1.1.21/types/proto/transaction.proto (about)

     1  syntax = "proto3";
     2  
     3  import "common.proto";
     4  
     5  package types;
     6  option go_package = "github.com/turingchain2020/turingchain/types";
     7  
     8  // assert transfer struct
     9  message AssetsGenesis {
    10      int64  amount        = 2;
    11      string returnAddress = 3;
    12  }
    13  
    14  message AssetsTransferToExec {
    15      string cointoken = 1;
    16      int64  amount    = 2;
    17      bytes  note      = 3;
    18      string execName  = 4;
    19      string to        = 5;
    20  }
    21  
    22  message AssetsWithdraw {
    23      string cointoken = 1;
    24      int64  amount    = 2;
    25      bytes  note      = 3;
    26      string execName  = 4;
    27      string to        = 5;
    28  }
    29  
    30  message AssetsTransfer {
    31      string cointoken = 1;
    32      int64  amount    = 2;
    33      bytes  note      = 3;
    34      string to        = 4;
    35  }
    36  
    37  message Asset {
    38      string exec   = 1;
    39      string symbol = 2;
    40      int64  amount = 3;
    41  }
    42  
    43  message CreateTx {
    44      string to          = 1;
    45      int64  amount      = 2;
    46      int64  fee         = 3;
    47      bytes  note        = 4;
    48      bool   isWithdraw  = 5;
    49      bool   isToken     = 6;
    50      string tokenSymbol = 7;
    51      string execName    = 8;
    52      string execer      = 9;
    53  }
    54  
    55  message ReWriteRawTx {
    56      string tx = 1;
    57      // bytes  execer = 2;
    58      string to     = 3;
    59      string expire = 4;
    60      int64  fee    = 5;
    61      int32  index  = 6;
    62  }
    63  
    64  message CreateTransactionGroup {
    65      repeated string txs = 1;
    66  }
    67  
    68  message UnsignTx {
    69      bytes data = 1;
    70  }
    71  
    72  // 支持构造多笔nobalance的交易 payAddr 可以支持 1. 地址 2. 私钥
    73  message NoBalanceTxs {
    74      repeated string txHexs  = 1;
    75      string          payAddr = 2;
    76      string          privkey = 3;
    77      string          expire  = 4;
    78  }
    79  
    80  // payAddr 可以支持 1. 地址 2. 私钥
    81  message NoBalanceTx {
    82      string txHex   = 1;
    83      string payAddr = 2;
    84      string privkey = 3;
    85      string expire  = 4;
    86  }
    87  
    88  message Transaction {
    89      bytes     execer    = 1;
    90      bytes     payload   = 2;
    91      Signature signature = 3;
    92      int64     fee       = 4;
    93      int64     expire    = 5;
    94      //随机ID,可以防止payload 相同的时候,交易重复
    95      int64 nonce = 6;
    96      //对方地址,如果没有对方地址,可以为空
    97      string to         = 7;
    98      int32  groupCount = 8;
    99      bytes  header     = 9;
   100      bytes  next       = 10;
   101      int32  chainID    = 11;
   102  }
   103  
   104  message Transactions {
   105      repeated Transaction txs = 1;
   106  }
   107  
   108  // 环签名类型时,签名字段存储的环签名信息
   109  message RingSignature {
   110      repeated RingSignatureItem items = 1;
   111  }
   112  
   113  // 环签名中的一组签名数据
   114  message RingSignatureItem {
   115      repeated bytes pubkey    = 1;
   116      repeated bytes signature = 2;
   117  }
   118  
   119  //对于一个交易组中的交易,要么全部成功,要么全部失败
   120  //这个要好好设计一下
   121  //最好交易构成一个链条[prevhash].独立的交易构成链条
   122  //只要这个组中有一个执行是出错的,那么就执行不成功
   123  //三种签名支持
   124  // ty = 1 -> secp256k1
   125  // ty = 2 -> ed25519
   126  // ty = 3 -> sm2
   127  // ty = 4 -> OnetimeED25519
   128  // ty = 5 -> RingBaseonED25519
   129  message Signature {
   130      int32 ty     = 1;
   131      bytes pubkey = 2;
   132      //当ty为5时,格式应该用RingSignature去解析
   133      bytes signature = 3;
   134  }
   135  
   136  message AddrOverview {
   137      int64 reciver = 1;
   138      int64 balance = 2;
   139      int64 txCount = 3;
   140  }
   141  
   142  message ReqAddr {
   143      string addr = 1;
   144      //表示取所有/from/to/其他的hash列表
   145      int32 flag      = 2;
   146      int32 count     = 3;
   147      int32 direction = 4;
   148      int64 height    = 5;
   149      int64 index     = 6;
   150  }
   151  
   152  message HexTx {
   153      string tx = 1;
   154  }
   155  
   156  message ReplyTxInfo {
   157      bytes    hash         = 1;
   158      int64    height       = 2;
   159      int64    index        = 3;
   160      repeated Asset assets = 4;
   161  }
   162  
   163  message ReqTxList {
   164      int64 count = 1;
   165  }
   166  
   167  message ReplyTxList {
   168      repeated Transaction txs = 1;
   169  }
   170  
   171  message ReqGetMempool {
   172      bool isAll = 1;
   173  }
   174  
   175  message ReqProperFee {
   176      int32 txCount = 1;
   177      int32 txSize  = 2;
   178  }
   179  
   180  message ReplyProperFee {
   181      int64 properFee = 1;
   182  }
   183  
   184  message TxHashList {
   185      repeated bytes hashes = 1;
   186      int64          count  = 2;
   187      repeated int64 expire = 3;
   188  }
   189  
   190  message ReplyTxInfos {
   191      repeated ReplyTxInfo txInfos = 1;
   192  }
   193  
   194  message ReceiptLog {
   195      int32 ty  = 1;
   196      bytes log = 2;
   197  }
   198  
   199  // ty = 0 -> error Receipt
   200  // ty = 1 -> CutFee //cut fee ,bug exec not ok
   201  // ty = 2 -> exec ok
   202  message Receipt {
   203      int32    ty              = 1;
   204      repeated KeyValue KV     = 2;
   205      repeated ReceiptLog logs = 3;
   206  }
   207  
   208  message ReceiptData {
   209      int32    ty              = 1;
   210      repeated ReceiptLog logs = 3;
   211  }
   212  
   213  message TxResult {
   214      int64       height      = 1;
   215      int32       index       = 2;
   216      Transaction tx          = 3;
   217      ReceiptData receiptdate = 4;
   218      int64       blocktime   = 5;
   219      string      actionName  = 6;
   220  }
   221  
   222  message TransactionDetail {
   223      Transaction tx            = 1;
   224      ReceiptData receipt       = 2;
   225      repeated bytes proofs     = 3;
   226      int64          height     = 4;
   227      int64          index      = 5;
   228      int64          blocktime  = 6;
   229      int64          amount     = 7;
   230      string         fromaddr   = 8;
   231      string         actionName = 9;
   232      repeated Asset assets     = 10;
   233      repeated TxProof txProofs = 11;
   234      bytes            fullHash = 12;
   235  }
   236  
   237  message TransactionDetails {
   238      repeated TransactionDetail txs = 1;
   239  }
   240  
   241  message ReqAddrs {
   242      repeated string addrs = 1;
   243  }
   244  
   245  message ReqDecodeRawTransaction {
   246      string txHex = 1;
   247  }
   248  
   249  message UserWrite {
   250      string topic   = 1;
   251      string content = 2;
   252  }
   253  
   254  message UpgradeMeta {
   255      bool   starting = 1;
   256      string version  = 2;
   257      int64  height   = 3;
   258  }
   259  
   260  //通过交易hash获取交易列表,需要区分是短hash还是全hash值
   261  message ReqTxHashList {
   262      repeated string hashes      = 1;
   263      bool            isShortHash = 2;
   264  }
   265  
   266  //使用多层merkle树之后的proof证明结构体
   267  message TxProof {
   268      repeated bytes proofs   = 1;
   269      uint32         index    = 2;
   270      bytes          rootHash = 3;
   271  }
   272  
   273  // 指定交易哈希,查找是否存在
   274  message ReqCheckTxsExist {
   275      repeated bytes txHashes = 1;
   276  }
   277  
   278  message ReplyCheckTxsExist {
   279      //对应请求序列存在标识数组,存在则true,否则false
   280      repeated bool existFlags = 1;
   281      //存在情况的总个数
   282      uint32 existCount = 2;
   283  }