FIPA8V1_Freedrive(zh-CN)



  • FIPA8: Freedrive
    Version: 1
    Language: zh-CN
    Author: C_armX, master_wang
    Status: draft
    Created date: 2021-06-12
    Last modified date:2022-02-12
    PID: ""
    TXID: 
    

    FIPA8V1_Freedrive(zh-CN)

    Contents

    Introduction

    General rules of FIPA type protocols

    Rules specific to this protocol

    流程

    服务申请信息

    基本操作

    错误信息

    Introduction

    Protocol type: FIPA
    Serial number: 8
    Protocol name: Freedrive
    Version: 1
    Description : 自由开放的分布式数据存储模式。
    Author: C_armX, Deisler-JJ_Sboy,master_wang
    Language: zh-CN
    Previous version PID:""
    

    General consensus of FIPA protocols

    FIPA protocols make improvements to the FCH ecosystem. These improvements will not lead to a hard fork of the main network, and will not write information on the blockchain.

    Consensus of this protocol

    1. 本协议提供存储系统接入自由共识生态的通用方式。
    2. 任何存储系统均可以按照本协议提供存储服务,在市场竞争中形成自由开放的分布式存储系统。
    3. 存储方:提供存储服务者。
    4. 使用者:使用存储服务者。

    流程

    1. 建立服务关系:使用者和存储方可以通过任何方式建立服务关系,存储方记录使用者的FCH地址及对应服务条件。
    2. 发起服务请求:使用者向存储方发出服务申请信息,包含所请求的操作和签名,详见
      [服务申请信息](#服务申请信息)。
    3. 验证服务请求:存储方接到请求后:
      • 验证FCH地址是否是在册服务对象
      • 验证签名是否正确
      • 验证签名时间是否符合要求,以防止重放攻击
      • 验证请求来源,防止转发攻击
      • 验证失败返回错误,详见
        [错误信息](#错误信息)
    4. 执行服务操作:验证成功后,存储方执行使用者请求的操作,基本操作见
      [基本操作](#基本操作)

    服务申请信息

    使用者向存储方提交的申请信息采取以下格式:

    {
          "message": {
          "requester": "[url]",
          "timestamp": "[unix timestamp]",
          "operation": "[operation]"
            },
          "address": "[FCH address of the user]",
          "signature": "[signature of message signed by the private key of the address]"
    }
    

    基本操作 (待细化)

    通用操作包括write、read和check。存储方可以定义更多操作。

    write

    操作说明:使用者向存储方存入数据,数据的哈希。失败返回错误代码201及错误信息。
    格式:write [data] [上传方式]

    read

    操作说明:使用者提交数据哈希给存储方,存储方返回哈希所对应的数据.数据不存在返回错误代码204及错误信息。失败返回错误代码202级错误信息。
    格式:read [hash] [下载方式]

    check

    操作说明:使用者提交数据哈希检查相应数据是否存储在存储方。存储方返回0为不存在,1为存在。失败返回错误代码203。
    格式:check [hash]

    错误信息

    存储方向使用者返回的错误信息采取以下格式:

    {
          "errorCode": [int,必填],
          "erroeMessage": "[string, 必填]"
    }
    

    错误代码与信息表

    错误代码 错误信息 说明
    100 You are not in the service list, please contact the service provider. 请求方无权获取服务
    101 Signature verification failed. 请求签名验证失败
    102 Signature has expired. 请求签名过期
    103 The request source does not match the signature information. 请求来源与签名内容不符
    201 Failed to write data. write失败
    202 Failed to read data. read失败
    203 Failed to check data. check失败
    204 The data does not exist. read时,数据不存在
    500 Unknown reason caused the failure. 未知原因导致请求失败


  • @昌用 这一版解耦性非常好。👍



  • @昌用 上传数据一般有GET、POST上传方式,协议里的operation(操作)字段里的拉取操作叫GET就把这个关键字给占用了。建议换成TAKE、PULL、ASK等意思相近的其它词。



  • @水雷_zzHe 好,考虑改成read、write、check



  • @昌用 这样就能避开关键字冲突了👍


Log in to reply