ElementsProject / rust-elements

Rust support for Elements transaction/block deserialization

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

WIF

uncomputable opened this issue · comments

Is the wallet import format defined for Elements? The generation involves prepending a byte that signifies the network. For Elements, is there something similar for the different address parameters? If so, then this method is currently missing.

WIF would be useful for importing output descriptors. I could write a PR that mimics rust-bitcoin.

I think so, but you want to use xprvs rather than WIF keys.

I found out the definition, but Elements uses bitcoin::PublicKey and bitcoin::SecretKey. Adding a custom WIF method would mean writing a custom elements::SecretKey, which seems a bit much.

Unless we want to do the extra work, let's close the issue. The following code is a workaround:

let network = match params {
    &AddressParams::LIQUID => bitcoin::Network::Bitcoin,
    _ => bitcoin::Network::Regtest,
};
let prv = bitcoin::PrivateKey::new(secret_key, network);

Well, if we need elements WIF keys we should add support .... but what are you doing with WIF private keys?