Sign inSign up

transferchain/transferchain-s4

By transferchain

•Updated about 1 month ago

TransferChain S4 Secure Simple Storage Service

Image
Security
Developer tools
Databases & storage
5

4.6K

transferchain/transferchain-s4 repository overview

⁠TransferChain S4

TransferChain S4 Secure Simple Storage Service

⁠Example

Direct docker run command:

docker run --name transferchain-s4 \
  -v ./env/s4.mapstructure:/etc/transferchain/s4.yaml \
  -v ./test/data/transferchain:/var/data/transferchain \
  -v ./test/log/transferchain:/var/log/transferchain \
  -e LOG_PATH=/var/log/transferchain \
  -e PORT=8080 \
  -e WITHOUT_LISTEN=true \
  -p "8080:8080" \
  transferchain/transferchain-s4:latest

⁠Docs

⁠Config file

behaviour: "standard" # or log-collect

# TransferChain authentication and authorization information.
account:
    api:
        token:
        secret:
        url: https://connect.transferchain.io
        proxy: # this option is optional
          type: "http" # http|socks5|socks5h
          host:
          port:
    identifier: 0
    mnemonics:
    ns:
    uuid:

# TransferChain file operation's (storage upload, download, delete) Server URL.
fileoperation:
    host: https://file-operation.transferchain.io
    fingerprint:
    insecure: false
    downloadurl:
    proxy: # this option is optional
      type: "http" # http|socks5|socks5h
      host:
      port:

limits:
    bodysize: 0 # in bytes, the default is 0, so it's 5368709120(5gb)
    timeout: 0 # in seconds, the default is 0, so it's 1800(30minutes)

# Logger configurations - required is log-collect mode
logger:
  sizeThreshold: 1048576 # in bytes (min 10mb)
  prefix: "s4-"

# TransferChain Blockchain information.
readnode:
    address: https://read-node-01.transferchain.io
    chain:
        name: medusa # constant
        version: v2 # constant
    wsaddress: wss://read-node-01.transferchain.io/ws
    fingerprint:
    insecure: false
    proxy: # this option is optional
      type: "http" # http|socks5|socks5h
      host:
      port:

# APIs verbose mode. if open showed all log events.
verbose: false
syslag: false
listen: true

logformat: "json" # or text

version: v1

⁠Requests

⁠Account

⁠Init

This request allows you to create your cloud account for the first time or to re-create it by force.
Note: If this request is successful, the mnemonics will be written to the config file.

Endpoint: /v1/account/init
Method: POST
Body (Optional):

{
  "force": false // if re-create account use true.
}

Response:

{
  "data": {
    "mnemonics": ["your", "account", "mnemonics", ...],
    "raw": "your account mnemonics ..."
  }
}
⁠Restore

Endpoint: /v1/account/restore
Method: POST Body (Optional):

{
  "mnemonics": ["your", "account", "mnemonics", ...],
  "force": false // if re-restore or use other account account use true
}

⁠Storage

⁠Upload

Endpoint: /v1/storage/upload
Method: POST
Body:

{
  "files": ["raw file data", "/home/transferchain/file1.zip"]
}

Response:

{
  "data": {
    "transactions": [
      {
        "id": "<txID>",
        "version": 2,
        "type": "storage",
        "sender_addr": "<your random address>",
        "recipient_addr": "<your random address>",
        "data": "<base encoded, encrypted data>",
        "sign": "<base encoded, sha512 hashed sender signed data>",
        "fee": 0
      }
    ],
    "storages": [
      {
        "UUID": "<string>",
        "FileName": "<uuid_v4>",
        "Size": 97,
        "Slots": [
          {
            "base_uuid": "<string>",
            "uuid": "<string>",
            "storage_service": "<provider title>",
            "storage_code": "<provider code>",
            "size": 0,
            "size_rl": 0,
            "user_id": 0,
            "chunk_size": 0
          }
        ],
        "KeyAES": "<base64 encoded random bytes>",
        "KeyHMAC": "<base64 encoded random bytes>",
        "UploadDate": "RFC3339 TIMESTAMP",
        "Policy": {
          "ID": "<string>",
          "Identifier": "<string>",
          "Owner": "<your random address>",
          "SourceIdentifier": "<your random address>",
          "TargetIdentifier": "<your random address>",
          "OPCode": "storage",
          "Policy": "owner",
          "EventType": "create",
          "CreatedAt": "RFC3339 TIMESTAMP"
        }
      }
    ],
    "mapped_storages": {
      "<txID>": {
        "UUID": "<string>",
        "FileName": "<uuid_v4>",
        "Size": 97,
        "Slots": [
          {
            "base_uuid": "<string>",
            "uuid": "<string>",
            "storage_service": "<provider title>",
            "storage_code": "<provider code>",
            "size": 0,
            "size_rl": 0,
            "user_id": 0,
            "chunk_size": 0
          }
        ],
        "KeyAES": "<base64 encoded random bytes>",
        "KeyHMAC": "<base64 encoded random bytes>",
        "UploadDate": "RFC3339 TIMESTAMP",
        "Policy": {
          "ID": "<string>",
          "Identifier": "<string>",
          "Owner": "<your random address>",
          "SourceIdentifier": "<your random address>",
          "TargetIdentifier": "<your random address>",
          "OPCode": "storage",
          "Policy": "owner",
          "EventType": "create",
          "CreatedAt": "RFC3339 TIMESTAMP"
        }
      }
    }
  }
}
⁠List

Endpoint: /v1/storage/
Query Params (optional):

  • limit: The desired tx count to be displayed.
  • last_id: The last tx id displayed on the previous page. Method: GET

Response:

{
  "data": {
    "transactions": [
      {
        "id": "<txID>",
        "version": 2,
        "type": "storage",
        "sender_addr": "<your random address>",
        "recipient_addr": "<your random address>",
        "data": "<base encoded, encrypted data>",
        "sign": "<base encoded, sha512 hashed sender signed data>",
        "fee": 0
      }
    ]
  }
}
⁠Get

Endpoint: /v1/storage/txID
Method: GET

Response:

{
  "data": {
        "id": "<txID>",
        "version": 2,
        "type": "storage",
        "sender_addr": "<your random address>",
        "recipient_addr": "<your random address>",
        "data": "<base encoded, encrypted data>",
        "sign": "<base encoded, sha512 hashed sender signed data>",
        "fee": 0
  }
}
⁠Download

Endpoint: /v1/storage/download/txID
Method: POST
Body:

{
  "path": "<download file path>" // optional
}

Response (JSON or Raw Data): ...

⁠Delete

Endpoint: /v1/storage/download/txID
Method: DELETE
Body:

{
  "tx_id": ["<txID_1>", "<txID_2>", ...]
}

⁠Docker compose

name: transferchain-s4

services:
  s4-local:
    image: transferchain/transferchain-s4:latest
    environment:
      PORT: 8080
      WITHOUT_LISTEN: 'false'
      LOG_PATH: /var/log/transferchain
    volumes:
      - ./env/s4.mapstructure:/etc/transferchain/s4.yaml
      - ./data:/var/data/transferchain
      - ./log:/var/log/transferchain
    restart: always
    ports:
      - '8080:8080'

Tag summary

Content type

Image

Digest

sha256:0f041d37e…

Size

13.2 MB

Last updated

about 1 month ago

docker pull transferchain/transferchain-s4