Giter Site home page Giter Site logo

0xcregis / anychain Goto Github PK

View Code? Open in Web Editor NEW
85.0 5.0 12.0 1.3 MB

Multi-chain Rust wallet sdk, supports Bitcoin, Ethereum, Tron, Filecoin, etc. https://cregisoffical.gitbook.io/anychain/

Home Page: https://www.cregis.com

License: MIT License

Rust 99.96% Shell 0.01% Makefile 0.03%
bitcoin ethereum filcoin polkadot rust tron tron-sdk neo ripple

anychain's Introduction

Anychain

A Rust library for multi-chain cryptowallet, supporting transactions of crypto assets on many different public blockchains including Bitcoin, Ethereum, Tron, Filecoin, etc.

Rust CI

Features

Common Traits when it comes to building transactions for different blockchains, they are

  • PublicKey
  • Address
  • Amount
  • Transaction
  • Network
  • Format

Common crates used in building transactions for different blockchains, they are

  • base58
  • secp256k1
  • hex
  • rand

Functions

  • Build raw unsigned transactions for different blockchains according to parameters taken from the user of this library

  • Build signed transactions for different blockchains by merging the raw transaction and the corresponding signature taken from the user of this library

Build the source

cargo build --release

Crates

Name Description Crates.io Documentation
anychain-core Core types and traits. Crates.io Documentation
anychain-kms BIP32、BIP39. Crates.io Documentation
anychain-bitcoin Bitcoin impl. Crates.io Documentation
anychain-ethereum Ethereum impl. Crates.io Documentation
anychain-filecoin Filecoin impl. Crates.io Documentation
anychain-tron Tron impl. Crates.io Documentation
anychain-ripple Ripple impl. Crates.io Documentation
anychain-polkadot Polkadot impl. Crates.io Documentation

Supported Chains

  • Bitcoin
  • BitcoinCash
  • Dogecoin
  • Litecoin
  • Ethereum
  • Filecoin
  • Tron
  • Ripple
  • Arbitrum, Optimism, and Avalanche
  • Polkadot
  • Neo

License

This project is licensed under the MIT license.

Contact

Feel free to join anychain sdk Telegram for discussions on code and research.

anychain's People

Contributors

aya015757881 avatar lvyaoting avatar shawndslee avatar shuimuliang avatar udun-cloud avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

anychain's Issues

feat: anychain-bitcoin-cli binary

  1. use clap 4.x crate
  2. Implement a binary to support the following operations:
    1. Generates Bitcoin addresses from a secret key
    2. Generates Bitcoin addresses from a public key
    3. Parses a Bitcoin address from a string
    4. Validates a Bitcoin address
    5. Generates Bitcoin amounts in satoshi from BTC and satoshi values
    6. Generates a Bitcoin transaction
anychain/
  examples/
    anychain-bitcoin-client/
      src/
        main.rs
      Cargo.toml

feat: anychain-ethereum-cli binary

  1. use clap 4.x crate
  2. Implement a binary to support the following operations:
    1. Generates Ethereum addresses from a secret key
    2. Generates Ethereum addresses from a public key
    3. Parses a Ethereum address from a string
    4. Validates a Ethereum address
    5. Generates Ethereum amounts
    6. Generates a Ethereum transaction
anychain/
  examples/
    anychain-ethereum-client/
      src/
        main.rs
      Cargo.toml

refactor: the dependency should be resolved using the workspace configuration

Cargo.toml

[dependencies]
anyhow = { workspace = true }

The { workspace = true } part of the declaration indicates that this dependency should be resolved using the workspace configuration. In a Rust project, a workspace is a group of related packages that share common settings and dependencies.
By setting workspace = true, Cargo will use the version and configuration of the anyhow crate specified in the workspace's Cargo.toml file, rather than specifying a version directly in the crates/aptos/Cargo.toml file.

This approach helps to maintain consistency across all the packages in the workspace, as they will all use the same version of the anyhow crate. It also makes it easier to update the dependency, as you only need to change the version in the workspace's Cargo.toml file, and all the packages in the workspace will automatically use the updated version

build: publish crates

  • anychain-core 0.1.0
  • anychain-bitcoin 0.1.0
  • anychain-bitcoincash 0.1.0
  • anychain-ethereum 0.1.0
  • anychain-filecoin 0.1.0
  • anychain-tron 0.1.0
  • anychain-polkadot
  • anychain-bitcoin-client
  • readme.md rs sample for all crates

Workflow about PR

  • Enforce git commit message standard in merging PR
  • Run cargo fmt in IDE to pass check

