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

1.0.0-beta.2 • Public • Published


The Official .bit JavaScript SDK provided by .bit team.

NPM npm

This is the new version of .bit (previously known as DAS) JavaScript SDK. If you are looking for the source code of the deprecated npm package das-sdk, please visit the das-sdk branch on GitHub.

Table of Contents


  • Query .bit account info (e.g. owner, manager, status, etc.)
  • Query .bit account records (e.g. addresses, profiles, dwebs and custom data.)
  • Enable .bit Second-level DID for a specific account.
  • Mint a Second-level DID of a .bit main account.
  • Query all the Second-level DIDs of a .bit main account.
  • Manage the ownership of a .bit account(Second-level DID included).
  • Manage the records of a .bit account(Second-level DID included).
  • Register a .bit account with CKB.

Getting Started

First, you need to install Dotbit.js using npm

npm install dotbit --save

or yarn.

yarn add dotbit

Then, you need to import Dotbit.js SDK in your code and create an instance before interacting with it:

// For CommonJS
const { createInstance } = require('dotbit')
const dotbit = createInstance()
// For ES Module
import { createInstance } from 'dotbit'
const dotbit = createInstance()

Now you could perform various operations using Dotbit.js SDK. Here is a simple example:

// Get the account info of a .bit account

A sample result would be like:

  account: 'imac.bit',
  account_id_hex: '0x5728088435fb8788472a9ca601fbc0b9cbea8be3',
  next_account_id_hex: '0x57280ab92f213d74c7a185e9b9d26d0a795108de',
  create_at_unix: 1671164348,
  expired_at_unix: 1702700348,
  status: 0,
  das_lock_arg_hex: '0x05b2be2887a26f44555835eeacc47d65b88b6b42c205b2be2887a26f44555835eeacc47d65b88b6b42c2',
  owner_algorithm_id: 17000,
  owner_key: '0xb2be2887a26f44555835eeacc47d65b88b6b42c2',
  manager_algorithm_id: 17000,
  manager_key: '0xb2be2887a26f44555835eeacc47d65b88b6b42c2',
  enable_sub_account: 0

For more details about each API, you could refer to our API Documentation. We also provide code examples here: For browser, For Node.js.



API Documentation


.bit has partnerships with the greatest teams & projects in the ecosystems. Dotbit.js offers a simple and powerful plugin system that allows us to add advanced features to this library.


Basically, you can install and use a plugin like the codes below.

import { PluginXXX } from 'dotbit-plugin-xxx'
import { createInstance } from 'dotbit'

const dotbit = createInstance()
dotbit.installPlugin(new PluginXXX())

For detailed usage, please follow the instructions in the specific plugin's README.

List of plugins

Write your own plugin

Write a plugin for .bit is easy!

If you want to write a plugin for your or other projects, please follow the same structure of plugin template.


What is coin_type?

coin_type is a way to distinguish between different coins or blockchain networks using the Coin Types defined in SLIP 44. For example, the coin_type for ETH is 60, the coin_type for BTC is 0, and the coin_type for BNB is 9006, etc.

Which coin_type does .bit support?

.bit uses coin_type in a few different ways:

  • .bit uses coin_type to identify each chain or coin in .bit records. In this case, .bit supports all coin_type values defined in SLIP 44.
  • .bit uses coin_type to identify different types of owner/manager key information. For example, you can use an ETH address (coin_type: 60) as your .bit owner and a TRON address (coin_type: 195) as your manager.

For a complete list of coin_type values that .bit supports in key_info, please see const.ts.

Get Help

If you have questions or need help with Dotbit.js, there are several ways to get assistance:


We welcome contributions to Dotbit.js! If you are interested in helping to improve the project, there are several ways you can contribute:

  • Report bugs or suggest improvements by opening an issue on the GitHub repository.
  • Submit a pull request with your changes to the code.

Please note that Dotbit.js SDK is still under development, so any contribution (including pull requests) is welcome.


Dotbit.js (including all dependencies) is protected under the MIT License. This means that you are free to use, modify, and distribute the software as long as you include the original copyright and license notice. Please refer to the license for the full terms.

Package Sidebar


npm i dotbit

Weekly Downloads






Unpacked Size

572 kB

Total Files


Last publish


  • jeffjing
  • max-npm
  • dotbithq