Javascript SDK to interact with BloqCloud blockchains
$ npm install --save @bloq/cloud-sdk
$ yarn add @bloq/cloud-sdk
const { connect } = require('@bloq/cloud-sdk')
const clientId = 'CLIENT_ID'
const clientSecret = 'CLIENT_SECRET'
const coin = 'btc'
const network = 'mainnet'
const client = connect.http({
coin,
network,
auth: {
clientId,
clientSecret
}
})
client
.block('00000000dfd5d65c9d8561b4b8f60a63018fe3933ecb131fb37f905f87da951a')
.then(function(block) {
// Use block
})
This method fetches a block by block hash
hash
: The hash of the block to be fetched
This method fetches a block by block height
height
: The height of the block hash to be fetched. A height of 0 is the genesis block
This method fetches a raw block by block hash
height
: The hash of the block to be fetched
This method fetches block summaries by date
limit
: The number of blocks to be fetched
date
: The date of the blocks. Example: 2017-05-25
This method fetches a transaction by transaction hash
hash
: The hash of the transaction to be fetched
This method fetches the properties of an address by address
address
: The address to be fetched
from
: Number to paginate transactions from addresses
to
: Number to paginate transactions from addresses
noTxList
: Boolean to determine if transactions associated to the address should be fetched
This method fetches an address balance in satoshis
address
: The address of the balance to be fetched
This method fetches an address total received in satoshis
address
: The address of the total received balance to be fetched
This method fetches an address total sent in satoshis
address
: The address of the total sent balance to be fetched
This method fetches an address unconfirmed balance in satoshis
address
: The address of the unconfirmed balance to be fetched
This method fetches unspent outputs from multiple addresses
addresses
: The unspent outputs addresses
This method fetches transactions by block
block
: The block hash associated to the transactions to be fetched
pageNum
: Pagination attribute
This method fetches transactions for an address
address
: The addrress associated to the transactions to be fetched
pageNum
: Pagination attribute
This method fetches transactions for multiple addresses
addresses
: The addrresses associated to the transactions to be fetched
from
: Pagination attribute
to
: Pagination attribute
noAsm
: Will omit script asm from results
noScriptSig
: Will omit the scriptSig from all inputs
noSpent
: Will omit spent information per output
This method broadcasts a signed transaction
rawtx
: Signed transaction as hex string
This method fetches the status of the bitcoin network
query
: A specific attribute from the status code. Possible values are: getInfo, getDifficulty, getBestBlockHash and getLastBlockHash
This method retrieves fee estimates
nbBlocks
: The number of blocks to confirm a transaction