Skip to content

API Basics

BlockApps STRATO blockchain platform exposes various services via REST API endpoints, which can be easily consumed and integrated into existing products and services.

This section will serve as a brief introduction to the concepts surrounding the STRATO API, and the basic ways to use it.

Assumptions

This article assumes a basic understanding of the STRATO platform and blockchain concepts such as:

  • Identity Management/OAuth
  • STRATO Accounts
  • Smart Contracts
  • EVM vs. SolidVM
  • Main Chain vs. Private Chains

Authorization

To make calls to the STRATO API, a call needs to be authorized with a valid JWT access token. An access token is received from the OAuth identity provider specified at STRATO Boot time. See the User Identity section for more information about how to obtain a valid access token.

All requests must contain the access token in the standard 'Authorization: Bearer' header format:

"Authorization: Bearer <token>"

Endpoint Routes

The STRATO API routes are prefixed by their functionality. All endpoints take the form of

https://<strato_address>/<prefix>/...
Below is a brief explanation of each endpoint prefix and what they are used for.

STRATO

https://<strato_address>/strato/
Contains most of the functionality with interacting with the STRATO platform, like making transactions, or getting user addresses. All calls to this endpoint (with the exception of /transaction/raw) use the STRATO key vault for authentication and key signatures.

Bloc

https://<strato_address>/bloc/
Used for calls that pertain to blockchain info, such as fetching contract state, function parameters, transaction results, etc.

STRATO API

https://<strato_address>/strato-api/
Calls that relate to low-level blockchain data, such as raw, signed transactions, account state, storage, block-data, etc. This endpoint is not widely used in favor of higher-level APIs like /strato or /bloc.

Cirrus

https://<strato_address>/cirrus/
Used to retrieve contract state from indexed blockchain data. Calls querying information about a contract will query over all the instances of that contract. This endpoint exposes PostgREST for querying data, so see the PostgREST v9.0 Documentation for the full explanation of querying cirrus.

Apex API

https://<strato_address>/apex-api
Used to monitor system related metrics, such as node health, and external storage functionality.

Account Management

Create an Account

This endpoint will generate a public-private key pair in the STRATO key vault for the user associated with the access token provided in the Authorization header. If an account already exists in association with this access token, see the instructions for Getting an Account Address. This endpoint creates an account address associated with the user's key pair so that the user with this access token now has the provided blockchain account address. If gas is on in your network, the account will not be immediately useable. To initialize an account with tokens, use the Faucet Account Endpoint.

Endpoint

POST https://<strato_address>/strato/v2.3/key
Example

curl -X POST \
  -H "Authorization: Bearer <token>" \
  -H "Accept: application/json" \
  "https://<strato_address>/strato/v2.3/key"

Response

The address and public key of the STRATO account that is associated with the provided user access token.

{
  "address": "ad7e55be36a413416abe3bce416abe",
  "pubkey": "b3df6d4553d40874af617e2523b53e5280bb3dac01504c8fc9ac50ce6c7e16c99cfdcd6b18505dfef7ce0ccb164d1c1f046ecbb8d85a245e7abfc70",
  "status": "success"
}

If a STRATO account has already been created with the user key associated with this access token, then the API will respond with "User <username> already exists"

The BlockApps Rest createUser method will create a STRATO account associated with this OAuth user. If the user already exists, the method will fetch the address of this OAuth user.

const user = await rest.createUser({ token : OAUTH_TOKEN }, options)

Response

An object with the user's address and OAuth access token.

{
  address: "ad7e55be36a413416abe3bce416abe"
  token: "abc..."
}

Getting an Account Address

This endpoint will fetch the address of the account of the user associated with the access token provided.

Endpoint

GET https://<strato_address>/strato/v2.3/key
Example

curl -X GET \
  -H "Authorization: Bearer <token>" \
  -H "Accept: application/json" \
  "https://<strato_address>/strato/v2.3/key"

The BlockApps Rest createUser method will fetch the address and of the STRATO account associated with this OAuth user. If the user does not exist, the method create a new STRATO account for this OAuth user.

const user = await rest.createUser({ token : OAUTH_TOKEN }, options)

Response

The address and public-key of the STRATO account:

An object with the user's address, public-key, and OAuth access token.

{
  address: "ad7e55be36a413416abe3bce416abe",
  token: "abc...",
  pubkey: "6dd79a1f64..."
}

