區塊鏈入門到獲利


陳品

早安  我的朋友

平安、喜樂、賺大錢

給忙碌人的挖礦教學

今天我們不挖 bitcoin

今天我們不挖 bitcoin

我們挖 Ethereum

Ethereum 挖礦流程

  • 連上礦池挖礦

  • 交易所換匯

  • 噹,變台幣~

組礦機

  • AMD 顯示卡
    • vRAM>2GB
  • 足夠的電源供應器
  • >4GB RAM
  • 散熱規劃
  • 剩下隨便啦

錢  包

  • 離線錢包
  • 線上錢包
  • 交易所錢包

虛擬貨幣交易所

  • Poloniex
  • Bittrex
  • C-Cex

BTC-NTD交易所

  • BitoEx
  • Maicoin
  • 地下匯兌

Cryptocoin Miner

GPU_FORCE_64BIT_PTR 0
GPU_MAX_HEAP_SIZE 100
GPU_USE_SYNC_OBJECTS 1
GPU_MAX_ALLOC_PERCENT 100
GPU_SINGLE_ALLOC_PERCENT 100

EthDcrMiner64.exe -epool eth-asia.dwarfpool.com:8008 
-ewal 0x749ccdca77c27bc181580b6dba5560bdf000d88f -epsw x

setup

Live Demo

About Bitcoin

我現在可以用 Bitcoin 幹嘛?

  • 買 Steam 的遊戲
  • 讓俄羅斯人幫你的 FB 文章按讚
  • 到 Amazon 大買特買
  • 付贖金給加密你檔案的人

什麼是貨幣

加密貨幣

Centralize

Decentralize

所以挖礦就是 :

let  x = "0x749ccdca77c27..."

f ( x + N ) = 0x0000...

find out any of legal N

 

Bitcoin 2.0 3.0 4.0 ?

Application

  • Turing Complete

  • Gas

  • Environment

  • Decentralize

Untraceable

天花板沒有洞啊

怎麼會有區塊鍊掉下來

價格、市場趨勢、新技術

我就再跑回去看

bitcointalk, reddit, 8btc

相關資訊來源

  • 口耳相傳 (?
  • 區塊練技術論壇
  • 當地社群

Taipei Ethereum Meetup

The Next Big Thing

Decentralized Autonomous Organization (DAO)

BlockCDN

blockchain-based CDN service

High Frequency Trading

DAPP

Decentralized Application

Smart Contract

Smart Contract

Smart Contract

if ( $ ):
    
    select item #



switch ( # ) :
    
    sell something

    sell something


confirm


end    

其實就是自動販賣機嘛

Solidity

pragma solidity ^0.4.6;
contract Bet {
    address[] Players; 
    mapping(address => uint) Bet_answer;
    mapping(address => uint) Bet_value;
    mapping(address => bool) is_winner;
    uint last_roundtime ;
    uint winner_count ;
    uint winner_total_invest ;

   function Bet(){
        mapping(address => uint) Bet_answer;
        mapping(address => uint) Bet_value;
        mapping(address => bool) is_winner;
        uint last_roundtime = now;
        uint winner_count = 0;
        uint winner_total_invest = 0;
    }
    
    function Join(uint bet) returns(bool){
        if(msg.sender.balance >= msg.value){
            Players.push(msg.sender);
            Bet_answer[msg.sender] = bet;
            Bet_value[msg.sender] = msg.value;
            return true;
        }
        else{
            return false;
        }
    }   

    function betClose(uint answer){
        if(now - last_roundtime >= 10 minutes && msg.sender == 0xabc){
            for(uint i = 0 ; i < Players.length ; i ++){
                if( Bet_answer[Players[i]] == answer ){
                    winner_count ++;
                    is_winner[Players[i]] = true;
                    winner_total_invest += Bet_value[Players[i]];
                }
               
            }   
            if (winner_count > 0){
                winnerWinner();
            }
            delete Players;
            last_roundtime = now;
            winner_total_invest = 0;
            winner_count = 0;
        } 

    }
    function winnerWinner (){
        for(uint i = 0 ; i < Players.length ; i++){
                if( is_winner[Players[i]] == true ){
                   if(! Players[i].send( Bet_value[Players[i]] / winner_total_invest * this.balance ) ){
                       throw;
                   }
                }
            }   
    }
}

Bet

Credit: Daniel Hsu 

pragma solidity ^0.4.6;
contract Vending {
    uint[3] items = [10,1000,10000];
   
    address refundAddr = 0x123;
    uint selectedItem;
    bool selected = false;

    function SelectItem(uint item){
        selectedItem = item;
        selected = true;
    }

    function Buy(uint selectedItem) returns(bool){
        if(msg.sender.balance >= msg.value && msg.value >= items[selectedItem] && selected == true){
            if (!refundAddr.send(msg.value)){
                 throw;
            }
            giveItemToBuyer();
            selected = false;
        }
        else{
            return false;
        }
        
    }
    function giveItemToBuyer(){
    }

}

Vending Machine

Credit: Daniel Hsu 

Solidity 入門

Reference

http://www.varchevbrokers.com/hft-high-frequency-trading/?lang=en

http://www.flaticon.com/

http://cn.nytimes.com/business/20160701/bitcoin-china-part2/zh-hant/

延伸閱讀

http://slides.com/chih-chengliang/blockchain_intro-10#/7/1

 

http://www.rirc.nccu.edu.tw/doc/105.05.28/smart_contract-NCCU-2016-05-28-Final.pdf

 

https://read01.com/dBxaEE.html

 

https://www.coursera.org/learn/cryptocurrency

Q & A

區塊鏈 ─ 從入門到獲利

By Ping Chen

區塊鏈 ─ 從入門到獲利

  • 824