# Address & XPUB

## Get Address

Get the address of `CoinType` and BIP44 Key Path using `getAddress()` function.

### **Parameters**

* coinType: coin type
* addressPath: key path to get address

### **Returns**

* result: (Bool) `true` if successful, `false` if error occurred
* address: address
* pubkey: public key value(pubkey exists only when the coinType is `.TEZOS` , `.XTZ_FA`, `.TEZOS_TESTNET` and `.XTZ_FA_TESTNET`)

**Example(bitcoin)**

```swift
// key path of the account
let keyPath = "m/44'/0'/0'/0/0/"
DcentMgr.getAddress(coinType: .BITCOIN, addressPath: keyPath) { (result, address, pubkey) in
    if result {
        ///
        print("success")
        print("address >> " + address)
    }
    else {
        print("fail")
    }
}
```

## Get XPUB

Get a xpub key of BIP44 Key Path or BIP32 master key using `requestExtractPublicKey()` function.

### **Parameters**

* KeyPath: key path to extract public key

### **Returns**

* result: (Bool) `true` if successful, `false` if error occurred
* publickey: extract public key

**Example**

```swift
// Hardened key path
let keyPath = "m/44'/0'"
DcentMgr.requestExtractPublicKey( KeyPath: keyPath) { (result, publickey) in
    if result {
        ///
        print("success")
        print("public key  >> " + publickey)
    }
    else {
        print("fail")
    }
}
```


---

# 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-mobile/dcent-biometric-sdk-ios/address-and-xpub.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.
