Communication Protocol

This section details the communication protocol between the user and tService.

Request format

The request is JSON formatted data.

{
    "version": "0.1",
    "pyxa-version": "0.1",
	  "header": { "src": "user", "type": "text/plain" },
  	"content-transfer-encoding": "base64",
    "app_id": "QmWPypqFkmHYEwB61g8FNmGLvXAGraLZ6yzxM4qG81g6nz",
    "function": "/submit",
    "code": "[plaintext code, encoded with content-transfer-encoding]",
    "data": "[AES128 encrypted data, encoded with content-transfer-encoding]"
}

version [required]: Float number which represents the Taxa communication protocol version.

pyxa-version [required]: Float number which represents the current version of the Pyxa framework. Taxa Nodes are backwards compatible for multiple old versions of the Pyxa framework.

header/src [required]: String indicating which party initiated the request (node or user). The current version only supports "user".

header/type [required]: String indicating the data type after decryption. Compatible with RFC2046 MIME type (considering future portability with HTTP). Options are as follow:

  • text/plain - plain text format [default]
  • application/json - json format
  • application/Octet-Stream - arbitrary binary format

content-transfer-encoding [required]: RFC2045 compatible encoding type: base64 [default]. As of version(0.1), base64 is the only supported encoding.

app_id: String in multihash format. It is the hash of the developer-generated python code.

function: String that represents the name of the entry function (e.g., taxa.route).

code: String in encrypted data format as indicated in content-transfer-encoding. Protocol-wise, the code needs to be included in the requests. Engineering-wise, it could be cached on the node. If left empty, the server will automatically search its cache folder. It will be invalidated if the hash doesn't match the app_id field.

data: String in encrypted data format as indicated in content-transfer-encoding

Response format

The response is JSON formatted data.

	{
		"version": "0.1",
		"pyxa-version": "0.1",
		"response-code": "1000",
		"direction": "0",
		"content-type": "text/plain",
		"content-transfer-encoding": "base64",
		"data": "cq6rTB3b4E/cT/dUQ3szzQ==\n"
	}

version [required]: Float number which represents the Taxa communication protocol version.

pyxa-version [required]: Float number which represents the current version of the Pyxa framework. Taxa Nodes are backwards compatible for multiple old versions of the Pyxa framework.

response code [required]: Integer which indicates the result of a handled request. The options are as follows:

  • 1000 - OK
  • 2000 - FULL_CODE_REQUIRED
  • 3000 - UNIDENTIFIED_ENCRYPTION

direction: Integer indicating the message's sender and handler. The current version only supports 0.

content-type: RFC2046 compatible MIME type (considering future portability with HTTP). Options include the following:

  • text/plain - plain text format [default]
  • application/json - json format
  • application/Octet-Stream - arbitrary binary format

content-transfer-encoding: RFC2045 compatible encoding type: base64 [default]. As of version(0.1), base64 is the only supported encoding.

data: String in encrypted return data format as indicated in content-transfer-encoding