Faucet (Add Value to) an Account

Every transaction performed on the blockchain has some computational cost to it (how much gas it takes), and STRATO uses tokens to control how much gas a user can use. A user has a balance of tokens that are spent on computation gas to perform operations. These tokens serve no monetary value in most STRATO networks and are not a form of cryptocurrency. They exist to guard against possible DoS attacks, such as code that executes indefinitely. For a more in-depth explanation of Gas in a blockchain network see the Official Ethereum Documentation on Gas.

By default the usage of these tokens (gas) in a network is disabled.

The /fill endpoint adds 2000 tokens to this blockchain account address. This function will not do anything if gas is disabled, and therefore does not need to be called.

Endpoint

POST https://<strato_address>/bloc/v2.2/users/user/<account_address>/fill

Example

curl -X POST \
  -H "Authorization: Bearer <token>" \
  -H "Accept: application/json" \
  "https://<strato_address>/bloc/v2.2/users/user/<account_address>/fill?resolve=true"

Response

This will return the status, hash, and other information for the account faucet that has just occurred.

{
  "status": "Success",
  "hash": "41b1a0649752af1b28b3dc29a1556eee781e4a4c3a1f7f53f90fa834de098c4d"
}

Note that if Gas is disabled, this endpoint will respond with a 200 status code and the following response body:

{
  "status": "Success",
  "hash": "0000000000000000000000000000000000000000000000000000000000000000",
  "txResult": null,
  "data": null
}

The BlockApps Rest createUser method will create and faucet a new STRATO account associated with this OAuth user. If the user already exists, the method will just fetch the address of this OAuth user.

Note that if Gas is disabled, the method's faucet will not add tokens to the account.

const user = await rest.createUser({ token : OAUTH_TOKEN }, options)

Response

An object with the user's address, public-key, and OAuth access token.

{
  address: "ad7e55be36a413416abe3bce416abe",
  pubkey: "abc..."
  token: "6dd79a1f64..."
}

Transactions

The transaction endpoint is used to perform three very common operations on the STRATO platform. These include Smart Contract Creation, Function Calls of a Smart Contract, and Balance Transfers of tokens between accounts (irrelevant if gas is disabled). We demonstrate here how to use this endpoint to accomplish contract creation and function calls.

Each transaction being sent is its own object in the request body array. A transaction has a payload, which contains key information like the name of the contract, arguments for the transaction, and possible contract source code. The metadata field specifies information like contract history and the VM to use. The type property is used to specify the type of transaction being done, such as a contract upload ("CONTRACT"), or a function call ("FUNCTION"). The txParams property contains guidelines for STRATO to run this transaction.

The chainid property of a transaction payload specifies the chain ID of the contract that this function belongs to. Transactions on the Main Chain do not need to have the chain ID specified. Transactions that are on a private chain must have the contract address in the form '\:\'. Contracts on the main chain do not have to have the chain ID specified.

STRATO also offers the ability to handle transactions signed directly by the user, rather than signing the transaction with the user's key in STRATO's Key Vault. This is a complex topic and is reserved for a separate Offline Transactions article.

For the following examples of transaction API calls, we will use the following contract source code:

contract SimpleStorage {
  uint storedData;
  constructor(uint _storedData) {
    storedData = _storedData;
  }
  function set(uint x) {
    storedData = x;
  }

  function get() returns (uint) {
    return storedData;
  }
}

The response from the transactions endpoint is an array of result objects for each transaction that was sent. Each result has the following fields:

  • success, whether or not the API call was successful or not.
  • hash, the transaction hash.
  • txResult, an object containing useful transaction data, such as VM kind, chain ID of transaction, block hash, and gasUsed.
  • data, an object containing a tag for the type of transaction, and contents, for the information relevant to the type of transaction, like a contract address, function returned values, etc.

See Transaction Results for more details on the shape of the returned data from a transaction.

Resolve Option

The transaction and faucet endpoints accept a query parameter of resolve which can be set true or false. By default this value is false. Setting resolve to true will make the API not return a response until the sent operation has completed or been terminated. If an operation does not resolve within 60 seconds, the API will respond with an error status. If resolve is false, then the API will send the transaction(s) to STRATO for completion, however it will return a response immediately back to the user with a status of "Pending", and the transaction hash.txResult and data will both be null.

Tip

Transactions sent with resolve=false must be resolved before a transaction with resolve=true is sent to the API, otherwise it will be discarded. Always ensure a transaction has been completed using the transaction results endpoint.

