For the complete documentation index, see llms.txt. This page is also available as Markdown.

Industrial Blockchain

The industrial blockchain extension provides an interface to interact with a SafeUrChain blockchain node. This specialized ledger creates a secure, immutable record for tracking data across manufacturing and supply chain networks.

Use this class to manage the node lifecycle, execute transaction writes, and query the ledger. This class requires an instance for ledger operations, but provides static functions for node process management. The code class name is SafeUrChain.

Node management

Use these static functions to control the local blockchain node process.

startNode

Starts a SafeUrChain node on the local system.

Parameters

Input
Key
Description
Type

options

network

The name of the network to join. Default 'hsmw'.

string

index

A unique identification index for this node in the network. Default 0.

integer

validator

Enables participation in block validation and creation. Default true.

boolean

validators

An array of trusted validator node IDs.

array

storeTransactionsFrom

An array of node ID patterns from which to store transactions.

array

singleNode

Runs the node in standalone isolation mode. Default true.

boolean

blockTimeInMs

The target duration between block creations in milliseconds. Default 5000.

integer

Output

Returns nothing.

Examples

Start a single validator node

Configures and starts a standalone test network node.

stopNode

Stops the currently running node process.

Parameters

None.

Output

Returns nothing.

isNodeRunning

Checks whether the node process is active on the system.

Parameters

None.

Output

Returns true if the node runs, or false if it is stopped.

create

Initializes a new SafeUrChain API client instance connected to a specific node's GraphQL endpoint.

Parameters

Input
Description
Type

apiUrl

The endpoint URL of the SafeUrChain node API. Falls back to internal environment variables if omitted.

string

Output

Returns the API client instance.

Examples

Writing and reading data

Use these member functions to interact with the ledger.

write

Writes a data point as a new transaction to the blockchain. The ledger timestamps the entry and indexes it under a designated measurement string.

Parameters

Input
Description
Type

measurement

The category identifier for the recorded data.

string

data

The data payload to record. Accepts any JSON-serializable value.

any

tags

Optional key-value metadata pairs used for filtering queries.

object

Output

Returns a string containing the unique transaction hash.

Examples

Record a temperature reading

read

Queries data from the blockchain by measurement category and filters the results using metadata tags.

Parameters

Input
Key
Description
Type

measurement

The name of the measurement category to query.

string

options

tags

Key-value pairs to filter records. Matches entries containing all specified tags.

object

Output

Returns an array of data point objects sorted chronologically by date. Each object includes the value, timestamp, transaction hash, and block height.

Examples

Query machine logs

getDataPoint

Retrieves a single data point directly using its unique transaction hash.

Parameters

Input
Description
Type

transactionHash

The targeted unique transaction hash identifier.

string

Output

Returns an object containing the stored payload value, timestamp, block hash, and block height.

Blockchain inspection

Use these functions to monitor blockchain structure and health status.

getTopBlock

Retrieves the latest block added to the chain.

Parameters

None.

Output

Returns an object containing the block digest hash and header info (including height, timestamp, and previous digest hash).

getBlockAtHeight

Retrieves a specific block using its sequential block height number.

Parameters

Input
Description
Type

height

The block sequence number.

integer

Output

Returns the block object details.

getBlocks

Retrieves a sequence range of blocks.

Parameters

Input
Description
Type

from

The starting sequential block height.

integer

to

The ending sequential block height.

integer

Output

Returns an array of block objects.

getHashesInBlock

Retrieves all transaction hashes wrapped inside a specific block.

Parameters

Input
Description
Type

block

The target block digest hash string.

string

Output

Returns an array of transaction hash strings.

getTelemetry

Retrieves network health information, node connection statuses, and active peer details.

Parameters

None.

Output

Returns a network telemetry status object.

Last updated

Was this helpful?