#hd-wallet #filecoin #wallet

hdwallet-filecoin

HD Wallet for Filecoin, including key generation, derivation and signing

3 unstable releases

0.2.1 Nov 3, 2023
0.2.0 Nov 3, 2023
0.1.0 Oct 30, 2023

#4 in #hd-wallet

MIT license

35KB
761 lines

hdwallet-filecoin

Hierarchical Deterministic Wallet for filecoin.

This implemention follows:

Usage

use hdwallet_filecoin::{new_mnemonic, SecretKey};

fn main() {
    let mnemonic = new_mnemonic().unwrap();
    println!("{}", mnemonic);
    let seed = mnemonic.to_seed("");

    let sk = SecretKey::from_seed_bls(&seed).unwrap();
    // You can also use SecretKey::from_seed_secp256k1 to generate a secp256k1 key
    let pk = sk.public_key();
    println!("{}", pk.address());

    let msg = b"hello world";
    let sig = sk.sign(msg).unwrap();

    assert!(sig.verify(msg, &pk).is_ok());
}

Thanks to these projects for reference

Dependencies

~19MB
~499K SLoC