Crates.io | powco |
lib.rs | powco |
version | 0.1.3 |
source | src |
created_at | 2022-02-10 04:53:45.094424 |
updated_at | 2022-02-10 08:17:56.024022 |
description | Rust Client for Pow.co HTTP & Websockets APIs |
homepage | https://onchain.sv/1PhzehjmBy1AaT5No3NzPfTKYWamGno9Aj |
repository | |
max_upload_size | |
id | 530028 |
size | 13,409 |
Rust Client for Pow.co HTTP & Websockets APIs
Authentication is done via ecdsa key pairs, where some API calls require small payments of Bitcoin
let keys = powco::Keys::generate();
println!("identifier: {}", keys.identifier);
println!("secret: {}", keys.secret);
Any valid Bitcoin private key (not HD) and address will work as secret and identifier
use std::env;
let keys = powco::Keys {
identifier: env::var("POWCO_CLIENT_ID"),
identifier: env::var("POWCO_CLIENT_SECRET"),
}
let client = powco::Client { keys: keys }
if !client.has_valid_keys() {
panic!("Invalid API Key Pair")
}
This call does not require payment
let jobs: Vec{powco::Job} = client.list_available_jobs();
This call does require payment. Getting a job will allow your boost miner to provide work for the job and claim the coins contained therein.
let job: powco::Job = client.get_job(&job.uid);