Use the methods in class to build third-party wallets or in DApps that register names.

### Hierarchy

- BlockstackNetwork

## Index

### Constructors

- constructor

### Properties

- DUST_MINIMUM
- MAGIC_BYTES
- blockstackAPIUrl
- broadcastServiceUrl
- btc
- excludeUtxoSet
- includeUtxoMap

### Methods

- broadcastNameRegistration
- broadcastServiceFetchHelper
- broadcastTransaction
- broadcastZoneFile
- getAccountAt
- getAccountBalance
- getAccountHistoryPage
- getAccountStatus
- getAccountTokens
- getDefaultBurnAddress
- getGracePeriod
- getNameInfo
- getNamePrice
- getNamePriceV1
- getNamePriceV2
- getNamesOwned
- getNamespaceBurnAddress
- getNamespaceInfo
- getNamespacePrice
- getNamespacePriceV1
- getNamespacePriceV2
- getNetworkedUTXOs
- getTransactionInfo
- getZonefile

## Constructors

### constructor

- new BlockstackNetwork(apiUrl: string, broadcastServiceUrl: string, bitcoinAPI: BitcoinNetwork, network?: Network): BlockstackNetwork

- - Defined in network.ts:79

  #### Parameters

  - ##### apiUrl: string

  - ##### broadcastServiceUrl: string

  - ##### bitcoinAPI: BitcoinNetwork

  - ##### Default value network: Network = networks.bitcoin

  #### Returns BlockstackNetwork

## Properties

### DUST_MINIMUM

DUST_MINIMUM: number

- Defined in network.ts:71

### MAGIC_BYTES

MAGIC_BYTES: string

- Defined in network.ts:79

### blockstackAPIUrl

blockstackAPIUrl: string

- Defined in network.ts:62

### broadcastServiceUrl

broadcastServiceUrl: string

- Defined in network.ts:64

### btc

btc: BitcoinNetwork

- Defined in network.ts:77

### excludeUtxoSet

excludeUtxoSet: UTXO[]

- Defined in network.ts:75

### includeUtxoMap

includeUtxoMap: object

- Defined in network.ts:73

#### Type declaration

- ##### [address: string]: UTXO[]

## Methods

### Private broadcastNameRegistration

- broadcastNameRegistration(preorderTransaction: string, registerTransaction: string, zoneFile: string): Promise<any>

- - Defined in network.ts:815

  Sends the preorder and registration transactions and zone file for a Blockstack name registration along with the to the transaction broadcast service.

  The transaction broadcast:

  - immediately broadcasts the preorder transaction
  - broadcasts the register transactions after the preorder transaction has an appropriate number of confirmations
  - broadcasts the zone file to the Atlas network after the register transaction has an appropriate number of confirmations

  This is intended for use in third-party wallets or in DApps that register names.

  #### Parameters

  - ##### preorderTransaction: string

    the hex-encoded, signed preorder transaction generated using the `makePreorder` function

  - ##### registerTransaction: string

    the hex-encoded, signed register transaction generated using the `makeRegister` function

  - ##### zoneFile: string

    the zone file to be broadcast to the Atlas network

  #### Returns Promise<any>

  Returns a Promise that resolves to an object with a `transaction_hash` key containing the transaction hash of the broadcasted transaction.

  In the event of an error, it rejects with:

  - a `RemoteServiceError` if there is a problem with the transaction broadcast service
  - `MissingParameterError` if you call the function without a required parameter

### Private broadcastServiceFetchHelper

- broadcastServiceFetchHelper(endpoint: string, body: any): Promise<any | Error>

- - Defined in network.ts:628

  Performs a POST request to the given URL. This is intended for use in third-party wallets or in DApps that register names.

  #### Parameters

  - ##### endpoint: string

    the name of

  - ##### body: any

  #### Returns Promise<any | Error>

  Returns a `Promise` that resolves to the object requested. In the event of an error, it rejects with:

  - a `RemoteServiceError` if there is a problem with the transaction broadcast service
  - `MissingParameterError` if you call the function without a required parameter

### Private broadcastTransaction

- broadcastTransaction(transaction: string, transactionToWatch?: string, confirmations?: number): Promise<any>

- - Defined in network.ts:672

  Broadcasts a signed bitcoin transaction to the network optionally waiting to broadcast the transaction until a second transaction has a certain number of confirmations.

  This is intended for use in third-party wallets or in DApps that register names.

  #### Parameters

  - ##### transaction: string

    the hex-encoded transaction to broadcast

  - ##### Default value transactionToWatch: string = null

    the hex transaction id of the transaction to watch for the specified number of confirmations before broadcasting the `transaction`

  - ##### Default value confirmations: number = 6

    the number of confirmations `transactionToWatch` must have before broadcasting `transaction`.

  #### Returns Promise<any>

  Returns a Promise that resolves to an object with a `transaction_hash` key containing the transaction hash of the broadcasted transaction.

  In the event of an error, it rejects with:

  - a `RemoteServiceError` if there is a problem with the transaction broadcast service
  - `MissingParameterError` if you call the function without a required parameter