Create a New Contract

In the example below we use 'contract-src' to refer to solidity code that is this contract to be uploaded. The args are the values needed for the constructor of this contract.

For a contract upload, the type parameter must be set to "CONTRACT".

Endpoint

POST https://<strato_address>/strato/v2.3/transaction?resolve=true

Example

curl -X POST \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -d '{
    "txs": [
        {
          "payload": {
            "contract": "SimpleStorage",
            "src": "<contract-src>",
            "args": {
              "_storedData": 3
            }
          },
          "type": "CONTRACT"
        }
    ],
    "txParams": {
      "gasLimit": 32100000000,
      "gasPrice": 1
    }
  }' \
  "https://<strato_address>/strato/v2.3/transaction?resolve=true"

Response

An array of results of each transaction sent in the request body.

The data in the contents field contains many useful data points such as contract address, and codeHash.

[
  { 
    "status": "success",
    "hash": "936f9ea1f29edd4f71af8004c115c90687b9dedc4b99c3e653c6a06f7341e6c1",
    "txResult": {...},
    "data": {
      "tag": "Upload",
      "contents": {
        ...,
        "address": "90f0a711cd0ab921bbc9b54c4a6bdb3219e590f9",
      }
    }
  }
]

The transaction hash and status of the pending transactions.

[
  {
    "status": "Pending",
    "hash": "c93ad8273db797e15e473fd40e058195ef7f3de5507dfc8adc88ca00f4ebd70b",
    "txResult": null,
    "data": null
  }
]
// create contract payload
const contracts = [
  {
    name: "SimpleStorage",
    source: contractSrc,
    args: {
      _storedData: 3,
    },
  }
]

const callOptions = {
  ...options,
  config: {
    ...options.config,
    isAsync: true
  }
}

const transactionResults = await rest.createContractList(user, contracts, callOptions)

Response

A list of each contract's upload info.

[
  {
    bin: "bin removed.",
    chainId: null,
    address: "90f0a711cd0ab921bbc9b54c4a6bdb3219e590f9",
    'bin-runtime': "bin-runtime removed.",
    codeHash: {
      kind: "EVM",
      digest: "e96a25b0aa2a8b185b7f833e5b1b1cd4f06d3f740091633dd59bfea7b283f7c8"
    },
    name: "SimpleStorage",
    src: "source removed.",
    xabi: "xabi removed."
  }
]

Call a Function

The transaction endpoint allows functions within contracts to be called. In the example below args are the arguments given to this function contract.

To call a function on a private chain, specify the chain ID in the query parameter chainid or in the transaction payload property chainid.

For function calls, the type parameter must be set to "FUNCTION".

Endpoint

POST https://<strato_address>/strato/v2.3/transaction?resolve=true

Example

curl -X POST \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -d '{
    "txs": [
      {
        "payload": {
          "contractName": "SimpleStorage",
          "contractAddress": "90f0a711cd0ab921bbc9b54c4a6bdb3219e590f9",
          "method": "set",
          "args": {
            "x": 5
          }
        },
        "type": "FUNCTION"
      }
    ],
    "txParams": {
      "gasLimit": 32100000000,
      "gasPrice": 1
    }
  }' \
  "https://<strato_address>/strato/v2.3/transaction?resolve=true"

Response

The data returned in the contents field contains nothing because the function called did not return any values. If the function called had returned some data, it would be contained there.

[
  { 
    "status": "Success",
    "hash": "936f9ea1f29edd4f71af8004c115c90687b9dedc4b99c3e653c6a06f7341e6c1",
    "txResult": {...},
    "data": {
      "tag": "Call",
      "contents": []
    }
  }
]
const calls = [
  {
    contract: {
      name: "SimpleStorage",
      address: contractAddress,
    },
    method: "set",
    args: {
      x: 5
    }
  }
]

const callOptions = {
  ...options,
  config: {
    ...options.config,
    isAsync: true
  }
}

const callResults = await rest.callList(user, calls, callOptions)

Response

An array of each function call's return value(s). (Note in this example, the set function does not return any values, so the response is only the removed data fields.)

[
  [
    src: 'source removed.',
    bin: 'bin removed.',
    'bin-runtime': 'bin-runtime removed.',
    xabi: 'xabi removed.'
  ]
]

Using SolidVM for Transactions

