Skip to content

Commit a27e707

Browse files
committed
bump: v0.1.9
1 parent 9c4b307 commit a27e707

22 files changed

Lines changed: 682 additions & 93 deletions

Cargo.toml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,13 @@ sha3 = { version = "0.10.8"}
2525
tokio = { version = "1.35.1", features = ["full"] }
2626
ureq = { version = "2.9.1", features = ["json"] }
2727
url = "2.5.0"
28-
29-
# Hash
3028
aes = { version = "0.8.3", features = ["hazmat"] }
3129
tiny-keccak = { version = "2.0.2", features=["keccak"] }
3230
keccak = "0.1.4"
33-
3431
# Hashes needed for implementing the final step
3532
groestl = "0.10.1"
3633
skein = "0.1.0"
3734
jh = "0.1.0"
3835
blake-hash = "0.4.1"
36+
# Hashes needed for implementing the final step (end)
37+
serde_json = "1.0.113"

README.md

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1-
<div style="border-radius: 100px; overflow: hidden">
2-
<img src="./assets/libmonero-logo.jpg"/>
3-
</div>
4-
1+
```
2+
_ _ _
3+
| (_) |__ _ __ ___ ___ _ __ ___ _ __ ___
4+
| | | '_ \| '_ ` _ \ / _ \| '_ \ / _ \ '__/ _ \
5+
| | | |_) | | | | | | (_) | | | | __/ | | (_) |
6+
|_|_|_.__/|_| |_| |_|\___/|_| |_|\___|_| \___/
7+
```
58
---
69
[![Crates.io](https://img.shields.io/crates/v/libmonero.svg)](https://crates.io/crates/libmonero)
710
[![Docs](https://docs.rs/libmonero/badge.svg)](https://docs.rs/libmonero)
@@ -20,6 +23,7 @@ libmonero is a powerful, batteries-included library for the Monero cryptocurrenc
2023
- Original (25-word) and MyMonero (13-word) seed support
2124
- Many language support for seeds: en, eo, fr, it, ja, pt, ru, lj...
2225
- Hexadecimal seed, private spend and view keys, address derivation
26+
- RPC for getting data from the Monero network
2327

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

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

3135
For more details, please take a look at [docs](https://docs.rs/libmonero).
36+
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).
3237

33-
## Sponsoring
34-
35-
You can sponsor this project for 20$/month. If you sponsor this project, you will get the following benefits:
36-
37-
- Mention in the README.md (with your logo and link to your website if you want)
38-
- Request features or bugfixes
39-
- Priority support
40-
- Special role in the matrix room
38+
## Supporting
4139

42-
If you want to sponsor this project, please contact us at the matrix room: [#monume:matrix.org](https://matrix.to/#/#monume:matrix.org)
40+
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:
41+
```
42+
48SK3AeqELVKwsyKkSvxw9YkY8YU5eBHTZTQS2eWZb9yNtb7FYAJqxnhY41x5uGb2UJew8pBek4Cdg41CaA3CHpCCsGGBjF
43+
```
4344

4445
## Licensing
4546

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

5859
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.
5960

60-
¹: 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'.
61+
¹: 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'.
6162

6263
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)
6364

assets/libmonero-logo.jpg

-49.4 KB
Binary file not shown.

precommit.sh

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,21 @@
11
#!/bin/sh
2-
cd scripts && python3 copyright.py
3-
cargo clippy --fix --lib -p libmonero --allow-staged --allow-dirty # For fixing clippy warnings
4-
cargo test
2+
echo ""
3+
echo "STARTING: Running precommit checks"
4+
echo ""
5+
# First step, run copyright script, update the output as the status
6+
printf "1 - status: running - process: running copyright" && python3 scripts/copyright.py && printf "\r1 - status: success - process: running copyright\n"
7+
# Second step, run clippy
8+
printf "2 - status: running - process: running clippy" && cargo clippy -q --all-targets --all-features -- -D warnings && printf "\r2 - status: success - process: running clippy\n"
9+
# Third step, run test with no output, check if process exited with 0
10+
printf "3 - status: running - process: running test" && if cargo test &> /dev/null; then
11+
printf "\r3 - status: success - process: running test\n";
12+
else
13+
printf "\r3 - status: failed - process: running tes\n";
14+
echo ""
15+
echo "RESULT: FAIL - Tests failed, please check the tests with 'cargo test' command"
16+
echo ""
17+
exit 1
18+
fi
19+
echo ""
20+
echo "RESULT: SUCCESS - All precommit checks passed, you can commit now!"
21+
echo ""

scripts/copyright.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,7 @@ def add_text_to_files(folder_path, text, ignored_extensions=[]):
5050
file.write(text + '\n' + ''.join(lines))
5151

5252
def main():
53-
print("Starting copyright script")
5453
add_text_to_files(path, header, ignore)
55-
print("Finished adding copyright headers")
56-
54+
5755
if __name__ == "__main__":
5856
main()

src/blocks/block.rs

Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
/*
2+
* This file is part of Monume's library libmonero
3+
*
4+
* Copyright (c) 2023-2024, Monume (monume.xyz)
5+
* All Rights Reserved
6+
* The code is distributed under MIT license, see LICENSE file for details.
7+
* Generated by Monume
8+
*
9+
*/
10+
11+
#![allow(non_snake_case)]
12+
13+
// Block structs
14+
15+
pub struct BlockHeader {
16+
pub block_size: u64,
17+
pub block_weight: u64,
18+
pub cumulative_difficulty: u64,
19+
pub cumulative_difficulty_top64: u64,
20+
pub depth: u64,
21+
pub difficulty: u64,
22+
pub difficulty_top64: u64,
23+
pub hash: String,
24+
pub height: u64,
25+
pub long_term_weight: u64,
26+
pub major_version: u64,
27+
pub miner_tx_hash: String,
28+
pub minor_version: u64,
29+
pub nonce: u64,
30+
pub num_txes: u64,
31+
pub orphan_status: bool,
32+
pub pow_hash: String,
33+
pub prev_hash: String,
34+
pub reward: u64,
35+
pub timestamp: u64,
36+
pub wide_cumulative_difficulty: String,
37+
pub wide_difficulty: String
38+
}
39+
40+
pub struct Gen {
41+
pub height: u64,
42+
}
43+
44+
pub struct Vin {
45+
pub gen: Gen,
46+
}
47+
48+
pub struct TaggedKey {
49+
pub key: String,
50+
pub view_tag: String,
51+
}
52+
53+
pub struct Target {
54+
pub tagged_key: TaggedKey,
55+
}
56+
57+
pub struct Vout {
58+
pub amount: u64,
59+
pub target: Target,
60+
}
61+
62+
pub struct EcdhInfo {
63+
pub trunc_amount: String,
64+
}
65+
66+
pub struct RctSignatures {
67+
pub type_int: u64,
68+
pub txn_fee: u64,
69+
pub ecdh_info: Vec<EcdhInfo>,
70+
pub out_pk: Vec<String>,
71+
}
72+
73+
pub struct MinerTxInfo {
74+
pub version: u64,
75+
pub unlock_time: u64,
76+
pub vin: Vec<Vin>,
77+
pub vout: Vec<Vout>,
78+
pub extra: Vec<u8>,
79+
pub rct_signatures: RctSignatures
80+
}
81+
82+
pub struct BlockDetailsJSON {
83+
pub major_version: u64,
84+
pub minor_version: u64,
85+
pub timestamp: u64,
86+
pub prev_id: String,
87+
pub nonce: u64,
88+
pub miner_tx: MinerTxInfo,
89+
pub tx_hashes: Vec<String>,
90+
}
91+
92+
pub struct Block {
93+
pub blob: String,
94+
pub block_header: BlockHeader,
95+
pub credits: u64,
96+
pub json: BlockDetailsJSON,
97+
pub miner_tx_hash: String,
98+
pub status: String,
99+
pub top_hash: String,
100+
pub untrusted: bool
101+
}
102+
103+
// Tx structs
104+
105+
pub struct KeyRawTx {
106+
pub amount: u64,
107+
pub key_offsets: Vec<u64>,
108+
pub k_image: String
109+
}
110+
111+
pub struct VinRawTx {
112+
pub key: KeyRawTx
113+
}
114+
115+
pub struct BPP {
116+
pub A: String,
117+
pub A1: String,
118+
pub B: String,
119+
pub r1: String,
120+
pub s1: String,
121+
pub d1: String,
122+
pub L: Vec<String>,
123+
pub R: Vec<String>,
124+
}
125+
126+
pub struct CLSAG {
127+
pub s: Vec<String>,
128+
pub c1: String,
129+
pub D: String,
130+
}
131+
132+
pub struct RctsigPrunable {
133+
pub nbp: u64,
134+
pub bpp: Vec<BPP>,
135+
pub CLSAGs: Vec<CLSAG>,
136+
pub pseudo_outs: Vec<String>
137+
}
138+
139+
pub struct RawTx {
140+
pub version: u64,
141+
pub unlock_time: u64,
142+
pub vin: Vec<VinRawTx>,
143+
pub vout: Vec<Vout>,
144+
pub extra: Vec<u8>,
145+
pub rct_signatures: RctSignatures,
146+
pub rctsig_prunable: RctsigPrunable,
147+
}

src/blocks/mod.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/*
2+
* This file is part of Monume's library libmonero
3+
*
4+
* Copyright (c) 2023-2024, Monume (monume.xyz)
5+
* All Rights Reserved
6+
* The code is distributed under MIT license, see LICENSE file for details.
7+
* Generated by Monume
8+
*
9+
*/
10+
11+
pub(crate) mod rpcs;
12+
pub(crate) mod nodes;
13+
pub(crate) mod transactions;
14+
pub(crate) mod block;
15+
16+
pub use rpcs::*;
17+
pub use nodes::*;
18+
pub use block::*;

src/blocks/nodes.rs

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/*
2+
* This file is part of Monume's library libmonero
3+
*
4+
* Copyright (c) 2023-2024, Monume (monume.xyz)
5+
* All Rights Reserved
6+
* The code is distributed under MIT license, see LICENSE file for details.
7+
* Generated by Monume
8+
*
9+
*/
10+
11+
/// DaemonNode struct contains all necessary and additional information about a daemon node
12+
pub struct DaemonNode {
13+
pub url: String,
14+
pub port: u16,
15+
pub tls: bool,
16+
}
17+
18+
/// DaemonNode functions etc.
19+
impl DaemonNode {
20+
/// Returns Cake Wallet's default node
21+
pub fn cake_wallet_default() -> DaemonNode {
22+
DaemonNode {
23+
url: "xmr-node.cakewallet.com".to_string(),
24+
port: 18081,
25+
tls: false
26+
}
27+
}
28+
29+
/// Returns Stack Wallet's default node
30+
pub fn stack_wallet_default() -> DaemonNode {
31+
DaemonNode {
32+
url: "monero.stackwallet.com".to_string(),
33+
port: 18081,
34+
tls: false
35+
}
36+
}
37+
38+
/// Creates a new DaemonNode from a given URL, port and tls flag
39+
pub fn new(url: String, port: u16, tls: bool) -> DaemonNode {
40+
DaemonNode {
41+
url,
42+
port,
43+
tls
44+
}
45+
}
46+
}

0 commit comments

Comments
 (0)