Node specification
Esta página aún no está disponible en tu idioma.
Bellchain has exactly one specification for nodes. The official nodes are built exactly like the community nodes in the public repository bellchain-app/nodes. Once you understand how the RSI works, you can write your own node. The packages are @bellchain-app/node-spec (types, defineNode(), time series, chain format) and @bellchain-app/nodes (the official nodes), both MIT licensed.
A node at a glance
Section titled “A node at a glance”import { defineNode, l, series } from '@bellchain-app/node-spec';
export default defineNode({ id: 'community.hull-ma', version: '1.0.0', category: 'ind', label: l('Hull Moving Average', 'Hull Moving Average'), description: l('Schneller Durchschnitt mit wenig Verzögerung', 'Fast average with little lag'), inputs: [{ id: 'in', type: 'series', label: l('Wert', 'Value') }], outputs: [{ id: 'out', type: 'series', label: l('HMA', 'HMA'), unit: 'input' }], settings: { length: { type: 'number', label: l('Kerzen', 'Candles'), help: l('Über wie viele Kerzen der Durchschnitt rechnet.', 'How many candles the average covers.'), default: 21, min: 2, max: 500, integer: true, }, }, // How the node reads on the board sentence: ({ settings }) => `HMA ${settings.length}`, // Candles needed before the first reliable value warmup: ({ settings }) => settings.length + Math.floor(Math.sqrt(settings.length)), // Pure: no network, no storage, no clock compute({ inputs, settings }) { return { out: series.hma(inputs.in, settings.length) }; }, // Required: known values every version is tested against tests: [{ fixture: 'binance-btcusdt-1h-500', settings: { length: 21 }, expectLast: { out: 81372.42333679654 } }],});defineNode() checks the definition right away and reports all problems at once. TypeScript derives the types of compute() from pins and settings: settings.length is a number, inputs.in a number series.
Id, version, category
Section titled “Id, version, category”idwith a namespace:core.rsi,community.hull-ma.corebelongs to the official nodes.versionas a semantic version. If the result changes, the major version goes up; chains can pin it withcore.rsi@1.category:srcsources,indindicators,condconditions,logiclogic & timing,datadata & text,actactions,tooltools.
Every visible text exists in German and English, built with l('Kurs', 'Price'): name, description, help, every pin, every setting, every option. If a language is missing, defineNode() rejects the definition.
descriptionis one line for the node panel: what the node does, in plain words.metaphoris an optional everyday picture in one or two sentences, so beginners grasp what the node is, such as “Like a rev counter: the RSI shows whether the price is overrevving.” It opens the docs page and sits above the help in the “Properties” panel.helpexplains in the “Properties” panel and in the docs what it measures or checks and what for, with an example.technicalis an optional sentence for advanced users, such as the formula. It only appears under “Technical details”.
| Type | Content | In the editor |
|---|---|---|
series |
number series, one value per candle; null means “no value yet”, for example during the warm-up |
round |
signal |
true or false per candle | square |
text |
message with placeholders, only from the message template to an action | diamond |
Inputs can be optional: true or grow: variadic: { min, max } creates the pins in0, in1 … Outputs can carry a unit: price appears as a price, percent with a percent sign, input like the input.
Settings
Section titled “Settings”| Kind | Fields |
|---|---|
number |
default, min, max, step, integer, unit, input |
select |
default, options: [{ value, label, help }] |
text |
default, minLength, maxLength, pattern, format (timezone or url), required, secret, multiline, placeholder |
All of them have label, optionally help and advanced: true (shown under “More”). The editor shows help below the field: what the setting does, typical values, when to change it. Options of a select can have help too; the editor then shows the explanation of the chosen option. The default must respect its own limits. secret: true marks secrets such as a webhook URL that lets anyone who knows it send to it: exporting a chain leaves the field empty, so its default must be empty.
input on a number names an optional input that replaces the setting once it is connected; the editor then shows where the value comes from instead of the field. That is how Range takes its limits as fixed numbers or from other nodes, such as VAL and VAH from the volume profile.
Chart in the editor (visual)
Section titled “Chart in the editor (visual)”With visual the editor shows settings as a chart above the last 150 candles that you can drag or type (Chart above the price). Seven kinds:
| Kind | Fields | Example |
|---|---|---|
band |
series, line (pins), width (number in percent, min ≥ 0) |
Band: line ± width % |
zone |
series, low, high (numbers), optional price |
Range: low to high; RSI: thresholds below the price |
level |
series, level (number), optional price |
Compare: threshold |
channel |
series, middle, upper, lower (pins), width (number, min > 0), optional high, low |
Bollinger: middle ± width × standard deviation |
levels |
levels (outputs), level (choice of these outputs), width (number in percent), series or high and low |
Pivot points: pick a level, band ± % for “near” |
factor |
series, line (pins), factor (number, min ≥ 0) |
Compare A/B: B × factor as a distance in % |
overlay |
series, draw() (function), handles, optional lower |
Smart money: candles with boxes, lines, areas and marks; divergence with the oscillator below |
Pins point to an input ({ input: 'in' }) or an output ({ output: 'poc' }) of type series. Optionally signal names the output or a list of outputs whose true candles the chart marks; without it, the first signal output, none for channel and overlay. high and low show the candles’ range, price shows the price at the top in its own panel above the oscillator. The editor computes the node itself over the series at its inputs, with the settings currently in the fields: its signals and the node’s own series the chart points to. The replay delivers as much lead-in as the node needs for that.
visual: { kind: 'band', series: { input: 'in' }, line: { input: 'line' }, width: 'width', signal: 'out' },visual: { kind: 'zone', series: { output: 'out' }, low: 'oversold', high: 'overbought', price: { input: 'in' }, signal: ['oversold', 'overbought'] },With overlay the node draws itself: draw({ inputs, settings, bars }) gets the same inputs and settings as compute() and returns shapes, with candles counted from 0. If the node is connected directly to a candle, the chart shows candles instead of a line. With lower (a pin of type series, such as { input: 'osc' }) a second panel below the price shows that series; paths with pane: 'lower' appear there instead of on top of the candles. The chain chart and the alert image put them into the panel of the series connected to the input, such as the RSI.
| Shape | Fields | In the chart |
|---|---|---|
boxes |
from, known, to, low, high, tone, faded, ghost, label |
box, dashed before known, such as an order block until the break that makes it known |
lines |
from, known, to, value, tone, label |
horizontal line, dotted before known |
paths |
upper, lower, tone, pane |
a series as a line or as an area between two series; with pane: 'lower' in the panel below the price |
marks |
at, value, tone, label, side |
mark with a short text, such as BOS |
spans |
from, to, tone |
section of the strip below the candles, such as the trend |
legend, note |
legend below the chart, state in the top line |
tone is up, down or neutral. Whatever only becomes certain later belongs before known: that way the chart shows when the node knew it. handles names settings you can drag in the chart: swing (candles before and after as a bracket at swing), size (percent of the price as a gauge on the right edge) and center (a band in percent of the range range around its middle). Without signal the chart marks no candles; the top line counts the marks instead.
visual: { kind: 'overlay', series: { input: 'close' }, handles: [{ kind: 'swing', left: 'left', right: 'right' }], draw({ inputs, settings }) { const breaks = findBreaks(inputs.close, inputs.high, inputs.low, settings.left, settings.right); return { lines: breaks.map((b) => ({ from: b.swingAt, known: b.confirmed, to: b.at, value: b.level, tone: b.up ? 'up' : 'down' })) }; },},In the sentence on the board, output('near') asks whether an output is connected. That is how the pivot points only mention “near R1 ±0.3%” when the “near” output is in use.
Computing with compute()
Section titled “Computing with compute()”compute() receives whole series and returns whole series, one per output. For every computing node:
- Pure and deterministic. No network, no storage, no clock, no randomness. That’s what lets Bellchain share results across chains; the engine computes RSI 14 on BTC/USDT 1h once for everyone.
- No look-ahead. The value at candle i depends only on candles up to i. What a candle shows never changes again (no repainting).
- Don’t modify inputs.
- Every output series has exactly as many values as there are candles.
Ready-made time-series functions live in series, among them sma, ema, rma, wma, hma, rsi, macd, stdev, bb, highest, lowest, roc, change, linreg, atr, sar, crossover, crossunder, cross and pivotHigh for swing points that are only reported once confirmed.
Memory, sources and actions
Section titled “Memory, sources and actions”stateinstead ofcompute()for nodes with memory, such as the cooldown:init()andstep()compute candle by candle, the state is JSON. That’s why replay and live operation match.sourcefor sources:{ kind: 'candles', market(settings) }declares exchange, pair and timeframe; the engine loads the data, never the node.{ kind: 'events' }receives the events from the calendar (ctx.events, kind, time and importance), like the Event node.effectfor actions:{ kind: 'notify', channel: 'telegram' }or{ kind: 'log' }. Actions don’t compute; the engine fires on a rising edge and respects the cooldown.
Messages and placeholders
Section titled “Messages and placeholders”Messages are filled in only when they fire, in the recipient’s language and time zone:
| Placeholder | German | Content |
|---|---|---|
{{chain}} |
{{kette}} |
name of the chain |
{{values}} |
{{werte}} |
values of the nodes involved, such as “RSI 14: 27.69 · Price: $77,788” |
{{price}} |
{{kurs}} |
closing price of the candle |
{{pair}} |
{{paar}} |
trading pair such as BTC/USDT |
{{coin}} |
base currency such as BTC | |
{{time}} |
{{zeit}} |
candle close with time zone and UTC, for example “Oct 17, 14:00 CEST (12:00 UTC)” |
{{event}} |
{{termin}} |
name of the event from the Event node, for example “US inflation (CPI)” |
{{eventtime}} |
{{terminzeit}} |
time of that event with time zone, for example “Nov 10, 14:30 CET” |
{{a}} to {{d}} |
values at inputs A to D of the message template |
Unknown placeholders stay as they are so that typos stand out. In the message, **bold**, _italic_ and `code` work (parseMarkup() in node-spec); Telegram, Discord and email show them highlighted, push shows the text without the characters, see how it looks.
Required tests
Section titled “Required tests”Every node that works with prices ships tests in its manifest: fixed price data in, known values out. The reference values of the official nodes come from an independent recalculation, not from the code they test. The test kit also checks determinism and causality.
Custom nodes as JSON
Section titled “Custom nodes as JSON”Custom nodes need no code: inputs, settings and outputs with one formula each, as JSON. Bellchain checks every formula and turns the node into a regular definition; it then computes like any official node, the same in replay and live. A chain carries the custom nodes it uses in the customNodes field; nodes refer to them with "type": "custom.…".
{ "$schema": "https://bellchain.app/schema/node-1.json", "format": 1, "id": "custom.golden-cross", "version": "1.0.0", "label": { "de": "Golden Cross", "en": "Golden cross" }, "inputs": [{ "id": "price", "type": "price", "label": { "de": "Kurs", "en": "Price" } }], "settings": [ { "id": "fast", "default": 50, "min": 2, "max": 500, "integer": true }, { "id": "slow", "default": 200, "min": 2, "max": 500, "integer": true } ], "outputs": [{ "id": "out", "type": "signal", "formula": "crossover(ema(price, fast), ema(price, slow))" }]}The format is described as a JSON Schema (draft 2020-12): node-1.json. If the file names it under $schema as above, editors such as VS Code check fields and limits while you type; Bellchain checks the formulas itself.
How to build custom nodes in the editor and which functions exist is explained under Custom node.
You can share nodes built from formulas through bellchain-app/nodes, see Contribute.
Versión 2026.11.29.15 · Changelog