API Reference for the Freight Trust Network REST API Gateway (1.0)

Download OpenAPI specification:Download

Smart Contract REST APIs

Webhook for async transactions

Request Body schema:
required
object

Headers section used in requests, and extended in asynchronous response messages

from
required
string ^(0x)?[0-9a-zA-Z]{40}$

The address to use when signing the transaction. Must be a wallet managed by Freight Trust Network. For example account[0] on the node.

to
string ^(0x)?[0-9a-zA-Z]{40}$

SendTransaction only: The contract address to send the transaction too.

methodName
string

SendTransaction only: The method name to invoke on the target contract.

Array of objects

The parameters to pass to the ethereum method or constructor.

soldity
string

DeployContract only: Soldity source code to compile.

contractName
string

DeployContract only: When there are multiple contracts in the compiler output, this field is required to select the contract to deploy.

compilerVersion
string
Default: "0.4"

DeployContract only: solc compiler version to use. Only the major version is used in the supplied semver, such as 0.4 or 0.5.

compiled
string <byte>

DeployContract only: Pre-compiled base64 encoded byecode - alternative to supplying Solidity code for compilation.

gas
string

The maximum gas the transaction can consume - omit to allow ethconnect to perform a gas estimation

gasPrice
string

The ETH price offered for gas - omit to use a gas price of zero

value
string

An optional ETH value to send along with the tranaction

nonce
string ^[0-9]+$

Assign an explicit nonce to the transaction - omit to allow ethconnect to manage the nonce

privateFrom
string

EEA privacy extensions privateFrom address for private transaction support (Quorum Tessera / PegaSys Orion)

privateFor
Array of strings

EEA privacy extensions privateFor addresses for private transaction support (Quorum Tessera / PegaSys Orion)

Responses

Request samples

Content type
{
  • "headers":
    {
    },
  • "from": "string",
  • "to": "string",
  • "methodName": "string",
  • "params":
    [
    ],
  • "soldity": "string",
  • "contractName": "string",
  • "compilerVersion": "0.4",
  • "compiled": "string",
  • "gas": "string",
  • "gasPrice": "string",
  • "value": "string",
  • "nonce": "string",
  • "privateFrom": "string",
  • "privateFor":
    [
    ]
}

Response samples

Content type
application/json
{
  • "id": "string",
  • "sent": true,
  • "msg": "string"
}

Fire & forget webhook

Responds as soon as the message is passed to the Kafka client library.

Request Body schema:
required
object

Headers section used in requests, and extended in asynchronous response messages

from
required
string ^(0x)?[0-9a-zA-Z]{40}$

The address to use when signing the transaction. Must be a wallet managed by Freight Trust Network. For example account[0] on the node.

to
string ^(0x)?[0-9a-zA-Z]{40}$

SendTransaction only: The contract address to send the transaction too.

methodName
string

SendTransaction only: The method name to invoke on the target contract.

Array of objects

The parameters to pass to the ethereum method or constructor.

soldity
string

DeployContract only: Soldity source code to compile.

contractName
string

DeployContract only: When there are multiple contracts in the compiler output, this field is required to select the contract to deploy.

compilerVersion
string
Default: "0.4"

DeployContract only: solc compiler version to use. Only the major version is used in the supplied semver, such as 0.4 or 0.5.

compiled
string <byte>

DeployContract only: Pre-compiled base64 encoded byecode - alternative to supplying Solidity code for compilation.

gas
string

The maximum gas the transaction can consume - omit to allow ethconnect to perform a gas estimation

gasPrice
string

The ETH price offered for gas - omit to use a gas price of zero

value
string

An optional ETH value to send along with the tranaction

nonce
string ^[0-9]+$

Assign an explicit nonce to the transaction - omit to allow ethconnect to manage the nonce

privateFrom
string

EEA privacy extensions privateFrom address for private transaction support (Quorum Tessera / PegaSys Orion)

privateFor
Array of strings

EEA privacy extensions privateFor addresses for private transaction support (Quorum Tessera / PegaSys Orion)

Responses

Request samples

Content type
{
  • "headers":
    {
    },
  • "from": "string",
  • "to": "string",
  • "methodName": "string",
  • "params":
    [
    ],
  • "soldity": "string",
  • "contractName": "string",
  • "compilerVersion": "0.4",
  • "compiled": "string",
  • "gas": "string",
  • "gasPrice": "string",
  • "value": "string",
  • "nonce": "string",
  • "privateFrom": "string",
  • "privateFor":
    [
    ]
}

Response samples

Content type
application/json
{
  • "id": "string",
  • "sent": true
}

Kafka acknowledged webhook

Waits for an acknowledgment from Kafka that the message has been delivered to a topic partition before responding.

Recommended when reliable transaction delivery is required.

Request Body schema:
required
object

Headers section used in requests, and extended in asynchronous response messages

from
required
string ^(0x)?[0-9a-zA-Z]{40}$

The address to use when signing the transaction. Must be a wallet managed by Freight Trust Network. For example account[0] on the node.

to
string ^(0x)?[0-9a-zA-Z]{40}$

SendTransaction only: The contract address to send the transaction too.

methodName
string

SendTransaction only: The method name to invoke on the target contract.

Array of objects

The parameters to pass to the ethereum method or constructor.

soldity
string

DeployContract only: Soldity source code to compile.

contractName
string

DeployContract only: When there are multiple contracts in the compiler output, this field is required to select the contract to deploy.

compilerVersion
string
Default: "0.4"

DeployContract only: solc compiler version to use. Only the major version is used in the supplied semver, such as 0.4 or 0.5.

compiled
string <byte>