fix test warnings in bitcoin and ethereum

cargo test --all-features

warning: unused import: SecretKey
--> ethereum/src/address.rs:4:26
|
4 | libsecp256k1::{self, SecretKey},
| ^^^^^^^^^
|
= note: #[warn(unused_imports)] on by default

warning: unused import: chainlib_core::libsecp256k1
--> bitcoin/src/transaction.rs:18:5
|
18 | use chainlib_core::libsecp256k1;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: #[warn(unused_imports)] on by default

warning: unused import: core::str::FromStr
--> bitcoin/src/lib.rs:26:9
|
26 | use core::str::FromStr;
| ^^^^^^^^^^^^^^^^^^

warning: unused import: crate::transaction::*
--> bitcoin/src/lib.rs:28:9
|
28 | use crate::transaction::*;
| ^^^^^^^^^^^^^^^^^^^^^

warning: unused import: crate::address::*
--> bitcoin/src/lib.rs:29:9
|
29 | use crate::address::*;
| ^^^^^^^^^^^^^^^^^

warning: unused import: crate::amount::*
--> bitcoin/src/lib.rs:30:9
|
30 | use crate::amount::*;
| ^^^^^^^^^^^^^^^^

warning: unused import: super::*
--> bitcoin/src/lib.rs:31:9
|
31 | use super::*;
| ^^^^^^^^

warning: unused import: rand::thread_rng
--> bitcoin/src/lib.rs:32:9
|
32 | use rand::thread_rng;
| ^^^^^^^^^^^^^^^^

warning: use of deprecated field ethabi::Function::constant: The constant attribute was removed in Solidity 0.5.0 and has been replaced with stateMutability.
--> ethereum/src/transaction.rs:53:9
|
53 | constant: None,
| ^^^^^^^^^^^^^^
|
= note: #[warn(deprecated)] on by default

warning: unused import: sha2::digest::typenum::Bit
--> bitcoin/src/transaction.rs:16:5
|
16 | use sha2::digest::typenum::Bit;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: unused variable: hrp
--> bitcoin/src/address.rs:184:22
|
184 | let (hrp, data, variant) = bech32::decode(&address)?;
| ^^^ help: if this is intentional, prefix it with an underscore: _hrp
|
= note: #[warn(unused_variables)] on by default

warning: unused variable: variant
--> bitcoin/src/address.rs:184:33
|
184 | let (hrp, data, variant) = bech32::decode(&address)?;
| ^^^^^^^ help: if this is intentional, prefix it with an underscore: _variant

warning: unused variable: hrp
--> bitcoin/src/transaction.rs:135:18
|
135 | let (hrp, data, variant) = bech32::decode(&address.to_string())?;
| ^^^ help: if this is intentional, prefix it with an underscore: _hrp

warning: unused variable: variant
--> bitcoin/src/transaction.rs:135:29
|
135 | let (hrp, data, variant) = bech32::decode(&address.to_string())?;
| ^^^^^^^ help: if this is intentional, prefix it with an underscore: _variant

warning: unused variable: signature
--> bitcoin/src/transaction.rs:732:24
|
732 | fn sign(&mut self, signature: Vec, recid: u8) -> Result<Vec, TransactionError> {
| ^^^^^^^^^ help: if this is intentional, prefix it with an underscore: _signature

warning: unused variable: recid
--> bitcoin/src/transaction.rs:732:44
|
732 | fn sign(&mut self, signature: Vec, recid: u8) -> Result<Vec, TransactionError> {
| ^^^^^ help: if this is intentional, prefix it with an underscore: _recid

warning: variable does not need to be mutable
--> bitcoin/src/transaction.rs:880:9
|
880 | mut public_key: Vec,
| ----^^^^^^^^^^
| |
| help: remove this mut
|
= note: #[warn(unused_mut)] on by default

warning: type alias N is never used
--> bitcoin/src/lib.rs:33:10
|
33 | type N = super::network::Testnet;
| ^
|
note: the lint level is defined here
--> bitcoin/src/lib.rs:2:31
|
2 | #![warn(unused_extern_crates, dead_code)]
| ^^^^^^^^^

warning: constant ACOUNTS is never used
--> bitcoin/src/lib.rs:39:11
|
39 | const ACOUNTS: [(&str,&str);2] = [
| ^^^^^^^

Compiling anychain v0.0.1 (/Users/cairo/anychain/anychain)
warning: bitcoin (lib) generated 17 warnings
warning: ethereum (lib) generated 2 warnings

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.