# Stellar

## Sign Transaction

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

### **getStellarSignedTransaction()**

#### Supported Coin Type

* STELLAR

#### Parameters&#x20;

* transactionJson: this value conforms JSON format of Transaction Types in [Stellar Docs](https://developers.stellar.org/docs/tutorials/send-and-receive-payments)

#### Requirements

* `D'CENT Bridge` version 1.4.0 or higher is required.
* D'CENT Biometric Wallet version 2.20.0 or higher is required.

#### Useage&#x20;

```javascript
const _buf2hex = (buffer) => { // buffer is an ArrayBuffer
    return Array.prototype.map.call(new Uint8Array(buffer), x => ('00' + x.toString(16)).slice(-2)).join('');
}
const server = new StellarSdk.Server('https://horizon.stellar.org')
const account = await server.loadAccount(address)

// Operation
const operationXdr = StellarSdk.Operation.createAccount({
    destination: toAddr,
    startingBalance: amount
})

// Builder
const transactionBuilder = new StellarSdk.TransactionBuilder(account, { 
    fee: StellarSdk.BASE_FEE,
    networkPassphrase: StellarSdk.Networks.TESTNET
})
.addOperation(operationXdr)
.setTimeout(300)
.build()

const unsignedTx = _buf2hex(transactionBuilder.signatureBase())

const transactionJson = {
    unsignedTx: unsignedTx,
    fee: StellarSdk.BASE_FEE
    path: `m/44'/148'/0'`,
}

var result
try {
    result = await DcentWebConnector.getStellarSignedTransaction(transactionJson);    
} catch (e) {
    console.log(e)
    result = e
}
```

#### Returned response object

```json
{
    "header": {
        "version": "1.0",
        "response_from": "stellar",
        "status": "success"
    },
    "body": {
        "command": "transaction",
        "parameter": {
            "signed_tx": "0x9b1cb82eb924178980b1d35f99ae24142d25ba08efabd1dfe7f4741028d03f3fe80770b395176b9d49381d98660e2746d38986b4e31af738524ca0936a7aa901",
            "pubkey": "0x283957814f67abe6eda79128d3d54655a1ec8c595aece2c12f0848461a4ef659"
        }
    }
}
```


---

# 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/stellar.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.