In order to use BlockApps' SolidVM, simply specify the VM in a transaction payload's metadata to 'SolidVM'. Valid VM types are 'EVM', and 'SolidVM'.

Example

Create a new contract with SolidVM.

curl -X POST \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -d '{
    "txs": [
        {
          "payload": {
            "contract": "SimpleStorage",
            "src": "<contract-src>",
            "args": {
              "_storedData": 3
            },
            "metadata": {
              "VM": "SolidVM"
            }
          },
          "type": "CONTRACT"
        }
      ],
      "txParams": {
        "gasLimit": 32100000000,
        "gasPrice": 1
      }
    }' \
  "https://<strato_address>/strato/v2.3/transaction?resolve=true"
const contracts = [
  {
    name: "SimpleStorage",
    source: contractSrc,
    args: {
      _storedData: 3,
    },
  }
]

const callOptions = {
  ...options,
  config: {
    ...options.config,
    isAsync: true,
    VM: "SolidVM",
  }
}

const callResults = await rest.createContractList(user, contracts, callOptions)

Response

The returned data will be in the same shape as a normal contract upload.

Enable a Contract's Audit Trail/History

A contract's data can change overtime. STRATO can capture this history by enabling the Audit Trail for a contract. For more information about contract Audit History, see the Contract Audit History page.

The Audit Trail/Contract History is enabled through the history property within the metadata property of an API call when uploading a contract. By default, the audit trail of a contract is disabled, so no contract history will be recorded.

Example

curl -X POST \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -d '{
    "txs": [
      {
        "payload": {
          "contract": "SimpleStorage",
          "src": "<contract-src>",
          "args": {
            "_storedData": 10
          },
          "metadata": {
            "history": "SimpleStorage"
          }
        },
        "type": "CONTRACT"
      }
    ],
    "txParams": {
      "gasLimit": 32100000000,
      "gasPrice": 1
    }
  }' \
  "https://<strato_address>/strato/v2.3/transaction?resolve=true"
const contracts = [
  {
    name: "SimpleStorage",
    source: contractSrc,
    args: {
      _storedData: 10,
    },
  }
]

const callOptions = {
    ...options,
    history: "SimpleStorage",
    config: {
      ...options.config,
      isAsync: true,
  }
}

const callResults = await rest.createContractList(user, contracts, callOptions)

Response

The returned data will be in the same shape as a normal contract upload.

Getting a Transaction's Results

You may access any transaction's results using its hash.

Endpoint

Get a single transaction's results:

GET https://<strato_address>/bloc/v2.2/transactions/<tx-hash>/result

Get multiple transactions' results:

POST https://<strato_address>/bloc/v2.2/transactions/results

When accessing multiple transactions' results, provide an array with each requested transactions' hash as elements in the request body.

Example

curl -X GET \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  "https://<strato_address>/bloc/v2.2/transactions/936f9ea1f29edd4f71af8004c115c90687b9dedc4b99c3e653c6a06f7341e6c1/result"
const transaction = {
  hash: txHash
}

const txResult = await rest.resolveResult(user, transaction, options)

Response

The information of the requested transaction.

