# Bitcoin

## Sign Transaction

The D'CENT Web SDK provides functions for signing transaction of coins.

### **getBitcoinSignedTransaction()**

#### Supported Coin Type

* BITCOIN
* MONACOIN

#### Parameters :

* transaction: this value generated by `getBitcoinTransactionObject()`

#### Usage:

```javascript
// generate Bitcoin Transaction object
let transaction = DcentWebConnector.getBitcoinTransactionObject(dcent.coinType.BITCOIN)
// Set input parameter(previous tx) in Bitcoin Transaction object
transaction = DcentWebConnector.addBitcoinTransactionInput(transaction,
    '0100000001e297417c46........293fce63b88ac00000000', //  full of previous tx data
    1, // index of previous tx output to be sent
    dcent.bitcoinTxType.p2pkh, // bitcoin tx type for this UTXO
    "m/44'/0'/0'/1/0") // signing key path
transaction = DcentWebConnector.addBitcoinTransactionInput(transaction,
    '0100000001e297417c46.........93fce63b88ac00000000',
    0,
    dcent.bitcoinTxType.p2pkh,
    "m/44'/0'/0'/0/7")
// Set output parameter(spending information) in Bitcoin Transaction object
transaction = DcentWebConnector.addBitcoinTransactionOutput(transaction,
        dcent.bitcoinTxType.p2pkh, // transaction type or this field can indicate output as a “change”
        '10000', // amount of coin to spend. Satoshi unit.
        ['1traqiFvydVk2hWdCj3WGRJbe4CGtfyHA']) // Base58Check encoded address of the receiver.
    result = await DcentWebConnector.getBitcoinSignedTransaction(transaction)
```

#### Returned response object:

```json
{
    "header": {
        "version": "1.0",
        "response_from": "erc20",
        "status": "success"
    },
    "body": {
        "command": "transaction",
        "parameter": {
            "signed": "0100000002233ee1fbcf.....71e088ac00000000"
        }
    }
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://dev-docs.dcentwallet.com/dcent-biometric-wallet-for-pc/dcent-web-connector/bitcoin.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
