Struct bitcoin::util::ecdsa::PublicKey [−][src]
A Bitcoin ECDSA public key
Fields
compressed: bool
Whether this public key should be serialized as compressed
key: PublicKey
The actual ECDSA key
Implementations
impl PublicKey
[src]
impl PublicKey
[src]pub fn new(key: PublicKey) -> PublicKey
[src]
Constructs compressed ECDSA public key from the provided generic Secp256k1 public key
pub fn new_uncompressed(key: PublicKey) -> PublicKey
[src]
Constructs uncompressed (legacy) ECDSA public key from the provided generic Secp256k1 public key
pub fn pubkey_hash(&self) -> PubkeyHash
[src]
Returns bitcoin 160-bit hash of the public key
pub fn wpubkey_hash(&self) -> Option<WPubkeyHash>
[src]
Returns bitcoin 160-bit hash of the public key for witness program
pub fn write_into<W: Write>(&self, writer: W) -> Result<(), Error>
[src]
Write the public key into a writer
pub fn read_from<R: Read>(reader: R) -> Result<Self, Error>
[src]
Read the public key from a reader
This internally reads the first byte before reading the rest, so
use of a BufReader
is recommended.
pub fn to_bytes(&self) -> Vec<u8>
[src]
Serialize the public key to bytes
pub fn from_slice(data: &[u8]) -> Result<PublicKey, Error>
[src]
Deserialize a public key from a slice
pub fn from_private_key<C: Signing>(
secp: &Secp256k1<C>,
sk: &PrivateKey
) -> PublicKey
[src]
secp: &Secp256k1<C>,
sk: &PrivateKey
) -> PublicKey
Computes the public key as supposed to be used with this secret
Trait Implementations
impl Deserialize for PublicKey
[src]
impl Deserialize for PublicKey
[src]impl<'de> Deserialize<'de> for PublicKey
[src]
impl<'de> Deserialize<'de> for PublicKey
[src]fn deserialize<D: Deserializer<'de>>(d: D) -> Result<PublicKey, D::Error>
[src]
impl PartialOrd<PublicKey> for PublicKey
[src]
impl PartialOrd<PublicKey> for PublicKey
[src]