{
  "status": "Success",
  "hash": "3edacd3a2a12d1357f836a5e14f7e4294869ce45035eec9b8be5f4c761679188",
  "txResult": {
    "deletedStorage": "",
    "status": "success",
    "contractsDeleted": "",
    "gasUsed": "0000000000000000000000000000000000000000000000000000000000019381",
    "stateDiff": "",
    "time": 0.0006703,
    "kind": "EVM",
    "chainId": null,
    "response": "<response>",
    "blockHash": "3a0f1ed3834733a32aafbe948fabbe22db242278dec4efe872c8196a1ccec218",
    "transactionHash": "3edacd3a2a12d1357f836a5e14f7e4294869ce45035eec9b8be5f4c761679188",
    "etherUsed": "0000000000000000000000000000000000000000000000000000000000019381",
    "newStorage": "",
    "message": "Success!",
    "trace": "",
    "contractsCreated": "eca3e4bb4de0e1fbfae17b45fa3dfce5ba9f8784,0000000000000000000000000000000000000000,ea245c8e259dcf724dd4852da6b288f6b0452db6"
  },
  "data": {
    "tag": "Upload",
    "contents": {
      "bin": "<binary>",
      "chainId": null,
      "address": "eca3e4bb4de0e1fbfae17b45fa3dfce5ba9f8784",
      "bin-runtime": "<binary-runtime>",
      "codeHash": {
        "kind": "EVM",
        "digest": "33e5b1b1cd4f06d3f7400916e96a25b0aa2a8b185b7f833dd59bfea7b283f7c8"
      },
      "name": "SimpleStorage",
      "src": "<contract-src>",
      "xabi": {
        // ...compiler information for contract functions, variables, modifiers, etc.
      }
    }
  }
}
{
  "status": "Success",
  "hash": "936f9ea1f29edd4f71af8004c115c90687b9dedc4b99c3e653c6a06f7341e6c1",
  "txResult": {
    "deletedStorage": "",
    "status": "success",
    "contractsDeleted": "",
    "gasUsed": "000000000000000000000000000000000000000000000000000000000000682d",
    "stateDiff": "",
    "time": 0.0006397,
    "kind": "EVM",
    "chainId": null,
    "response": "",
    "blockHash": "2724b0519d2fec120eca6c74504d1ebd3c7d98a4f90e0667f7b67652ba837edc",
    "transactionHash": "936f9ea1f29edd4f71af8004c115c90687b9dedc4b99c3e653c6a06f7341e6c1",
    "etherUsed": "000000000000000000000000000000000000000000000000000000000000682d",
    "newStorage": "",
    "message": "Success!",
    "trace": "",
    "contractsCreated": ""
  },
  "data": {
    "tag": "Call",
    "contents": [
      // each element is a returned value from the function
    ]
  } 
}

Using Cirrus

Query Cirrus

You may access any number of a given contract's instances via the Cirrus search endpoint. This provides data like contract address, chain ID, instance variables, block timestamp, etc.

Cirrus is queriable through the PostgREST API. This allows for SQL-like queries to be made right from the API parameters without exposing raw query strings on the data tables. For complete documentation on using the Cirrus API with PostgREST, visit the Cirrus Documentation.

Endpoint

GET https://<strato_address>/cirrus/search/<contract-name>

Example

This query filters the results of the SimpleStorage contracts which have storedData less than or equal to 10, limits the returned array to only two elements, and only selects the chain ID, address, block_number, and the storedData variable that is in the SimpleStorage contract.

curl -X GET \
  -H "Authorization: Bearer <token>" \
  -H "Accept: application/json" \
  "https://<strato_address>/cirrus/search/SimpleStorage?storedData=lte.10&limit=2&select=chainId,address,block_number,storedData"
const query = {
  storedData: 'lte.10',
  limit: 2,
  select: 'chainId,address,block_number,storedData'
}

const searchOptions = {
  ...options,
  query
}

const contract = {
  name: "SimpleStorage"
}

const results = await rest.search(user, contract, searchOptions)

Response

An array of each contract instance matching the PostgREST query given in the request's query parameters.

[
  {
    "chainId": "",
    "address": "90f0a711cd0ab921bbc9b54c4a6bdb3219e590f9",
    "storedData": 5,
    "block_number": 6
  },
  {
    "chainId": "",
    "address": "171077556038f63f7debba796d96886abce0d4e1",
    "storedData": 3,
    "block_number": 7
  }
]

Accessing Contract Audit Trail/History

You can query for the history of any contract with history enabled by specifying querying cirrus with [email protected]<contract-name> as the contract name. Call this endpoint just as you would a normal contract's Cirrus endpoint

Endpoint

GET https://<strato_address>/cirrus/search/[email protected]<contract-name>

Example

curl -X GET \
  -H "Authorization: Bearer <token>" \
  -H "Accept: application/json" \
  "https://<strato_address>/cirrus/search/[email protected]?address=eq.803af30af892a9d84aa2231077779e143ea80fb0&order=block_timestamp.asc"
const query = {
  address: `eq.${contractAddress}`,
  order: 'block_timestamp.asc'
}

const searchOptions = {
  ...options,
  query
}

const contract = {
  name: "[email protected]"
}

const results = await rest.search(user, contract, searchOptions)

Response

This call will return an array of a contract's historical data if it exists (history enabled for the contract). Below is an example of the history of the SimpleStorage contract if the storedData had been initalized to 10, and then the set function was called to set the value of storedData to 20.

