Skip to content
This repository has been archived by the owner on May 7, 2024. It is now read-only.

Release v0.2.0-rc1 #53

Merged
merged 10 commits into from
Jan 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

39 changes: 23 additions & 16 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ license = "GPL-3.0"
name = "atomicalsir"
readme = "README.md"
repository = "https://github.com/hack-ink/atomicalsir"
version = "0.1.9"
version = "0.2.0"

[profile.ci-dev]
incremental = false
Expand All @@ -24,18 +24,25 @@ vergen = { version = "8.3", features = ["build", "cargo", "git", "gitcl"] }

[dependencies]
# crates.io
anyhow = { version = "1.0" }
array-bytes = { version = "6.2" }
bitcoin = { version = "0.31", features = ["rand-std"] }
ciborium = { version = "0.2" }
clap = { version = "4.4", features = ["color", "derive"] }
color-eyre = { version = "0.6" }
num_cpus = { version = "1.16" }
rand = { version = "0.8" }
reqwest = { version = "0.11", features = ["json", "rustls-tls"] }
serde = { version = "1.0", features = ["derive"] }
serde_json = { version = "1.0" }
sha2 = { version = "0.10" }
tokio = { version = "1.35", features = ["macros", "rt-multi-thread"] }
tracing = { version = "0.1" }
tracing-subscriber = { version = "0.3" }
anyhow = { version = "1.0" }
atomicals-electrumx = { version = "0.2.0", path = "atomicals-electrumx" }
bitcoin = { version = "0.31", features = ["rand-std"] }
ciborium = { version = "0.2" }
clap = { version = "4.4", features = ["color", "derive"] }
color-eyre = { version = "0.6" }
num_cpus = { version = "1.16" }
rand = { version = "0.8" }
reqwest = { version = "0.11", features = ["json", "rustls-tls"] }
serde = { version = "1.0", features = ["derive"] }
serde_json = { version = "1.0" }
tokio = { version = "1.35", features = ["macros", "rt-multi-thread"] }
tracing = { version = "0.1" }
tracing-subscriber = { version = "0.3" }

[dev-dependencies]
array-bytes = { version = "6.2" }

[workspace]
members = [
"atomicals-electrumx",
]
39 changes: 23 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
```
Atomicals mining manager.

Usage: atomicalsir [OPTIONS] --ticker <NAME> <--rust-engine <RUST_ENGINE>|--js-engine <PATH>>
Usage: atomicalsir [OPTIONS] --fee-bound <MIN,MAX> --ticker <NAME> <--rust-engine <RUST_ENGINE>|--js-engine <PATH>>

Options:
--rust-engine <RUST_ENGINE>
Expand All @@ -28,18 +28,21 @@ Options:

Need to provide a path to the atomicals-js repository's directory.

--thread <NUM>
Thread count.

This adjusts the number of threads utilized by the Rust engine miner.

[default: 16]

--network <NETWORK>
Network type

[default: mainnet]
[possible values: mainnet, testnet]

--max-fee <VALUE>
Maximum acceptable fee.

This value will be passed to atomicals-js's `--satsbyte` flag if the current network's priority fee is larger then this value.

[default: 150]
--fee-bound <MIN,MAX>
Set the fee rate range to sat/vB

--electrumx <URI>
Specify the URI of the electrumx.
Expand All @@ -61,11 +64,10 @@ Options:

### Warning
The Rust mining engine is not fully tested; use at your own risk.
Additionally, it does not support `bitworkr`.

#### Example
```sh
RUST_LOG=atomicalsir=debug cargo r -r -- --rust-engine .maintain/atomicals-js/wallets --network testnet --electrumx https://eptestnet.atomicals.xyz/proxy --ticker atomicalsir4
RUST_LOG=atomicalsir=debug cargo r -r -- --rust-engine .maintain/atomicals-js/wallets --network testnet --fee-bound 50,150 --electrumx https://eptestnet.atomicals.xyz/proxy --ticker atomicalsir4
```

#### [Bitcoin testnet result](https://mempool.space/testnet/tx/aabbcc683171c11c3513f88f0c601e2657982e07d4e9259c8cfa4d909eb397bc)
Expand Down Expand Up @@ -245,16 +247,20 @@ To build from the source code, use the following commands:
```sh
git clone https://hack-ink/atomicalsir
cd atomicalsir
cargo build --release
cargo b -r
```

#### Step-by-step setup
#### Step-by-step setup (js-engine)
1. Follow the installation steps for [`atomicals-js`](https://github.com/atomicals/atomicals-js#install).
2. Follow the installation steps for [`atomicalsir`](#installation).
3. Run the following command: `atomicalsir --max-fee 150 <PATH to the atomicals-js folder>`
3. Run the following command: `atomicalsir --js-engine <PATH to the atomicals-js folder> --fee-bound 50,150 --ticker quark`

#### Step-by-step setup (rust-engine)
1. Follow the installation steps for [`atomicalsir`](#installation).
2. Run the following command: `atomicalsir --rust-engine <PATH to the atomicals-js's wallets folder> --fee-bound 50,150 --ticker quark`

### Q&A
- **Where can I find the mining log?**
- **Where can I find the js-engine mining log?**

You'll find the information in `stdout.log` and `stderr.log`, which are located in the current working directory.

Expand Down Expand Up @@ -296,6 +302,7 @@ cargo build --release
- The `wallet-first` strategy mines indefinitely, switching wallets until the current wallet has more than 12 unconfirmed transactions.

## Future plan
- [ ] Update and rebuild `atomicals-js` automatically.
- [ ] Implement wallet balance detection.
- [x] Implement a mining worker in pure Rust.
- [ ] Remove js-engine.
- [x] Implement wallet balance detection.
- [x] Implement mining worker in Rust.
- [ ] Implement GPU mining worker.
25 changes: 25 additions & 0 deletions atomicals-electrumx/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
[package]
authors = ["Xavier Lau <[email protected]>"]
description = "Atomicals electrumx APIs."
edition = "2021"
homepage = "https://hack.ink/atomicalsir"
license = "GPL-3.0"
name = "atomicals-electrumx"
readme = "README.md"
repository = "https://github.com/hack-ink/atomicalsir"
version = "0.2.0"

[dependencies]
# crates.io
array-bytes = { version = "6.2" }
bitcoin = { version = "0.31", features = ["rand-std"] }
reqwest = { version = "0.11", features = ["json", "rustls-tls"] }
serde = { version = "1.0", features = ["derive"] }
serde_json = { version = "1.0" }
sha2 = { version = "0.10" }
thiserror = { version = "1.0" }
tokio = { version = "1.35", features = ["macros", "rt-multi-thread"] }
tracing = { version = "0.1" }

[dev-dependencies]
tracing-subscriber = { version = "0.3" }
17 changes: 17 additions & 0 deletions atomicals-electrumx/src/error.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//! atomicals-electrumx error collections.

#![allow(missing_docs)]

// crates.io
use thiserror::Error as ThisError;

#[derive(Debug, ThisError)]
pub enum Error {
#[error("exceeded maximum retries")]
ExceededMaximumRetries,

#[error(transparent)]
Bitcoin(#[from] bitcoin::address::Error),
#[error(transparent)]
Reqwest(#[from] reqwest::Error),
}
Loading
Loading