DeployContract only: Pre-compiled base64 encoded byecode - alternative to supplying Solidity code for compilation.

gas
string

The maximum gas the transaction can consume - omit to allow ethconnect to perform a gas estimation

gasPrice
string

The ETH price offered for gas - omit to use a gas price of zero

value
string

An optional ETH value to send along with the tranaction

nonce
string ^[0-9]+$

Assign an explicit nonce to the transaction - omit to allow ethconnect to manage the nonce

privateFrom
string

EEA privacy extensions privateFrom address for private transaction support (Quorum Tessera / PegaSys Orion)

privateFor
Array of strings

EEA privacy extensions privateFor addresses for private transaction support (Quorum Tessera / PegaSys Orion)

Responses

Request samples

Content type
{
  • "headers":
    {
    },
  • "from": "string",
  • "to": "string",
  • "methodName": "string",
  • "params":
    [
    ],
  • "soldity": "string",
  • "contractName": "string",
  • "compilerVersion": "0.4",
  • "compiled": "string",
  • "gas": "string",
  • "gasPrice": "string",
  • "value": "string",
  • "nonce": "string",
  • "privateFrom": "string",
  • "privateFor":
    [
    ]
}

Response samples

Content type
application/json
{
  • "id": "string",
  • "sent": true,
  • "msg": "string"
}

Add new contract REST API

Request Body schema: multipart/form-data
findsolidity
string

Discovery mode: If set then the response will be an array of Solidity files found in the supplied files, rather than attempting the compilation (can also be set as a URL query parameter)

findcontracts
string

Discovery mode: If set then the response will be an array of contract names returned by solc in the compiled output, rather than attempting to install the REST API (can also be set as a URL query parameter)

source
string

If a zip/tarball is supplied containing multiple solidity files, this field is required to set the Solidity source code file to compile (can also be set as a URL query parameter). Use findsolidity to find possible values.

contract
string

If the compilation results in multipel contracts, this field is required to set the contract name to use when deploying contracts via the factory methods (can also be set as a URL query parameter). Use findcontracts to find possible values.

*
string <binary>

Any other properties should be file-content: .sol .zip .tar .tgz .tar.gz .tar.bz2 files are supported

Responses

Response samples

Content type
application/json
{
  • "created": "2019-08-24T14:15:22Z",
  • "id": "string",
  • "description": "string",
  • "path": "string",
  • "deployable": true,
  • "openapi": true,
  • "compilerVersion": true
}

List contract REST APIs

List the previously installed ABI definitions with available factory, query & event-subscription REST APIs

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Get contract REST API

List details of a single previously installed ABI definitions with a factory, query & event-subscription REST API

path Parameters
abi_id
required
string

The ID of the install ABI

Responses

Response samples

Content type
application/json
{
  • "created": "2019-08-24T14:15:22Z",
  • "id": "string",
  • "description": "string",
  • "path": "string",
  • "deployable": true,
  • "openapi": true,
  • "compilerVersion": true
}

List contract instance APIs

List the previously installed ABI definitions with available REST APIs

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Get contract instance API

List the previously installed ABI definitions with available REST APIs

path Parameters
contract_address_or_friendly_name
required
string

The ID of the install ABI

Responses

Response samples

Content type
application/json
{
  • "created": "2019-08-24T14:15:22Z",
  • "id": "string",
  • "description": "string",
  • "path": "string",
  • "deployable": true,
  • "openapi": true,
  • "compilerVersion": true
}

Event Streams

Add Event Stream

Add a new event stream, to which subscriptions can deliver messages

Responses

Response samples

Content type
application/json
{
  • "created": "2019-08-24T14:15:22Z",
  • "id": "string",
  • "path": "string",
  • "type": "webhook",
  • "suspended": true,
  • "batchSize": 1,
  • "batchTimeoutMS": 5000,
  • "retryTimeoutSec": 0,
  • "errorHandling": "block",
  • "blockedReryDelaySec": 30,
  • "webhook":
    {
    }
}

List Event Streams

Returns a list of all event streams registered on this node

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Get Event Stream

Get the details of an individual event stream

path Parameters
stream_id
required
string

The ID of the Event Stream

Responses

Response samples

Content type
application/json
{
  • "created": "2019-08-24T14:15:22Z",
  • "id": "string",
  • "path": "string",
  • "type": "webhook",
  • "suspended": true,
  • "batchSize": 1,
  • "batchTimeoutMS": 5000,
  • "retryTimeoutSec": 0,
  • "errorHandling": "block",
  • "blockedReryDelaySec": 30,
  • "webhook":
    {
    }
}

Delete Event Stream

Delete an event stream, and any registered subscriptions

path Parameters
stream_id
required
string

The ID of the Event Stream

Responses

Suspend a stream

Stops event delivery on an Event Stream, while retaining state of the events delivered so far

path Parameters
stream_id
required
string

The ID of the Event Stream

Responses

Resume a stream

Resumes delivery on an Event Stream that was previously suspended

path Parameters
stream_id
required
string

The ID of the Event Stream

Responses

List Subscriptions

Returns a list of all subscriptions registered on this node

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Get Subscription

Returns details of an individual subscription

path Parameters
subscription_id
required
string

The ID of the Subscription

Responses

Response samples

Content type
application/json
{
  • "stream": "string",
  • "fromBlock": "string",
  • "created": "2019-08-24T14:15:22Z",
  • "id": "string",
  • "path": "string",
  • "name": "string",
  • "filter": { },
  • "event": { }
}

Delete Subscription

Deletas a subscription

path Parameters
subscription_id
required
string

The ID of the Subscription

Responses