<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.15.0 -",
    "tvOS: 13.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 6.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "P256K",
  "identifier" : "/documentation/P256K/P256K/Schnorr/PublicKey",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "P256K"
    ],
    "preciseIdentifier" : "s:5P256KAAO7SchnorrO9PublicKeyV"
  },
  "title" : "P256K.Schnorr.PublicKey"
}
-->

# P256K.Schnorr.PublicKey

secp256k1
[BIP-340](https://github.com/bitcoin/bips/blob/master/bip-0340.mediawiki) Schnorr
public key in compressed or uncompressed form, from which the x-only key used
for signature verification is derived via the [`xonly`](/documentation/P256K/P256K/Schnorr/PublicKey/xonly) property.

```
struct PublicKey
```

## Overview

For BIP-340 Schnorr signature verification, use the [`xonly`](/documentation/P256K/P256K/Schnorr/PublicKey/xonly) property of this
key. The full [`P256K.Schnorr.PublicKey`](/documentation/P256K/P256K/Schnorr/PublicKey) is provided for contexts that require the complete
curve point, such as key aggregation ([`aggregate(_:)`](/documentation/P256K/P256K/MuSig/aggregate(_:))) or
[BIP-341](https://github.com/bitcoin/bips/blob/master/bip-0341.mediawiki)
Taproot key-path spending.

## Topics

### Construction

[`init(xonlyKey:)`](/documentation/P256K/P256K/Schnorr/PublicKey/init(xonlyKey:))

Creates a compressed secp256k1 public key from an x-only key by prepending the 0x02 (even-Y) or 0x03 (odd-Y) parity prefix.

[`init(dataRepresentation:format:)`](/documentation/P256K/P256K/Schnorr/PublicKey/init(dataRepresentation:format:))

Creates a secp256k1 Schnorr public key from serialized bytes.

### Serialized Forms

[`dataRepresentation`](/documentation/P256K/P256K/Schnorr/PublicKey/dataRepresentation)

The serialized public key bytes as `Data`, in the key’s [`format`](/documentation/P256K/P256K/Schnorr/PublicKey/format).

[`format`](/documentation/P256K/P256K/Schnorr/PublicKey/format)

The serialization format of this public key: `.compressed` (33 bytes) or
`.uncompressed` (65 bytes).

[`xonly`](/documentation/P256K/P256K/Schnorr/PublicKey/xonly)

The 32-byte x-only public key (X coordinate only) derived from this key for
use in BIP-340 Schnorr signature verification.

