Cryptojacking How To

Cryptojacking tutorial

This tutorial is a cryptojacking how-to detailing exactly what you need to setup an opt-in WordPress Coinhive miner for the Monero cryptocurrency.

The 4 basic steps are:

  1. Get a mymonero.com account.
  2. Get a coinhive.com account.
  3. Customize JavaScript code.
  4. Add JavaScript code to your site.

Get a mymonero.com account

  • Navigate to https://mymonero.com.
  • Create an account.
  • Copy down your Private Login Key.
  • Store your Address.

Private Login Key

Cryptojacking How To: MyMonero Private

Address

Cryptojacking How To: MyMonero Address

Get a coinhive.com account

Cryptojacking How To: Coinhive

Customize JavaScript code

Cryptojacking How To: Coinhive Site Key

Add JavaScript code to your site

If you're using a WordPress site, there are WordPress plugins that should make this super easy to configure.

However...

If you don't want to install yet another plugin to simply add JavaScript to your posts, here's what I did...

  • Install the Ad Inserter WordPress plugin.
  • Ad Inserter provides many advanced options to insert any JavaScript, CSS, HTML, PHP or advert code anywhere on the page.
  • In your WordPress Admin page, go to Settings > Ad Inserter.
  • Add your JavaScript snippet.
  • Set Automatic Insertion to Before Post.
  • Set the Posts dropdown to Individually enabled. If you want the code on all posts, change this to Individually disabled.
  • Click Save All Settings.
  • Navigate to your post, scroll to the bottom, and enable it in the post.

Ad Inserter settings

Cryptojacking How To: Ad Inserter

Enable Ad Inserter

Cryptojacking How To: Enable Ad Inserter

About the Author

Ray Li

Ray is a software engineer and data enthusiast who has been blogging for over a decade. He loves to learn, teach and grow. You’ll usually find him wrangling data, programming and lifehacking.

Comments 8

    1. Post
      Author

      To get an idea of how Coinhive accomplishes cryptojacking, you could inspect their source code. It’s written in JavaScript, so presumably you could just debug the code that is executing in your browser to get some ideas. Then put together something similar.

      You could also check GitHub for others that may have done this before: https://github.com/search?q=coinhive.

  1. i will like to know how i can use this your script to create a cryptojacking script that can be adder to an application like a windows application

    1. Buddy did you figure it out? I’m also trying to do something similar and It’ll be great help for me if you are kind enough to guide me. Please.

  2. “Then customize the JavaScript code below by substituting the Site Key inline 3”
    please explain this in detail I didn’t understood

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.