Skip to content

Getting started

This guide gets a Node.js project connected to Blurt with a safe read-only workflow.

It deliberately does not use private keys and does not broadcast transactions. First learn to read, then learn authorities and signing.

Prerequisites

You need:

  • Node.js supported by the package metadata;
  • a project with npm;
  • network access to Blurt RPC endpoints.

For runtime support details, see Compatibility.

1. Install

bash
npm install @beblurt/dblurt

2. Create a client

ts
import { Client } from '@beblurt/dblurt';

const rpcList = [
    'https://rpc.blurt.blog',
    'https://blurt-rpc.saboin.com',
    'https://rpc.beblurt.com',
    'https://blurtrpc.dagobert.uk',
    'https://rpc.drakernoise.com'
];

const client = new Client(rpcList, {
    timeout: 15_000,
    failoverThreshold: 3
});

Why an endpoint list? Blockchain RPC endpoints can lag, fail or be temporarily unreachable. A list lets the SDK fail over instead of making your app depend on one URL.

Endpoint strategy is explained later in RPC endpoints and failover.

3. Read current chain state

ts
const props = await client.condenser.getDynamicGlobalProperties();

console.log({
    head: props.head_block_number,
    irreversible: props.last_irreversible_block_num,
    time: props.time
});

This is a Layer 1 read. It asks a Blurt RPC node for dynamic global properties such as head block and last irreversible block.

The head block is the latest block known by the endpoint. The last irreversible block is the safer reference when a workflow needs stable history.

4. Load an account

ts
async function loadAccount(name: string) {
    const accounts = await client.condenser.getAccounts([name]);
    return accounts[0];
}

const account = await loadAccount('beblurt');

if (!account) {
    console.log('account not found');
} else {
    console.log(account.name);
    console.log(account.balance);
    console.log(account.vesting_shares);
}

Account state is also Layer 1 data. It includes balances, authorities and other chain account fields exposed by the RPC API.

5. Query social data with Nexus

ts
const posts = await client.nexus.getRankedPosts({
    sort: 'trending',
    limit: 10,
    tag: 'blurt',
    observer: null
});

for (const post of posts) {
    console.log(`${post.author}/${post.permlink}: ${post.title}`);
}

This is a Nexus Layer 2 query. It is useful for building social interfaces because Nexus exposes ranked and indexed views. Do not treat it as replacing Layer 1 consensus state.

6. API details

Use the API reference when you need exact signatures:

7. What you learned

You have now used three important surfaces:

GoalSurfaceLayer
Create an SDK clientnew Client(...)SDK
Read chain propertiesclient.condenserBlurt Layer 1
Read account stateclient.condenserBlurt Layer 1
Read ranked social postsclient.nexusNexus Layer 2

Next steps

Read-only first

You do not need a private key for any example on this page. Private keys appear only in signing and broadcast workflows.