Nadie Programa más

    TypeScript icon, indicating that this package has built-in type declarations

    1.2.5 • Public • Published


    Robust hive client library that runs in both node.js and the browser.

    Needs test net urls, chain id

    note As of version 0.7.0 WebSocket support has been removed. The only transport provided now is HTTP(2). For most users the only change required is to swap wss:// to https:// in the address. If you run your own full node make sure to set the proper CORS headers if you plan to access it from a browser.

    Browser compatibility

    Build Status


    Via npm

    For node.js or the browser with browserify or webpack.

    npm install @hiveio/dhive

    From cdn or self-hosted script

    Grab dist/dhive.js from git and include in your html:

    <script src="@hiveio/dhive.js"></script>

    Or from the unpkg cdn:

    <script src=""></script>

    Make sure to set the version you want when including from the cdn, you can also use dhive@latest but that is not always desirable. See for more information.


    In the browser

    <script src=""></script>
      var client = new dhive.Client(["", "", "", ""]);
        .getDiscussions("trending", { tag: "writing", limit: 1 })
        .then(function(discussions) {
          document.body.innerHTML += "<h1>" + discussions[0].title + "</h1>";
          document.body.innerHTML += "<h2>by " + discussions[0].author + "</h2>";
          document.body.innerHTML +=
            '<pre style="white-space: pre-wrap">' + discussions[0].body + "</pre>";

    See the demo source for an example on how to setup a livereloading TypeScript pipeline with wintersmith and browserify.

    In node.js

    With TypeScript:

    import { Client } from "@hiveio/dhive";
    const client = new Client(["", "", "", ""]);
    for await (const block of client.blockchain.getBlocks()) {
      console.log(`New block, id: ${block.block_id}`);

    With JavaScript:

    var dhive = require("@hiveio/dhive");
    var client = new dhive.Client(["", "", "", ""]);
    var key = dhive.PrivateKey.fromLogin("username", "password", "posting");
          voter: "username",
          author: "almost-digital",
          permlink: "dhive-is-the-best",
          weight: 10000
        function(result) {
          console.log("Included in block: " + result.block_num);
        function(error) {

    With ES2016 (node.js 7+):

    const { Client } = require("@hiveio/dhive");
    const client = new Client(["", "", "", ""]);
    async function main() {
      const props = await client.database.getChainProperties();
      console.log(`Maximum blocksize consensus: ${props.maximum_block_size} bytes`);

    With node.js streams:

    var dhive = require("@hiveio/dhive");
    var es = require("event-stream"); // npm install event-stream
    var util = require("util");
    var client = new dhive.Client(["", "", "", ""]);
    var stream = client.blockchain.getBlockStream();
      .pipe(, callback) {
          callback(null, util.inspect(block, { colors: true, depth: null }) + "\n");


    The easiest way to bundle dhive (with browserify, webpack etc.) is to just npm install @hiveio/dhive and require('@hiveio/dhive') which will give you well-tested (see browser compatibility matrix above) pre-bundled code guaranteed to JustWork™. However, that is not always desirable since it will not allow your bundler to de-duplicate any shared dependencies dhive and your app might have.

    To allow for deduplication you can require('@hiveio/dhive/lib/index-browser'), or if you plan to provide your own polyfills: require('@hiveio/dhive/lib/index'). See src/index-browser.ts for a list of polyfills expected.

    Share and Enjoy!


    npm i @hiveio/dhive

    DownloadsWeekly Downloads






    Unpacked Size

    2.35 MB

    Total Files


    Last publish


    • mahdiyari
    • jes2850
    • therealwolf
    • bgornicki
    • openhive
    • feruzm