# BitcoinCash

## Create BitcoinCash Client

{% tabs %}
{% tab title="PHP" %}

```php
use BlockSDK;

$blockSDK = new BlockSDK("YOU_TOKEN");
$bchClient = $blockSDK->createBitcoinCash();

or

$bchClient = BlockSDK::createBitcoinCash("YOU_TOKEN");
```

{% endtab %}
{% endtabs %}

## Object

### TX

| Name          | Type                                                          | Content                                                      |
| ------------- | ------------------------------------------------------------- | ------------------------------------------------------------ |
| txid          | string                                                        | hash of the transaction.                                     |
| hash          | string                                                        | hash of the transaction.                                     |
| size          | int                                                           | size of the transaction.                                     |
| version       | char                                                          | version of the transaction.                                  |
| vin           | array\[[vin](https://blockchen.gitbook.io/api/bitcoin#vin)]   | List of inputs into transaction                              |
| total\_in     | double                                                        | Total balance of transaction input                           |
| vout          | array\[[vout](https://blockchen.gitbook.io/api/bitcoin#vout)] | List of outputs into transaction                             |
| total\_out    | double                                                        | Total balance of transaction output                          |
| in\_count     | int                                                           | Transaction input count                                      |
| out\_count    | int                                                           | Transaction output count                                     |
| fee           | double                                                        | Transaction fee                                              |
| fee\_per\_kb  | double                                                        | Transaction fee per kb                                       |
| locktime      | int                                                           | If not 0, this tells when a transaction output is spendable. |
| block\_hash   | string                                                        | block hash including the transaction                         |
| block\_height | int                                                           | block height including the transaction                       |
| time          | int                                                           | The time contained in the block                              |
| confirmations | int                                                           | Transaction Confirmation Count                               |

### VIN

| Name      | Type           | Content                                                            |
| --------- | -------------- | ------------------------------------------------------------------ |
| txid      | string         | hash of the transaction                                            |
| vout      | int            | the index of the output being redeemed from the origin transaction |
| scriptSig | object         | signature script                                                   |
| addresses | array\[string] | BitcoinCash Address                                                |
| value     | double         | Amount used                                                        |

### VOUT

| Name         | Type           | Content                                 |
| ------------ | -------------- | --------------------------------------- |
| value        | double         | Amount received                         |
| n            | int            | Output index                            |
| scriptPubKey | object         | the public key script used to pay coins |
| addresses    | array\[string] | BitcoinCash Address                     |

## &#x20;GetBlockChain

<mark style="color:blue;">`GET`</mark> `https://api.blocksdk.com/v1/bch/block`

{% tabs %}
{% tab title="200 Cake successfully retrieved." %}

```javascript
{
    "height":613543,
    "bestblockhash":"00000000000000000040c5bf0562c1f23250d4250adc7dfe1b090956d55c22a5",
    "prev_hash":"000000000000000002d6421daf0adc3b325292f37400506d02648d9018bfe14c",
    "unconfirmed_count":585,
    "low_fee_per_kb":0.00005,
    "medium_fee_per_kb":0.00008,
    "high_fee_per_kb":0.00008
}
```

{% endtab %}
{% endtabs %}

### Response

| Name                 | Type   | Content                                      |
| -------------------- | ------ | -------------------------------------------- |
| height               | int    | number of most recent block.                 |
| bestblockhash        | string | hash of most recent block.                   |
| prev\_hash           | string | Previous block hash of the most recent block |
| unconfirmed\_count   | int    | Unconfirmed Transaction Count                |
| low\_fee\_per\_kb    | double | Low Priority (7+ blocks)                     |
| medium\_fee\_per\_kb | double | Medium Priority (3-6 blocks)                 |
| high\_fee\_per\_kb   | double | High Priority (1-2 blocks)                   |

{% tabs %}
{% tab title="PHP" %}

```php
$blockChain = $bchClient->getBlockChain();
```

{% endtab %}
{% endtabs %}

## GetBlock

<mark style="color:blue;">`GET`</mark> `https://api.blocksdk.com/v1/bch/block/{block}`

#### Path Parameters

| Name  | Type   | Description          |
| ----- | ------ | -------------------- |
| block | string | Block number or hash |

#### Query Parameters

| Name   | Type    | Description                      |
| ------ | ------- | -------------------------------- |
| rawtx  | boolean | Get transaction details          |
| limit  | number  | Number of transactions to import |
| offset | number  | Transaction List Offset          |

{% tabs %}
{% tab title="200 " %}

```javascript
{
    "hash":"00000000000000000040c5bf0562c1f23250d4250adc7dfe1b090956d55c22a5",
    "confirmations":1,
    "height":613543,
    "time":1576474675,
    "tx":[...],
    "tx_count":328,
    "input_total":1093.54265824,
    "input_count":556,
    "out_total":1093.53638031,
    "out_count":930,
    "fee_per_kb":0.00004835,
    "fee_total":0.00627793,
    "generation":12.5,
    "reward":12.50627793,
    "size":129834,
    "prev_hash":"000000000000000002d6421daf0adc3b325292f37400506d02648d9018bfe14c",
    "next_hash":""
}
```

{% endtab %}
{% endtabs %}

### Response

| Name          | Type   | Content                                                     |
| ------------- | ------ | ----------------------------------------------------------- |
| hash          | string | hash of the block                                           |
| confirmations | int    | Block Confirmation Count                                    |
| height        | int    | the block number                                            |
| time          | int    | The date and time at which a block is mined.                |
| tx            | array  | Transaction contained in the block                          |
| tx\_count     | int    | The number of transactions contained in the block           |
| input\_total  | double | Total input balance of transactions contained in the block  |
| input\_count  | int    | The number of inputs for all transactions in the block      |
| out\_total    | double | Total output balance of transactions contained in the block |
| out\_count    | int    | The number of outputs for all transactions in the block     |
| fee\_per\_kb  | double | Kb unit fee for all transactions in a block                 |
| fee\_total    | double | Total transaction fee                                       |
| generation    | double | Mining Compensation Including Fees                          |
| reward        | double | Block Mining Reward                                         |
| size          | int    | integer the size of this block in bytes.                    |
| prev\_hash    | string | Previous block hash                                         |
| next\_hash    | string | Next block hash                                             |

{% tabs %}
{% tab title="PHP" %}

```php
$block = $bchClient->getBlock([
    "block" => 600125,
    "rawtx" => true,
    "offset" => 0,
    "limit" => 10
]);
```

{% endtab %}
{% endtabs %}

## GetMemPool

<mark style="color:blue;">`GET`</mark> `https://api.blocksdk.com/v1/bch/mempool`

#### Query Parameters

| Name   | Type    | Description                      |
| ------ | ------- | -------------------------------- |
| rawtx  | boolean | Get transaction details          |
| offset | number  | Transaction List Offset          |
| limit  | number  | Number of transactions to import |

{% tabs %}
{% tab title="200 " %}

```
{
    "unconfirmed_count" : 10,
    "tx" : {...}
}
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="PHP" %}

```php
$pool = $bchClient->getMemPool([
    "rawtx" => true,
    "offset" => 0,
    "limit" => 10
]);
```

{% endtab %}
{% endtabs %}

## GetAddressInfo

<mark style="color:blue;">`GET`</mark> `https://api.blocksdk.com/v1/bch/address/{address}`

#### Path Parameters

| Name    | Type   | Description         |
| ------- | ------ | ------------------- |
| address | string | BitcoinCash Address |

#### Query Parameters

| Name    | Type    | Description                     |
| ------- | ------- | ------------------------------- |
| reverse | boolean | Reverse transaction information |
| rawtx   | boolean | Get transaction details         |
| offset  | number  | Transaction List Offset         |
| limit   | number  | Number of Transaction to import |

{% tabs %}
{% tab title="200 " %}

```javascript
{
    "cash_address":"qp8sd6zyx0ja34xq2rk4wcmd6eganmx80cxtpm4az8",
    "legacy_address":"18Crf5jR5P9vryyjqPWJh1TZDTGXajcUgr",
    "tx":[...],
    "tx_count":3348,
    "received_count":119,
    "received_total":0.39569261,
    "received_unconfirmed":0,
    "spent_count":3229,
    "spent_total":0.3913941200000001,
    "spent_unconfirmed":0,
    "balance":0.00429849,
    "unconfirmed_count":0,
    "first_time":1575514420,
    "last_time":0
}
```

{% endtab %}
{% endtabs %}

### Response

| Name                  | Type   | Content                                                                |
| --------------------- | ------ | ---------------------------------------------------------------------- |
| address               | string | BitcoinCash Address                                                    |
| tx                    | array  | Transaction originated from address                                    |
| tx\_count             | int    | The number of transactions that occurred at the address                |
| received\_count       | int    | The number of transactions received from the address                   |
| received\_total       | double | Transaction amount received from the address                           |
| received\_unconfirmed | double | Transaction amount not included in the block received from the address |
| spent\_count          | int    | The number of transactions spent from the address                      |
| spent\_total          | double | Transaction amount spent from the address                              |
| spent\_unconfirmed    | double | Transaction amount not included in the block spent from the address    |
| balance               | double | Remaining balance                                                      |
| unconfirmed\_count    | int    | Transaction count not included in address block                        |
| first\_time           | int    | First Deal Creation Time at Address                                    |
| last\_time            | int    | Last transaction creation time from address                            |

{% tabs %}
{% tab title="PHP" %}

```php
$addressInfo = $bchClient->getAddressInfo([
    "address" => "qp8sd6zyx0ja34xq2rk4wcmd6eganmx80cxtpm4az8",
    "rawtx" => true,
    "reverse" => true,
    "offset" => 0,
    "limit" => 10
]);
```

{% endtab %}
{% endtabs %}

## GetAddressBalance

<mark style="color:blue;">`GET`</mark> `https://api.blocksdk.com/v1/bch/address/{address}/balance`

#### Path Parameters

| Name    | Type   | Description         |
| ------- | ------ | ------------------- |
| address | string | BitcoinCash Address |

{% tabs %}
{% tab title="200 " %}

```javascript
{
    "address":"qp8sd6zyx0ja34xq2rk4wcmd6eganmx80cxtpm4az8",
    "balance":0.00429849,
    "unconfirmed_balance":"0.00000000"
}
```

{% endtab %}
{% endtabs %}

### Response

| Name                 | Type   | Content                                                        |
| -------------------- | ------ | -------------------------------------------------------------- |
| address              | string | BitcoinCash Address                                            |
| balance              | double | Balance of the address                                         |
| unconfirmed\_balance | double | Balance of transactions not included in the block of addresses |

{% tabs %}
{% tab title="PHP" %}

```php
$balance = $bchClient->getAddressBalance([
    "address" => "14cK6zRk4zdfbrYG5srA69hCngkV7zDzbt"
]);
```

{% endtab %}
{% endtabs %}

## ListWallet&#x20;

<mark style="color:blue;">`GET`</mark> `https://api.blocksdk.com/v1/bch/wallet`

#### Query Parameters

| Name   | Type   | Description                 |
| ------ | ------ | --------------------------- |
| offset | number | Number of Address to import |
| limit  | number | Address List offset         |

{% tabs %}
{% tab title="200 " %}

```javascript
{
    "items" : [
        {
        "id":31,
        "name":"PLum6KG5bbbLqPovFT5vTCTtPME4Zaaaaaa",
        "created_at":"2019-07-16 08:14:21"
        },
        {
        "id":32,
        "name":"2ypjOjJhbbb3qBiyPhEHpDouyKDt8bbbbb",
        "created_at":"2019-07-16 08:15:56"
        }
    ]
}
```

{% endtab %}
{% endtabs %}

### Response

| Name        | Type     | Content                             |
| ----------- | -------- | ----------------------------------- |
| id          | int      | Unique ID of the wallet             |
| name        | string   | Name specified when creating wallet |
| created\_at | datetime | Date Wallet Was Created             |

{% tabs %}
{% tab title="PHP" %}

```php
$listWallet = $bchClient->listWallet([
    "offset" => 0,
    "limit" => 10
])
```

{% endtab %}
{% endtabs %}

## CreateWallet

<mark style="color:green;">`POST`</mark> `https://api.blocksdk.com/v1/bch/wallet`

#### Request Body

| Name | Type   | Description |
| ---- | ------ | ----------- |
| name | string | Wallet Name |

{% tabs %}
{% tab title="201 " %}

```javascript
{
    "id": 38,
    "name": "test",
    "seed_wif": "abcdefg"
}
```

{% endtab %}
{% endtabs %}

### Response

| Name      | Type   | Content                                                                   |
| --------- | ------ | ------------------------------------------------------------------------- |
| id        | id     | Unique ID of the wallet                                                   |
| name      | string | Wallet name                                                               |
| seed\_wif | string | Seed private key of wallet(This key is not stored on the blocksdk server) |

{% tabs %}
{% tab title="PHP" %}

```php
$wallet = $bchClient->createWallet([
    "name" => "test"
]);
```

{% endtab %}
{% endtabs %}

## LoadWallet

<mark style="color:green;">`POST`</mark> `https://api.blocksdk.com/v1/bch/wallet/{wallet_id}/load`

Load your wallet.\
The loaded wallet does not require seed\_wif when using CreateAddress,SendToAddress,SendMany\
\
※It is not recommended to use

#### Path Parameters

| Name       | Type   | Description      |
| ---------- | ------ | ---------------- |
| wallet\_id | number | Wallet Unique ID |

#### Request Body

| Name      | Type   | Description                             |
| --------- | ------ | --------------------------------------- |
| password  | string | Only available if the wallet is loaded. |
| seed\_wif | string | Wallet seed private key                 |

{% tabs %}
{% tab title="201 " %}

```
[]
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="PHP" %}

```php
$load = $bchClient->loadWallet([
    "wallet_id" => 999,
    "seed_wif" => "abcdefg",
    "password" => "abcdefg"
]);
```

{% endtab %}
{% endtabs %}

## UnloadWallet

<mark style="color:green;">`POST`</mark> `https://api.blocksdk.com/v1/bch/wallet/{wallet_id}/unload`

#### Path Parameters

| Name       | Type   | Description      |
| ---------- | ------ | ---------------- |
| wallet\_id | number | Wallet Unique ID |

{% tabs %}
{% tab title="201 " %}

```
[]
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="PHP" %}

```php
$unload = $bchClient->unloadWallet([
    "wallet_id" => 999
]);
```

{% endtab %}
{% endtabs %}

## GetWalletBalance

<mark style="color:blue;">`GET`</mark> `https://api.blocksdk.com/v1/bch/{wallet_id}/balance`

#### Path Parameters

| Name       | Type   | Description      |
| ---------- | ------ | ---------------- |
| wallet\_id | number | Wallet Unique ID |

{% tabs %}
{% tab title="200 " %}

```
{
    "balance":0,
    "unconfirmed_balance":0
}
```

{% endtab %}
{% endtabs %}

### Response

| Name                 | Type   | Content                                                     |
| -------------------- | ------ | ----------------------------------------------------------- |
| balance              | double | Wallet Balance                                              |
| unconfirmed\_balance | double | Balance of transactions not included in the block of wallet |

{% tabs %}
{% tab title="PHP" %}

```php
$walletBalance = $bchClient->getWalletBalance([
    "wallet_id" => 999
]);
```

{% endtab %}
{% endtabs %}

## ListWalletAddress

<mark style="color:blue;">`GET`</mark> `https://api.blocksdk.com/v1/bch/wallet/{wallet_td}/address`

#### Path Parameters

| Name       | Type   | Description      |
| ---------- | ------ | ---------------- |
| wallet\_id | string | Wallet Unique ID |

#### Query Parameters

| Name      | Type   | Description                      |
| --------- | ------ | -------------------------------- |
| offset    | string | Number of Address to import      |
| limit     | string | Number of transactions to import |
| address   | string | Search by this address           |
| hdkeypath | string | Search by this hdkeypath         |

{% tabs %}
{% tab title="200 " %}

```javascript
{
    "items" : {
        {
            "address":"qp8sd6zyx0ja34xq2rk4wcmd6eganmx80cxtpm4az8",
            "hdkeypath":"m\/0'\/0'\/0'"
        },
        {
            "address":"qp8sd6zyx0ja34xq2rk4wcmd6eganmx80cxtpm4az8",
            "hdkeypath":"m\/0'\/0'\/1'"
        }
    }
}
```

{% endtab %}
{% endtabs %}

### Response

| Name      | Type   | Content                                       |
| --------- | ------ | --------------------------------------------- |
| address   | string | Bitcoin Address                               |
| hdkeypath | string | The HD keypath if the key is HD and available |

{% tabs %}
{% tab title="PHP" %}

```php
$listAddress = $bchClient->listWalletAddress([
    "wallet_id" => 999,
    "offset" => 0,
    "limit" => 10
]);
```

{% endtab %}
{% endtabs %}

## CreateWalletAddress

<mark style="color:green;">`POST`</mark> `https://api.blocksdk.com/v1/bch/wallet/{wallet_id}/address`

#### Path Parameters

| Name       | Type   | Description      |
| ---------- | ------ | ---------------- |
| wallet\_id | string | Wallet Unique ID |

#### Request Body

| Name      | Type   | Description                                                                        |
| --------- | ------ | ---------------------------------------------------------------------------------- |
| password  | string | Only available if the wallet is loaded.                                            |
| seed\_wif | string | Seed private key issued at wallet creation(Not necessary if your wallet is loaded) |

{% tabs %}
{% tab title="201 " %}

```javascript
{
    "address": "qp8sd6zyx0ja34xq2rk4wcmd6eganmx80cxtpm4az8",
    "hdkeypath": "m/0'/0'/0'"
}
```

{% endtab %}
{% endtabs %}

### Response

| Name      | Type   | Content                                       |
| --------- | ------ | --------------------------------------------- |
| address   | string | Bitcoin Address                               |
| hdkeypath | string | The HD keypath if the key is HD and available |

{% tabs %}
{% tab title="PHP" %}

```php
$address = $bchClient->createWalletAddress([
    "wallet_id" => 999,
    "seed_wif" => "abcdefg"
]);

or

$address = $bchClient->createWalletAddress([
    "wallet_id" => 999,
    "password" => "abcdefg"
]);
```

{% endtab %}
{% endtabs %}

## GetWalletTx

<mark style="color:blue;">`GET`</mark> `https://api.blocksdk.com/v1/bch/wallet/{wallet_id}/transaction`

#### Path Parameters

| Name       | Type   | Description      |
| ---------- | ------ | ---------------- |
| wallet\_id | string | Wallet Unique ID |

#### Request Body

| Name     | Type   | Description                                           |
| -------- | ------ | ----------------------------------------------------- |
| category | string | Transaction type to import(all,receive,spent,unspent) |
| order    | string | Sort deals to import(desc,asc)                        |
| offset   | number | Number of Address to import                           |
| limit    | number | Address List offset                                   |

{% tabs %}
{% tab title="200 " %}

```javascript
{
   "items" : { 
       {
            "txid":"ffc243f17d737cb04ad336b4483159fdb13189b267769529d4875f502be27c9b",
            "category":"receive",
            "address":"qp8sd6zyx0ja34xq2rk4wcmd6eganmx80cxtpm4az8",
            "amount":0.0001,
            "confirmations":0
        },
        {
            "txid":"dabe93e37d25ad1d9c7643a68cbffccc0df735178aea655f0d1592557467be8b",
            "category":"receive",
            "address":"qp8sd6zyx0ja34xq2rk4wcmd6eganmx80cxtpm4az8",
            "amount":0.0001,
            "confirmations":0
        }
    }
}
```

{% endtab %}
{% endtabs %}

### Response

| Name          | Type   | Content                                |
| ------------- | ------ | -------------------------------------- |
| txid          | string | Transaction hash                       |
| category      | string | receive or spent                       |
| address       | string | Address where the transaction occurred |
| amount        | double | Transaction balance amount             |
| confirmations | int    | Transaction Confirmation Count         |

{% tabs %}
{% tab title="PHP" %}

```php
$walletTx = $bchClient->getWalletTx([
    "wallet_id" => 999,
    "category" => "all",
    "order" => "desc",
    "offset" => 0,
    "limit" => 10
]);
```

{% endtab %}
{% endtabs %}

## SendToAddress

<mark style="color:green;">`POST`</mark> `https://api.blocksdk.com/v1/bch/wallet/{wallet_id}/sendtoaddress`

&#x20;

#### Path Parameters

| Name       | Type   | Description      |
| ---------- | ------ | ---------------- |
| wallet\_id | string | Wallet Unique ID |

#### Request Body

| Name                  | Type    | Description                                                                                                                    |
| --------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------ |
| subtractfeefromamount | boolean | The fee will be deducted from the amount being sent. The recipient will receive less coins than you enter in the amount field. |
| password              | string  | Only available if the wallet is loaded.                                                                                        |
| kbfee                 | number  | Fee per kilobytes to be used for transactions                                                                                  |
| seed\_wif             | string  | Seed private key issued at wallet creation(Not necessary if your wallet is loaded)                                             |
| amount                | number  | balance to be sent                                                                                                             |
| address               | string  | BitcoinCash Address to Receive                                                                                                 |

{% tabs %}
{% tab title="201 " %}

```javascript
{
	"txid":"dabe93e37d25ad1d9c7643a68cbffccc0df735178aea655f0d1592557467be8b",
	"hash":"dabe93e37d25ad1d9c7643a68cbffccc0df735178aea655f0d1592557467be8b",
	"version":1,
	"size":224,
	"vin":[
		{
			"txid":"159d65808fa552f0bf04626e6a98094de22d1219ad0e9d28a8b8a7f89c4dedd2",
			"vout":0,
			"scriptSig":{
				"asm":"3045022100db441c8f41fbf96fbcb11f1b2a1760b9d6ca03a73093a7df346e983dbaa1dec102204813b339c85d71d5e130328e2be15fa609966a6a1049d095492315d3c4a85ee241 045c5c1b214e3269883a2fc2d9083856be3652e102c3eeae533cec2396e055d292d3a1aebf39b1b8a4d44626b8dc945eb7617b2319bed261152a49c4cc1bc38264",
				"hex":"483045022100db441c8f41fbf96fbcb11f1b2a1760b9d6ca03a73093a7df346e983dbaa1dec102204813b339c85d71d5e130328e2be15fa609966a6a1049d095492315d3c4a85ee24141045c5c1b214e3269883a2fc2d9083856be3652e102c3eeae533cec2396e055d292d3a1aebf39b1b8a4d44626b8dc945eb7617b2319bed261152a49c4cc1bc38264"
			},
			"addresses":["qp8sd6zyx0ja34xq2rk4wcmd6eganmx80cxtpm4az8"],
			"value":0.00084820
		}
	],
	"total_in":0.00084820,
	"vout":[
		{
			"value":0.00084590,
			"n":0,
			"scriptPubKey":{
				"type":"pubkeyhash",
				"asm":"OP_DUP OP_HASH160 4f06e84433e5d8d4c050ed57636dd651d9ecc77e OP_EQUALVERIFY OP_CHECKSIG",
				"hex":"76a9144f06e84433e5d8d4c050ed57636dd651d9ecc77e88ac"
			},
			"addresses":["qp8sd6zyx0ja34xq2rk4wcmd6eganmx80cxtpm4az8"]
		}
	],
	"total_out":0.00084590,
	"in_count":1,
	"out_count":1,
	"fee":0.00000230,
	"fee_per_kb":0.00001027,
	"locktime":0,
	"block_hash":"000000000000000002c0be4e85a5f470e36615b1b393cfb35c11de98e112c80d",
	"block_height":613544,
	"time":1576477136,
	"confirmations":3
}
```

{% endtab %}
{% endtabs %}

### Response

Return [Tx](https://blockchen.gitbook.io/api/bitcoin#tx) on Success

{% tabs %}
{% tab title="PHP" %}

```php
$tx = $bchClient->sendToAddress([
    "wallet_id" => 999,
    "seed_wif" => "abcdefg",
    "address" => "qp8sd6zyx0ja34xq2rk4wcmd6eganmx80cxtpm4az8",
    "amount" => 0.1,
    "kbfee" => 0.0001
])

or

$tx = $bchClient->sendToAddress([
    "wallet_id" => 999,
    "password" => "abcdefg",
    "address" => "qp8sd6zyx0ja34xq2rk4wcmd6eganmx80cxtpm4az8",
    "amount" => 0.1,
    "kbfee" => 0.0001
])
```

{% endtab %}
{% endtabs %}

## SendMany

<mark style="color:green;">`POST`</mark> `https://api.blocksdk.com/v1/bch/wallet/{wallet_id}/sendmany`

#### Path Parameters

| Name       | Type   | Description      |
| ---------- | ------ | ---------------- |
| wallet\_id | string | Wallet Unique ID |

#### Request Body

| Name                  | Type    | Description                                                                                                                    |
| --------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------ |
| subtractfeefromamount | boolean | The fee will be deducted from the amount being sent. The recipient will receive less coins than you enter in the amount field. |
| password              | string  | Only available if the wallet is loaded.                                                                                        |
| to                    | object  | Receiving Information                                                                                                          |
| kbfee                 | number  | Fee per kilobytes to be used for transactions                                                                                  |
| seed\_wif             | string  | Seed private key issued at wallet creation(Not necessary if your wallet is loaded)                                             |

{% tabs %}
{% tab title="201 " %}

```javascript
{
	"txid":"dabe93e37d25ad1d9c7643a68cbffccc0df735178aea655f0d1592557467be8b",
	"hash":"dabe93e37d25ad1d9c7643a68cbffccc0df735178aea655f0d1592557467be8b",
	"version":1,
	"size":224,
	"vin":[
		{
			"txid":"159d65808fa552f0bf04626e6a98094de22d1219ad0e9d28a8b8a7f89c4dedd2",
			"vout":0,
			"scriptSig":{
				"asm":"3045022100db441c8f41fbf96fbcb11f1b2a1760b9d6ca03a73093a7df346e983dbaa1dec102204813b339c85d71d5e130328e2be15fa609966a6a1049d095492315d3c4a85ee241 045c5c1b214e3269883a2fc2d9083856be3652e102c3eeae533cec2396e055d292d3a1aebf39b1b8a4d44626b8dc945eb7617b2319bed261152a49c4cc1bc38264",
				"hex":"483045022100db441c8f41fbf96fbcb11f1b2a1760b9d6ca03a73093a7df346e983dbaa1dec102204813b339c85d71d5e130328e2be15fa609966a6a1049d095492315d3c4a85ee24141045c5c1b214e3269883a2fc2d9083856be3652e102c3eeae533cec2396e055d292d3a1aebf39b1b8a4d44626b8dc945eb7617b2319bed261152a49c4cc1bc38264"
			},
			"addresses":["qp8sd6zyx0ja34xq2rk4wcmd6eganmx80cxtpm4az8"],
			"value":0.00084820
		}
	],
	"total_in":0.00084820,
	"vout":[
		{
			"value":0.00084590,
			"n":0,
			"scriptPubKey":{
				"type":"pubkeyhash",
				"asm":"OP_DUP OP_HASH160 4f06e84433e5d8d4c050ed57636dd651d9ecc77e OP_EQUALVERIFY OP_CHECKSIG",
				"hex":"76a9144f06e84433e5d8d4c050ed57636dd651d9ecc77e88ac"
			},
			"addresses":["qp8sd6zyx0ja34xq2rk4wcmd6eganmx80cxtpm4az8"]
		}
	],
	"total_out":0.00084590,
	"in_count":1,
	"out_count":1,
	"fee":0.00000230,
	"fee_per_kb":0.00001027,
	"locktime":0,
	"block_hash":"000000000000000002c0be4e85a5f470e36615b1b393cfb35c11de98e112c80d",
	"block_height":613544,
	"time":1576477136,
	"confirmations":3
}
```

{% endtab %}
{% endtabs %}

### Example PostData

```
{
   "to":{
     	"qp8sd6zyx0ja34xq2rk4wcmd6eganmx80cxtpm4az8":0.0001,
		 "qp8sd6zyx0ja34xq2rk4wcmd6eganmx80cxtpm4az8":0.0001
   },
   "kbfee":0.00001,
   "seed_wif" : "abcdefg"
}
```

### Response

Return [Tx](https://blockchen.gitbook.io/api/bitcoin#tx) on Success

{% tabs %}
{% tab title="PHP" %}

```php
$tx = $bchClient->sendMany([
    "wallet_id" => 999,
    "seed_wif" => "abcdefg",
    "to" => [
        "qp8sd6zyx0ja34xq2rk4wcmd6eganmx80cxtpm4az8" => 0.0001,
        "qp8sd6zyx0ja34xq2rk4wcmd6eganmx80cxtpm4az8" => 0.0001
    ],
    "kbfee" => 0.0001,
    "seed_wif" => "abcdefg"
]);

or

$tx = $bchClient->sendMany([
    "wallet_id" => 999,
    "password" => "abcdefg",
    "to" => [
        "qp8sd6zyx0ja34xq2rk4wcmd6eganmx80cxtpm4az8" => 0.0001,
        "qp8sd6zyx0ja34xq2rk4wcmd6eganmx80cxtpm4az8" => 0.0001
    ],
    "kbfee" => 0.0001,
    "seed_wif" => "abcdefg"
]);
```

{% endtab %}
{% endtabs %}

## GetTransaction

<mark style="color:blue;">`GET`</mark> `https://api.blocksdk.com/v1/bch/transaction/{hash}`

#### Path Parameters

| Name | Type   | Description      |
| ---- | ------ | ---------------- |
| hash | string | transaction hash |

{% tabs %}
{% tab title="201 " %}

```javascript
{
	"txid":"dabe93e37d25ad1d9c7643a68cbffccc0df735178aea655f0d1592557467be8b",
	"hash":"dabe93e37d25ad1d9c7643a68cbffccc0df735178aea655f0d1592557467be8b",
	"version":1,
	"size":224,
	"vin":[
		{
			"txid":"159d65808fa552f0bf04626e6a98094de22d1219ad0e9d28a8b8a7f89c4dedd2",
			"vout":0,
			"scriptSig":{
				"asm":"3045022100db441c8f41fbf96fbcb11f1b2a1760b9d6ca03a73093a7df346e983dbaa1dec102204813b339c85d71d5e130328e2be15fa609966a6a1049d095492315d3c4a85ee241 045c5c1b214e3269883a2fc2d9083856be3652e102c3eeae533cec2396e055d292d3a1aebf39b1b8a4d44626b8dc945eb7617b2319bed261152a49c4cc1bc38264",
				"hex":"483045022100db441c8f41fbf96fbcb11f1b2a1760b9d6ca03a73093a7df346e983dbaa1dec102204813b339c85d71d5e130328e2be15fa609966a6a1049d095492315d3c4a85ee24141045c5c1b214e3269883a2fc2d9083856be3652e102c3eeae533cec2396e055d292d3a1aebf39b1b8a4d44626b8dc945eb7617b2319bed261152a49c4cc1bc38264"
			},
			"addresses":["qp8sd6zyx0ja34xq2rk4wcmd6eganmx80cxtpm4az8"],
			"value":0.00084820
		}
	],
	"total_in":0.00084820,
	"vout":[
		{
			"value":0.00084590,
			"n":0,
			"scriptPubKey":{
				"type":"pubkeyhash",
				"asm":"OP_DUP OP_HASH160 4f06e84433e5d8d4c050ed57636dd651d9ecc77e OP_EQUALVERIFY OP_CHECKSIG",
				"hex":"76a9144f06e84433e5d8d4c050ed57636dd651d9ecc77e88ac"
			},
			"addresses":["qp8sd6zyx0ja34xq2rk4wcmd6eganmx80cxtpm4az8"]
		}
	],
	"total_out":0.00084590,
	"in_count":1,
	"out_count":1,
	"fee":0.00000230,
	"fee_per_kb":0.00001027,
	"locktime":0,
	"block_hash":"000000000000000002c0be4e85a5f470e36615b1b393cfb35c11de98e112c80d",
	"block_height":613544,
	"time":1576477136,
	"confirmations":3
}
```

{% endtab %}
{% endtabs %}

### Response

Return [Tx](https://blockchen.gitbook.io/api/bitcoin#tx) on Success

{% tabs %}
{% tab title="PHP" %}

```php
$tx = $bchClient->getTransaction([
    "hash" => "892235a5aa0f52c2240603e9ca55012f0c76fee688623961003eae1f0ede4506	"
]);
```

{% endtab %}
{% endtabs %}

## SendTransaction

<mark style="color:green;">`POST`</mark> `https://api.blocksdk.com/v1/bch/transaction`

#### Request Body

| Name      | Type   | Description            |
| --------- | ------ | ---------------------- |
| sign\_hex | string | signed transaction hex |

{% tabs %}
{% tab title="201 " %}

```javascript
{
	"txid":"dabe93e37d25ad1d9c7643a68cbffccc0df735178aea655f0d1592557467be8b",
	"hash":"dabe93e37d25ad1d9c7643a68cbffccc0df735178aea655f0d1592557467be8b",
	"version":1,
	"size":224,
	"vin":[
		{
			"txid":"159d65808fa552f0bf04626e6a98094de22d1219ad0e9d28a8b8a7f89c4dedd2",
			"vout":0,
			"scriptSig":{
				"asm":"3045022100db441c8f41fbf96fbcb11f1b2a1760b9d6ca03a73093a7df346e983dbaa1dec102204813b339c85d71d5e130328e2be15fa609966a6a1049d095492315d3c4a85ee241 045c5c1b214e3269883a2fc2d9083856be3652e102c3eeae533cec2396e055d292d3a1aebf39b1b8a4d44626b8dc945eb7617b2319bed261152a49c4cc1bc38264",
				"hex":"483045022100db441c8f41fbf96fbcb11f1b2a1760b9d6ca03a73093a7df346e983dbaa1dec102204813b339c85d71d5e130328e2be15fa609966a6a1049d095492315d3c4a85ee24141045c5c1b214e3269883a2fc2d9083856be3652e102c3eeae533cec2396e055d292d3a1aebf39b1b8a4d44626b8dc945eb7617b2319bed261152a49c4cc1bc38264"
			},
			"addresses":["qp8sd6zyx0ja34xq2rk4wcmd6eganmx80cxtpm4az8"],
			"value":0.00084820
		}
	],
	"total_in":0.00084820,
	"vout":[
		{
			"value":0.00084590,
			"n":0,
			"scriptPubKey":{
				"type":"pubkeyhash",
				"asm":"OP_DUP OP_HASH160 4f06e84433e5d8d4c050ed57636dd651d9ecc77e OP_EQUALVERIFY OP_CHECKSIG",
				"hex":"76a9144f06e84433e5d8d4c050ed57636dd651d9ecc77e88ac"
			},
			"addresses":["qp8sd6zyx0ja34xq2rk4wcmd6eganmx80cxtpm4az8"]
		}
	],
	"total_out":0.00084590,
	"in_count":1,
	"out_count":1,
	"fee":0.00000230,
	"fee_per_kb":0.00001027,
	"locktime":0,
	"block_hash":"000000000000000002c0be4e85a5f470e36615b1b393cfb35c11de98e112c80d",
	"block_height":613544,
	"time":1576477136,
	"confirmations":3
}
```

{% endtab %}
{% endtabs %}

### Response

Return [Tx](https://blockchen.gitbook.io/api/bitcoin#tx) on Success

{% tabs %}
{% tab title="PHP" %}

```php
$tx = $bchClient->sendTransaction([
    "sign_hex" => "abcdefg"
])
```

{% endtab %}
{% endtabs %}
