Get a list of the last 10 transactions to enter the mempool. Each transaction object contains simplified overview data, with the following fields: txid, fee, vsize, and value.
Returns details about a block. Available fields: id, height, version, timestamp, bits, nonce, merkle_root, tx_count, size, weight, and previousblockhash.
Parameters:
- {Object} params - Params object.
- {string} params.hash - Hash from a block
[Code Example](examples/blocks.ts)
```js
import { blocks } from './../src/index';
...
const block = await blocks.getBlock({
hash: '000000000000000015dc...'
});
console.log(block);
```
<br/>
### Get Block Status
Returns the confirmation status of a block. Available fields: in_best_chain (boolean, false for orphaned blocks), next_best (the hash of the next block, only available for blocks in the best chain).
Parameters:
- {Object} params - Params object.
- {string} params.hash - Hash from a block
[Code Example](examples/blocks.ts)
```js
import { blocks } from './../src/index';
...
const blockStatus = await blocks.getBlockStatus({
hash: '000000000000000015dc...'
});
console.log(blockStatus);
```
<br/>
### Get Block Txs
Returns a list of transactions in the block (up to 25 transactions beginning at start_index). Transactions returned here do not have the status field, since all the transactions share the same block and confirmation status.
Parameters:
- {Object} params - Params object.
- {string} params.hash - Hash from a block
- {number} params.start_index - Default: 25
[Code Example](examples/blocks.ts)
```js
import { blocks } from './../src/index';
...
const blockTxs = await blocks.getBlockTxs({
hash: '000000000000000015dc...'
});
console.log(blockTxs);
```
<br/>
### Get Block Txids
Returns a list of all txids in the block.
Parameters:
- {Object} params - Params object.
- {string} params.hash - Hash from a block
[Code Example](examples/blocks.ts)
```js
import { blocks } from './../src/index';
...
const blockTxids = await blocks.getBlockTxids({
hash: '000000000000000015dc...'
});
console.log(blockTxids);
```
<br/>
### Get Block Txid
Returns the transaction at index :index within the specified block.
Parameters:
- {Object} params - Params object.
- {string} params.hash - Hash from a block
- {number} params.index - Index
[Code Example](examples/blocks.ts)
```js
import { blocks } from './../src/index';
...
const blockTxid = await blocks.getBlockTxid({
hash: '000000000000000015dc...',
index: 218
});
console.log(blockTxids);
```
<br/>
### Get Block Raw
Returns the raw block representation in binary.
Parameters:
- {Object} params - Params object.
- {string} params.hash - Hash from a block
[Code Example](examples/blocks.ts)
```js
import { blocks } from './../src/index';
...
const blockRaw = await blocks.getBlockRaw({
hash: '000000000000000015dc...'
});
console.log(blockRaw);
```
<br/>
### Get Blocks Height
Returns the hash of the block currently at :height.
Parameters:
- {Object} params - Params object.
- {number} params.height - Height from a block
[Code Example](examples/blocks.ts)
```js
import { blocks } from './../src/index';
...
const blockHeight = await blocks.getBlockHeight({
height: 66666,
});
console.log(blockHeight);
```
<br/>
### Get Blocks
Returns the 10 newest blocks starting at the tip or at :start_height if specified.
Parameters:
- {Object} params - Params object.
- {number} params.start_height - Height from a block
[Code Example](examples/blocks.ts)
```js
import { blocks } from './../src/index';
...
const getBlocks = await blocks.getBlocks({
start_height: 66666
});
console.log(getBlocks);
```
<br/>
### Get Blocks Tip Height
Returns the 10 newest blocks starting at the tip or at :start_height if specified.
Parameters:
- {Object} params - Params object.
- {number} params.start_height - Height from a block
Returns the spending status of a transaction output. Available fields: spent (boolean), txid (optional), vin (optional), and status (optional, the status of the spending tx).
Broadcast a raw transaction to the network. The transaction should be provided as hex in the request body. The txid will be returned on success.
Parameters:
- {Object} params - Params object.
- {string} params.txid - Transactions id.
[Code Example](examples/transactions.ts)
```js
import { transactions } from './../src/index';
...
const postTx = await transactions.postTx({
txid: '15e10745f15593...'
});
console.log(postTx);
```
<br/>
---
### Get Address
Returns details about an address. Available fields: address, chain_stats, and mempool_stats. {chain,mempool}\_stats each contain an object with tx_count, funded_txo_count, funded_txo_sum, spent_txo_count, and spent_txo_sum.
Parameters:
- {Object} params - Params object.
- {string} params.address - Address id.
[Code Example](examples/addresses.ts)
```js
import { addresses } from './../src/index';
...
const addressTest = await addresses.getAddress({
address: '15e10745f15593a...'
});
console.log(addressTest);
```
<br/>
### Get Address Txs
Get transaction history for the specified address/scripthash, sorted with newest first. Returns up to 50 mempool transactions plus the first 25 confirmed transactions. You can request more confirmed transactions using :last_seen_txid (see below).
Get confirmed transaction history for the specified address/scripthash, sorted with newest first. Returns 25 transactions per page. More can be requested by specifying the last txid seen by the previous query.