# deriveAddressAndPublicKey

The `deriveAddressAndPublicKey` method derives an address and public key from a predecessor ID and derivation path.

## Usage

```ts twoslash
// [!include ~/snippets/code/chains.ts]
// ---cut---
const predecessor = '0x8626f6940E2eb28930eFb4CeF49B2d1F2C9C1199'
const path = 'my_derivation_path'
const keyVersion = 1

const { address, publicKey } = await evmChain.deriveAddressAndPublicKey(
  predecessor,
  path,
  keyVersion
)
```

## Parameters

| Parameter     | Type     | Description                                          |
| ------------- | -------- | ---------------------------------------------------- |
| `predecessor` | `string` | The wallet/contract address requesting the signature |
| `path`        | `string` | The derivation path to use                           |
| `keyVersion`  | `number` | The version of the MPC key to use                    |

## Returns

| Property    | Type     | Description                                                                  |
| ----------- | -------- | ---------------------------------------------------------------------------- |
| `address`   | `string` | The derived address                                                          |
| `publicKey` | `string` | The derived public key (compressed for Bitcoin/Cosmos, uncompressed for EVM) |

## Working Examples

* [EVM E2E](https://github.com/sig-net/signet.js/blob/main/tests/e2e/evm/EVM.e2e.test.ts) — derive EVM address from MPC key
* [Bitcoin E2E](https://github.com/sig-net/signet.js/blob/main/tests/e2e/btc/BTC.e2e.test.ts) — derive P2WPKH address from MPC key
* [Cosmos E2E](https://github.com/sig-net/signet.js/blob/main/tests/e2e/cosmos/Cosmos.e2e.test.ts) — derive bech32 address from MPC key
