Coinhive 教學 - 讓網頁瀏覽器幫你挖礦(門羅幣 XMR),賺進額外收入

傳統的網頁想賺錢,直覺大概就會想到投放廣告,但現在誰的瀏覽器沒有裝ADB?廣告早就被擴充插件都阻擋掉了,何況純瀏覽的收入少之又少,靠經營網站賺錢顯得越來越困難。

而結合最新興的潮流-挖礦,不但可以讓網頁保持乾淨不會有煩人的廣告,還可以為網頁主賺進一筆額外收入,聽起來有多吸引人應該就不用我贅述了吧,可能大部分人的第一個反應會認為挖礦不是很燒顯卡嗎?會不會看一看網頁就當掉了,但 Coinhive 其實是用CPU挖礦的,而且可以自行調節功率,實際上在使用者的角度幾乎感覺不到有在挖礦,我相信未來網頁挖礦會慢慢成熟替代傳統煩人的廣告,成為網站營運的經費來源。


那回到主題,就要來介紹開發這項計畫的 Coinhive 了,基本上它的運營原理很簡單,網站主在 Coinhive 註冊帳號,取得程式碼  (其實js也都是在Coinhive的伺服器,所以幾乎不會影響到網站的速度) ,然後只要有人在瀏覽你的網站它就會自動幫你挖礦了,會即時顯示在 Coinhive 的儀錶板上,一旦到了它的起付額 (0.5 XMR) 就可以提領到自己的虛擬錢包,就是這麼簡單。


coinhive
Coinhive

  • 官方網站:https://coinhive.com 
  • (如果不介意可以點cnhv.co/hbli 轉址能為我賺一點點XMR)
  • 挖取貨幣:門羅幣 Monero (XMR)
  • 起付金額:0.5 XMR








註冊完成後先到 settings 裡面的 Sites & API Keys 創立一個新網站 (Create A New Site)


之後會得到兩組Key,Site Key (public) 是拿來置入程式碼內的Secret Key記得不要讓他人知道,如果不小心洩漏了可以按 revoke 重新產生。





documentation 裡面有幾種現成的挖礦程式碼,Captcha 是類似轉網址的服務,在轉址中也會順便挖礦回饋給建立連結的人。




以最簡單的 Simple Miner UI 為例

因為主要的程式碼都在 Coinhive 的伺服器端,其實只是單純導入然後有一些參數可以設置,如下的 "width: 256px; height: 310px" 可以設定介面的寬與高,YOUR_SITE_KEY則要改成自己的 Site key (public)。

<script src="https://authedmine.com/lib/simple-ui.min.js" async></script>
<div class="coinhive-miner" 
 style="width: 256px; height: 310px"
 data-key="YOUR_SITE_KEY">
 <em>Loading...</em>
</div>
挖礦介面大致上的樣子:



Loading...
下面是一些官網提供的參數,可以加在<div>裡面接在data-key之後

data-keyYour public Site-Key. See Settings » Sites.
data-userOptional. The user name to which the hashes will be credited to. Just leave this empty if you are unsure.
data-autostart
自動開始
Optional. Whether to automatically start mining (true|false). The default is false. The miner will only autostart on subsequent page loads after the user has initially started the miner once himself. See our AuthedMine documentation for the details.
data-whitelabel
是否顯示由coinhive提供
Optional. Whether to hide the Powered by Coinhive text (true|false). The default is false.
data-background
背景顏色
Optional. The background color for the UI as 3 or 6 digit HEX color code. E.g.: #000000 for black, #ff0000 for red. Try htmlcolorcodes.com to find the right colors.
data-text
字體顏色
Optional. The text color for the UI as 3 or 6 digit HEX color code. E.g.: #000000 for black or #ff0000 for red. Try htmlcolorcodes.com to find the right colors.
data-action
動作顏色
Optional. The action color for the UI as 3 or 6 digit HEX color code. E.g.: #000000 for black or #ff0000 for red. Try htmlcolorcodes.com to find the right colors.
data-graph
圖形顏色
Optional. The graph color for the UI as 3 or 6 digit HEX color code. E.g.: #000000 for black or #ff0000 for red. Try htmlcolorcodes.com to find the right colors.
data-threads
執行緒數量
Optional. The number of threads the miner should start with.
data-throttle
初始的挖礦功率
Optional. The throttle value the miner should start with. See miner.setThrottle()
當然還有更多細節可以自訂,也有別種的 gui 可以選擇,有興趣的可以慢慢摸索,如果想看目前挖的進度可以到 dashboard 查看,在下方也會統計轉址 shortlinks 為你賺了多少 hashes。


但藉由瀏覽器的挖礦成效一定非常有限,一來侷限於瀏覽者的硬體設施一定不如專業挖礦,二來瀏覽器本身就會有一定的資源限制,不可能讓你無限使用CPU資源,所以網頁挖礦的概念其實是積少成多,比較起傳統投置廣告的好處就是它的收益曲線更平滑,不會在沒人點擊廣告的情況下收益幾乎掛零,挖礦長久累積起來還是不無小補的,未來挖礦產業可能會更成熟,XMR也是值得討論的新興虛擬貨幣,就和當時比特幣一樣,越早入場越有可能賺到時間紅利,不妨試試看這個網頁挖礦的功能吧!


如果喜歡這篇文章也歡迎點擊 Coinhive 的轉址進入官網,順便也能為我賺進一點點的 XMR 哦。(cnhv.co/hbli

留言

這個網誌中的熱門文章

CPU 加密貨幣挖礦入門首選匿名幣 - Monero(XMR)、Electroneum(ETN)、IntenseCoin(ITNS),到底該挖哪個?(CryptoNight 收益計算機)

格式化 (Format) 教學,重灌基本功|配置單位大小|NTFS、FAT32、exFAT 怎麼選?

Ubuntu 打不出中文?(Chinese input / Type Chinese) 安裝 gcin 注音輸入法輕鬆打出繁體中文