Skip to content

Commit

Permalink
bump: v0.1.9
Browse files Browse the repository at this point in the history
  • Loading branch information
detherminal committed Mar 30, 2024
1 parent 9c4b307 commit a27e707
Show file tree
Hide file tree
Showing 22 changed files with 682 additions and 93 deletions.
5 changes: 2 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,13 @@ sha3 = { version = "0.10.8"}
tokio = { version = "1.35.1", features = ["full"] }
ureq = { version = "2.9.1", features = ["json"] }
url = "2.5.0"

# Hash
aes = { version = "0.8.3", features = ["hazmat"] }
tiny-keccak = { version = "2.0.2", features=["keccak"] }
keccak = "0.1.4"

# Hashes needed for implementing the final step
groestl = "0.10.1"
skein = "0.1.0"
jh = "0.1.0"
blake-hash = "0.4.1"
# Hashes needed for implementing the final step (end)
serde_json = "1.0.113"
29 changes: 15 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
<div style="border-radius: 100px; overflow: hidden">
<img src="./assets/libmonero-logo.jpg"/>
</div>

```
_ _ _
| (_) |__ _ __ ___ ___ _ __ ___ _ __ ___
| | | '_ \| '_ ` _ \ / _ \| '_ \ / _ \ '__/ _ \
| | | |_) | | | | | | (_) | | | | __/ | | (_) |
|_|_|_.__/|_| |_| |_|\___/|_| |_|\___|_| \___/
```
---
[![Crates.io](https://img.shields.io/crates/v/libmonero.svg)](https://crates.io/crates/libmonero)
[![Docs](https://docs.rs/libmonero/badge.svg)](https://docs.rs/libmonero)
Expand All @@ -20,6 +23,7 @@ libmonero is a powerful, batteries-included library for the Monero cryptocurrenc
- Original (25-word) and MyMonero (13-word) seed support
- Many language support for seeds: en, eo, fr, it, ja, pt, ru, lj...
- Hexadecimal seed, private spend and view keys, address derivation
- RPC for getting data from the Monero network

And many more features... ([Roadmap](#roadmap))

Expand All @@ -29,17 +33,14 @@ Add the library to your project and use the functions: \
```cargo add libmonero```

For more details, please take a look at [docs](https://docs.rs/libmonero).
If you have any questions, you can ask either at the [discussions](https://github.com/monumexyz/libmonero/discussions) or [matrix room](https://matrix.to/#/#monume:matrix.org).

## Sponsoring

You can sponsor this project for 20$/month. If you sponsor this project, you will get the following benefits:

- Mention in the README.md (with your logo and link to your website if you want)
- Request features or bugfixes
- Priority support
- Special role in the matrix room
## Supporting

If you want to sponsor this project, please contact us at the matrix room: [#monume:matrix.org](https://matrix.to/#/#monume:matrix.org)
As you may notice, we don't make any money from this project. We are working on this project for the Monero community and for the love of open-source. If you want to support us, you can donate to the following Monero address:
```
48SK3AeqELVKwsyKkSvxw9YkY8YU5eBHTZTQS2eWZb9yNtb7FYAJqxnhY41x5uGb2UJew8pBek4Cdg41CaA3CHpCCsGGBjF
```

## Licensing

Expand All @@ -57,7 +58,7 @@ This project is licensed under the MIT License. Please take a look at [LICENSE.m

Almost every Monero 'library' on the net is either a wrapper or a port of the official software and it's RPC. They just make interface for you to communicate with the 'real software', where all things happen. This is not the case with libmonero¹. You don't need any of the official code, which is written in C++ and is very hard to understand (some people even say wallet2 is 'hell' :D). This library is designed to be a fast, safe, and full-featured library, with support for all the features of the Monero blockchain and ecosystem.

¹: This library is written from scratch in Rust and is designed to be easy to use and understand with no need for any other software (other than Monero Daemon for blockchain data etc.). We aim for this library to be usable even for embedded apps. That's why we are calling it 'batteries-included'.
¹: This library is written from scratch in Rust and is designed to be easy to use and understand with no need for any other software (other than Monero Daemon for blockchain data etc., NO WALLET RPC). We aim for this library to be usable even for embedded apps. That's why we are calling it 'batteries-included'.

Building this library from scratch is a huge task. We are working hard to make it as good as possible. If you want to help us, please consider contributing to this project. We are looking for people who can help us with the development, testing, and documentation. If you are interested and need any help about it, please contact community at the matrix room: [#monume:matrix.org](https://matrix.to/#/#monume:matrix.org)

Expand Down
Binary file removed assets/libmonero-logo.jpg
Binary file not shown.
23 changes: 20 additions & 3 deletions precommit.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,21 @@
#!/bin/sh
cd scripts && python3 copyright.py
cargo clippy --fix --lib -p libmonero --allow-staged --allow-dirty # For fixing clippy warnings
cargo test
echo ""
echo "STARTING: Running precommit checks"
echo ""
# First step, run copyright script, update the output as the status
printf "1 - status: running - process: running copyright" && python3 scripts/copyright.py && printf "\r1 - status: success - process: running copyright\n"
# Second step, run clippy
printf "2 - status: running - process: running clippy" && cargo clippy -q --all-targets --all-features -- -D warnings && printf "\r2 - status: success - process: running clippy\n"
# Third step, run test with no output, check if process exited with 0
printf "3 - status: running - process: running test" && if cargo test &> /dev/null; then
printf "\r3 - status: success - process: running test\n";
else
printf "\r3 - status: failed - process: running tes\n";
echo ""
echo "RESULT: FAIL - Tests failed, please check the tests with 'cargo test' command"
echo ""
exit 1
fi
echo ""
echo "RESULT: SUCCESS - All precommit checks passed, you can commit now!"
echo ""
4 changes: 1 addition & 3 deletions scripts/copyright.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,7 @@ def add_text_to_files(folder_path, text, ignored_extensions=[]):
file.write(text + '\n' + ''.join(lines))

def main():
print("Starting copyright script")
add_text_to_files(path, header, ignore)
print("Finished adding copyright headers")


if __name__ == "__main__":
main()
147 changes: 147 additions & 0 deletions src/blocks/block.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
/*
* This file is part of Monume's library libmonero
*
* Copyright (c) 2023-2024, Monume (monume.xyz)
* All Rights Reserved
* The code is distributed under MIT license, see LICENSE file for details.
* Generated by Monume
*
*/

#![allow(non_snake_case)]

// Block structs

pub struct BlockHeader {
pub block_size: u64,
pub block_weight: u64,
pub cumulative_difficulty: u64,
pub cumulative_difficulty_top64: u64,
pub depth: u64,
pub difficulty: u64,
pub difficulty_top64: u64,
pub hash: String,
pub height: u64,
pub long_term_weight: u64,
pub major_version: u64,
pub miner_tx_hash: String,
pub minor_version: u64,
pub nonce: u64,
pub num_txes: u64,
pub orphan_status: bool,
pub pow_hash: String,
pub prev_hash: String,
pub reward: u64,
pub timestamp: u64,
pub wide_cumulative_difficulty: String,
pub wide_difficulty: String
}

pub struct Gen {
pub height: u64,
}

pub struct Vin {
pub gen: Gen,
}

pub struct TaggedKey {
pub key: String,
pub view_tag: String,
}

pub struct Target {
pub tagged_key: TaggedKey,
}

pub struct Vout {
pub amount: u64,
pub target: Target,
}

pub struct EcdhInfo {
pub trunc_amount: String,
}

pub struct RctSignatures {
pub type_int: u64,
pub txn_fee: u64,
pub ecdh_info: Vec<EcdhInfo>,
pub out_pk: Vec<String>,
}

pub struct MinerTxInfo {
pub version: u64,
pub unlock_time: u64,
pub vin: Vec<Vin>,
pub vout: Vec<Vout>,
pub extra: Vec<u8>,
pub rct_signatures: RctSignatures
}

pub struct BlockDetailsJSON {
pub major_version: u64,
pub minor_version: u64,
pub timestamp: u64,
pub prev_id: String,
pub nonce: u64,
pub miner_tx: MinerTxInfo,
pub tx_hashes: Vec<String>,
}

pub struct Block {
pub blob: String,
pub block_header: BlockHeader,
pub credits: u64,
pub json: BlockDetailsJSON,
pub miner_tx_hash: String,
pub status: String,
pub top_hash: String,
pub untrusted: bool
}

// Tx structs

pub struct KeyRawTx {
pub amount: u64,
pub key_offsets: Vec<u64>,
pub k_image: String
}

pub struct VinRawTx {
pub key: KeyRawTx
}

pub struct BPP {
pub A: String,
pub A1: String,
pub B: String,
pub r1: String,
pub s1: String,
pub d1: String,
pub L: Vec<String>,
pub R: Vec<String>,
}

pub struct CLSAG {
pub s: Vec<String>,
pub c1: String,
pub D: String,
}

pub struct RctsigPrunable {
pub nbp: u64,
pub bpp: Vec<BPP>,
pub CLSAGs: Vec<CLSAG>,
pub pseudo_outs: Vec<String>
}

pub struct RawTx {
pub version: u64,
pub unlock_time: u64,
pub vin: Vec<VinRawTx>,
pub vout: Vec<Vout>,
pub extra: Vec<u8>,
pub rct_signatures: RctSignatures,
pub rctsig_prunable: RctsigPrunable,
}
18 changes: 18 additions & 0 deletions src/blocks/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
* This file is part of Monume's library libmonero
*
* Copyright (c) 2023-2024, Monume (monume.xyz)
* All Rights Reserved
* The code is distributed under MIT license, see LICENSE file for details.
* Generated by Monume
*
*/

pub(crate) mod rpcs;
pub(crate) mod nodes;
pub(crate) mod transactions;
pub(crate) mod block;

pub use rpcs::*;
pub use nodes::*;
pub use block::*;
46 changes: 46 additions & 0 deletions src/blocks/nodes.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* This file is part of Monume's library libmonero
*
* Copyright (c) 2023-2024, Monume (monume.xyz)
* All Rights Reserved
* The code is distributed under MIT license, see LICENSE file for details.
* Generated by Monume
*
*/

/// DaemonNode struct contains all necessary and additional information about a daemon node
pub struct DaemonNode {
pub url: String,
pub port: u16,
pub tls: bool,
}

/// DaemonNode functions etc.
impl DaemonNode {
/// Returns Cake Wallet's default node
pub fn cake_wallet_default() -> DaemonNode {
DaemonNode {
url: "xmr-node.cakewallet.com".to_string(),
port: 18081,
tls: false
}
}

/// Returns Stack Wallet's default node
pub fn stack_wallet_default() -> DaemonNode {
DaemonNode {
url: "monero.stackwallet.com".to_string(),
port: 18081,
tls: false
}
}

/// Creates a new DaemonNode from a given URL, port and tls flag
pub fn new(url: String, port: u16, tls: bool) -> DaemonNode {
DaemonNode {
url,
port,
tls
}
}
}
Loading

0 comments on commit a27e707

Please sign in to comment.