[
  {
    "address": "803af30af892a9d84aa2231077779e143ea80fb0",
    "chainId": "",
    "block_hash": "5b336c2537afda79291581ff4f8d89138ec653c0d137192e6b2e931a0c890da1",
    "block_timestamp": "2021-09-28 15:19:17 UTC",
    "block_number": "6",
    "transaction_hash": "2f3fd0cefd452a1dbf539ff443a93b3f098a6485b33dbc83e3642b982663f1bf",
    "transaction_sender": "f6fedad2c09578a52100835c27de7927d73e6f2c",
    "transaction_function_name": "",
    "storedData": 10
  },
  {
    "address": "803af30af892a9d84aa2231077779e143ea80fb0",
    "chainId": "",
    "block_hash": "3b370b4061dc7643204123eb112f416507ad322cec015cf82f7434a6062e2ece",
    "block_timestamp": "2021-09-28 15:20:17 UTC",
    "block_number": "7",
    "transaction_hash": "1f2b255f01e0f80ed95c028a55adb29f7603916638f3b3aaf810d4e47237fc62",
    "transaction_sender": "f6fedad2c09578a52100835c27de7927d73e6f2c",
    "transaction_function_name": "",
    "storedData": 20
  }
]

Private Chains

Create a Private Chain

Private chains are a highlight feature of the STRATO platform allowing you to perform all blockchain operations in a private environment only visible to the explicit members of the private chain. For more information about Private Chains, their benefits, and how to best use them, see the Private Chains Feature Page. Create a new private chain with a provided governance contract and parent chain.

Endpoint

POST https://<strato_address>/bloc/v2.2/chain
Example

Here we create a new private chain as a 'child' of the Main chain. It's governance contract as shown in the Governance Section. Note because that contract does not take any constructor arguments, the args property is empty. For each user that should be a member of this chain, we add their address and enode information to the members array. The balances array is used when gas is enabled. When creating a chain as a child of a non-Main chain, the chain ID must be specified in the parentChain property of the request body.

curl -X POST \
  -H "Authorization: Bearer <token>" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
      "args": {},
      "members": 
        [
          {
            "address": <member_1_user_address>,
            "enode": <member_1_enode_address>
          },
          {
            "address": <member_2_user_address>,
            "enode" <member_2_enode_address>
          }
        ],
      "balances":
        [
          {
            "address": <member_1_user_address>
            "balance": <member_1_balance>,
          },
          {
            "address": <member_2_user_address>
            "balance": <member_2_balance>,
          }
        ],
      "contract": "Governance",
      "src": <governance-src>,
      "label": "MyPrivateChain"
    }' \
"https://<strato_address>/bloc/v2.2/chain"
const chainInfo = {
  label: "MyPrivateChain",
  src: governanceSrc,
  args: {},
  members: [
    {
      address: memberAddress,
      enode: memberEnode
    }
  ],
  balances: [
    {
      address: memberAddress,
      balance: memberBalance
    }
  ],
}

const contractInfo = {
  name: "Governance"
}

const chainId = await rest.createChain(user, chainInfo, contractInfo, options)

Response

The chainId of the newly created chain:

"4574c8c75d6e88acd28f7e467dac97b5C60c3838d9dad993900bdf402152228e"

Access Chain Information

Get information about a specific chain or a number of chains. The query parameter chainid allows users to specify one or more chain IDs to get information about. If no chain IDs are provided, information about every chain this user has access to will be returned.

Endpoint

GET https://<strato_address>/strato-api/eth/v1.2/chain"
Example

curl -X GET \
  -H "Accept: application/json" \
  -H "Authorization: Bearer <token>" \
  "https://<strato_address>/strato-api/eth/v1.2/chain?chainid=4574c8c75d6e88acd28f7e467dac97b5C60c3838d9dad993900bdf402152228e"

Response

[
  {

    "id": "4574c8c75d6e88acd28f7e467dac97b5C60c3838d9dad993900bdf402152228e",
    "info": {
      ...,
      "label": "MyPrivateChain",
      "members": [...],
      "accountInfo": [...],
      "nonce": "123...",
      "codeInfo": [...],
      "parentChain": null
    }
  }
]
const chainInfo = await rest.getChain(stratoUser, chainId, options)

Response

Information for the specified chain.

{
  id: "4574c8c75d6e88acd28f7e467dac97b5C60c3838d9dad993900bdf402152228e",
  info: {
    label: "MyPrivateChain",
    balances: [...],
    members: [...],
  }
}

More

For a full detailed reference of API endpoints, see the API Reference Guide section of this documentation.