mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-07-29 11:48:12 -07:00
computer: pools part 1 + fetcher: fix url + interface: more ddos protection
This commit is contained in:
@@ -21,6 +21,7 @@ brk_parser = { workspace = true }
|
||||
vecdb = { workspace = true }
|
||||
derive_deref = { workspace = true }
|
||||
log = { workspace = true }
|
||||
num_enum = "0.7.4"
|
||||
pco = "0.4.6"
|
||||
rayon = { workspace = true }
|
||||
serde = { workspace = true }
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
use std::{collections::BTreeMap, path::Path, thread};
|
||||
|
||||
use brk_computer::{Computer, pools};
|
||||
use brk_error::Result;
|
||||
use brk_fetcher::Fetcher;
|
||||
use brk_indexer::Indexer;
|
||||
use vecdb::Exit;
|
||||
|
||||
fn main() -> Result<()> {
|
||||
brk_logger::init(Some(Path::new(".log")))?;
|
||||
|
||||
let exit = Exit::new();
|
||||
exit.set_ctrlc_handler();
|
||||
|
||||
thread::Builder::new()
|
||||
.stack_size(256 * 1024 * 1024)
|
||||
.spawn(move || -> Result<()> {
|
||||
let outputs_dir = Path::new(&std::env::var("HOME").unwrap()).join(".brk");
|
||||
|
||||
let indexer = Indexer::forced_import(&outputs_dir)?;
|
||||
|
||||
let fetcher = Fetcher::import(true, None)?;
|
||||
|
||||
let computer = Computer::forced_import(&outputs_dir, &indexer, Some(fetcher))?;
|
||||
|
||||
let pools = pools();
|
||||
|
||||
let mut res: BTreeMap<&'static str, usize> = BTreeMap::default();
|
||||
|
||||
let mut height_to_first_txindex_iter = indexer.vecs.height_to_first_txindex.iter();
|
||||
// let mut i = indexer.vecs.txz
|
||||
|
||||
indexer
|
||||
.stores
|
||||
.height_to_coinbase_tag
|
||||
.iter()
|
||||
.for_each(|(_, coinbase_tag)| {
|
||||
let pool = pools.find_from_coinbase_tag(&coinbase_tag);
|
||||
if let Some(pool) = pool {
|
||||
*res.entry(pool.name).or_default() += 1;
|
||||
} else {
|
||||
*res.entry(pools.get_unknown().name).or_default() += 1;
|
||||
}
|
||||
});
|
||||
|
||||
let mut v = res.into_iter().map(|(k, v)| (v, k)).collect::<Vec<_>>();
|
||||
v.sort_unstable();
|
||||
println!("{:#?}", v);
|
||||
println!("{:#?}", v.len());
|
||||
|
||||
Ok(())
|
||||
})?
|
||||
.join()
|
||||
.unwrap()
|
||||
}
|
||||
@@ -16,6 +16,7 @@ mod fetched;
|
||||
mod grouped;
|
||||
mod indexes;
|
||||
mod market;
|
||||
mod pools;
|
||||
mod price;
|
||||
mod stateful;
|
||||
mod states;
|
||||
@@ -24,6 +25,7 @@ mod utils;
|
||||
|
||||
use indexes::Indexes;
|
||||
|
||||
pub use pools::*;
|
||||
pub use states::PriceToAmount;
|
||||
use states::*;
|
||||
|
||||
|
||||
@@ -0,0 +1,175 @@
|
||||
use num_enum::{FromPrimitive, IntoPrimitive};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[allow(clippy::upper_case_acronyms)]
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, FromPrimitive, IntoPrimitive)]
|
||||
#[repr(u16)]
|
||||
pub enum PoolId {
|
||||
#[default]
|
||||
Unknown,
|
||||
BlockFills,
|
||||
Ultimuspool,
|
||||
TerraPool,
|
||||
Luxor,
|
||||
OneTHash,
|
||||
BTCCom,
|
||||
Bitfarms,
|
||||
HuobiPool,
|
||||
WayiCn,
|
||||
CanoePool,
|
||||
BTCTop,
|
||||
BitcoinCom,
|
||||
OneSevenFiveBtc,
|
||||
GBMiners,
|
||||
AXbt,
|
||||
ASICMiner,
|
||||
BitMinter,
|
||||
BitcoinRussia,
|
||||
BTCServ,
|
||||
SimplecoinUs,
|
||||
BTCGuild,
|
||||
Eligius,
|
||||
OzCoin,
|
||||
EclipseMC,
|
||||
MaxBTC,
|
||||
TripleMining,
|
||||
CoinLab,
|
||||
FiftyBTC,
|
||||
GHashIO,
|
||||
STMiningCorp,
|
||||
Bitparking,
|
||||
MMPool,
|
||||
Polmine,
|
||||
KnCMiner,
|
||||
Bitalo,
|
||||
F2Pool,
|
||||
HHTT,
|
||||
MegaBigPower,
|
||||
MtRed,
|
||||
NMCbit,
|
||||
YourbtcNet,
|
||||
GiveMeCoins,
|
||||
BraiinsPool,
|
||||
AntPool,
|
||||
MultiCoinCo,
|
||||
BCPoolIo,
|
||||
Cointerra,
|
||||
KanoPool,
|
||||
SoloCK,
|
||||
CKPool,
|
||||
NiceHash,
|
||||
BitClub,
|
||||
BitcoinAffiliateNetwork,
|
||||
BTCC,
|
||||
BWPool,
|
||||
EXXAndBW,
|
||||
Bitsolo,
|
||||
BitFury,
|
||||
TwentyOneInc,
|
||||
DigitalBTC,
|
||||
EightBaochi,
|
||||
MyBTCcoinPool,
|
||||
TBDice,
|
||||
HASHPOOL,
|
||||
Nexious,
|
||||
BravoMining,
|
||||
HotPool,
|
||||
OKExPool,
|
||||
BCMonster,
|
||||
OneHash,
|
||||
Bixin,
|
||||
TATMASPool,
|
||||
ViaBTC,
|
||||
ConnectBTC,
|
||||
BATPOOL,
|
||||
Waterhole,
|
||||
DCExploration,
|
||||
DCEX,
|
||||
BTPOOL,
|
||||
FiftyEightCoin,
|
||||
BitcoinIndiaLowercase,
|
||||
ShawnP0wers,
|
||||
PHashIO,
|
||||
RigPool,
|
||||
HAOZHUZHU,
|
||||
SevenPool,
|
||||
MiningKings,
|
||||
HashBX,
|
||||
DPOOL,
|
||||
Rawpool,
|
||||
Haominer,
|
||||
Helix,
|
||||
BitcoinUkraine,
|
||||
Poolin,
|
||||
SecretSuperstar,
|
||||
TigerpoolNet,
|
||||
SigmapoolCom,
|
||||
OkpoolTop,
|
||||
Hummerpool,
|
||||
Tangpool,
|
||||
BytePool,
|
||||
SpiderPool,
|
||||
NovaBlock,
|
||||
MiningCity,
|
||||
BinancePool,
|
||||
Minerium,
|
||||
LubianCom,
|
||||
OKKONG,
|
||||
AAOPool,
|
||||
EMCDPool,
|
||||
FoundryUSA,
|
||||
SBICrypto,
|
||||
ArkPool,
|
||||
PureBTCCom,
|
||||
MARAPool,
|
||||
KuCoinPool,
|
||||
EntrustCharityPool,
|
||||
OKMINER,
|
||||
Titan,
|
||||
PEGAPool,
|
||||
BTCNuggets,
|
||||
CloudHashing,
|
||||
DigitalXMintsy,
|
||||
Telco214,
|
||||
BTCPoolParty,
|
||||
Multipool,
|
||||
TransactionCoinMining,
|
||||
BTCDig,
|
||||
TrickysBTCPool,
|
||||
BTCMP,
|
||||
Eobot,
|
||||
UNOMP,
|
||||
Patels,
|
||||
GoGreenLight,
|
||||
BitcoinIndiaCamel, // duplicate-ish entry preserved with slight name change
|
||||
EkanemBTC,
|
||||
CanoeUppercase,
|
||||
TigerLowercase,
|
||||
OneM1X,
|
||||
Zulupool,
|
||||
SECPOOL,
|
||||
OCEAN,
|
||||
WhitePool,
|
||||
Wiz,
|
||||
Mononaut,
|
||||
Rijndael,
|
||||
Wk057,
|
||||
FutureBitApolloSolo,
|
||||
Emzy,
|
||||
Knorrium,
|
||||
CarbonNegative,
|
||||
PortlandHODL,
|
||||
Phoenix,
|
||||
Neopool,
|
||||
MaxiPool,
|
||||
DrDetroit,
|
||||
BitFuFuPool,
|
||||
LuckyPool,
|
||||
MiningDutch,
|
||||
PublicPool,
|
||||
MiningSquared,
|
||||
InnopolisTech,
|
||||
Nymkappa,
|
||||
BTCLab,
|
||||
Parasite,
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
mod id;
|
||||
mod pool;
|
||||
mod pools;
|
||||
|
||||
pub use id::*;
|
||||
pub use pool::*;
|
||||
pub use pools::*;
|
||||
@@ -0,0 +1,12 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::pools::PoolId;
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct Pool {
|
||||
pub id: PoolId,
|
||||
pub name: &'static str,
|
||||
pub addresses: Box<[&'static str]>,
|
||||
pub tags: Box<[&'static str]>,
|
||||
pub link: &'static str,
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user