dartminer 0.0.6 copy "dartminer: ^0.0.6" to clipboard
dartminer: ^0.0.6 copied to clipboard

outdatedDart 1 only

A Bitcoin miner with Dart language.

example/dartminer.dart

// Import the dartminer package.
import 'package:dartminer/dartminer.dart';

// Our main file
void main() {  
  
  // Create a bitcoin client with the proper configuration.  
  Bitcoin bitcoin = new Bitcoin({
    "scheme": "http",
    "host": "127.0.0.1",
    "port": 18332,
    "user": "bitcoinrpc",
    "pass": "123123123123123"
  });
  
  // Mine for gold.
  void mineForGold() {
    
    // Get work from the bitcoind.
    bitcoin.getwork().then((Map<String, String> work) {
      
      // Work.
      print(work);
      
      // Create the miner.
      Miner miner = new Miner.fromJSON(work);
      
      // Mine for gold!
      Map<String, String> result = miner.mine();
      
      // If the result isn't null, then
      if (result != null) {
        print('Gold!');
        print(result);
        bitcoin.getwork(params: [result['data']]);
      }
      
      // Mine for more gold.
      mineForGold();
    });
  }
  
  // Mine for gold.
  mineForGold();
}
0
likes
0
points
18
downloads

Publisher

unverified uploader

Weekly Downloads

A Bitcoin miner with Dart language.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

unittest, utf

More

Packages that depend on dartminer