Skip to content

Latest commit

 

History

History
313 lines (283 loc) · 5.46 KB

契约.md

File metadata and controls

313 lines (283 loc) · 5.46 KB

契约

Web端

注册

getVerificationCodeRequest {
  ResponseStatus {
    String Ack;// success || error
    String ErrorMessage;
    String Timestamp;
  }
  string email;
}

getVerificationCodeResponse {
  ResponseStatus {
    String Ack;// success || error
    String ErrorMessage;
    String Timestamp;
  }
  int status;// 0: success & 1: error
}

registerRequset {
  ResponseStatus {
    String Ack;// success || error
    String ErrorMessage;
    String Timestamp;
  }
  int accountType;// 0: email, 1: facebook & 2: google
  userData {
    // 0: email
    string verificationCode;
    string username;
    string email;
    string password;

    // 1: facebook || 2: google
  }
}

registerResponse {
  ResponseStatus {
    String Ack;// success || error
    String ErrorMessage;
    String Timestamp;
  }
  int status;// 0: success & 1: error
  data {
    // 0: success
    string successMessage;
    
    // 1: error
    int errorStatus;// 0: verificationCode, 1: username, 2: email & 3: password & 4: other
    string errorMessage;
  }
}

登陆

loginRequest {
  ResponseStatus {
    String Ack;// success || error
    String ErrorMessage;
    String Timestamp;
  }
  int loginType;// 0: email||name, 1: facebook & 2: google
  string address;
  string username;
  string password;
}

loginResponse {
  ResponseStatus {
    String Ack;// success || error
    String ErrorMessage;
    String Timestamp;
  }
  int status;// 0: success & 1: error
  data {
    // 0: success
    string successMessage;

    // 1: error
    int errorStatus;// 0: username, 1: password & 2: other
    string errorMessage;
  }
}

首页显示最近交易

getLastTransactionRequest {
  ResponseStatus {
    String Ack;// success || error
    String ErrorMessage;
    String Timestamp;
  }
  string address;
}

getLastTransactionResponse {
  ResponseStatus {
    String Ack;// success || error
    String ErrorMessage;
    String Timestamp;
  }
  int status;// 0: success & 1: error
  lastTransactionData {

  }
}

获取交易详细信息

getTransactionDataRequest {
  ResponseStatus {
    String Ack;// success || error
    String ErrorMessage;
    String Timestamp;
  }
  string transactionId;
}

getTransactionDataResponse {
  ResponseStatus {
    String Ack;// success || error
    String ErrorMessage;
    String Timestamp;
  }
  int status;// 0: success & 1: error
  transactionData {
    string output;
    string input;
    double sum;
  }
}

搜索交易

searchTransactionRequest {
  ResponseStatus {
    String Ack;// success || error
    String ErrorMessage;
    String Timestamp;
  }
  string keyword;
  string filterKind;// 0: 钱包地址(公钥), 1: 节点 & 2: 块标识符
}

searchTransactionResponse {
  ResponseStatus {
    String Ack;// success || error
    String ErrorMessage;
    String Timestamp;
  }
  int status;// 0: success & 1: error
  int sum;
  array transactionList [
    {
      string output;
      string input;
      int sum;
    }
  ]
}

状态页

@Author(KWJ)
(这里我觉得就是在网页显示到目前为止区块链最长合法链,参考[连接](https://www.blockchain.com/explorer))
statusPageRequest {
  ResponseStatus {
    String Ack;// success || error
    String ErrorMessage;
    String Timestamp;
  }
  int pageNumber;//当前页数
  int pageSize;
}

statusPageResponse {
  ResponseStatus {
    String Ack;// success || error
    String ErrorMessage;
    String Timestamp;
  }
  int status;//0: success | 1: error
  int sum;
    array BlockList [
      {
        int height;
        int age;//从出块到现在的存在时间
        int transactionNumber;//记录的交易数
        String miner;//来自矿工名字
        double size;
      }
    ]
}

查看某个区块的详细信息

@Author(KWJ)
getBlockInfoRequest {
  ResponseStatus {
    String Ack;// success || error
    String ErrorMessage;
    String Timestamp;
  }
  String hash;
}

getBlockInfoResponse {
  ResponseStatus {
    String Ack;// success || error
    String ErrorMessage;
    String Timestamp;
  }
  int status;//0: success | 1: error
  BlockInfo {
    BlockHeader {
      String hash;
      String preHash;
      String MerkleRootHash;
      int transactionNumber;
      int height;
      ResponseStatus {
        String Ack;// success || error
        String ErrorMessage;
  
        String Timestamp;
      }
      int nonce;//通过挖矿得到的随机数
      double blockReward;//区块奖励
    }
    BlockBody {
      array Transactions [
        {
          String time;//交易时间
          string output;
          string input;
          double sum;
        }
      ]
    }
  }
}

APP端

用户

注册/登陆

@Author(KWJ)
// 同web端

发送/接受交易

@Author(KWJ)
transferRequest {
  ResponseStatus {
    String Ack;// success || error
    String ErrorMessage;
    String Timestamp;
  }
  String output;
  String input;
  int sum;//转账金额	
}

transferResponse {
  ResponseStatus {
    String Ack;// success || error
    String ErrorMessage;
    String Timestamp;
  }
  int status;//0: success | 1: error
}

查看余额

@Author(KWJ)
getBalanceRequest {
  ResponseStatus {
    String Ack;// success || error
    String ErrorMessage;
    String Timestamp;
  }
  String username;
}

getBalanceResponse {
  ResponseStatus {
    String Ack;// success || error
    String ErrorMessage;
    String Timestamp;
  }
  int status;//0: success | 1: error
  int balance;
}

PoC