# PublicKey.from

Instantiates a typed [`PublicKey.PublicKey`](/api/PublicKey/types#publickey) object from a [`PublicKey.PublicKey`](/api/PublicKey/types#publickey), [`Bytes.Bytes`](/api/Bytes/types#bytes), or [`Hex.Hex`](/api/Hex/types#hex).

## Imports

:::code-group
```ts [Named]
import { PublicKey } from 'ox'
```

```ts [Entrypoint]
import * as PublicKey from 'ox/PublicKey'
```
:::

## Examples

```ts twoslash
import { PublicKey } from 'ox'

const publicKey = PublicKey.from({
  prefix: 4,
  x: '0x8318535b54105d4a7aae60c08fc45f9687181b4fdfc625bd1a753fa7397fed75',
  y: '0x3547f11ca8696646f2f3acb08e31016afac23e630c5d11f59f61fef57b0d2aa5'
})
// @log: {
// @log:   prefix: 4,
// @log:   x: '0x8318535b54105d4a7aae60c08fc45f9687181b4fdfc625bd1a753fa7397fed75',
// @log:   y: '0x3547f11ca8696646f2f3acb08e31016afac23e630c5d11f59f61fef57b0d2aa5',
// @log: }
```

### From Serialized

```ts twoslash
import { PublicKey } from 'ox'

const publicKey = PublicKey.from(
  '0x048318535b54105d4a7aae60c08fc45f9687181b4fdfc625bd1a753fa7397fed753547f11ca8696646f2f3acb08e31016afac23e630c5d11f59f61fef57b0d2aa5'
)
// @log: {
// @log:   prefix: 4,
// @log:   x: '0x8318535b54105d4a7aae60c08fc45f9687181b4fdfc625bd1a753fa7397fed75',
// @log:   y: '0x3547f11ca8696646f2f3acb08e31016afac23e630c5d11f59f61fef57b0d2aa5',
// @log: }
```

## Definition

```ts
function from<publicKey>(
  value: from.Value<publicKey>,
): from.ReturnType<publicKey>
```

**Source:** [src/core/PublicKey.ts](https://github.com/wevm/ox/blob/main/src/core/PublicKey.ts#L568)

## Parameters

### value

* **Type:** `from.Value<publicKey>`

The public key value to instantiate.

#### value.prefix

* **Type:** `number`
* **Optional**

## Return Type

The instantiated [`PublicKey.PublicKey`](/api/PublicKey/types#publickey).

`from.ReturnType<publicKey>`
