{
  "openapi": "3.0.0",
  "info": {
    "version": "1.0.0",
    "title": "Partner chain writer server for light blockchain",
    "license": {
      "name": "MIT"
    }
  },
  "servers": [
    {
      "url": "https://writer.networknt.com"
    }
  ],
  "paths": {
    "/txs": {
      "post": {
        "summary": "Write a list of new transactions in a batch to the blockchain(s)",
        "operationId": "createTransactions",
        "requestBody": {
          "description": "Transactions in encoded format to add to the blockchain",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Transaction"
                }
              }
            }
          }
        },
        "tags": [
          "txs"
        ],
        "security": [
          {
            "tx_auth": [
              "tx.w"
            ]
          }
        ],
        "responses": {
          "201": {
            "description": "Null response"
          }
        }
      }
    },
    "/tx": {
      "post": {
        "summary": "Write a single transaction with a list of credit entries and debit entries to the blockchain(s)",
        "operationId": "createTransaction",
        "requestBody": {
          "description": "Transaction in encoded format to add to the blockchain",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Transaction"
              }
            }
          }
        },
        "tags": [
          "tx"
        ],
        "security": [
          {
            "tx_auth": [
              "tx.w"
            ]
          }
        ],
        "responses": {
          "201": {
            "description": "Null response"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "tx_auth": {
        "type": "oauth2",
        "description": "This API uses OAuth 2.0 with the client credential grant flow.",
        "flows": {
          "clientCredentials": {
            "tokenUrl": "https://localhost:6882/token",
            "scopes": {
              "tx.r": "read tx",
              "tx.w": "write tx"
            }
          }
        }
      }
    },
    "schemas": {
      "Transaction": {
        "type": "object",
        "properties": {
          "currency": {
            "type": "string",
            "enum": [
              "taiji"
            ]
          },
          "d": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LedgerEntry"
            }
          },
          "c": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LedgerEntry"
            }
          }
        }
      },
      "LedgerEntry": {
        "type": "object",
        "properties": {
          "address": {
            "type": "string"
          },
          "signedEntry": {
            "type": "string"
          }
        }
      }
    }
  }
}