Latest0.1.0
Homepagehttps://github.com/TENDIGI/XMRMiner
LicenseMIT
Platformsios 10.0, osx 10.12
DependenciesCocoaAsyncSocket, ObjectMapper, NSData+FastHex
Authors

XMRMiner is an embeddable Monero miner written in Swift. It can be used to repurpose old iPhones/iPads, or as an alternative to in-app ads as a means for generating revenue. Use it responsibly.

Version

Miner Working

Why Monero?

There are a lot of reasons. More importantly, however, it can be mined profitably on low-end CPUs which makes it perfect for the ARM chips in iPhones and iPads. It’s also the currency similar web-based offerings use.

We tested it on a variety of devices. As an example, an iPhone 7 Plus can operate at a hashrate of 50 H/s when the library is compiled with the -Ofast optimization profile. At the time of this writing, that means it will generate approximately $2.37/month according to this calculator.

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

To get started, you’ll need to set up a Monero wallet and get a Monero address. You can either set up a wallet locally by following a guide like this one, or use an online wallet like MyMonero.

Also, you’ll need at least the following:

  • iOS 10.0+
  • Xcode 9+
  • Swift 4+

Installation and Usage

Getting the library

XMRMiner is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod 'XMRMiner'

Integrating the miner into an application

First, import the library:

import XMRMiner

Next, you’ll need to instantiate a Miner. If you’re just getting started, most of the default parameters should be fine. See Miner.swift for the other parameters that can be passed to the Miner constructor. We did this in AppDelegate.swift.

let miner = Miner(destinationAddress: "<your Monero address>")

You’ll then want to set the Miner’s delegate, and implement the status method:

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
    miner.delegate = window?.rootViewController as? MinerDelegate
    return true
}

In our app’s ViewController.swift:

extension ViewController: MinerDelegate {
    func miner(updatedStats stats: MinerStats) {
        hashrateLabel.text = "(stats.hashRate) H/s"
        submittedHashesLabel.text = "(stats.submittedHashes)"
    }
}

Finally, you’ll want to configure your app to start/stop the Miner at appropriate times. Again, in AppDelegate.swift:

func applicationWillResignActive(_ application: UIApplication) {
    miner.stop()
}

func applicationDidBecomeActive(_ application: UIApplication) {
    do {
        try miner.start()
    }
    catch {
        print("something bad happened")
    }
}

Author

Nick Lee, [email protected]

License / Credits

Portions of this software are subject to additional license restrictions, as they have been ported from the Xmonarch repository. They can be found in the Vendor/crypto folder.

XMRMiner is available under the MIT license.

Latest podspec

{
    "name": "XMRMiner",
    "version": "0.1.0",
    "summary": "An embeddable Monero miner written in Swift.",
    "description": "XMRMiner is an embeddable Monero miner written in Swift. It can be used to repurpose old iPhones/iPads, or as an alternative to in-app ads as a means for generating revenue. Use it responsibly.",
    "homepage": "https://github.com/TENDIGI/XMRMiner",
    "screenshots": [
        "https://github.com/TENDIGI/XMRMiner/raw/master/Assets/xmrminer.gif"
    ],
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "nickplee": "[email protected]"
    },
    "source": {
        "git": "https://github.com/TENDIGI/XMRMiner.git",
        "tag": "0.1.0"
    },
    "social_media_url": "https://twitter.com/tendigi",
    "platforms": {
        "ios": "10.0",
        "osx": "10.12"
    },
    "source_files": [
        "XMRMiner/Source/**/*.{h,swift,m,mm}",
        "XMRMiner/Vendor/crypto/**/*.{c,cpp,s,S}",
        "XMRMiner/Vendor/crypto/**/*.{h,hpp}"
    ],
    "public_header_files": [
        "XMRMiner/Source/**/*.h"
    ],
    "private_header_files": [
        "XMRMiner/Vendor/crypto/**/*.{h,hpp}"
    ],
    "dependencies": {
        "CocoaAsyncSocket": [
            "~> 7.6"
        ],
        "ObjectMapper": [
            "~> 3.0"
        ],
        "NSData+FastHex": []
    },
    "pushed_with_swift_version": "4.0"
}

Pin It on Pinterest

Share This