{"id":47177,"library":"blockapps-rest","title":"BlockApps-Rest SDK","description":"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.","status":"active","version":"8.4.0","language":"javascript","source_language":"en","source_url":null,"tags":["javascript","BlockApps","STRATO","rest","api"],"install":[{"cmd":"npm install blockapps-rest","lang":"bash","label":"npm"},{"cmd":"yarn add blockapps-rest","lang":"bash","label":"yarn"},{"cmd":"pnpm add blockapps-rest","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"self-referential but required for usage","package":"blockapps-rest","optional":false}],"imports":[{"note":"ESM import path - library ships CommonJS but supports ESM syntax in Node >=10.1.0","wrong":"const { rest } = require('blockapps-rest')","symbol":"rest","correct":"import { rest } from 'blockapps-rest'"},{"note":"Named export, not default","wrong":"import fsUtil from 'blockapps-rest'","symbol":"fsUtil","correct":"import { fsUtil } from 'blockapps-rest'"},{"note":"Named export for utility functions","symbol":"util","correct":"import { util } from 'blockapps-rest'"},{"note":"Custom assert, not Node built-in; must import from library","wrong":"const assert = require('assert')","symbol":"assert","correct":"import { assert } from 'blockapps-rest'"}],"quickstart":{"code":"import { rest, fsUtil, util, assert } from 'blockapps-rest';\nimport { config } from './config';\n\nconst options = { config, logger: console };\nconst user = await rest.createUser({ token: process.env.USER_TOKEN ?? '' }, options);\n\nconst contractArgs = {\n  name: 'TestContract',\n  source: 'contract TestContract { uint a; constructor(uint _a) { a = _a; } function add(uint b) returns(uint) { return a+b; }',\n  args: { _a: 10 }\n};\nconst contract = await rest.createContract(user, contractArgs, options);\nassert.equal(contract.name, contractArgs.name, 'name');\nassert.isOk(util.isAddress(contract.address), 'address');\n\nconst state = await rest.getState(user, contract, options);\nassert.equal(state.a, contractArgs.args._a);\n\nconst callArgs = { contract, method: 'add', args: { b: 10 } };\nconst [result] = await rest.call(user, callArgs, options);\nassert.equal(result, contractArgs.args._a + callArgs.args.b);","lang":"javascript","description":"Creates a user from OAuth token, deploys a simple contract, queries state, and calls a contract method."},"warnings":[{"fix":"Set up an OAuth provider and configure clientId, clientSecret, openIdDiscoveryUrl in config.yaml.","message":"Requires OAuth server – blockapps-rest cannot be used without a third-party OAuth instance.","severity":"gotcha","affected_versions":"*"},{"fix":"Use the exact template and only replace placeholder values.","message":"Configuration file must be exact YAML with strict syntax – do not change node order, nodes[0] is the default URL for single-node calls.","severity":"gotcha","affected_versions":"*"},{"fix":"Use Node.js 14+ for security and performance, though library may still work on 10.1.","message":"Deprecated Node.js version requirement: engines.node >=10.1.0 – newer STRATO features may require updating.","severity":"gotcha","affected_versions":">=8.0.0"},{"fix":"Explicitly pass config object instead of relying on file auto-discovery.","message":"fsUtil.getYaml reads config.yaml from root – this hardcodes file path and may be replaced in future versions.","severity":"deprecated","affected_versions":">=7.0.0"}],"env_vars":null,"search_vec":"'abstract':25 'api':86 'authent':81 'base':80 'blockapp':2,6,19,57,83 'blockapps-rest':1,5 'blockchain':21 'built':68 'chain':33 'configur':44 'contract':35,74 'creat':27 'develop':62 'differenti':65 'enforc':77 'file':45 'includ':71 'integr':39 'interact':17 'intern':61 'javascript':82 'key':30,64 'librari':41 'lifecycl':75 'maintain':55 'manag':29 'mirror':59 'node.js':10 'oauth':38,51,79 'oauth-bas':78 'parti':50 'platform':22 'privat':32 'provid':24,52 'purpos':67 'purpose-built':66 'queri':34 'repositori':63 'requir':42 'rest':3,7,85 'sdk':4,14 'server':12 'server-sid':11 'side':13 'state':36 'strato':20,70,84 'third':49 'third-parti':48 'transact':31 'util':72 'v8.4.0':15","created_at":"2026-06-07T16:50:11.871835+00:00","updated_at":"2026-06-07T16:50:11.871835+00:00","problems":[{"fix":"Ensure blockapps-rest is installed and import is correct: `import { rest } from 'blockapps-rest';`","cause":"Missing or incomplete import – usually `import { rest } from 'blockapps-rest'` returns undefined.","error":"TypeError: Cannot read property 'rest' of undefined"},{"fix":"Place config.yaml in project root or provide full path: `fsUtil.getYaml(path.join(__dirname, 'config.yaml'))`","cause":"fsUtil.getYaml('config.yaml') fails if config.yaml is missing or not in current working directory.","error":"Error: Config file not found"},{"fix":"Check OAuth token validity, ensure user has sufficient balance (faucet), and increase timeout if transaction not finalized.","cause":"Contract creation may have failed due to nonce mismatch or insufficient funds.","error":"AssertionError: 'name' expected 'TestContract' got undefined"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":null,"github":null,"docs":null,"changelog":null,"pypi":null,"npm":"blockapps-rest","openapi_spec":null,"status_page":null,"smithery":null,"categories":["blockchain"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}