### Private broadcastZoneFile

- broadcastZoneFile(zoneFile?: string, transactionToWatch?: string): Promise<any>

- - Defined in network.ts:728

  Broadcasts a zone file to the Atlas network via the transaction broadcast service. This is intended for use in third-party wallets or in DApps that register names.

  #### Parameters

  - ##### Optional zoneFile: string

    the zone file to be broadcast to the Atlas network

  - ##### Default value transactionToWatch: string = null

    the hex transaction id of the transaction to watch for confirmation before broadcasting the zone file to the Atlas network

  #### Returns Promise<any>

  Returns a Promise that resolves to an object with a `transaction_hash` key containing the transaction hash of the broadcasted transaction.

  In the event of an error, it rejects with:

  - a `RemoteServiceError` if there is a problem with the transaction broadcast service
  - `MissingParameterError` if you call the function without a required parameter

### getAccountAt

- getAccountAt(address: string, blockHeight: number): Promise<any[]>

- - Defined in network.ts:527

  Get the state(s) of an account at a particular block height. This includes the state of the account beginning with this block's transactions, as well as all of the states the account passed through when this block was processed (if any).

  This is intended for use in third-party wallets or in DApps that register names.

  #### Parameters

  - ##### address: string

    the account's address

  - ##### blockHeight: number

    the block to query

  #### Returns Promise<any[]>

  a promise that resolves to an Array of Objects, where each Object encodes states of the account at this block.

### getAccountBalance

- getAccountBalance(address: string, tokenType: string): Promise<BN>

- - Defined in network.ts:589

  Get the number of tokens owned by an account. If the account does not exist or has no tokens of this type, then 0 will be returned.

  This is intended for use in third-party wallets or in DApps that register names.

  #### Parameters

  - ##### address: string

    the account's address

  - ##### tokenType: string

    the type of token to query.

  #### Returns Promise<BN>

  a promise that resolves to a BigInteger that encodes the number of tokens held by this account.

### getAccountHistoryPage

- getAccountHistoryPage(address: string, page: number): Promise<any[]>

- - Defined in network.ts:489

  Get a page of an account's transaction history. This is intended for use in third-party wallets or in DApps that register names.

  #### Parameters

  - ##### address: string

    the account's address

  - ##### page: number

    the page number. Page 0 is the most recent transactions

  #### Returns Promise<any[]>

  a promise that resolves to an Array of Objects, where each Object encodes states of the account at various block heights (e.g. prior balances, txids, etc)

### getAccountStatus

- getAccountStatus(address: string, tokenType: string): Promise<any>

- - Defined in network.ts:459

  Get the status of an account for a particular token holding. This includes its total number of expenditures and credits, lockup times, last `txid`, and so on.

  This is intended for use in third-party wallets or in DApps that register names.

  #### Parameters

  - ##### address: string

    the account

  - ##### tokenType: string

    the token type to query

  #### Returns Promise<any>

  a promise that resolves to an object representing the state of the account for this token

### getAccountTokens

- getAccountTokens(address: string): Promise<AccountTokens>

