Skip to content

Not Generating Address for Testnet #5

Open
@RohitSingh107

Description

@RohitSingh107

I am trying to use library with testnet but it always generate address for mainnet. Here is my code:

use bip47::PublicCode;
use bip47::PrivateCode;
use bip47::bitcoin::Network;

fn main() {
    let alice_seed = String::from("Here I had my secret seed");
    // Alice constructs her own payment code using a BIP32 seed
    let alice_private = PrivateCode::from_seed(&alice_seed.as_bytes(), 0, Network::Testnet).unwrap();


    println!("Alice Public code: {}", alice_private.v2_public_code());

    // let bob_public = PublicCode::from_wif("PM8TJS2JxQ5ztXUpBBRnpTbcUXbUHy2T1abfrb3KkAAtMEGNbey4oumH7Hc578WgQJhPjBxteQ5GHHToTYHE3A1w6p7tU6KSoFmWBVbFGjKPisZDbP97").unwrap();
    let bob_public = PublicCode::from_wif("PM8TJPb3pgoZ5Gxs1kzYkkLQoHnnwHMvwP87SEeteG8F1eCx8PBVi8Zpf9wo44SJAFSLWyiXpXSw3y9SMKzaHpQFgEixJwZpP2zUAHsZhEf3ZS3JFymB").unwrap();

    // Alice parses Bob's payment code
    println!("Boc's Public payment code: {:?}", bob_public.to_string());

    // Alice calculates Bob's receive address at index 0, known only to them
    let bob_address_0 = bob_public.address(&alice_private, 0, false).unwrap();

    // Alice can now pay Bob privately
    println!("Bob's Private Payment code: {}", bob_address_0.to_string());
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions