Skip to content

BitCANN/bitcann-core

Repository files navigation

@bitcann/core

BitCANN - Bitcoin Cash for Assigned Names and Numbers – is a decentralized domain name and identity system built on the Bitcoin Cash Blockchain.

NPM version
Join Chat on Telegram npm downloads

Contract and Documentation

For more details, visit the BitCANN Contracts and Documentation repository.

Usage

Installation

npm install @bitcann/core

Setup

import { BitCANNManager } from '@bitcann/core';

const manager = new BitCANNManager({
  // Category ID for the BitCANN system
  category: '0x0000000000000000000000000000000000000000',
  // Minimum starting bid in satoshis
  minStartingBid: 100000000,
  // Minimum bid increase percentage
  minBidIncreasePercentage: 5,
  // Inactivity expiry time in blocks/MTP
  inactivityExpiryTime: 1000000,
  // Minimum wait time in blocks/MTP
  minWaitTime: 1,
  // The TLD of the names
  tld: '.bch',
  // Creator Incentive Address
  creatorIncentiveAddress: '',
  // Network provider (optional)
  networkProvider: new ElectrumNetworkProvider('mainnet'),
});

Handling

Name Operations

// Get name records
const records = await manager.getRecords('satoshi');

// Get name information
const name = await manager.getName('satoshi');

// Create record
const recordTx = await manager.createRecordTransaction({
  name: 'satoshi',
  record: 'Hello, World!',
  address: 'bitcoincash:...'
});

Auction Operations

// Get active auctions
const auctions = await manager.getAuctions();

// Create auction
const auctionTx = await manager.createAuctionTransaction({
  name: 'satoshi',
  amount: 100000000,
  address: 'bitcoincash:...'
});

// Place bid
const bidTx = await manager.createBidTransaction({
  name: 'satoshi',
  amount: 200000000,
  address: 'bitcoincash:...'
});

// Claim name
const claimTx = await manager.createClaimNameTransaction({
  name: 'satoshi'
});

Support

For support, please open an issue on our GitHub repository or create a PR, or join our community chat at Telegram.

Configuration Options

Option Description Default
category Category ID for the BitCANN system Required
minStartingBid Minimum starting bid in satoshis Required
minBidIncreasePercentage Minimum bid increase percentage Required
inactivityExpiryTime Inactivity expiry time in blocks/MTP Required
minWaitTime Minimum wait time in blocks/MTP Required
creatorIncentive Creator Incentive Optional
networkProvider Network provider Optional

License

MIT

About

@bitcann/core package, exposed API, types and functions for BitCANN

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published