PublicKey

data class PublicKey(val value: ByteVector)

A bitcoin public key (in compressed form). A public key is valid if it represents a point on the secp256k1 curve. The validity of this public key is not checked by default, because when you create a public key from a private key it will always be valid. However, if you receive a public key from an external, untrusted source, you should call isValid() before actually using it.

Constructors

Link copied to clipboard
fun PublicKey(data: ByteArray)
Link copied to clipboard
fun PublicKey(value: ByteVector)

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
fun hash160(): ByteArray
Link copied to clipboard
fun isEven(): Boolean
Link copied to clipboard
fun isOdd(): Boolean
Link copied to clipboard
fun isValid(): Boolean

A public key is valid if it represents a point on the secp256k1 curve.

Link copied to clipboard
operator fun minus(that: PublicKey): PublicKey
Link copied to clipboard
fun p2pkhAddress(chainHash: ByteVector32): String
Link copied to clipboard
fun p2shOfP2wpkhAddress(chainHash: ByteVector32): String
Link copied to clipboard
fun p2wpkhAddress(chainHash: ByteVector32): String
Link copied to clipboard
operator fun plus(that: PublicKey): PublicKey
Link copied to clipboard
operator fun times(that: PrivateKey): PublicKey
Link copied to clipboard
fun toHex(): String
Link copied to clipboard
open override fun toString(): String
Link copied to clipboard
fun toUncompressedBin(): ByteArray
Link copied to clipboard
operator fun unaryMinus(): PublicKey
Link copied to clipboard
fun xOnly(): XonlyPublicKey

Properties

Link copied to clipboard
val value: ByteVector