bitcoinwallet-library

Crates.iobitcoinwallet-library
lib.rsbitcoinwallet-library
version0.1.16-alpha.0
sourcesrc
created_at2023-01-20 04:50:54.254155
updated_at2023-04-02 13:37:49.762797
descriptiona wallet maintains a set of transactions and balances, and provides the ability to create new transactions
homepage
repositoryhttps://github.com/klebz/bitcoin-rs
max_upload_size
id763147
size240,653
(klebs6)

documentation

https://docs.rs/bitcoinwallet-library

README

bitcoinwallet-library

This Rust crate is a direct translation from C++ to Rust of the Bitcoin Core wallet implementation. It provides functions for creating and managing Bitcoin wallets, including generating new private keys, signing transactions, and synchronizing with the Bitcoin network.

Notice: This crate is part of a direct translation from C++ to Rust of the Bitcoin Core. As such, some of the function bodies may still be in the process of translation. Please note that this system will become testable once the translation process is complete.

The following mathematical concepts are associated with some of the tokens used in this crate:

  • Private key: A private key in Bitcoin is a randomly generated 256-bit integer. It is used to generate the public key, which in turn is used to create a Bitcoin address. The private key is also used to sign transactions. The security of the Bitcoin system relies on the fact that it is computationally infeasible to derive the private key from the public key or the Bitcoin address. The equation for generating a Bitcoin public key from a private key is:

    public_key = G * private_key
    

    where G is the generator point of the elliptic curve used in Bitcoin's digital signature algorithm.

  • Public key: A public key in Bitcoin is a point on the elliptic curve generated by multiplying the generator point G by the private key. The public key is used to create a Bitcoin address and to verify the digital signature of a transaction. The equation for verifying a digital signature in Bitcoin is:

    sG = R + eP
    

    where s is the signature, R is the signature's first component, e is the message hash, G is the generator point, and P is the public key.

  • Bitcoin address: A Bitcoin address is a 160-bit hash of the public key. It is used to receive Bitcoin payments. The equation for generating a Bitcoin address from a public key is:

    address = RIPEMD160(SHA256(public_key))
    

    where RIPEMD160 and SHA256 are hash functions used in Bitcoin.

  • Transaction: A transaction in Bitcoin is a signed message that transfers Bitcoin from one address to another. The transaction includes the input(s), which are the Bitcoin(s) to be spent, and the output(s), which are the Bitcoin(s) to be received. The equation for signing a Bitcoin transaction is:

    s = k^(-1)(e + da) mod n
    

    where s is the signature, k is a random number, e is the message hash, d is the private key, a is the ephemeral public key, and n is the order of the elliptic curve.

Commit count: 48

cargo fmt