Registry / blockchain / blockapps-rest

blockapps-rest

JSON →
library8.4.0jsnpmunverified

BlockApps-Rest is a Node.js server-side SDK (v8.4.0) for interacting with BlockApps STRATO blockchain platform. It provides abstractions for creating and managing keys, transactions, private chains, querying contract state, and OAuth integration. The library requires a configuration file and a third-party OAuth provider. It is maintained by BlockApps and mirrors their internal development repository. Key differentiators: purpose-built for STRATO, includes utilities for contract lifecycle, and enforces OAuth-based authentication.

npm install blockapps-rest
INSTALL
IMPORT
SIG · BLOCKAPPS-REST
B
blockapps-rest
blockchainjavascriptv8.4.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

rest
import { rest } from 'blockapps-rest'
const { rest } = require('blockapps-rest')
ESM import path - library ships CommonJS but supports ESM syntax in Node >=10.1.0
fsUtil
import { fsUtil } from 'blockapps-rest'
import fsUtil from 'blockapps-rest'
Named export, not default
util
import { util } from 'blockapps-rest'
Named export for utility functions
assert
import { assert } from 'blockapps-rest'
const assert = require('assert')
Custom assert, not Node built-in; must import from library

Creates a user from OAuth token, deploys a simple contract, queries state, and calls a contract method.

import { rest, fsUtil, util, assert } from 'blockapps-rest'; import { config } from './config'; const options = { config, logger: console }; const user = await rest.createUser({ token: process.env.USER_TOKEN ?? '' }, options); const contractArgs = { name: 'TestContract', source: 'contract TestContract { uint a; constructor(uint _a) { a = _a; } function add(uint b) returns(uint) { return a+b; }', args: { _a: 10 } }; const contract = await rest.createContract(user, contractArgs, options); assert.equal(contract.name, contractArgs.name, 'name'); assert.isOk(util.isAddress(contract.address), 'address'); const state = await rest.getState(user, contract, options); assert.equal(state.a, contractArgs.args._a); const callArgs = { contract, method: 'add', args: { b: 10 } }; const [result] = await rest.call(user, callArgs, options); assert.equal(result, contractArgs.args._a + callArgs.args.b);
Debug
Known issues
gotchaRequires OAuth server – blockapps-rest cannot be used without a third-party OAuth instance.
fix
Set up an OAuth provider and configure clientId, clientSecret, openIdDiscoveryUrl in config.yaml.
affects: *
gotchaConfiguration file must be exact YAML with strict syntax – do not change node order, nodes[0] is the default URL for single-node calls.
fix
Use the exact template and only replace placeholder values.
affects: *
gotchaDeprecated Node.js version requirement: engines.node >=10.1.0 – newer STRATO features may require updating.
fix
Use Node.js 14+ for security and performance, though library may still work on 10.1.
affects: >=8.0.0
deprecatedfsUtil.getYaml reads config.yaml from root – this hardcodes file path and may be replaced in future versions.
fix
Explicitly pass config object instead of relying on file auto-discovery.
affects: >=7.0.0
Errors
Common errors & fixes
TypeError: Cannot read property 'rest' of undefined
Missing or incomplete import – usually `import { rest } from 'blockapps-rest'` returns undefined.
fix
Ensure blockapps-rest is installed and import is correct: `import { rest } from 'blockapps-rest';`
Error: Config file not found
fsUtil.getYaml('config.yaml') fails if config.yaml is missing or not in current working directory.
fix
Place config.yaml in project root or provide full path: `fsUtil.getYaml(path.join(__dirname, 'config.yaml'))`
AssertionError: 'name' expected 'TestContract' got undefined
Contract creation may have failed due to nonce mismatch or insufficient funds.
fix
Check OAuth token validity, ensure user has sufficient balance (faucet), and increase timeout if transaction not finalized.
Upgrade
Version history
8.4.0latest on npm
Audit
Dependencies
blockapps-restrequiredself-referential but required for usage
Agent activity
31 hits · last 30 days
node
26
OpenAI (training)
1
Resources
blockapps-rest — npm install blockapps-rest · libregistry