- - Defined in network.ts:560

  Get the set of token types that this account owns. This is intended for use in third-party wallets or in DApps that register names.

  #### Parameters

  - ##### address: string

    the account's address

  #### Returns Promise<AccountTokens>

  a promise that resolves to an Array of Strings, where each item encodes the type of token this account holds (excluding the underlying blockchain's tokens)

### getDefaultBurnAddress

- getDefaultBurnAddress(): string

- - Defined in network.ts:118

  This is intended for use in third-party wallets or in DApps that register names.

  #### Returns string

### getGracePeriod

- getGracePeriod(_fullyQualifiedName?: string): Promise<number>

- - Defined in network.ts:304

  How many blocks can pass between a name expiring and the name being able to be re-registered by a different owner. This is intended for use in third-party wallets or in DApps that register names.

  #### Parameters

  - ##### Optional _fullyQualifiedName: string

  #### Returns Promise<number>

  a promise to the number of blocks

### getNameInfo

- getNameInfo(fullyQualifiedName: string): Promise<any>

- - Defined in network.ts:362

  Get WHOIS-like information for a name, including the address that owns it, the block at which it expires, and the zone file anchored to it (if available).

  This is intended for use in third-party wallets or in DApps that register names.

  #### Parameters

  - ##### fullyQualifiedName: string

    the name to query. Can be on-chain of off-chain.

  #### Returns Promise<any>

  a promise that resolves to the WHOIS-like information

### getNamePrice

- getNamePrice(fullyQualifiedName: string): Promise<PriceInfo>

- - Defined in network.ts:275

  Get the price of a name. This is intended for use in third-party wallets or in DApps that register names. This is intended for use in third-party wallets or in DApps that register names.

  #### Parameters

  - ##### fullyQualifiedName: string

    the name to query

  #### Returns Promise<PriceInfo>

  a promise to an Object with { units: String, amount: BigInteger }, where .units encodes the cryptocurrency units to pay (e.g. BTC, STACKS), and .amount encodes the number of units, in the smallest denominiated amount (e.g. if .units is BTC, .amount will be satoshis; if .units is STACKS, .amount will be microStacks)

### Private getNamePriceV1

- getNamePriceV1(fullyQualifiedName: string): Promise<PriceInfo>

- - Defined in network.ts:129

  Get the price of a name via the legacy /v1/prices API endpoint. This is intended for use in third-party wallets or in DApps that register names.

  #### Parameters

  - ##### fullyQualifiedName: string

    the name to query

  #### Returns Promise<PriceInfo>

  a promise to an Object with { units: String, amount: BigInteger }

### Private getNamePriceV2

- getNamePriceV2(fullyQualifiedName: string): Promise<PriceInfo>

- - Defined in network.ts:196

  Get the price of a name via the /v2/prices API endpoint. This is intended for use in third-party wallets or in DApps that register names.

  #### Parameters

  - ##### fullyQualifiedName: string

    the name to query

  #### Returns Promise<PriceInfo>

  a promise to an Object with { units: String, amount: BigInteger }

### getNamesOwned

- getNamesOwned(address: string): Promise<string[]>

- - Defined in network.ts:314

  Get the names -- both on-chain and off-chain -- owned by an address. This is intended for use in third-party wallets or in DApps that register names.

  #### Parameters

  - ##### address: string

    the blockchain address (the hash of the owner public key)

  #### Returns Promise<string[]>

  a promise that resolves to a list of names (Strings)

### getNamespaceBurnAddress

- getNamespaceBurnAddress(namespace: string): Promise<string>

- - Defined in network.ts:329

  Get the blockchain address to which a name's registration fee must be sent (the address will depend on the namespace in which it is registered.)

  This is intended for use in third-party wallets or in DApps that register names.

  #### Parameters

  - ##### namespace: string

    the namespace ID

  #### Returns Promise<string>

  a promise that resolves to an address (String)

### getNamespaceInfo

- getNamespaceInfo(namespaceID: string): Promise<any>

- - Defined in network.ts:394

  Get the pricing parameters and creation history of a namespace. This is intended for use in third-party wallets or in DApps that register names.

  #### Parameters

  - ##### namespaceID: string

    the namespace to query

  #### Returns Promise<any>

  a promise that resolves to the namespace information.

### getNamespacePrice

- getNamespacePrice(namespaceID: string): Promise<PriceInfo>

- - Defined in network.ts:291

  Get the price of a namespace. This is intended for use in third-party wallets or in DApps that register names.

  #### Parameters

  - ##### namespaceID: string

    the namespace to query

  #### Returns Promise<PriceInfo>

  a promise to an Object with { units: String, amount: BigInteger }, where .units encodes the cryptocurrency units to pay (e.g. BTC, STACKS), and .amount encodes the number of units, in the smallest denominiated amount (e.g. if .units is BTC, .amount will be satoshis; if .units is STACKS, .amount will be microStacks)

### Private getNamespacePriceV1

- getNamespacePriceV1(namespaceID: string): Promise<PriceInfo>

- - Defined in network.ts:164

  Get the price of a namespace via the legacy /v1/prices API endpoint. This is intended for use in third-party wallets or in DApps that register names.

  #### Parameters

  - ##### namespaceID: string

    the namespace to query

  #### Returns Promise<PriceInfo>

  a promise to an Object with { units: String, amount: BigInteger }

### Private getNamespacePriceV2

- getNamespacePriceV2(namespaceID: string): Promise<PriceInfo>

- - Defined in network.ts:235

  Get the price of a namespace via the /v2/prices API endpoint. This is intended for use in third-party wallets or in DApps that register names.

  #### Parameters

  - ##### namespaceID: string

    the namespace to query

  #### Returns Promise<PriceInfo>

  a promise to an Object with { units: String, amount: BigInteger }

### getNetworkedUTXOs

- getNetworkedUTXOs(address: string): Promise<UTXO[]>

- - Defined in network.ts:987

  #### Parameters

  - ##### address: string

  #### Returns Promise<UTXO[]>

### getTransactionInfo

- getTransactionInfo(txHash: string): Promise<TransactionInfo>

- - Defined in network.ts:976

  #### Parameters

  - ##### txHash: string

  #### Returns Promise<TransactionInfo>

### getZonefile

- getZonefile(zonefileHash: string): Promise<string>

- - Defined in network.ts:429

  Get a zone file, given its hash. Throws an exception if the zone file obtained does not match the hash.

  This is intended for use in third-party wallets or in DApps that register names.

  #### Parameters

  - ##### zonefileHash: string

    the ripemd160(sha256) hash of the zone file

  #### Returns Promise<string>

  a promise that resolves to the zone file's text

Generated using TypeDoc