Quantcast
Channel: 未分类 –懒得折腾
Viewing all 759 articles
Browse latest View live

Accessible Google Maps

$
0
0

Accessible Google Maps

Breaking a bit of a rule here in order to help out a colleague – committing code without tests. Gasp!!! I have been working on this for a while but got interrupted and have not gone back to make sure all my tests work, but a colleague needs this work, so…here it is.

Patrick Lauke did a posting on how to make Google Maps accessible a while back but it is out of date, so I took a shot at making Google maps v3 accessible.

First things first, Google has really made absolutely no attempt to make Google maps accessible at all and the fact that I can take a weekend, without access to their code and make it basically fully keyboard and screen reader accessible (at least for the basic functionality) speaks to how irrelevant accessibility seems to be to them. Shame on you Googlers!!

Secondly, the Google maps markup is obviously generated because it does not contain a single class. It does not contain a style sheet and all of the styling is inline for all the elements. This makes the code particularly difficult to retro. I basically had to resort to looking for the title attributes on elements to try to figure out what they are. This means that this code is language dependent. I did go to the trouble of making it work for both English and German, and would appreciate any assistance in adding support for other languages. Please use the normal pull request mechanism in the a11yfy repository to contribute.

As you can tell from the above paragraph, the code has been integrated into the a11yfy repo BUT is independent of the rest of the library, so using it is simple. Simply include one JavaScript file into your page…

    http://gmaps/jquery.a11yfy.gmaps.js

…and then call the gmaps() jQuery method on the container that contains the Google Map element(s)…

    jQuery(document).gmaps();

The Accessible Google Maps demo is up on my github.io pages and there is also an example in the google-maps.html file in the examples directory in the repository that you can use to play around with this. Please send feedback via GitHub or comments on this posting.

Limitations of this implementation is that it works only for the default functionality and I have not tested it with multiple maps on the same page (I think it will not work – at least not the sliders and not unless you call the gmaps() function once for each map), but the concept can be expanded to add support for any/all of the Google Maps features. Perhaps you can contribute to this by adding support for the features you are using or requesting a feature on GitHub.

UPDATE 11/24/2013: Added the link to the running example on github.io.

UPDATE 3/23/2014: Fixed the link to the running example on github.io.



Keyboard accessible Google map

$
0
0

Keyboard accessible Google map

The basic zoom and pan controls on embedded Google maps are not keyboard accessible.

This can be addressed by including the map via one of the scripts in the examples below. Try it out by pressing the Tab key to move focus to the map controls. Once a map control has focus it can be activated using the Enter key.

To pan the map, move focus to one of the zoom controls, then press an Arrow key on the keyboard.

Example 1 – default controls

Code

<!DOCTYPE html>
<html lang=“en”>
<head>
    
<meta charset=“utf-8”>
    
<title>Keyboard access to Google maps</title>
<style>

#map_canvas {
     width
: 500px;
     height
: 400px;
}
</style>
<!–add Google map library–>
 src=http://maps.googleapis.com/maps/api/js?sensor=false&#8221;>

<!–add keybpard access script–>

(function(){

if(!window.visionaustralia) window.visionaustralia = {};

visionaustralia

.addmap = function(domid,lat,lon,zo){

    

var map;
    
function init() {
        
var map_canvas = document.getElementById(domid);
        
var map_options = {
            center
: new google.maps.LatLng(lat,lon),
            zoom
: zo,
            mapTypeId
: google.maps.MapTypeId.ROADMAP
        
}
        map 
= new google.maps.Map(map_canvas, map_options);

        

var hPan = Math.floor(map_canvas.offsetHeight/3);
        
var wPan = Math.floor(map_canvas.offsetWidth/3);

        

var googListener = google.maps.event.addListener(map, ’tilesloaded’, function() {

            

var titles = {“zoom in”:1,“zoom out”:1,“show street map”:1,“show satellite imagery”:1};
            
var divs = map_canvas.getElementsByTagName(“div”);
            
for(var i=0,el;el=divs[i];i++){

                

var title = el.getAttribute(“title”)
                
if(title) title=title.toLowerCase().trim();
                
if(title in titles){

                    el

.setAttribute(“tabindex”,“0”);
                    el
.setAttribute(“role”,“button”);
                    el
.setAttribute(“aria-label”,title);
                    el
.addEventListener(“keydown”, function(ev){
                        
var key = ev.keyCode || ev.which;
                        
if(key == 13 || key == 32){
                            
var event = document.createEvent(‘HTMLEvents’);
                            event
.initEvent(‘click’, true, false);
                            
this.dispatchEvent(event);

                        

}else if(key==40) {//down
                            map
.panBy(0, wPan);
                        
}else if(key==38) {//up
                            map
.panBy(0, wPan);
                        
}else if(key==37) {//left
                            map
.panBy(-hPan, 0);
                        
}else if(key==39) {//right
                            map
.panBy(hPan, 0);
                        
}else{
                            
return
                        
}
                        ev
.preventDefault();
                    
});

                    

(function(el){
                        
var mo = false;
                        
var bo = el.style.border;
                        
var ma = el.style.margin;
                        
var bc = el.style.backgroundColor;
                        
var op = el.style.opacity;

                        el

.addEventListener(“mouseover”,(function(){mo=true;}));
                        el
.addEventListener(“mouseout”,(function(){mo=false;}));

                        el

.addEventListener(“focus”,(function(){
                            
if(mo)return;
                            el
.style.border =“2px solid blue”;
                            el
.style.margin=“-2px”;
                            el
.style.backgroundColor = “transparent”;
                            el
.style.opacity = “1”;
                        
}));
                        el
.addEventListener(“blur”,(function(){
                            el
.style.border = bo;
                            el
.style.margin= ma;
                            el
.style.backgroundColor = bc;
                            el
.style.opacity = op;
                        
}));
                    
})(el);
                
}
            
}
            
            google
.maps.event.removeListener(googListener);
        
});
    
}//end init

    google

.maps.event.addDomListener(window, ‘load’, init);

}//end addmap
})();

</head>
<body>

<p>content….</p>
 id=“map_canvas”>


<p>…. other content</p>


//”map_canvas” is the id of the div that will contain the map and the 3 parameters after are: latitude, longitude and zoom level
visionaustralia
.addmap(“map_canvas”,45.6,4.9,8);

</body>
</html>

Example 2 – custom controls

This example replaces the default controls with a custom SVG control.

Press the Tab key to move focus to a control, then press the Enter key to activate it.

To pan the map, move focus to one of the zoom controls, then press an Arrow key on the keyboard.

Code

<!DOCTYPE html>
<html lang=“en”>
<head>
    
<meta charset=“utf-8”>
    
<title>Keyboard access to Google maps – custom controls</title>
<style>

#map_canvas_2 {
     width
: 500px;
     height
: 400px;
}
</style>
<!–add Google map library–>
 src=http://maps.googleapis.com/maps/api/js?sensor=false&#8221;>

<!–add keybpard access script–>

(function(){

if(!window.visionaustralia) window.visionaustralia = {};

visionaustralia

.addmapII = function(domid,lat,lon,zo){

    

var map;
    
    
function init() {
        
var map_canvas = document.getElementById(domid);
        
var map_options = {
            center
: new google.maps.LatLng(lat,lon),
            zoom
: zo,
            mapTypeId
: google.maps.MapTypeId.ROADMAP,
            disableDefaultUI
: true
        
}
        map 
= new google.maps.Map(map_canvas, map_options);

        

var hPan = Math.floor(map_canvas.offsetHeight/3);
        
var wPan = Math.floor(map_canvas.offsetWidth/3);
        
        
var div = document.createElement(“div”);
        div
.setAttribute(“style”,“position:absolute;border:none;outline:none;padding:0px;margin:0px 6px 0px 0px;”);
        div
.innerHTML =;
        
        
var yin = div.getElementsByClassName(“yin”)[0];
        
var yang = div.getElementsByClassName(“yang”)[0];
        
        
var bStyl = “position: absolute !important;clip: rect(1px, 1px, 1px, 1px);padding: 0 !important;border: 0 !important;height: 1px !important;width: 1px !important;overflow: hidden”;
        
        
var yinB = document.createElement(“button”);
        yinB
.setAttribute(“aria-label”,“Zoom out”);
        yinB
.setAttribute(“style”,bStyl);
        
        
var yangB = document.createElement(“button”);
        yangB
.setAttribute(“aria-label”,“Zoom in”);
        yangB
.setAttribute(“style”,bStyl);
        
        div
.appendChild(yinB);
        div
.appendChild(yangB);
    
        map
.controls[google.maps.ControlPosition.RIGHT_BOTTOM].push(div);

        

var arr,i,el;
        arr 
= [yin,yinB];
        
for(i=0;el=arr[i];i++){
            el
.addEventListener(‘click’, function(ev) {
                map
.setZoom(map.getZoom() + 1);
                ev
.stopPropagation();
                ev
.preventDefault();
            
});
        
}
        arr 
= [yang,yangB];
        
for(i=0;el=arr[i];i++){
            el
.addEventListener(‘click’, function(ev) {
                map
.setZoom(map.getZoom()  1);
                ev
.stopPropagation();
                ev
.preventDefault();
            
});
        
}
        
        yinB
.addEventListener(‘focus’, function() {
            
//IE wants this done everytime(?)
            
var yins = yin.getElementsByTagName(“*”);
            yins
[0].setAttribute(“fill”,“yellow”);
            yins
[0].setAttribute(“stroke-width”,“1”);
            yins
[1].setAttribute(“stroke-width”,“1”);
        
});
        yinB
.addEventListener(‘blur’, function() {
            
var yins = yin.getElementsByTagName(“*”);
            yins
[0].setAttribute(“fill”,“black”);
            yins
[0].setAttribute(“stroke-width”,“0”);
            yins
[1].setAttribute(“stroke-width”,“0”);
        
});
        yangB
.addEventListener(‘focus’, function() {
            
var yangs = yang.getElementsByTagName(“*”);
            yangs
[0].setAttribute(“fill”,“yellow”);
        
});
        yangB
.addEventListener(‘blur’, function() {
            
var yangs = yang.getElementsByTagName(“*”);
            yangs
[0].setAttribute(“fill”,“white”);
        
});
        
        arr 
= [yinB,yangB];
        
for(i=0;el=arr[i];i++){
            el
.addEventListener(“keydown”, function(ev){
                
var key = ev.keyCode || ev.which;
                
if(key==40) {//down
                    map
.panBy(0, wPan);
                
}else if(key==38){//up
                    map
.panBy(0, wPan);
                
}else if(key==37){//left
                    map
.panBy(-hPan, 0);
                
}else if(key==39){//right
                    map
.panBy(hPan, 0);
                
}else if(key==61 || key== 107){
                     map
.setZoom(map.getZoom() + 1);
                
}else if(key==173 || key== 109){
                     map
.setZoom(map.getZoom()  1);
                
}else{
                    
return;
                
}
                ev
.stopPropagation();
                ev
.preventDefault();
            
});
        
}
    
}//end init

    google

.maps.event.addDomListener(window, ‘load’, init);

}//end addmap
})();

</head>
<body>

<p>content….</p>
 id=“map_canvas_2”>


<p>…. other content</p>


//”map_canvas” is the id of the div that will contain the map and the 3 parameters after are: latitude, longitude and zoom level
visionaustralia
.addmapII(“map_canvas_2”,55.651,12.081,13);

</body>
</html>

Terms of Use

Developed by Pierre Frederiksen. Pierre is a Digital Access Specialist at Vision Australia

This software is being provided “as is”, without any express or implied warranty. In particular, Vision Australia does not make any representation or warranty of any kind concerning the reliability, quality, or merchantability of this software or its fitness for any particular purpose. additionally, Vision Australia does not guarantee that use of this software will ensure the accessibility of your web content or that your web content will comply with any specific web accessibility standard.


國際主義格局下的東亞民族構建

$
0
0

本文为2017年9月24日在中國民主轉型研究所和普林斯頓大學中美聯盟主办“普林斯顿中国论坛”第三期所做分享的文字版。整理者:三馬兄

簡介:

共產國際和早期馬克思主義的認知差異,主要在於列寧的帝國主義論。帝國主義論主要是一種差序格局的世界秩序觀,將世界劃分為中心和邊緣。中心的資本主義之所以沒有像馬克思預言的那樣自我瓦解,是因為工人階級加入了共同剝削邊緣地帶的聯盟,在歐洲政治上體現為社民黨和資產階級的聯盟。資本家的統治不能僅僅依靠剝削本國工人階級,而且要依靠剝削邊緣地區和殖民地,因此從自由資本主義發展到帝國主義。儘管民族主義是資產階級的虛假構建,在中心地區是反動的,但邊緣地區的資本主義同樣遭到帝國主義剝削,因此具備進步和反動的兩面性。帝國主義時代的國際革命,不能像自由資本主義時代一樣,局限於發動中心地帶的工人階級,而是要統戰和領導邊緣地區的資產階級,從帝國主義的薄弱環節入手。共產國際對伊斯蘭世界、東亞和各殖民地的政策,就是建立在這個理論之上。大多數非西方的民族國家構建,都以不同方式受到共產國際上述戰略的刺激或影響。中華民族、中國本部、漢族、少數民族、台灣和韓國等政治構建,都產生於上述鬥爭。北京政府今天的國際格局觀和內外政策,仍然深受上述構建方式的影響。

https://www.youtube.com/watch?v=U5eNs7DPP8c(注:該視頻存在中斷。)

我們要注意,民族主義是近代世界國家構建的主要基礎。迄今為止,在最近五百年內,儘管民族主義有眾多流弊,但是實際上大多數已經成型的國家都是按照民族主義的構建方式和想像方式建立起來的,迄今為止我們還沒有找到可以替代它的方式。而且民族主義的產生與我們通常所說的民主 — — 也就是說政權由上層階級壟斷逐步轉到全社會共同參與的這個過程有非常密切的關係。在政權可以由上層階級壟斷的情況下,強調民族是不必要的,一般都只是說各種稱號的統治者和臣民之間的關係,很少有人提到民族。即使提到,意義也跟我們現在提到的不一樣。

民族這個概念最初產生,就是英、法、荷蘭這些比較先進、首先進入近代社會的國家試圖探索將政權由舊式的封建君主轉移到社會各階層共同參與的方法,在這個過程當中為自己尋找合法性。典型的法蘭西式民族構建強調的就是,由忠於法蘭西國王轉為忠於法蘭西國民,但是國王是實有其人的,國民,那麼誰是國民,誰不是國民呢?到底你是法蘭西國民還是非法蘭西國民?這就需要有一個定義問題。而且集體意志的產生在技術操作上是困難得多的。最後集體意志產生的過程必然跟我們所說的民主進程融匯在一起,因為最初的哪怕是共和國的政治構建雖然不見得符合我們現在對民主的理解,但它必然要把有形體的君主統治轉化為有待於定義的一個共同體的統治,然後圍繞著這個共同體的構建展開現代社會的政治進程,因此民族和民主通常是連在一起的。

無論在英國和法國,在宗教戰爭以後走向近代的幾次革命的過程中間,一般的說法都是“保王黨”和“愛國者”的鬥爭。這個“愛國者”大致上就是相當於共和主義者或者是民主主義者;“保王黨”,不用解釋,就是擁護舊式的君主統治的人。擁護君主統治的人不需要新的意識形態,他們要按照封建時代那種個人和個人的關係來安排政治組織,那麼國王和他自己的封臣、各種人民之間的關係是個人對個人的契約;而愛國者則必須用國民共同體和國民契約的概念來取而代之,因此根據國民契約的概念,就要把愛國王轉變為愛國家。

這個概念最初是非常新穎的。例如,像海地黑人起義的時候,他們最初歸附西班牙國王,理由就是,我們原先忠於法蘭西國王,現在你們要我們忠於法蘭西國民,我們知道國王是誰,但是什麼叫做國民?我們從來沒有見過“法蘭西國民”這樣的東西。那麼你們法國人既然不要國王了,好在我們跟前還有一個西班牙國王,不要法蘭西國王,我們忠於西班牙國王可不可以?這總比我們忠於一個看不見摸不著、不知是什麼的“國民共同體”要好得多吧。這就是“國民”和“愛國者”這兩個詞最初的含義。“愛國者”這個詞跟我們現在所謂的民主是有非常密切的關係的。你要取代國王,就要建立國民共同體,把愛國王和愛國民兩者對立起來。所以“愛國者”這個詞也就包含著現代人意義上的共和主義和民主主義的全部含義。

民族構建一點一點地從非法的、不被承認的狀態變成國際政治中的主流,這個過程用了幾百年時間。從威斯特伐利亞和約開始,一直到凡爾賽和約正式承認民族自決的原則,然後再延伸到近代以來的後殖民主義,這個過程直到現在還沒有停止。但是從國際協定的角度來講,1919年的凡爾賽會議是主要列強正式承認民族國家構成國際社會的主流共同體和合法性的主要來源的一個標誌性事件。在這以前,在維也納會議的時候,正統的合法性仍然是不承認民族國家的;在這以後,即使並非民族國家的政治組織也感到有必然使自己冒充民族國家。

民族共同體這個東西的構建就要依據想像的歷史資源,想像的歷史資源歷來就有三種。一種就是把過去的多民族帝國直接轉化為一個民族的設想,像大俄羅斯主義、大奧斯曼主義都是要把原來的俄羅斯帝國和奧斯曼帝國的邊境直接繼承下來,把邊境內部無論什麼語言、宗教和族群的居民統統構建成一個新的政治共同體。他們認為這樣是可行的,因為這些政治實體現在就是存在的,比起向壁虛造新的政治實體,運用現在既存的政治實體的成本要更低一些;第二,這樣能夠保存原有的邊疆,不會因為劃分邊界引起外國干涉,引起各式各樣的麻煩。

第二種構建方法就是泛文化民族主義,它要求打破原有的邊界,但是要把不符合文化邊界的帝國邊界按照文化邊界進行重新修定。這種學說最早的提倡者是拿破崙三世,他在民族發明學當中具有開山祖的重要地位,我們現在的“中華民族”其實是拿破崙三世的“拉丁民族”概念的再傳弟子的再傳弟子,但是限於時間,我們就不詳細介紹了。關鍵就是,我們要知道,它是要以文化為邊界構建新的政治共同體。例如,屬於拉丁語系各種語言的居民 — — 西班牙、葡萄牙、義大利、法蘭西都應該屬於拉丁民族。根據同樣的邏輯,屬於日耳曼語系各分支的居民都應該屬於泛日耳曼民族。同樣的邏輯,可以構建泛斯拉夫民族和泛突厥民族。大體上構建的時間就是,拉丁民族在先,泛日耳曼主義其次,然後是泛斯拉夫主義和泛突厥主義。

最後一種構建方式就是目前的主流 — — 小民族主義,以最小單位的方言或者地區為基礎構建民族國家。最初的時候,即使是在歐洲,在知識份子、民族發明家和政治理論家這個層面,這種主張是最弱的,支持它的人是最少的;但是最後,至少在目前,它是佔據優勢的主流意識形態。關鍵因素就是因為:第一,它操作起來很容易,越小的單位,再分裂的可能性就越小;第二,大型民族主義之間的相互鬥爭有利於它,例如像波羅的海三國其實就是大俄羅斯主義和泛日耳曼主義相互鬥爭的結果。

本來誰也沒有想要發明愛沙尼亞或者拉脫維亞,但是,愛沙尼亞和拉脫維亞的領土從文化角度來講跟路德教的德語文化關係比較密切,德國浪漫主義者在發明德國的各種方言的時候沒有忘記把愛沙尼亞和波西米亞放在一起,同時在政治上講,它在版圖上是屬於大俄羅斯帝國的一部分,所以大俄羅斯的民族發明家在發明民族的時候也要把他們發明成為俄羅斯人,那麼當地人就自然陷入難以適從的狀態。說你在文化上是德國人吧,俄國人不答應;說你在法律上是俄國人吧,德國人又不滿意。最後德俄雙方在第一次世界大戰的時候交替佔領波羅的海地區,各自推行各自的民族發明。結果是,雙方都沒有勝利,反而使波羅的海國家變成了德國和俄國之間的緩衝國,從而建立了我們現在的波羅的海國家。

巴爾幹國家的發明也是出於同樣的道理,它也是兩種不同發明的交叉地帶。在交叉地帶,大家都很想把它發明成為大民族的一部分。例如,泛斯拉夫民族主義者 — — 像陀思妥耶夫斯基就極力想把他們發明成為泛斯拉夫的一部分,跟俄羅斯人是親戚,我們都是東正教徒;同時,奧斯曼主義者也很想把他們發明成為奧斯曼民族的一部分,因為你們是奧斯曼帝國的臣民。雙方之間發生了類似波羅的海地區的交替爭奪戰,最後當地的居民哪一邊也沒有被發明進去,而是發明成了我們今天看到的巴爾幹半島的一系列小民族、一系列小國家。這種模式在東南亞也是經常出現的。總之,在各帝國勢力的交錯點、在各種民族發明模式的交錯點上,小民族的產生是解決國際爭議、解除困境的一個好辦法,因此它大量地被推廣開來 — — 儘管這是違背最初最主流的民族發明家的初衷的。

在大清帝國接近沒落的時候,這幾種民族發明的理論就相應地進來了。我以前曾經說過多次,就不用詳細解釋了。奧斯曼主義就體現於梁啟超的中華民族主義,它的要點就是把大清帝國直接轉型成為中華帝國。大清帝國本來是由內亞征服者征服東亞建立起來的二元統治結構:內亞人,包括滿洲人和蒙古人,要麼是征服者,要麼是征服者的盟軍,是統治者;而東亞人,無論是湘人、贛人還是苗人,他們都是被征服者,是降虜。降虜之所以要納貢,是要買你的命,因為你本來作為失敗者,是應該在揚州十日或者類似的情況下一起被殺掉的,現在征服者開恩,准你不死,但是你為了酬謝征服者的恩德,當然應該納貢。納貢跟納稅是兩個政治上不一樣的概念。

英國貴族可以反對國王,因為他們都是征服者團體的一部分。他們並不是大清皇帝跟揚州市民的那種關係,而是大清皇帝跟蒙古貴族的那種關係。他們同樣是征服者的一部分,只不過國王是征服者的酋長,而貴族是征服者的武士。當國王要求貴族納稅的時候,雙方要談判,要雙方都同意,因為貴族是拿著武器來保衛國王、跟國王一起打仗的,他並不是失敗者。而國王,哪怕你是成吉思汗,在沒有貴族和武士支持的情況下,你也沒法打仗。為什麼英國國會和日耳曼系各國的國會要講究各等級共治,未經國會批准、未經納稅人批准不能徵稅呢?因為組成國會的各個等級本身就是征服者集團各個等級組成的。作為一個共同體的組成部分,他們當然要商量著辦,誰也強制不了誰。但是對於被征服者,那就沒有這樣客氣了。你既然沒有能力保衛自己,留你的命就已經很不錯了。

大清帝國本來是這樣的二元帝國,它跟奧斯曼帝國和俄羅斯帝國一樣,是截然地分為征服者和被征服者兩個部分的。奧斯曼帝國屬於征服者的那一部分就不用解釋了,巴爾幹、阿拉伯那些部分都是屬於被征服者的部分,它就存在一個類似大清以長城為界、分為內亞和東亞兩部分的類似結構。梁啟超這一派就是主張要把這個結構盤下來,但是要取消原先征服者和降虜之間的階級界限,然後大家你好我好大家好,以最低成本的方式實現近代化轉型。這就是東亞的奧斯曼主義。它產生的時間當然要比俄羅斯帝國和奧斯曼帝國的奧斯曼主義都要晚得多,理論構建也要差得多。

梁啟超從漢語世界的標準來說是了不起的大人物,但是你要真看他搞中華民族構建的那些文章,都是些零零碎碎的雜文,論水準也就只相當於現在的報刊專欄作家。像俄羅斯、突厥這些民族發明家整部頭整部頭的複雜理論和艱深的語言學、民族學、種族學各方面的知識,他本人是不具備的。他如果放到西亞或者東歐去的話,估計當不了最主要的民族發明家,而只能在眾多民族發明家當中充當一個第三流的角色。但是東亞在各方面都是比西亞和東歐更落後的,它接收歐洲思想總是比東歐和西亞要慢上好幾拍,構建的簡陋程度也是更加明顯。不僅是這方面,其他方面也是這樣。

第二種構建方式就是所謂的炎黃子孫,它非常精確地對應著泛突厥主義和泛斯拉夫主義。它不主張現在的帝國結構應該維持下來,恰好相反,這種帝國結構對於我們被征服者來說是恥辱的源泉,我們如果不能驅逐內亞征服者的話,我們的恥辱就無法洗去,而且我們在文化上的差異也太大了。同時,在大清帝國的國界線外有我們的兄弟,韓國人、越南人毫無疑問跟吳越的儒家士大夫是兄弟。這個道理就好像是俄羅斯中亞地區的突厥人跟小亞細亞的突厥人是兄弟、巴爾幹的東正教徒跟聖彼得堡的東正教徒是兄弟一樣。

泛斯拉夫主義必然要主張大俄羅斯帝國的東正教徒應該跟巴爾幹的東正教徒聯合起來;至於大俄羅斯領土上的芬蘭人、波蘭人、日耳曼人這些,倒是可以把他們踢出去。泛突厥主義者必然會主張,小亞細亞的突厥人跟中亞的突厥人聯合起來;同時,奧斯曼帝國境內的基督徒和阿拉伯人反倒可以踢出去。汪精衛和早期的國民黨人就是屬於這一派的。他們堅決地主張跟日本的泛亞主義者聯合,日本、韓國和未來的中華民國是一家,相互提攜;但是一定要把滿洲人和蒙古人趕出去。這種邏輯是辛亥革命的主要動機,也是漢族構建的主要動機。

我們今天面臨著兩個重大的民族構建:一個是中華民族,它產生於奧斯曼主義在東亞的構建,也就是梁啟超那一派;第二個構建就是漢族,漢族直接來自於清末革命黨人對炎黃子孫的構建,它實際上是文化民族主義的體現,也就是泛斯拉夫主義、泛文化民族主義在東亞的體現。中華民族的破綻是很明顯的,長城內外的生活方式、宗教信仰、各方面的差別是很明顯的,這也是奧斯曼主義構建或者中華民族構建的致命傷;漢族的構建表面上看起來漏洞比較小,但是實際上也很大。

革命黨人所主張的炎黃子孫和漢族構建,自身的力量不夠大,不足以掀起革命,真正掀起革命的力量還是清末在政治構建的過程中間要改變過去滿洲帝國任官程式的力量。過去滿洲帝國的任官程式是什麼呢?就是關外來的八旗,包括滿洲旗人、漢軍旗人和蒙古旗人,在關內是佔據優先地位的,大部分總督、巡撫這些大官是由關外的旗人擔任的。旗人不一定是滿洲貴族,有很多都是漢軍旗人。所以它和其他的民族一樣,本身是一個政治共同體,而不是種族共同體。種族可以作為發明民族的部分依據,但是世界上很少有真正以種族為依據而能夠發明民族的。辛亥前後所謂的滿族也是按照政治共同體的方式構建的。

政治共同體和民族共同體的不同,你可以從袁崇煥的家族看出來。袁崇煥的後裔到哪兒去了呢?他投向了清朝。袁崇煥本人是廣東人,他的後裔投向了清朝,變成了清末的一位將軍 — — 富明阿的祖先。你如果看富明阿這個名字,你會以為他是滿人,但他實際上是漢軍旗人。那麼從清末的革命黨人的角度來看,富明阿這個人到底是廣東人、應該隨著十八省的民軍一起建立中華民國的聯省共和國呢,還是應該作為打倒的對象呢?他們的選擇很清楚 — — 當然應該打倒你。

端方自己也說他是漢人的後代,但是起義的民軍照樣堅持說,他是托忒克氏,是屬於八旗人的一部分。端方自己說他是漢人陶家的後代,所以他專門辦了一個陶氏學堂,也就是要把子孫後代培養成陶家,這本身就是一種民族構建。例如,一個斯洛伐克人如果讓他的子女受匈牙利語的教育,就會把他變成匈牙利人;受斯洛伐克語的教育,就會把他變成斯洛伐克人。斯洛伐克是沒有固定邊界的,就是看你讓他受哪一種語言的教育,然後他就會在奧匈帝國解體的時候變成哪一個民族。從端方這種做法就可以看出,他其實是有意在清末民初發明的競爭當中把他的後代發明成為漢族的,然後把他自己的歷史解釋成為,他是明末清初的時候被俘虜或者主動投靠滿洲人的那一批明朝臣民的後代。但是革命軍卻不認他。他死到臨頭的時候聲嘶力竭地說,我也是漢人,而革命軍卻堅持說,你就是滿人,還是把他們兄弟殺了。

這種又像鬧劇又像悲劇的故事在民族發明的過程中間是不可避免的。同一個立陶宛人,因為你信奉了路德教,你的後代就會被發明成為普魯士人,然後就會被解釋成為大德意志的一部分,他的鄰居、兄弟或者侄子因為信了天主教,然後在事後的民族發明當中就會被發明成為立陶宛民族,然後這兩撥人不可避免地會在戰場上相見。也有很多誤會的情況,你自己以為我是全心全意熱愛立陶宛的,但是立陶宛人卻認為你是德國人,或者你認為你天經地義就是日耳曼人和雅利安人,很不幸,希特勒的門徒卻做了一個鑒定,認為你絕對是斯拉夫人,堅定不移地把你送進了集中營。

這類故事對當時來說是極其可悲的,但是我們從共同體構建的角度來講,那也無非是像資產階級知識份子的子弟懷著熱愛毛主席的心理投靠了無產階級革命,他已經跟資產階級劃清了一切界限,下定決心要打倒地主資產階級的統治,然而他的無產階級出身的革命同胞卻堅信他是資產階級派進無產階級隊伍內的內奸,堅定不移地把他活埋了。或者是版本緩和一點,雖然容許他參加了革命工作,但是把他劃入了黑五類,讓他受了幾十年的歧視。這樣的故事我們應該是非常熟悉,而且寫滿了各種各樣的傷痕文學,包括《山楂樹之戀》的傷痕電影當中。這些故事說明什麼呢?就是在共同體構建的過程中間,邊界的劃分是不可避免地要製造悲劇的。你也不要以為毛澤東和他的門徒是吃飽了撐的,或者像現在有些淺薄的民主小清新說的那樣,那都是過去的事情了,當時的人糊塗,我們現在的人聰明。當時的人一點也不糊塗,你們這些小清新才是糊塗。

任何政治共同體用文學辭彙和宣傳辭彙來描繪,那都是很容易的事情,但是一到具體的程度,就要涉及到非常具體的權利和義務,尤其是人頭和金錢的問題。因為政治共同體首先就要涉及兩個問題:誰來流血犧牲保衛它,誰來出錢維持它,這是不能含糊的。誰是可以信任的人,只有可以信任的人才能加入流血保衛的過程。華盛頓將軍搞美國獨立戰爭的時候,美國的自由黑人很想加入他的軍隊,但是佛吉尼亞的很多種植園主都很不願意讓他們加入,因為他們知道,參軍和公民權利是不可分割的。一方面,非我族類其心必異,如果我們不承認黑人是美利堅的一部分的話,那麼他們參加我們的大陸軍,我們能信得過他們嗎?如果我們能信得過他們,他們已經是我們的兄弟了,黑人已經是我們的兄弟了,我們還能維持奴隸制嗎?所以這是不可能的。如果我們要接納黑人加入我們的軍隊,我們必然要取消奴隸制;如果我們不肯取消奴隸制的話,那麼我們就不能讓黑人 — — 哪怕是自由黑人加入我們的軍隊。這就是一個非常嚴肅的共同體問題。

對於講階級共同體不講民族共同體的馬克思主義者來說的話,你是哪個階級,那麼你就要根據你的階級確定你的共同體身份,然後確定我們能不能信任你、你是屬於哪一方面的、你能不能為革命事業出錢出力的問題。把第五縱隊放進來是非常危險的,就像是伯利克裏的雅典非常不願意讓外邦人生的孩子當雅典公民一樣,公民權的改變就是主權者的改變,這是至關重要的問題。同樣的道理,民族共同體當中,誰是我們民族的人,誰不是我們民族的人,標準怎麼劃分,這才是政治上的首要問題。主權者確定以後,然後才能搞政體問題。如果主權者是誰都確定不了,那麼主權者內部的權力劃分是沒意義的。照梁啟超的說法就是,這是一個國體和政體的問題。他說他自己是爭政體不爭國體的,實際上的意思就是,他打算把大清帝國的盤子整個盤下來,回避這個國體問題。但是事後的歷史發展證明,在他的討論範圍內跟在世界上其他地區 — — 在奧斯曼帝國和俄羅斯帝國一樣,這個問題是無法回避的。他企圖只爭政體,最後仍然無法只爭政體。

最後,無論是馬克思主義的階級國家,還是民族國家,無論民族國家按照哪種方式來構建,在你確定政體是立憲君主制、共和制、議會制或者是總統制之前,你要先確定,你未來要建立的這個共同體,誰是這個共同體的成員,誰不是這個共同體的成員。德國猶太人認為他們當然是屬於日耳曼民族的,希特勒則堅定地認為他們只是混進日耳曼民族的第五縱隊,只會為外國人服務,所以就要屠殺猶太人。猶太人沒有反抗,則是因為他們認為他們跟周圍的德國人是鄰居和朋友,想不到這些人會來殺自己。否則的話,如果他們也認為自己不是德國人,那麼他們就應該像波蘭人一樣跟別的德國人打一仗。打一仗可能會打敗,但至少你是在被打敗以後才會被屠殺的,不會連打都不打就束手就擒地被人屠殺了。德國猶太人的悲劇和毛澤東時代參加革命隊伍的黑五類的悲劇其實是一樣的,就是當事人對自己共同體身份的界定跟別人對他們身份的界定不一致,這個落差導致了他們的悲劇。

這是在近代國家的構建過程中間不可避免會發生的現象,我們不要以為在美國沒有發生這種現象。華盛頓將軍的共同體包括印第安人和黑人嗎?今天的美國共同體包括了印第安人和黑人,這就是為什麼圍繞李將軍的雕像引起那麼多問題的緣故。如果美國的共同體不包括黑人,那麼李將軍雕像就沒有任何問題了。之所以要對李將軍的雕像下手,並不是因為李將軍本人有什麼問題,而是在今天的美利堅民族的構建當中、我們是不是應該為了維持各種族之間共同的美利堅認同而把李將軍給犧牲了的問題。李將軍已死,你幹的這些事情對他一點影響都沒有,但是為了美利堅合眾國的共同體構建,需要一個民族神話,是不是需要李將軍作為犧牲呢?這就變成一個重要的問題。這個問題當然不是一個歷史問題 — — 李將軍的歷史記錄是很容易考證清楚的,而是一個政治問題,而且不是南北戰爭時期的政治問題,而是當代美國的共同體構建問題,也就是說,生活在美國、在法律上享有美國公民權的各種族裔的後代要用什麼方式構建未來的美利堅政治共同體的問題。你理解了這一點就會明白,在美國這種條件總的來說是比較好的地方,共同體的邊界構建仍然是極其敏感的問題,那你就不要懷疑,在東亞這種歷史問題很多、困難比美國大得多的地方,在政治共同體的邊界構建方面是一開始就註定要起無數的糾紛的。這些糾紛的產生不是由於當事人的低能或者邪惡。你就是換一種方式去構建,也只是解決了一方面的問題,而同時又製造了另一方面的問題。沒有任何一種構建的方式是能夠同時讓所有人滿意,能夠不讓任何人做任何犧牲的。

我們回過頭來講漢族的構建。漢族的構建,關鍵就在於辛亥年間的十八省獨立。漢族的邊界是怎樣的呢?從滿洲過來的這一批,無論是漢軍旗人、蒙古旗人還是滿洲旗人,你一來就可以做大官,而漢地十八省的士大夫需要經過科舉勝利以後,好不容易才能做小官,他們本來就已經感到不公平了。皇族內閣來了以後,他們感到,在中央一級,過去一半對一半的比例被破壞了,現在滿洲人居然佔領了比以前更多的職位,他們感到忍無可忍了。我們要明白,辛亥革命並不是海外這些流亡者發動的,他們沒有這樣的力量,辛亥革命真正的力量是各省的土豪和地方實力派。這些地方實力派之所以從曾國藩時代的忠於清朝轉到袁世凱時代的背叛清朝,關鍵就在於爭奪官位的矛盾。由於爭奪官位的矛盾,他們願意認為自己是漢族。漢族革命的口號產生,主要是因為在大清帝國內部的官場上擺不平。後來組成北洋系的要員,早在他們附和革命以前、在他們還是清朝官員的時候,就已經在一天到晚地抱怨朝廷歧視漢人。歧視漢人這件事情主要就是一個任官的問題。具體的官職該任命誰或者不任命誰,這是可以爭議的問題、可以具體討論的問題,但是關鍵在於,圍繞著有限的精英職位,兩個精英集團之間出現了無法擺平的傾向。隨著無法擺平的傾向,自然而然形成了邊界,也就是說,有資格當大官的和只能從小官做起的這兩批人開始各自把自己發明成為民族。

他們發明民族的方式是相當粗糙的,借用了很多種族主義的口號,但是我們要清楚 — — 他們自己當時也清楚,滿漢關係不是什麼種族關係,它就是一個政治關係。富明阿和陳炯明之間的血緣關係大概是比富明阿和溥儀之間的血緣關係更近,但是他們一個是滿族一個是漢族,這是沒有關係的。他們之間劃分為不同的民族,唯一的理由就是,富明阿可以直接做總督,而陳炯明不行。同樣,在黃興和湘西的苗人之間,他們有共同的種族依據嗎?沒有,或者說至少是差得很大。湘西的苗民酋長對黃興想要構建的這個漢族很感興趣嗎?顯然並不。對於支持黃興搞革命的那些人來說的話,把關外的滿洲人的特權取消掉對他們是一個重大的關鍵問題。願意為理想主義犧牲的人在任何時代都是極少數,雖然他們在歷史書的記載上往往佔據了比在真實歷史上要大得多的地位,但是大多數人參加革命都是為了更具體的利益的,包括被我們嚴重神話的波蘭人、捷克人,其實也並不例外。大多數人都知道自己不是能夠名垂青史的人物,都知道自己註定既不會是梁啟超也不會是孫中山的。他們如果願意說自己是炎黃子孫或者說自己是中華民族,那是因為他們考慮了,跟著梁啟超的構建走或者是跟著孫文、汪精衛的構建走,在重新組合的這個新的政治共同體當中,他自己能夠得到更有利的地位。

漢族的發明跟拉丁美洲的美洲人的發明是非常相似的。你如果要問,米蘭達和玻利瓦爾這種人為什麼說他們跟山裏的印第安人都是美洲的愛國者,而跟伊比利亞半島的人不是一夥人?那就是一個官位的問題。從西班牙半島來的人就像從山海關外來的人一樣,一到美洲就可以做大官,而美洲本地的人,儘管錢比你多,文化水準比你高,各方面都比你強,他還是只能做小官,做一個檢審法院的法官就了不起了,做總督身邊的大官是沒戲的事情,能夠做大官的就是幾十萬從西班牙半島過來的人。於是他們就做了一個民族發明:我們是美洲的愛國者,我們要驅逐Gachupín — — 也就是來自西班牙的特權階級。西班牙的Gachupín和美洲愛國者之間的關係,非常接近於清末對革命黨人或者是漢官對滿人和漢人的劃分方法,都是政治劃分,跟種族沒關係的。所謂的漢人,當然,比如說在湖南,既包括城裏面的黃興這些大地主大資產階級,也包括山上的連漢字都不認識的那些苗人。苗人當然不知道他們已經被劃分為漢族了,但是這個沒關係,民族發明從來都是少數精英的事情,發明到你頭上,大多數老百姓只需要跟著被發明就足夠了。玻利瓦爾和米蘭達把印第安人發明成跟他們一夥,就是要凸顯幾十萬西班牙人和幾百萬美洲愛國者之間的不同:前者是該死的特權階級,代表著歷史的沒落一方;後者是先進的愛國者,要把英國人和法國人推行的自由主義和民主主義引進到落後的美洲來,重新組織一個新的共同體。

當然從血統上來講,西班牙來的那些人跟拉美的土生白人血統上可能會更接近一些,比他們雙方跟山裏面的印第安人的血統可能還要更接近一些。所謂的滿人,其實是包括了蒙古人、朝鮮人和很多不同的族群,所謂的西班牙人也同樣包含了加泰羅尼亞人、卡斯蒂利亞人、巴斯克人和很多不同的族群。巴斯克人和加泰羅尼亞人的差別,如果你按血統來算的話,肯定要比玻利瓦爾和米蘭達跟西班牙人的差別要大。但是這沒關係,巴斯克也好,加泰羅尼亞也好,卡斯蒂利亞也好,加利西亞也好,都是關外的土地,像關外的朝鮮漢軍、蒙古八旗一樣,都是滿洲皇帝的直轄,他們都是西班牙國王的直轄,他們只要到了美洲,都要高人一等。滿洲來的,無論你是蒙古人還是漢軍,你只要入了關,都要高人一等。所以你只要入了關,你原先是安達盧西亞人還是卡斯蒂利亞人就已經不重要了,反正美洲愛國者都要管你叫做萬惡的西班牙人或者Gachupín。同樣的道理,哪怕你是廣東人的後裔,你只要是跟著滿洲人一起入了關、可以直接就做大官的話,廣東人和湖南人都要義正辭嚴地說你是萬惡的滿韃子,一定要把你驅逐出去。這就是政治共同體和種族之間的重大區別。種族是很難考證的,政治共同體則涉及到非常明確的現實利益。所有民族的構建都是政治共同體的構建。它能夠發揮動員力量,都要涉及非常具體的利益安排,絕不是說只憑幾個想要名垂青史的知識份子就能夠發明得動。諸如此類的發明在任何一個時代都有很多種,但是最後勝出的、能夠在歷史上留下痕跡的都是極少數。這極少數能夠留下痕跡的,都是因為能夠產生相應的利益動機。

辛亥年間的民族發明就是雙重的,因為在晚清那種思想比較自由、尤其是在東京和上海租界、任何事情都可以討論的環境下,民族發明當然也是多種多樣的。你去查看當時的報刊就可以發現,除了我們認識得比較清楚、看得比較多的中華民族發明和炎黃子孫 — — 也就是漢民族發明這兩種大發明以外,還有各種小發明,例如還算是知道得比較多的滿洲民族的發明,“我們退回滿洲去,自己搞一個滿洲共同體”這樣的發明。提倡這些發明的人並不是居住在關外的漢軍旗人或者滿洲旗人,而是旅居上海的滿洲人。他們在上海的報刊上鼓吹滿洲獨立,理由就是,既然你們要排滿,那麼我們為什麼不能建滿洲國呢?排滿的意思就是你們十八省不歡迎我們,那麼我們當然應該回滿洲去建國了。這就像是歐洲興起排猶主義催化了以色列國的誕生一樣,既然以色列人不適合規劃為德國人或者歐洲人,你們的意思就是讓我們離開歐洲,回到以色列去建國,OK~這樣做也好。滿洲的民族發明就是這樣產生的。

同時還有各種雙重民族的發明,有很多重要的漢民族發明家同時也是小民族主義的發明家。這個現象在美洲也不稀奇。玻利瓦爾毫無疑問是委內瑞拉最重要的民族發明家、最重要的國父,但是他也是美洲民族的重要發明家。他有時候說他是美洲的愛國者,有時候說他是大哥倫比亞的愛國者,有時候說他是委內瑞拉的愛國者。他在自己政治上比較得意的時候就主張,在驅逐西班牙人以後要把整個西班牙美洲重新整合起來,建立一個美洲合眾國,大哥倫比亞共和國都還不夠大,要進一步把美洲團結起來,建立美洲民族,他說這話的時候就不再說委內瑞拉愛國者如何了;他在勢力比較小、連哥倫比亞都落到保守派和保王黨的手裏面、只有委內瑞拉的老家支持他的時候,他只說他是委內瑞拉愛國者,這時候他就不指望能夠搞什麼美洲合眾國甚至大哥倫比亞共和國了,只要委內瑞拉第二共和國能夠保得住他就心滿意足了。這些話他都說過的。孫文在不同時期,梁啟超在不同時期,也對同胞有過不同的定義。例如梁啟超有的時候說四萬萬同胞,有的時候說三千萬同胞。三千萬同胞指的是誰呢?他的廣東老鄉。四萬萬同胞指的是誰呢?我們不用解釋了。他為什麼會有這兩種不同的看法?就是因為各種不同的民族構建在當時是處於設想的階段,任何思想實驗都是容許的。我們後來塑造的臉譜式的歷史人物,至多只能代表他的主流方面,他也有很多側面的。當然其他比較次要的歷史人物就不用再說了。

類似的現象在敘利亞也可以看得出來。我們大家都很熟悉在漢語世界很流行的著名詩人紀伯倫,你翻看他的詩歌和文集就會發現,他有的時候說我是敘利亞的愛國者,有時候又說我是黎巴嫩的愛國者,他到底是黎巴嫩人還是敘利亞人?答案是,兩者都是,因為這涉及到不同的民族構建的問題。黎巴嫩的阿拉伯基督教徒也是有不同的選擇的:他可以選擇建立比如說像納賽爾和阿拉伯復興社會黨都設想過的,按照拿破崙三世那個想法,把所有阿拉伯語和阿拉伯文化區都統一起來,建立大阿拉伯民族,這時候他就說他是阿拉伯人了,基督徒的身份、黎巴嫩人的身份、敘利亞人的身份就不重要了;有的時候他像玻利瓦爾那樣主張建立一個大敘利亞,也就是說包括今天的敘利亞和黎巴嫩、有時候還包括約旦和巴勒斯坦在內的地方,未來建立一個大敘利亞國,這時候他就說他是敘利亞人,敘利亞如何如何,敘利亞曾經多麼多麼輝煌,敘利亞是世界上最古老的文明古國,但是現在可悲地衰微了,我們敘利亞愛國者要在比如說法國啟蒙主義的啟發之下重新搞敘利亞民族復興,這些話在紀伯倫的文學作品和文章中間是俯拾皆是的;但是他有時候也說他是黎巴嫩人,我有我的黎巴嫩,你們有你們的黎巴嫩,我的黎巴嫩是多麼的理想,你們這些土豪劣紳的黎巴嫩是多麼的壞,我們黎巴嫩人應該如何如何,應該如何如何。

這種構建就是針對現在的黎巴嫩共和國了,它要求把基督徒為主的黎巴嫩和穆斯林為主的敘利亞分割開來。理由是,如果基督徒支持了大敘利亞的構建 — — 順便說一句,大多數早期的阿拉伯民族主義者,照我的話說就是民族發明家,跟大敘利亞的民族發明家都是占人口少數的基督教徒,但是等到他們的構想快要實現的時候他們就看到,基督教社區在敘利亞是占少數的;但是如果黎巴嫩從敘利亞分離出來,那麼基督教徒在黎巴嫩大概佔有55%的優勢。這個邏輯是最後黎巴嫩脫離敘利亞的主要原因。黎巴嫩脫離敘利亞,也還有大黎巴嫩和小黎巴嫩兩種方案。小黎巴嫩就是只把黎巴嫩的阿拉伯基督徒社區拖出來建國。這個建國的理想就差不多是,山東的長老會成員宣佈,我們要建立一個膠東基督教共和國,不僅要從大清帝國獨立出來,而且要從中華民國獨立出來,而且要從可能建立的大山東共和國獨立出來,要建立一個小的膠東基督教共和國。小黎巴嫩的理想相對於包括沿海地區穆斯林的大黎巴嫩、包括敘利亞和約旦的大敘利亞、包括整個阿拉伯語地區的大阿拉伯,就是相當於我剛才假設過的這個膠東基督教共和國。

從這一點你也可以看出,現在的中國在世界史和世界政治當中都是一個極為怪異的存在 — — 它是全世界唯一一個沒有完成正常的民族構建歷史進程的地區,這也是我們現在面臨著的大部分問題的深層原因。如果按照西亞或者歐美的慣例,相當於美洲愛國者的美洲民族的漢民族在驅逐了滿洲人以後就應該立國了。美洲愛國者沒有意思說是要打回西班牙去、建立一個包括西班牙在內的大西班牙共和國,他們把西班牙人趕回西班牙就完了。西班牙的自由派倒是很有這個意思,他們想把西班牙和西班牙語的美洲都共同整合起來,建立一個自由民主的西班牙,這種方式倒是很接近於梁啟超的方式,但是他們很快就失敗了。而美洲共同體建立以後,又出於軍閥混戰的原因,大軍閥在美洲合眾國失敗以後,首先企圖建立大哥倫比亞共和國和墨西哥帝國;在這樣的大國維持不下去的情況下,又分裂出中美聯邦、委內瑞拉、小哥倫比亞這樣的新型的民族發明;然後中美聯邦和小哥倫比亞這樣的新的政治共同體又進一步分裂,產生出哥斯大黎加和巴拿馬這樣的更小的單位。

其實這些單位有很多都是像吳佩孚和張作霖這樣的軍閥,他在本國的黨派爭鬥中打了敗仗、被迫撤退以後就建立了自己的國家。這個模式,其實張作霖這種人至少是用過的。他在打勝仗的時候自稱是中華民國的某個軍政府的首腦,或者要支持中華民國的政府;在打了敗仗、退回到東三省的時候,他就會宣佈滿洲獨立,召集一個東三省父老的代表會議,然後宣佈,東三省父老要擁護我張作霖來保境安民,同時徐世昌或者中華民國的什麼總統多麼多麼壞,你們中華民國百計害我滿洲,算計我滿洲父老,我們滿洲父老讓你們給騙慘了,淳樸的滿洲父老決不能繼續受騙了,幸好還有我張作霖在,只要我張作霖不死,滿洲父老就絕不會讓你們中華民國繼續欺負,然後他就宣佈獨立了。當然是事實獨立,並沒有什麼公使館來承認,但是我們不要忘記,在烏拉圭和巴拿馬最初獨立的時候也是沒有什麼公使館來承認的。但是,沒有法律上的承認,卻有事實上的承認。列強要站出來,既然你們誰也打不過誰,那是不是為了大家做生意好,我們談判一下?徐世昌和吳佩孚,你就不要出山海關了,張作霖你也不要進山海關了,英國人和日本人派出國際維和部隊的觀察員,在山海關設立一個二十五公里或者多少公里的非軍事區,在這個非軍事區裏面駐上英國人和日本人的代表,監督你們執行停火協議,你們誰也不要打誰。然後雙方都接受了。

巴拿馬和烏拉圭的情況也就是這樣的。烏拉圭人最初是阿根廷的聯邦主義者,然後在企圖打進布宜諾斯艾利斯的時候吃了敗仗,退守到烏拉圭河東岸,然後由英國人和葡萄牙人出來調解一下,達成了停火協議,派了一些觀察員在那裏看守著,然後過了幾十年他們發現入關無望以後,就索性把事實獨立變成法理獨立了。巴拿馬則是小哥倫比亞共和國自由黨的根據地。大家都很熟悉加西亞·馬爾克斯的《百年孤獨》,它裏面講的故事就是哥倫比亞歷史上著名的千日戰爭(1899~1902),是哥倫比亞保守黨和自由黨的戰爭。保守黨的大本營就是今天的哥倫比亞,自由黨的大本營就是今天的巴拿馬。以巴拿馬為根據地的自由黨和以波哥大為根據地的保守黨打了一千天的戰爭以後,保守黨打贏了,然後自由黨在撤退的過程中決定,與其做一個哥倫比亞人,接受保守黨的統治,還不如在美國的支持之下乾脆宣佈獨立,建立一個自由黨的國家。於是他們就建立了我們所知的巴拿馬共和國。

他們雙方之間的戰爭其實跟孫文和北洋軍閥之間的護法戰爭沒有什麼區別。巴拿馬的自由黨最初打的也是護法戰爭,他們說保守黨像北洋軍閥一樣破壞了憲法,企圖走向專制主義,然後我們為了護法起見,武裝起抗拒首都的各省起來,企圖打進首都。他們最初的理由也是要讓護法軍打進首都的,但是實在打不下來以後就宣佈獨立了。這種邏輯其實在民國已經初見苗頭了。孫文在搞起護法軍政府以後,最後打來打去打不進北京,然後廣東、廣西的實力派就厭倦了,你既然沒有本事打進北京你就別再瞎逼逼了,你自己愛去哪兒去哪兒,我們廣東父老不再歡迎你。於是廣東的父老 — — 也就是廣東的大地主大資本家就請來了陳炯明,陳炯明就像是後期的巴拿馬自由黨一樣,他就覺得我們沒必要勞民傷財去打進北京,我們只要在廣東搞好建設事業就行了。

他在廣東如果獲得成功,把事實上的獨立維持幾十年,然後再跟香港的英國人達成了協議的話,那就是巴拿馬的那種格局了,他之所以沒有成功,倒也不是因為他自己的政績比巴拿馬的自由黨差到哪兒,關鍵因素還是因為孫文和蔣介石拿著蘇聯的援助打回來了。如果蘇聯人沒有插進來的話,那麼陳炯明和廣東的大地主大資產階級從實際上來看是完全有能力把孫中山和國民黨趕走的。那樣的話,廣東就會變成中華民國的巴拿馬了。如果中華民國是大哥倫比亞共和國,那麼廣東就會變成中華民國的小巴拿馬了。順著中華民國軍閥政治的自然邏輯搞下去的話,自然而然會形成拉美或者西亞那種格局。但是在這種情況下,我們都知道 — — 因為這不涉及今天的主題,就簡單地說 — — 蘇聯人介入了東亞的政局,從內亞方面首先武裝了國民黨推翻北洋軍閥,然後武裝了共產黨來推翻國民黨。如果沒有蘇聯的積極干涉、憑國民黨和共產黨的自身實力的話,它是不可能獲得全國性的勝利的。它如果只獲得局部性的勝利,如果毛澤東做了湖南共和國的總統或者是孫文做了廣東共和國的總統,中華民國一樣是要解體的。

解體以後,事實會迫使它的精英搞民族發明,也就是說,為了證明我占住這個權力是合理的,所以我要把我們發明成為一個民族。如果烏拉圭軍閥的後裔始終說他是阿根廷的聯邦黨的話,那就是等於給了布宜諾斯艾利斯當權派一個理由 — — 我隨時可以派兵渡河來重新吞併你或者消滅你,就像是今天的共產黨動不動就要揚言我要出兵香港或者出兵台灣滅了你們一樣;相反,我如果一不做二不休,乾脆建立一個台灣民族或者香港共和國,你再來打我就算是來侵略了,這樣一來,我獲得的政治遺產就可以很穩妥地傳給我的政治繼承人了。當然,如果我有能耐打回北京或者打回布宜諾斯艾利斯的話,我可能不會動這個想法,但是既然橫豎打不回來,最後相對力量已經發展到這個地步 — — 我要打回去是不可能的,你要打我卻是綽綽有餘,到這個時候,它就非要獨立不可了。獨立以後就要反過來發明民族,製造一些歷史依據,證明我們烏拉圭人自古以來就跟你們阿根廷人不同文不同種或者是如何如何不同。

當然,你如果按照中華民族構建的邏輯來說,這些理由都是極其牽強的。他們全都是講西班牙語的,而且全都是西班牙移民的後代,而且連經濟結構都是一樣的,都是依靠養牛養羊、出口牛羊肉的經濟結構。就連他們這樣一點點差別 — — 就是根據聯邦主義和中央集權主義這一點點差別,以及最初的那幾場每一次只不過死幾百人的小小的戰爭,就能夠把其中的一次敗仗,例如阿蒂加斯率領他的部眾撤出烏拉圭東岸那一次行軍,發明成為烏拉圭的摩西。摩西帶領以色列人過紅海,阿蒂加斯帶領烏拉圭東岸共和國的父老撤出東岸,他帶著幾千人馬到東岸打了個圈,過幾年就回來了,這件事情就變成了烏拉圭民族的史詩。像是共產黨利用的萬里長征,國民黨說是可悲的逃竄,我說是國際恐怖主義勢力被迫撤退,這只是對同一現象的不同描繪而已。無論如何,就是阿蒂加斯這次遠征,變成了烏拉圭民族的史詩,然後烏拉圭民族誕生了。

所以按照這種方式發明的話,可以說,任何一個省,廣東也好,湖南也好,比這更加悲壯慘烈的史詩不知道有多少,只要有了那樣一個實力派能夠承得住廣東或湖南的盤子,發明一個民族簡直是不費吹灰之力,之所以沒有發明成功,不是因為它缺少幾個夠水準的民族發明家,這樣的民族發明家多得很。辛亥革命以後的二十年,大多數政治家都是雙重愛國主義者,也就是說像玻利瓦爾和紀伯倫那樣,一會兒說他是美洲愛國者,一會兒說他是委內瑞拉愛國者。像楊度、蔡鍔這種人,他的認同都是有過多次反復的。楊度一會兒說我們湖南是亞洲的普魯士,好像你們吳越人或者其他各省人都是很孬種的,不會跟我們在一起;一會兒又要說炎黃子孫如何如何,我們共同團結起來打倒滿洲。蔡鍔也是這樣的,他一會兒是湖南的愛國者,一會兒是雲南的愛國者,一會兒又是炎黃子孫和堅定的反滿分子。這種現象跟西亞和美洲發生的現象非常相似,也沒有什麼值得大驚小怪的。在民族發明還不確定的關鍵時刻,差不多所有重要的政治家和文化領袖都是屬於這種模式的。

共產國際的介入就造成了嚴重的問題。首先我們要明白,共產國際的共同體構建方式是階級共同體而非民族共同體,它並不是完全沒有理智地說任何民族共同體都是大地主和大資產階級的工具。華盛頓將軍之所以說他不是英國人而是美利堅民族的創始人,是為了維持佛吉尼亞大地主和馬薩諸塞大商人的階級利益,這些人的階級利益跟東印度公司和英國壟斷當局發生了衝突,所以他們發明美利堅民族,骨子裏面是為了反對東印度公司和威斯敏斯特當局對美洲地主資產階級的利益衝突。同樣,玻利瓦爾和米蘭達這些人發明美洲共同體,這個動機是更加直接的,就是西班牙波旁王朝通過行政合理化的改革 — — 這次改革的性質其實也很接近於晚清新政,企圖把原先還分配得比較公正的官職更多地集中在西班牙半島派出去的這批官吏頭上,使原來在美洲本地至少還享有一定特權的土生白人和克裏奧爾人感到自己的特權受到了損害,於是他們就通過發動美洲獨立戰爭和發明美洲民族的方式來維護自己的特權和地位。

如果說他們是維護印第安人的利益,那麼我們擺事實講道理,印第安人在他們的統治下過的日子難道真比在西班牙統治下過得更好?印第安人過去跟現在一樣都是被統治者,至於統治者變成了美洲土生白人還是西班牙人,對他們影響不大。同樣,宣統皇帝統治的湖南、黃興黃大元帥領導的中華民國臨時政府、黃興黃都督領導的湖南軍政府,這三種不同政權的統治對於長沙的地主資產階級來說差別是很大的,但是對於湘西山地的苗民、瑤民和各種高地蠻族來說有什麼差別?無論是大清帝國當權、中華民國的大元帥當權、還是湖南共和國的大都督當權,反正做官都沒有你的份,這個民族發明跟你有關系麼?所以馬克思主義者認為,民族共同體是虛假的共同體,只是大地主大資產階級企圖使自己的統治合理化的一個工具。

大地主大資產階級為了使窮人和無產階級相信統治者是代表了他自己的利益,於是就發明了民族這個概念,要欺騙他們說,我們中華民國、委內瑞拉共和國或者是美利堅合眾國跟過去的專制統治不一樣,在過去的專制統治下你沒有權利,在今天的美利堅合眾國、委內瑞拉共和國、中華民國或者是湖南聯省共和國的統治之下,現在你是一個有權利的公民了,以前你是一個消極被動的臣民,現在你是國家的主人和公民了。馬克思主義者就說,你是胡說八道,你是欺騙性的,真正的統治關係不是這樣的,一個印第安人即使得到了美利堅合眾國的公民身份和委內瑞拉共和國的公民身份,照樣是被統治者,只不過統治者由英國的國王和貴族變成了美洲本地的像華盛頓這樣的大地主大資產階級而已,中華民國或者湖南獨立也無非是意味著滿洲的皇帝和滿洲的貴族離去了,然後南京的大地主大資產階級或者長沙的大地主大資產階級取而代之,你的真實地位沒有什麼改變,你只是名義上得到了一個公民權而已。

當然,占當今世界主流的資產階級民族主義者就不會這麼認為。他們會說,儘管你們仍然很窮,這也是事實,甚至可能獨立以後由於獨立戰爭或者以後的分離造成的各種經濟後果,你比獨立前更窮了,但是作為共和國的有政治權利的公民,你是非常不同的,具體有什麼不同?蘇聯就提供了很好的例子,你做一個蘇聯工人,隨時都可能被抓到古拉格去;你做一個美國工人、委內瑞拉工人,或者假如湖南共和國獨立了,或者中華民國沒有被共產主義顛覆的話,那麼你再窮的一個工人,別人要控告你的時候,還得要經過資產階級民主和法治的法定程式,你再沒有錢,國家還要給你免費請一個代理律師。別人要誣陷你是反革命分子,這是很困難的,再大的大地主、再大的大資產階級想要誣陷一個最窮困的美國黑人或者美國印第安人,說他是反革命分子或者說他是蘇聯間諜,這是非常困難的事情;但是任何權高望重的蘇聯政治家都很容易落到這個下場。如果說我們資產階級的民族構建方法是假的,請問涉及人頭的事情能是假的嗎?你在美國做一個窮工人或者做一個窮印第安人比在蘇聯做一個大官還要安全得多,這是假的嗎?任何事情都可以是假的,你的人頭能是假的嗎?你在監獄裏面還是在監獄外面,這能是假的嗎?

但是,馬克思主義者對民族共同體的批判儘管有以偏概全和誇大的一面,也絕不是毫無理由。從卡廷大屠殺和其他民族主義與共產主義的鬥爭就可以看出,民族精英主要還是體現在地主資產階級。普通的老百姓或者無產階級,雖然他們並不見得像是馬克思和列寧說的那樣“工人沒有祖國”,但是他們對於比如說是維護波蘭獨立或者是維護波蘭的民族價值起的作用,沒有我所謂的土豪和凝結核 — — 也就是卡廷的那些波蘭軍官,在戰爭時期是軍官,在和平時期是地主資產階級 — — 起的作用要大。毛澤東搞土改、搞三反五反,他的目的是什麼呢?就是要清除掉地方上有威望的儒家士紳、資本家或者教會頭領那些能夠發揮凝結核作用的人。清除了這些人,比較窮困的人群龍無首,即使是心裏面有什麼不滿意,也沒法反抗。如果當地有了相當於是鄉紳的那種人,那指不定他就會變成當地的華盛頓了,他就可能拉起一支武裝來反抗你,或者因為他至少比較有文化的緣故,他可以團結當地人來反抗你。反抗不了,也可以像後來台灣的地主資產階級那樣發明出一套台獨的理論,在中國人、外省人和台灣本土人之間製造出理論上的差別來,我這一代贏不了你,我通過發明台灣民族,讓我的孫子這一代通過民主的方式,反過來顛覆掉你。這些事情都是他們能夠做到的。但是如果把這些人都殺掉了,問題就可以解決了。

蘇聯在征服東歐的過程中間,蘇聯情報部門是有過經驗的。首先,不殺人不足以征服,但是殺什麼樣的人,效果是不一樣的。其實這個經驗性的做法在聖經時代就存在。聖經上說,亞述王征服了以色列人,就把最富有的那些人都虜走了,只留下最窮的人。他做的事情其實就是毛澤東在土改時期做的事情,也就是史達林派克格勃在卡廷森林裏面做的事情 — — 去掉精英。精英是凝結核,他們不僅更有錢、更有文化,而且也是當地無產階級和貧下中農相互之間能夠組織起來的主要力量。貧下中農自己沒有威望,組織不起來,但是如果當地一個知名人士 — — 照日本的說法就是名望家 — — 站出來的話,他們就有勇氣跟著他走了。美國獨立戰爭和美洲獨立戰爭能夠成功,恰好就是因為華盛頓和玻利瓦爾是大地主的緣故,所以他們能夠號召得動周圍附近的窮人。辛亥革命的主要領導人也是大地主和大資產階級。卡廷的那些波蘭軍官,或者是地主資產階級,或者就是醫生、律師那樣的專業人員,都是比一般的窮人要強,在一般的窮人看來是有威望的、能夠號召得動窮人的。

根據經驗,把這些人殺掉或者流放掉了,當地的窮人至少是在一代人的時間內就群龍無首。當然過上兩、三代,通過教育和經濟發展的方式,他們可能又培養出新一代的土豪,培養出新的地主、新的資產階級、新的知識份子、新的醫生和律師,這些人又可能發揮新的凝結核作用,但那是以後的事情。就在這一代內,最有效的統治方法就是除掉這些凝結核,然後蛇無頭不行,群龍無首的無產階級鬧不出大事來,我就可以有效地統治了。如果把這些人留下,殺掉數量相同的無產階級而把精英留下來,這些精英要鬧事是很容易的。所以殺無產階級和精英的政治效果是不一樣的。從統治經驗來講,你確實是應該殺精英。殺掉五萬波蘭精英,就能夠瓦解一代波蘭人可能的潛在反抗;如果只殺五萬無產階級的話,同樣的效果就達不到。

所以這是共產主義統治的一個秘傳心法,也是列寧主義的黨派和一般的馬克思主義者不同的關鍵所在。一般的馬克思主義者,按照他們比較鬆散的社團,是做不到這一點的,他們在理論上也不贊同這樣做。但是不贊同這樣做的結果就是,要麼他們不能統治,要麼他們比如說通過民主方式,像社會民主黨那種方式,通過選舉實現統治,那麼他們只能以改良主義的方式,例如增加稅收、增加社會福利,暫時地改變一下政策,過幾年時間以後他們又要下去了,他們不能根本上改變社會結構。只要社會上仍然有大量的精英階級、在經濟上和文化上佔有領導權的話,資本主義的整個社會結構不會發生重大的變化。而列寧主義就認為,通過民主方式實現社會主義是不可能的,只能通過專政的方式、通過極少數精英恐怖分子專政的方式實行統治。事實上,他們也確實用這種方式在東歐和東亞建立了廣大的帝國,這就是我們今天的中華人民共和國。

列寧主義者在革命的過程中間經常採取統戰的做法。我們當然已經看出,從列寧主義者的理論和實踐來看,民族主義就是資產階級實行政治剝削和壓迫的工具,所以列寧主義者必然是民族主義的敵人,但是這並不排除為了統戰的需要,策略性地運用民族主義。也就是說,當民族主義跟更強大的帝國主義有矛盾的時候,我們可以支持民族資產階級和民族主義,利用他們做白手套來反對更危險的帝國主義,然後等到他們取得勝利以後再從內部推翻他們。蘇聯首先在遠東共和國就採取的是這種政策 — — 首先建立一個資產階級政府,發明一個遠東共和國。遠東地區當然在沙皇時期並不是一個民族,而且布爾什維克就它自己的理論來說也是不贊成民族主義的,但是它可以策略性地、在當地本來沒有民族發明基礎的情況下硬生生地發明出一個民族來,產生一個資產階級遠東共和國,然後用這個遠東共和國做白手套,去顛覆日本、朝鮮和中華民國。因為國際社會對待布爾什維克政權的態度就像現在的列強對待伊斯蘭國的態度一樣,伊斯蘭國雖然佔領了大片河山,誰也不派大使館過去,但是如果成立一個遠東共和國,那就不一樣了,遠東共和國是一個資產階級國家,它跟日本、滿洲、朝鮮有著廣泛的貿易聯繫,日本人、朝鮮的日本殖民當局、中華民國政府和張作霖的滿洲當局為了本地的商業利益以及僑民的利益,不能不跟遠東共和國發生關係。

於是,儘管他們不接受蘇聯的外交官,卻不得不容許遠東共和國在張作霖的領地、在日本和朝鮮的領地、在中華民國各地設立領事館,而這些領事館就是蘇聯情報機關在遠東培養新一代恐怖分子 — — 也就是未來的國民黨和共產黨的基地。後來顛覆中華民國北洋政府的那些武器和那些幹部隊伍,第一批就是通過遠東共和國的領事館和商務代表派來的。當然我們也可以想像,這些商務代表根本不像是一般的外交慣例所設想的那樣是來管理我國僑民和商務的,他們就是蘇聯派來的間諜。如果沒有遠東共和國這樣一個資產階級民族主義政權,這些事情都辦不到。根據同樣的道理,蘇聯也會支持蔣介石,支持捷克的貝奈斯政府,支持西班牙共和國的資產階級政府,不讓共產黨直接露到前臺來。他們支持這些資產階級政府,是因為這些資產階級政府反對帝國主義。利用捷克的資產階級政府趕走德國人,利用西班牙的資產階級政府趕走英法帝國主義,利用蔣介石這個資產階級政府取消列強在中華民國的條約權利,然後等到帝國主義滾蛋以後,我們再跟你算總賬,把貝奈斯和蔣介石統統趕走。西班牙是出了差錯,被佛朗哥將軍給破壞掉了,否則後來的結果也是一樣的。

 

共產主義策略性地運用民族主義作為統戰工具和顛覆工具,結果造成了小民族主義得以展開的另一種條件。我剛才曾經提到過,帝國民族主義和泛文化民族主義的衝突對小民族主義的勝利起到了極大的作用。波羅的海國家和巴爾幹國家,就是大俄羅斯主義和泛日耳曼主義衝突、以及大奧斯曼主義和泛斯拉夫主義衝突的結果。雙方衝突的結果等於是鷸蚌相爭漁翁得利,雙方所企圖建立的大國都失敗了,卻在可能建立大國的中間地帶建立了一系列小的民族國家。現在我們看到的中亞五國其實也是屬於這種情況,它是大俄羅斯和大土耳其勢力平衡的結果,結果導致了哈薩克民族、吉爾吉斯民族的發明。在沙俄時代,雖然有這些部落的前身存在,但是連哈薩克和吉爾吉斯這兩個名詞都是混亂的。你如果看在沙俄時代寫的中亞歷史的話就會發現,這些歷史上所謂的“吉爾吉斯人”,恰好是指我們現在所謂的哈薩克人;現在我們所謂的吉爾吉斯人,當時被稱為“野石帳吉爾吉斯人”。他們認為,今天的哈薩克和吉爾吉斯是吉爾吉斯遊牧部落的不同分支,就像察哈爾蒙古人和額濟納旗蒙古人是內蒙古蒙古人的不同分支那樣。當時就是這樣一種關係。後來他們是怎麼被發明成為哈薩克民族和吉爾吉斯民族的呢?主要就是由於各種泛民族主義和各種帝國民族主義相互衝突的結果。

在遠東這樣即使是最早出現的帝國民族主義和泛民族主義的構建都極不發達、非常脆弱的地方,共產主義作為白手套設立的這種資產階級民族主義介入當地的結果是產生了類似的效果,就是在不同的大帝國之間的鬥爭當中產生了小民族,一方面促使了作為緩衝的小民族主義產生,一方面促使了作為自衛性質的資產階級民族主義產生。這兩種例子你在現在都可以看得到。像今天的香港民族黨之所以存在 — — 它在2014年以前是不存在的 — — 就是因為香港作為緩衝地帶的存在。香港到底是西方帝國主義的領地呢,還是中華人民共和國的橋頭堡呢?答案是,它都是。中共的地下黨早在中共奪取政權以前就在香港有長期的活動。大家都很熟悉的潘漢年同志在四十年代在香港長期活動,在香港通過他跟香港本地華人資本家和南洋華人資本家的關係,把十分困難和緊俏的戰爭物資,包括沒有工業的大後方根本不可能存在的醫藥、器械、南洋的石油和橡膠 — — 我們要記住南洋的石油和橡膠是多麼重要,日本發動珍珠港事變就是為了得到南洋的石油和橡膠 — — 他把這些物資通過香港轉移到延安去了,在朝鮮戰爭的時候還轉移了一部分給蘇聯。不僅是中國共產黨,甚至蘇聯共產黨都非常依賴香港的地下組織。同時另一方面,香港當然也是資產階級世界的一部分,這個是不用解釋的。

香港在東亞的地位跟愛沙尼亞在東歐的地位是一樣的。東歐的愛沙尼亞是泛日耳曼勢力和大俄羅斯勢力的一個交錯點,這個相持不下的情況導致了愛沙尼亞民族主義的產生。我們要知道,愛沙尼亞民族原先是不存在的東西。第一批愛沙尼亞民族發明家是誰呢?他們是講德語的德國路德教的教士。這些人怎麼會變成後來的愛沙尼亞人的祖先呢?這就跟越南華人移民在香港的後代或者是上海難民和廣東難民在香港的後代變成香港民族黨的黨員是一個道理。他們本身如果不遇到壓力的話,他們可能會永遠都認為自己是路德派的德國人,但是他們在面臨著兩大勢力的交錯、看到本地社會因為兩大勢力的衝突而嚴重撕裂的時候,就感到有必要為父老鄉親做一點事情。他們覺得,為了擺脫這種痛苦的局面,保衛地方利益,保衛我們這些孤兒,無論哪一個大帝國都不會真正照顧我們這些孤兒的利益,我們有必要把愛沙尼亞發明成為民族,把原來被認為是德語的一種方言、芬蘭語的一種方言的愛沙尼亞語,通過民歌、童話之類的,變成一種正規的國語,然後依託這種國語、通過民歌的方式發明民族。我們都知道,愛沙尼亞的獨立是通過所謂的“歌唱革命”,幾十萬的愛沙尼亞人手拉手,唱起愛沙尼亞的民歌,表示我們不是俄羅斯人,我們不是蘇聯民族的一部分,最終爭取到了自己的獨立。其實這些事情,你看愛沙尼亞民族早期的發明歷史,就好像在看香港最近發生的事情一樣。

另一個典型的例子就是泰國的民族發明。泰國原來是暹羅,它是一個封建君主國,封建君主國是不在乎你是什麼文化基礎的。當然,泰國的王室也有廣東各族群的濃厚血統,從第一代開始一直到1930年代都是這樣。泰國的居民也有很多的潮汕人、梅州人、客家人、各式各樣的廣東居民的混血在內。但在二、三十年代它突然要發明民族,為什麼?因為國共聯合,在蘇聯的支持下正在搞北伐,北伐的一個重要手段就是恐怖活動,把蘇聯布爾什維克搞恐怖活動的技術在香港和上海拿來運用,在資本家的門口扔些炸彈。你如果不給革命勢力捐些錢的話,我們革命黨明天就過來殺你全家,你不要以為租界的員警能保護得了你。或者就是純粹為了製造混亂,讓大家都看到,誰敢得罪我,就沒有好下場。這些事件就是1967年香港暴動的實質。當時金庸正在香港辦報,香港地下黨在他的門口扔了炸彈,嚇得他在香港待不住,一溜煙就跑到新加坡去了。可想而知,如果事情進一步鬧大的話,他就要留在新加坡永遠不回來了。但是最後由於中共黨內鬥爭的緣故,最後占上風的一派認為,目前在香港搞革命不適合,香港目前還應該作為緩衝地帶存在,於是香港的局面又平息下來,金庸又回到香港了。這就是香港六七暴動的真相。

它跟本土意義上的左派根本不是一回事,並不說是本土的工人嫌待遇不好、發動社會主義運動,或者說是本土的資本家不夠關心他們,或者說是教會在調解勞資關係方面做得不夠、在社會進步方面做得不夠。其實你們香港本地的無論是左派還是右派,無論是工人還是資本家,無論你做什麼還是不做什麼,該發生的事情都會發生,因為這些事情不是為香港本地的工人或者資本家的利益而發動的,而是服務於北京和莫斯科爭奪世界革命領導權的鬥爭。如果他們決定香港是一個適當的戰場,那麼你無論做什麼,香港都會變成戰場;如果他們認為香港應該作為一個緩衝地帶,那麼你無論做什麼,香港都會變成緩衝地帶。這就是關鍵。當然,愛沙尼亞民族發明家也正是因為看到了這一點,才覺得你們全都靠不住,愛沙尼亞除了獨立以外沒有辦法維護自己。

我剛才講到泰國,泰國原先也是一個君主國,民族不民族並不重要,但它在三十年代終於由暹羅變成泰國。從暹羅變成泰國的他者塑造 — — 民族的意思就是說,什麼人是我們自己人,什麼是外國人 — — 是以中華民國為他者的。泰國的君主和泰民族最初的發明家義正辭嚴地說,中國人對我們構成了滲透,對泰民族的生存構成了嚴重的威脅,我們如果不建構泰民族的話,就有可能變成中華民國的行省。我們再來看這些發明家的血統,這些發明家從國王他老人家第一個,他就是廣東人的混血兒,他身上的廣東人的血統比非廣東人的血統還要多。最初幾個宣稱自己是泰民族的那些人,他們全都有廣東的名字,毫無例外都是跟檀香山的孫中山一模一樣的出身,是清朝末年遷到那裏的廣東移民。而暹羅王國內地比較接近老撾邊境的那些真正是泰民族血統的酋長反倒根本沒有發聲。那麼這些人是吃錯了什麼藥,他們不發明中華民族,不發明漢族,偏偏要發明泰民族,而且一定要把自己發明成為反華分子呢?要知道,那些反華分子跟他的親緣關係、血緣關係,可要比他們跟老撾邊境上的那些部落酋長的血緣關係要近得多。

關鍵就在於國民黨根據他們自己的炎黃子孫的民族發明,認為自己不僅有權在廣東或者上海鬧革命,而且有權在全世界的華人社區鬧革命,包括馬來亞和泰國的華人社區。如果你們這些社區不好好拿出錢來捐獻給國民黨、跟著國民黨鬧革命的話,我們就要用我們從共產國際那裏學來的手段,在你們門口扔炸彈,搞一些六七暴動這些事情。然後本地的大地主大資產階級正如馬克思主義者英明預見的那樣,儘管他們在革命初期對革命抱有一定的同情,但是革命一旦向縱深發展,無產階級真的起來了,恐怖活動真的鬧起來以後,他們馬上想到了自己的財產,屁股決定了腦袋,從革命的不可靠的同盟軍變成了堅定不移的反革命分子。泰國的民族發明是他們搞反革命的一種方式,因為他們既然把自己發明為泰國人,然後還要把拒絕做泰國人的華裔居民變成危害泰國安全的外國顛覆分子,那麼他們的階級利益就能夠得到保證了,他們就可以理直氣壯地保全自己原有的地位和財產了。即使他們原先有濃厚的潮汕人血統,之後他們只要運用他們的發明,就可以把這段歷史抹去,堂而皇之地做未來泰國的愛國者,繼續發動排華運動。而在這次鬥爭當中站錯了隊或者說是站到相反一邊、繼續跟著國民黨的僑社走的那批人,最後他們就沒有把自己登記為泰國公民,而是繼續登記為中華民國的僑民,然後在抗日戰爭的時候繼續捐出比廣西省更多的錢來支持國民政府抗戰,在國共之間的戰爭當中又讓自己的社區變成了國民黨和共產黨鬥爭的戰場。

馬來華人也經歷了類似的過程。這方面的鬥爭就是原先分散的、血統各不相同的馬來亞各民族一定要通過馬來民族統一機構或巫統這個政黨發動馬來民族運動的根本原因,也是馬來西亞要建構馬來西亞國族的根本原因。馬來西亞國族和馬來亞民族之間的關係,就像是大黎巴嫩和小黎巴嫩之間的關係一樣。小黎巴嫩是作為黎巴嫩核心的阿拉伯基督教徒;大黎巴嫩是包括各教派和各族群的黎巴嫩國。小馬來西亞 — — 也就是馬來亞族,是馬來亞的穆斯林;馬來西亞國族則是包括馬來穆斯林、馬來印度移民、馬來華人和其他各原住民的一個整體。這就是一個核心和週邊之間的關係。這個雙重民族發明,從根本上講就是受到國民黨所熱衷的那種炎黃子孫 — — 漢族的民族發明和作為共產黨白手套而投入使用的中華民族發明的雙重衝擊的產物。儘管你可能會覺得國民黨的民族發明和共產黨的民族發明有很大差別,但是對於南洋土族人的社會來說,這兩者的區別很小,都是十分危險的顛覆勢力和帝國主義,差一點點就會把馬來的穆斯林土族變得跟朝鮮的高山族沒有什麼區別,變成連媳婦都找不上、自己的女人都會被征服者娶走的受保護的少數民族。

現在的馬來族要在憲法中堅決要求保護原住民的土地,就是擔心自己在搞資本主義的時候搞不過你們,然後自己的土地一點點被賣掉,然後就像是台灣的土族民族一樣,在自己的土地上變成外人。台灣的土族民族、台灣本土人的命運對於他們來說就是前車之鑒。這是涉及到非常具體的利益的。他們把自己變成穆斯林,把自己的子弟送到阿拉伯世界去學阿拉伯語、學伊斯蘭教法,或者送到英國去學普通法,就是要培養出自己的精英階級,跟馬華社會已經產生的這些共產黨的地下黨和國民黨的僑社領袖相對抗的精英階級。從現在的情況來看,他們已經占了上風,把馬華擠到一個很邊緣性的位置上,但是從三十年代到六十年代這段時間,鬥爭的前途未定,他們的前途一度是顯得很危險的。從這一點你就可以看出民族發明的實際功效了。民族發明有巨大的政治功效。成功的民族發明可以把本地的精英階級從行將滅亡、眼看就要變成印第安式土族或者台灣高山族那種危險的前途當中解救出來,使自己反敗為勝,重新變成當地的主人。

當然,錯誤的民族發明則很可能像蔣介石所支持的那種民族發明,以及他為了維護這種民族發明採取的政策,很可能引狼入室,使自己很容易變成例如共產國際或者其他勢力滲透的白手套。可以說,中華民族之所以落到這個下場,就是蔣介石雖然事事把自己作為凱末爾,但是拒絕像凱末爾那樣放棄奧斯曼主義、轉而搞小民族發明的必然結果。如果蔣介石肯承認滿洲獨立,願意放棄中華民族的發明,願意發明一個吳越民族,那麼他在江東五省的統治是很難被顛覆的。但他如果為了爭奪滿洲國跟日本打仗,那麼就不得不跟蘇俄聯盟,跟蘇俄聯盟就不得不容許共產黨的正常活動,接下來的事情就會變得不可避免。凱末爾也正是因為放棄了奧斯曼帝國過去的領土,把這些領土割讓給英法帝國主義,才避免了這種命運。否則的話,他如果為了收復奧斯曼帝國的失地,為了收復英國統治下的賽普勒斯,收復法國統治下的敘利亞,那麼誰能支援他這麼做呢?仍然是只有背後的蘇聯。而他如果要跟蘇聯結盟的話,也就沒有辦法禁止本國的共產黨活動了。如果他按照這樣的程式打走了帝國主義,恢復了奧斯曼帝國的原有領土,那麼下一步就是土耳其共產黨該推翻他了,他就只能像蔣介石逃到台灣那樣逃到被他剛剛解放的賽普勒斯去了。

這就是安危存亡得失之際,不同的民族發明會決定不同共同體的命運。像台灣國民黨和藍營現在的情況就是,他們無法捨棄中華民族的發明,因此在台灣的日益茁壯的新本土派看來,你們已經是台灣民族的第五縱隊了,你們要在台灣混不下去。但是你們回到中國來,如果你們在台灣沒有影響力、沒有統戰價值的話,那能有什麼下場?也無非是像過去那些馬來華僑因為鬧革命被本國驅逐了以後來到毛澤東的中國,他們去了哪兒?也無非去了華僑農場,華僑農場無非是夾邊溝的一個比較體面的名字,實際命運是一模一樣的。但是今天還有很多台灣藍營的成員無法放棄危險的民族發明。這個民族發明對他們的破壞作用,比起馬來民族發明對馬來亞土族社會的促進作用還要大。

類似的情況就是波羅的海的日耳曼居民。我們要知道,波羅的海的德語居民過去就是波羅的海中產階級社會的精英,現在的愛沙尼亞人和拉脫維亞人是他們發明出來的。他們是本地受教育程度最高的人,他們跟所謂的拉脫維亞人和愛沙尼亞人不是說種族上有很大差別,而就是學問比較大一點。比如說如果你是一個韓國人或者湖南人,如果你錢很多、學問很大的話,那你必然要學漢字的,讀多了四書五經以後,你自然就變成一個儒家知識份子了。同樣的道理,波羅的海的土族居民如果上了很多大學的話,大學都是用德語教育的,你必然會精通德語,然後別人就會說你是波羅的海的日耳曼人。這時候你可以選擇,跟著愛沙尼亞的民族發明家把自己發明成為愛沙尼亞人,或者硬著頭皮把自己發明成為居住在愛沙尼亞的德國人。後一種發明的後果就是台灣國民黨現在的下場,我住在台灣,但是要變成住在台灣的中國人,然後你就變成住在本地的外人了,然後在下一次蘇聯佔領愛沙尼亞的時候,就會把你作為外國人驅逐出去。愛沙尼亞和拉脫維亞的日耳曼語居民曾經是本地的精英,占本地十分之一的人口,就是這樣滅絕的。他們為什麼滅絕?不是因為他們在血統上跟所謂的愛沙尼亞人有什麼重大區別,他們原先就是鄰居,只是他們比那些鄰居讀書讀得更好,賺錢賺得更多,更加資產階級,更加成功,因此他們裝逼的機會就更大,完全有資格把自己發明成為比愛沙尼亞更加強大的德國人,但這就是他們毀滅的原因。錯誤的民族發明毀了他們,正如錯誤的民族發明正在毀滅台灣的藍營支持者一樣。

相反,正確的民族發明使愛沙尼亞人沒有落到諾夫哥羅德同樣的下場。本來裏加、塔林和諾夫哥羅德都是漢薩同盟的地方,都是講德語的商人和資產階級建立起來的自由城邦,但是諾夫哥羅德人把自己發明成為俄羅斯人 — — 儘管他們比大多數俄羅斯人更富有更文明,更有資格做歐洲人。可以說,在諾夫哥羅德那個時代,你如果說誰是歐洲人,是諾夫哥羅德的商人還是烏克蘭農民?任何人都會說,諾夫哥羅德的商人跟漢堡的商人沒有什麼區別,而烏克蘭的農民跟莫斯科的農民區別不大,將來如果說有誰是歐洲人,那肯定是諾夫哥羅德人變成歐洲人而烏克蘭人變成亞洲人。結果現在的情況居然恰好相反,就是因為諾夫哥羅德人把自己發明成俄羅斯人,而烏克蘭人好歹把自己發明成了烏克蘭人,還有一個進歐洲的機會。而愛沙尼亞人呢,也就是把自己發明成了愛沙尼亞人,才保證了自己沒有落到跟諾夫哥羅德人同樣的下場。馬來的穆斯林土族也就是通過正確的民族發明,巧妙地利用英國、中國和各大國之間的矛盾,才有今天的。這就是民族發明非常現實的政治作用。

所以你們在討論梁啟超所謂的政體和具體的政策構建之前,首先要考慮共同體的構建本身。在整個歷史看來,共同體的構建是最根本的。波蘭到底是由畢蘇斯基將軍的開明專制來統治,還是由自由共和國來統治,關係不是很大;但是波蘭民族能不能存在,是建立一個歐洲的波蘭民族,還是發明一個屬於泛斯拉夫體系的西斯拉夫民族,那就是關係很大了。這一點不搞清楚,你們就永遠是在細枝末節上做工作。上海人之所以現在得不到愛沙尼亞的待遇,不是因為他們在經濟上不如愛沙尼亞,他們在大多數時間,經濟上是比愛沙尼亞強得多的,但是他們既然把自己發明成為中國人,那你就必須承認,上海的知青會發配到新疆和西藏去是理所當然的,這是你作為中華民族一份子應該承受的代價。上海作為共和國的長子,大部分的錢都要拿去建設駐馬店,這也是你作為中華民族一份子所應該受的待遇。

愛沙尼亞人在被蘇聯吞併、作為蘇聯民族的一部分的時候,遭到的也是這種待遇,大批精英被迫去了西伯利亞,錢都用來建設莫斯科了,但是愛沙尼亞可以把這些事情發明成為蘇聯的迫害,然後通過加入歐盟得到更好的待遇;而上海人做不到,就是因為上海人搞不出這個民族發明。我們要明白,不是說上海人在血統上講,獨特性比愛沙尼亞人更好,而是上海的精英階級有沒有這樣的膽識的問題。如果有這樣的膽識,一百年的時間足夠他們建立一個遠東的愛沙尼亞了;如果沒有的話,那麼他們將來,比如說在未來中國如果走向跟西方世界對抗的道路、政策重新收緊的話,同樣的命運還會重演,未來的上海知青再一次上山下鄉也不是不可能的。台灣的國民黨如果堅持現在的觀點的話,他們的下場很可能就是像六十年代馬來的紅色華人一樣回歸華僑農場;而台灣的本土派呢,如果他們發明台灣民族成功的話,他們再壞也不過像愛沙尼亞那樣,就算是一度被征服,還能夠被重新解救出來,無論如何,他們未來的青年會去美國留學,會去日本留學,無論如何他們不會考慮跑到新疆或西藏去搞生產建設兵團和農場或者遭到諸如此類的命運。你現在看他們的動作和他們在民族發明方面選擇的不同方向,就能大致預見到他們的命運了。

他們跟我們的關係並不密切,所以關鍵還是在我們。如果在座的各位真的是關心現在這個中國轉型,那麼首先要搞清楚一個基本前提:中國目前採取的這個民族構建是不符合世界主流的,目前世界上除了中華人民共和國以外,沒有任何一個國家是按照奧斯曼主義的構建方式建立的,更沒有一個國家是按照奧斯曼主義做白手套、背後由反民族主義的共產國際殘餘勢力控制著,世界主流的小民族主義在這塊土地上還沒有開始生根。所以轉型以後,你首先要面臨的就是這個問題 — — 如果還真的能夠轉型的話。另外一方面,如果你一定要維持這個盤子的話,確實很難認為轉型是適當的。轉型以後,你沒有辦法回避像藏人或者突厥人學習愛沙尼亞人的榜樣,一路發明民族,原先是小俄羅斯人的烏克蘭人也自己發明民族,一步一步來解構這個帝國。如果你想維持現有的版圖的話,現在這個列寧黨就是維持這個版圖的最強大的現實力量。雖然它並不是出於資產階級民族主義的目的來維持這個帝國的,但是除了它以外,確實沒有其他合適的政治力量能夠維持這片版圖。

所以你們在國體方面和政體方面提出的要求其實是跟梁啟超一樣矛盾的。梁啟超所要建立的那些政體,只有在國體 — — 也就是政治共同體的邊界已經劃分得非常完善的情況下才能起到作用。否則的話,在共同體劃分還沒有完善的情況下啟動政治變革的進程,那麼不可避免的效果就是,像西班牙自由派在西班牙立憲促成了美洲民族的發明和美洲各國的解體、俄羅斯和蘇聯的改革促成了自身的解體、奧斯曼帝國的改革促成了奧斯曼帝國的解體一樣,你一旦啟動了這個進程,最先面對的不是關於政體的爭論,不是什麼聯邦制、中央集權制、內閣制、總統制這方面的爭論,首先面臨的就是中國本身還能不能存在、應不應該存在的問題。即使是最初屬於政體性質的爭論,例如像阿根廷的聯邦制和中央集權制、大哥倫比亞和小哥倫比亞的那種保守派和自由派的爭論,在經過一定程度的博弈以後,也有很大的概率把黨派之間的鬥爭轉化為地區之間的鬥爭,再把地區之間的鬥爭轉化為民族發明。

答問部分(所有提問均經過精煉):

:你剛才說到,在民族建構當中,最關鍵的是精英階層在歷史節點上的選擇。經過土改、反右、國有化之後,當今的中國還有這樣的精英階層存在嗎?在高考以後新上來的新貴,他們有沒有可能通過財富或知識的積累,形成這種新的精英階層?

劉仲敬:我真實的看法是,很悲觀。我認為他們的無根性太強,不像是以前的儒家地主那樣能夠紮根在一個地方,維持一個地方的秩序,而且把自己的利益和地方的利益結合在一起。所以儒家地主至少還能夠出一個曾國藩,而現在這批人,他們徒然有錢,但他們是很容易流動的,而且確實在迅速流動。如果每一個地方用最廣義來解釋精英的話,中國有10%~15%的人口,包括我自己在內,都是在不斷流動之中,他們總能找到新的臺階。如果你在深圳或者上海的話,十之八九你就會往美國跑;如果你是在內地的話,你就會往北上廣跑,小縣城裏面往省會城市跑。也就是說,在每一個地方,最有條件、最有可能、最有資格變成土豪的人都不打算做土豪,而是打算升高一層,到別的地方去做遊士。他們全都以用腳投票的方式對本地的未來投下了支持張獻忠的一票,所以這樣的路徑積分是極度危險的。

但是我也不能說,既然如此,你們就乾脆準備吃人肉算了。在你們還沒有被煮成人肉之前,至少要給一個死馬當活馬醫的機會,所以可以避免張獻忠的幾種可能路徑至少都值得根據假設來考慮一下。根據假設就是說,這樣的社會條件存在不存在。我個人是有極大懷疑的。例如,中國能不能轉型這件事情,我就有極大的懷疑。我自己的直覺是,有了中國就沒法轉型,轉型以後就沒中國了。但是如果有很大一批人認為這是可能的,那麼我也願意根據這種假定的可能性為起點來討論。照我的推演,即使假定中國是能夠轉型的,轉型以後的結果仍然逃不脫,要麼是內亞勢力 — — 上一次是共產國際,這一次可能就是伊斯蘭極端勢力 — — 再來一次輸入,要麼就是,在外來干涉沒有出現的情況下,按照拉美式軍閥割據的方式走向分裂和解體。而且這都不是最悲觀的情況,軍閥本身都多多少少要有一些有根性,至少他要認為值得在本地長期當一個軍閥,如果他認為在本地迅速地搶劫一批然後拍屁股走人是很合理,讓本地居民愛死愛活、自己想辦法解決的話,那麼情況會比軍閥割據還要糟糕得多。

:中國的構成相當複雜,既有新疆和西藏這樣的地方,也有大片的自認為在文化上是漢族的地方。你說的解體是指少數幾個地方獨立出去,還是說整個解體掉?

劉仲敬:這個可能是任何一種情況,這要取決於當時的博弈。如果拉丁美洲各路軍閥正在打內戰的時候,美國人、英國人或者蘇聯人,只要是任何列強有一支像普法戰爭那樣強大的軍隊進行干涉的話,那麼結果就完全不一樣。你完全可以想像,某一個拉美的孫中山或者蔣介石把黃埔軍校得到的蘇聯那批援助拿到手,那麼他必然就可以削平群雄、重新統一美洲,歷史路徑就不一樣了。我沒法預見在中國這樣一個面對內亞完全開放的邊境上會有多大的外來干涉力量進入,這樣的干涉力量比起當年共產國際的干涉來說是會更大還是更小。要把這些數據都掌握到,我至少需要讓中央情報局聽我指揮才行。所以我只能做一個大致上的估計,就是說,干涉是會存在的。至於干涉到什麼程度,落在哪一方,具體會對哪一方有利,哪一方能夠利用局勢,這在事先是不可能預測的,當時的人的決斷會改變很多。我們要注意,清末的滿漢構建跟美洲革命時期西班牙人和美洲人的構建從技術上講是一模一樣的,但是滿洲和內亞跟東亞是挨在一起的,有一個開放的、無法封鎖的邊界,而西班牙和西班牙美洲之間隔著大海,這就造成了一個非常基本的不同。內亞闌入東亞是自古以來兩千年曆史的既成事實。既成事實,照它的路徑積分,過去經常發生的事情即使在未來不是一定會發生,也是很容易發生、發生的可能性比不發生的可能性要大得多的。

假定大明留下來的十八省像西班牙美洲一樣相對隔離、假定還能夠得到美國門羅主義的不受外界干涉的保證的話,那麼最可能發生的事情就是軍閥割據和事實獨立。事實獨立你認為是不重要的,但是實際上歷史的經驗就是,一個地方只要事實獨立了幾十年,即使再統一也統一不住。像海地島東部的聖多明各,被海地和西班牙交替統治了僅僅十幾年時間,下一次重新回歸的時候本地人就要鬧獨立,因為他們已經被別人統治過了,他們的民族性格已經發生了改變,即使原來是一個國家,今後也再統治不住。當然,西班牙美洲那些國家,我們都很清楚,按照它們的政治邏輯,是不會高呼“寧願讓台灣不長草也要如何如何”的,你既然非要獨立不可,那就算了,獨立就獨立吧,也就這樣了。烏拉圭人建國者的第一代是堅定不移的阿根廷人,他們做夢都想要打回布宜諾斯艾利斯去,但是這絲毫沒有妨礙第三代人以烏拉圭的愛國者自居,而且理直氣壯地把那些明明自己以為自己是阿根廷人的先輩發明成為本國獨立戰爭的英雄。

所以你現在考慮的問題實際上就是,在假定內亞干涉根本不存在 — — 順便說一句,這純粹是一個思想實驗,能夠站得住腳的現實可能性是少到接近於零的,干涉是一定會有的 — — 假定在沒有干涉的情況下,以方塊字為根據、帶有濃厚儒家色彩的漢字文化圈是不是具有比天主教社會西班牙語文化圈更加深厚的凝聚力,以至於西班牙的一個省份只要事實獨立幾十年以後就堅定不移地不願意再被統一了,而漢字的省份獨立了幾十年以後還是會很渴望統一。這個事情不會有絕對的結論,但是你可以到韓國、越南和台灣去看。雖然時間比西班牙語的幾十年要長,但是確實是,同樣使用漢字的越南人在五代十國的時期獨立了也不過幾十年以後,就要堅決抗拒同樣是使用方塊字、同樣信仰儒家的宋朝軍隊,而且還寫下了“南國山河南帝居”這樣的愛國詩篇,然後又在類似的情況下,同樣信仰儒家、由儒家官僚統治、用方塊字的越南人發佈了《平吳大誥》,把同樣以儒家為意識形態、同樣由儒家官僚統治的朱明王朝的軍隊打了回去。他們都是使用方塊字的,好像並沒有因為使用方塊字、接受儒家文化,就在一度獨立以後變得很願意接受中原王朝的再統一。在天主教士為他們發明了拉丁化的新文字以後,這種可能性就變得幾乎沒有了。韓國的去中國化也就是二十世紀六十年代的事情,是近在眼前的。所以我可以很有把握地說,漢字和儒家文化並不能構成民族發明必然的障礙。它是不是會比西班牙語中央集權的性格更大、更容易造成統一,這是有可能的,但是這個可能性沒有大到能夠絕對排除民族發明的地步。

:民主轉型有兩種分析,一種是討論社會條件和歷史因素,一種是討論具體的政治過程。如果僅從前者討論,是不是會忽略歷史的複雜性?比如小民族認同和大民族認同會在具體的政治過程中相互轉化。

劉仲敬:分析政治的過程一般都是以一國為單位的,也就是說,它事先假定了這個國家、這個政治共同體是已經存在的,而對於政治共同體本身的誕生,據我所知還沒有人做過真正靠譜的分析,所以這些分析的參考價值其實本身就是很小的。你可以撇開枝葉直接切入根本,就是說,在威斯特伐利亞體系之下,是分裂容易統一難,已經建立的民族國家要想重新統一是極難的,而沒有分裂的帝國型民族和泛文化民族要想分裂卻是很容易的,兩者之間不是對稱的。布希總統曾經堅決反對烏克蘭獨立,但是烏克蘭一旦獨立了以後,俄羅斯哪怕是收回烏克蘭極小一部分土地,被認為是非常親俄的川普總統也不得不硬著頭皮制裁它。也就是說,烏克蘭一旦產生了以後,你就沒有辦法把這個過程倒回去了。這兩者是不對稱的。你可以假設,如果列寧沒有容許蘇維埃烏克蘭繼續存在,而是把烏克蘭收編成為小俄羅斯行省,會不會在1991年的時候,小俄羅斯行省繼續作為俄羅斯聯邦共和國的一部分存在,因此就不會有現在的克裏米亞問題了?這種可能性當然是存在的。同樣的道理,如果卡累利阿-芬蘭共和國仍然是蘇聯的第十六個加盟共和國,那麼蘇聯和芬蘭之間是不是現在就應該有一個愛沙尼亞式的新國家?這當然也是有可能的。但是這只影響具體問題。整體就是,建國一旦產生,即使不是不可逆的,要逆轉,成本也是極高的,但是解體的成本就要小得多。

奧斯曼主義和泛文化民族主義自身不斷解體,它們之間的相互衝突導致了邊緣地區的解體;殖民主義的瓦解和共產主義對殖民主義的侵襲,導致了後殖民主義所涉及的這些地區大量的發明民族;而這些發明民族本身的邊界和各方面安排不當,又造成了類似拉美式的次級、三級、四級的發明。所以自從凡爾賽會議確定了民族國家為正常和主流的國際共同體基礎形態以後,民族國家的數目一直是有增無減。蘇聯吞併波羅的海三國只是一個非常短暫而且非常局部的逆流,並沒有根本上改變從1919年以後民族國家數量就不斷增加的事實。這個事實並不是由於誰的雄才大略或者說是怎樣設計出來的,也不是由於誰的轉型方案設計得好或者不好而造成的,根本上講就是因為現行的國際遊戲規則是有利於民族發明家的,而對奧斯曼主義和文化民族主義則是非常不利的。

:最近蘋果公司出了上海話聽寫程序,這對該地的民族發明有何幫助?

劉仲敬:語言民族主義產生民族是典型的東歐模式。它是一個常見的途徑,但並不是必然的。拉美的民族發明就是在沒有動搖西班牙語作為共同語言地位的情況下進行的。所有的西班牙語美洲國家全都使用相同的語言,但這也沒有妨礙它的民族發明。所以這個本身不是決定因素。但是有一件事情倒是決定因素:如果有人跳起來說,“你們這是要鬧獨立,我們要堅決打壓你們,一定要消滅你們,你們敢講上海話還是不是中國人?你們跟港獨有什麼區別?”不這麼搞的話,成敗未可知,這麼搞了以後,那麼路徑依賴就形成了,以後就真的有上海獨立和上海民族這件事了。如果根本沒有人來干涉你,你只是自己去學習、去維護上海語言的話,那麼這種事情倒是不一定會發生。

:第一,你剛才說巴拿馬獨立是源於兩黨之間的鬥爭,但是主流歷史學家都認為這是巴拿馬運河造成的,你怎麼解釋?第二,你說漢族的發明是從晚清開始的,但是,西漢到東漢將近八百年,算什麼民族?冉閔號召漢人殺胡人,他們算什麼民族?元朝把人分為四類,蒙古人,色目人,北人,南人,他們算什麼民族?如果你的漢族定義是不同於我們常見的漢族定義的,那你應該事先說明。即使說明了,也應該解釋這種定義到底有什麼意義。

劉仲敬:首先第一個問題,你說的話不過是左派歷史學家慣用的反美材料而已。就不用考慮巴拿馬本身,你只要按照左派歷史學家一般的宣傳風格和美國一般的行事風格,你也知道這是不靠譜的。它裏面有一定的合理成分,就是說,如果美國沒有干涉的話,巴拿馬可能獨立不了。如果英國和葡萄牙沒有干涉,烏拉圭可能也獨立不了。但是如果美國沒有干涉的話,連韓國都獨立不了。你只要對美國的習慣做法稍微有一點瞭解,你也會產生懷疑。美國就不是那種會單單為了自己的利益、就在一個沒有獨立運動的地區煽動起獨立運動的。

首先,巴拿馬在西班牙帝國的時代就是一個相當特殊的地區。在美洲解體的時代,巴拿馬人並不是玻利瓦爾那支部隊解放的,而是自己的民軍解放的。他們在決定是不是要派代表去參加玻利瓦爾的共和國的時候是有過爭議的,最後是決定自願派代表去的。後來,巴拿馬獨立以後和獨立當時都曾經以此為論據,證明我們不是大哥倫比亞的一部分,我們去參加大哥倫比亞的議會只是我們自己選擇去,像是西藏參加國民大會那樣,並沒有放棄我們自己的主權,大哥倫比亞對於我們來說只是一個聯合國。這個邏輯跟美國南部諸州想要獨立的理由是相同的。巴拿馬獨立不是只有一次,而是有幾次反反復複,每一次都跟哥倫比亞內部的政治鬥爭有關系。哥倫比亞核心地區之所以傾向保守派,跟天主教會的特權很有關系,而拉丁美洲的自由派和保守派之間的鬥爭主要就是圍繞天主教會特權的問題。

最後形成的事實獨立是依靠美國幫忙。可以說,如果沒有美國幫忙,按照他們單方面的能力來對抗大哥倫比亞的兵力,他們有可能再輸一次,有美國幫忙,那就不一樣了,但是如果他們自身沒有反復獨立過幾次、也沒有要求美國干涉的強烈欲望和法律手續的話,你也不用指望說是美國真會幫你的忙。美國如果一定要用帝國主義的手段,在尼加拉瓜修一條運河也是可以的。當時巴拿馬運河的方案和尼加拉瓜運河的方案鹿死誰手猶未可知,美國人並非一定需要巴拿馬。而且按照你說的那種方式故意肢解大哥倫比亞,是根本違反門羅主義原則和美國正常的政治運作的。

如果按照馬克思主義史學家那種論證美帝國主義侵略全世界、包括侵略伊拉克的邏輯來說,你當然可以說,不僅巴拿馬,連委內瑞拉和哥倫比亞本身都是美帝國主義干涉的結果,因為沒有美帝國主義干涉,西班牙很可能還會派來復仇的軍隊,是靠著門羅主義的那些軍隊才沒有復仇。但是如果按照舊式的 — — 也就是十九世紀以前那種老自由主義的敘事性的史學方法的話,那我只能說,首先,巴拿馬在獨立戰爭的當時是自己建立的獨立政權,後來才加入玻利瓦爾的大哥倫比亞共和國。在哥倫比亞反反復複進行的內戰中,它至少是獨立過三次,後來在內戰占上風或者是雙方和解的情況下又寧願回去。

最後一次獨立確實是借助了美國的力量,但是推動獨立的那些領袖人物,他們自身是早在美國產生巴拿馬運河或者尼加拉瓜運河的計畫以前,就已經就獨立和不獨立、要做哥倫比亞的內戰一方還是建立獨立國家的問題做過長期的討論,而且擁有巨大的政治勢力 — — 即使美國不干涉、他們至少也能打一仗的那個地步。沒有這樣的基礎,你也很難指望當時還是孤立主義占壓倒優勢的美國政壇會願意進行干涉,支持巴拿馬的獨立。這個事情本來應該是很好考證的,因為據我所知,國內關於拉美方面的通史為數甚多,而關於巴拿馬方面的通史,是很容易找到這方面的材料的。

關於第二個問題,漢人和漢族完全是兩碼事,漢人本來是指的漢朝的臣民。作為政治共同體的民族,這個概念是近代歐洲發明的。以前是只有文化意義上的族群,而這些族群跟現代民族的關係從來都是模糊不清的。羅馬人是近代米蘭人的祖先嗎?我們從血統上就可以看出不可能,他們是日耳曼征服者的後代。冉閔那個時代,根據我對漢字古籍的一般瞭解,當時的說法一般是“胡晉人口”,沒有說“胡漢人口”的,就算有也是極少。什麼叫“胡晉人口”?“胡”是胡人,“晉”是晉朝,就是胡人的人口和晉朝臣民的人口。這兩者之間確實發生過多次衝突,胡人之間也曾經發生過多次衝突。冉閔是幹過那一次在宮廷政變以後屠殺原先的統治者的事情,但是他極其不可能是為了漢族的利益而做這件事情的,因為當時只有晉人,沒有漢人,更不存在什麼漢族。

元朝時候的漢人和南人,漢人指的金國臣民,蒙古把金國臣民叫做漢人,把金國的公主叫做漢公主,把宋朝的臣民叫做南人。蒙古是根據習慣法統治的。宋人和金人的法律不一樣,大體上來講時間有所不一樣,金人主要是使用唐律、再加上女真人原有的習慣法,宋人的法律在唐以後已經有所演變,這是主要差別。而蒙古人為了節省統治成本,實行因俗而治的原則,也就是說你原來用什麼法,現在照樣繼續用什麼法,因此產生了漢人和南人的不同。從這一點你也可以看出,漢人和南人跟現在所謂的漢族完全不一樣,現在所謂的漢族這個構建是不會承認湖南高地人和山東半島人屬於不同族群的,但是蒙古人說漢人和南人,很明顯是認為他們是屬於完全不同的族群的。現代起作用的這個漢族構建,跟中華人民共和國的漢族構建還是有點不同的。辛亥時期的滿漢構建就是以山海關為界一刀切斷。後來被共產黨劃為土家族、苗族的這些人,在當時全都是漢族。李宗仁、白崇禧、龍雲這些人在當時的標準來看都是漢族,但是按照共產黨的劃分方法,龍雲就是彝族了 — — 共產黨用的是蘇聯式的劃分法。

所以,民族發明學是各有各的構建方法,這個沒錯,漢族是有不同的定義。我剛才用的就是辛亥時期的革命家一直到國民黨時期通用的那個定義。這個定義,現在的海外華人當中也還有很多人在用,跟共產黨講的漢族定義是有所不同的。但是無論哪一種漢族定義,都很難把它的歷史延伸到清末以前。它跟歷史上的漢朝或者漢人之間的關係,也只能說勉勉強強相當於羅馬人和現代義大利人的那種關係,他們在血緣上沒有連續性,這是可以肯定的。冉閔時代晉人和胡人的後代基本上沒有什麼機會能夠活得過元末明初的大屠殺。現在的戶籍記錄清楚地顯示,無論以前發生過多少大屠殺,今天中國華北各省的人口絕大部分都是在明朝初年從山西和察哈爾一帶遷入的,他們大概有濃厚的胡人血統,他們的後裔遍佈了今天的華北。在那以前曾經居住過的居民,包括春秋時代孔子同時代的居民、漢朝的大多數臣民、晉朝的大多數臣民,最合理的解釋就是,他們已經在歷次反復發生過的大滅絕當中不復存在了。

你一定要用神話的力量去加強民族構建的力量,這是可以的,因為民族構建本來就是千奇百怪的,任何神話都可能出現。這樣的解釋,認為漢朝以來到民國時代人口有連續性的說法,雖然在學術上純屬胡說八道,但是從神話的角度來講並不特別離譜,所以要堅持就堅持,也是無所謂的。民族神話的主要作用就是由精英階級和知識份子用來哄騙讀書不太多、被意見領袖所驅使的普通民眾,讓他們相信自己是理所當然地屬於一個共同體。這種東西就恰好屬於柏拉圖所謂的那種“善意的謊言”。所以裁判這種“善意的謊言”到底是好還是壞,不是按照學術上是真是偽或者偽造的程度大小來判斷,而是第一,看它的政治目的是不是符合你自己的政見,第二就是,看它所要達到的政治目的和它採取的手段之間是不是有明顯的矛盾。

前者,是不是符合你的政見,因為政見是各人不一樣的,所以根本就沒有什麼統一標準,你認為是好的,我就認為是壞的,除了吵一架或者打一架以外沒有別的解決辦法 — — 如果吵了以後打了以後能夠到此為止的話。第二就是手段和目的的矛盾,那麼我可以負責任地說,漢族發明的技術和漢族發明所要達到的目的是極端背離的。大多數民族發明的目的是為了在政治上有利於發明家所在的或者是發明家企圖建立的這個集團的精英階級,而漢族的發明所造成的結果恰好就是把漢族發明的忠實支持者趕到了今天馬來華人和台灣的蔣介石支持者落到的這種下場,把他們從一度很有機會的地位趕到了今天這種兩頭不是人、眼看就要走投無路的悲慘命運上面來。所以從目的和手段的角度來看,從馬基雅維利主義只講技術不講價值的角度來看,漢族是一個拙劣的民族發明。拙劣的民族發明就是說,它會破壞自己發明的目的,坑害接受這種發明的人;而好的民族發明、馬基雅維利意義上的優秀的民族發明,是會讓這些人佔便宜的。

:韓國這幾年在東北亞做了很多小動作。未來,韓國、朝鮮和間島的朝鮮族人會是同一個民族嗎?

劉仲敬:韓國當然也是發明的結果,實際上這個發明當中還留下了明顯的裂隙。韓國歷來的黨派鬥爭實際上跟地區鬥爭是結不解緣的:韓國的保守派政黨一般是以釜山為基地的嶺南地方的人,他們發明的歷史是以歷史上的新羅為歷史正統的;而屬於韓國自由派或者是左派的人通常是以湖南地方為核心的,例如金大中這些人的集團,這個集團在威權主義時期長期受壓迫,然後現在是以左派的名義捲土重來,一度佔領了總統職位。兩者之間的差別有強烈的地域性,這就說明韓國的民族發明所發揮的彌合作用本身還不是很好。如果真要另外搞一個發明,三國時代的發明,把高麗人作為一個跟滿洲特別有關系的民族單獨列出來,然後按照新羅和百濟分別發明,把嶺南地方發明成為一個民族,把湖南地方發明成為另外一個民族,從單純的技術上來講,沒有什麼不可以,也並不比目前的發明更加不合理。之所以這樣的事情沒有出現,是因為朝鮮戰爭以來的列強博弈造成的結果。但是列強博弈造成現在的結果,在未來的東北亞格局改變以後並不是沒有機會改變。例如,假定韓國的精英階級感到要把朝鮮的盤子接下來極其困難、得不償失,他們完全可以把高麗人和韓國人發明成為不同的民族。如果他們想要給韓國的政治混亂另外找一條出路,也可以重新把韓國發明成兩個民族。

如果他們一定要按照一種盡可能發明大民族主義的方式,把韓國人發明成為一個地跨滿洲的、非常偉大的歷史民族 — — 因為現在有些韓國的歷史發明家是走的這條道路,那就很可能會把間島的韓裔居民也一起發明進來。但是按照我剛才對漢族發明的定義,這是一種拙劣的發明,因為它造成的政治後果會對發明家不利。凱末爾在做小土耳其民族發明的時候曾經對奧斯曼主義的發明和泛突厥主義的發明做過一系列重點批駁,他批駁的要點就是,如果按照你們的發明下去的話,會把我們拖進沒完沒了的政治糾紛當中,對我們小土耳其人民的福利是不利的,民族發明的用意是為了改善我們的福利,並不是為了破壞我們的福利,所以無論你們在理論上正確不正確,你們的發明都很糟糕。他的話大致上就是這個意思。這一點也適合於你所說的那種假定的大韓國民族的發明。泰國人之所以在今天還能有好日子過,就是因為他們放棄了大泰語民族的發明。如果按照這種發明的話,老撾當然是泰語民族的一部分,越南的很大一部分屬於泰語民族,泰語民族在緬甸聯邦的很大一部分佔據優勢,在雲南、廣西也有很大一部分移民。如果要實現解放各泰語民族的偉大計畫的話,那麼泰國必然會陷入蔣介石式的連綿不絕的戰爭,多半也會落入共產黨統治之下。他們放棄了這種誇大的發明,是泰國今天還能夠多多少少算得上是小康的重要原因。韓國上述的民族發明家假如有朝一日能夠掌權,那就只能說是,韓國精英階級的政治德性不算太好,跟支持蔣介石的那個集團差不了多少,他們也會因為一個糟糕的民族發明而坑害自身。

:第一,中國現在佔據地方上這個生態位的是共產黨權貴,您覺得他們有沒有可能接受諸夏理論、搞出自己的獨立?第二,香港很多獨立運動的領袖表現出了很明顯的白手套傾向,您對共產黨在這方面進行的滲透怎麼看?

劉仲敬:這個當然是可能的,因為他們是一批機會主義者,如果事態發展到需要他們出來接盤、而他們處在地方軍閥那種位置上的話,照他們那種最荒謬的政治理論都可以拿來當廣告的性格來說,接受諸夏的理論來維護自身利益,本身是沒有什麼不可以的。雖然我對他們懷有一種近乎階級仇恨的感情,很希望他們落到張獻忠的手裏面,但是如果這樣的事情真的出現的話,我也肯定會支持他們至少先搞一個諸夏出來,以免發生更糟糕的事情。第二個問題,首先香港一直是地下黨的根據地。港英當局即使是在冷戰的最高潮期,對這一點也不是完全不知道,是在知道的情況下實行既限制又默許的政策。所以他們根深蒂固,難以迅速清除。同時,他們在香港的存在和他們斷斷續續的干涉只要不發展到極端的地步,形成一種長期抗戰、不斷施加刺激的狀態,對香港的民族發明本身是極有利的。

:實現諸夏是不是你的目的?這是不是現代民主轉型的一個路徑?

劉仲敬:諸夏是一個廣告,民族神話是必然要有廣告的。例如,締造法蘭西的四十位君王就是法蘭西民族的廣告。每一個民族在發明的過程中間都會給自己列出國父和民族英雄,或者是假定的輝煌時代和遠古起源之類的。諸夏是有一個現成的起源,就是春秋時代、孔子時代產生的諸子百家的列國,那麼這個起源是很現成的歷史資源,所以就不用白不用了。正如中華民族會用成吉思汗和秦始皇做自己的歷史資源,我當然也可以用孔子和他的同時代的人做自己的歷史資源,現在的希臘人也是用伯利克裏和蘇格拉底做自己的歷史資源的。但是我們都要很清楚,這些東西是神話,神話是派來用的。你作為發明家,你的目的是什麼,你心裏應該清楚。你扔石頭打狗,目的是要打到狗,而不是很在乎這塊石頭。如果換了塊磚頭也能打狗的話,那你就眼睛也不要眨一下地換成磚頭就行了。諸夏是民族發明的一個適當的廣告,但是如果你願意用別的廣告,例如滿洲民族發明用滿洲國的廣告而不用諸夏,或者其他人發明出他認為更適合的廣告、而且在實際上行得通的話,那麼這些廣告就必然會比我現在提出的廣告更好。民族發明包括民族神話,民族神話必須有廣告,因為團結人和動員人是要通過講故事的方式,其中就必須包括若干的神話成分。這個神話成分跟其他的神話成分相比,並不更糟。

至於說諸夏是不是我的目的,坦白地說,不是。我對此沒有任何特定的目的,包括對所謂的中國轉型,沒有任何目的。我只是在做馬基雅維利式的技術推演,推演最有可能出現的情況。我斷定,無論你選擇怎樣的路徑,各方共同作用的結果,最容易發生的情況就是,經過若干回合的博弈以後,導致支離破碎的局面。這種支離破碎的局面有可能因為共產黨挑戰西方導致自身毀滅、勝利者又不願意收拾殘局而造成,也可能因為共產黨雖然不挑戰西方,但是為了以它自己現有的方式維持統治,導致基層社會繼續黑社會化,逐步瓦解,導致大片的政治生態區落入類似黑社會的組織手裏面,從而間接地通向敘利亞化而引起,也可能通過黨內的派系鬥爭、日益增加的門生與派系,逐步形成類似東南互保的局面而引起。但是無論怎樣博弈,維持這個橫跨東亞和內亞的巨大區域的技術性困難都會使它殊途同歸,造成事實上的各種分裂。而這些各種分裂狀態需要有一個政治上的名分,於是給它設計一個諸夏的名分是一個合理的解決方法。

所謂合理的解決方法就是,你要認清楚,形勢不是你能左右的,只是你能夠觀察和利用的。如果你認為你設立了一個目標就能達到什麼目的,那很容易使你自己的判斷力受到損害。最能清醒判斷局勢的人往往不是懷有特定目的的人,而恰好是那種沒有什麼目的的人,沒有什麼目的的人對懷有各種目的的各種人的動機和效果之間的背離是處在最有利的旁觀者清的立場上。如果我認為你們主張的民主轉型有成功的希望的話,我自然會製造相應的理論;我之所以沒這麼做的話,是因為我對這事抱悲觀希望。我對共產黨的星辰大海或者長治久安兩個一百年的看法也是這樣的。如果我認為他們有成功的希望的話,我現在就不會在這兒;我之所以在這兒就是因為,我反復分析以後認為它沒什麼成功的希望。總的來說,我認為所有各方都達不到自己的目的,而合力的結果則會出現他們都不怎麼希望卻不得不接受的情況。

:要追求民主制度,大民族的構建也有相當的歷史優勢。你覺得是利用這些歷史優勢來實現民主好,還是放棄它、經過百年動亂來實現民主好?

劉仲敬:好不好,這是看你站的立場。你要建立民主,就必須要有一個主體,就是“誰的民主”的問題,必然有被排斥在外的部分。波蘭民主的前提就是,大批猶太人、烏克蘭人、立陶宛人遭到了屠殺和驅逐。目前波蘭人的民主,沒有以上的犧牲做前提是做不到。其他所有的民主都要涉及共同體的問題,伯利克裏的民主也有被排除在外的人。所以,民主不是一個有好處還是有壞處的問題,而是一個對誰有好處和對誰有壞處的問題。你沒有搞清楚你想要讓誰得到好處、想要讓誰得到壞處以前,這個問題是沒有答案的。而且我並不特別支持民主,民主可能是好的,但是假如在未來的三十年它並不是可能性最大的路徑的話,那麼我確實不願意浪費太多時間去探討它。它也可能是壞的,但是假如它在未來三十年內是極其可能出現的情況的話,那麼我也會去仔細探討它。這是實然和應然的區別。“百年動亂”這件事情是帝國這個系統的附帶產物,而且是人類歷史上的常規,至於它本身是好是壞,那是另外一個問題,它是最有可能出現的,這才是要害問題。如果一定要抽象討論是好是壞的話,那麼最有利於我所在乎的價值觀 — — 就是一個有利於產生自由秩序的多元環境的情況,並不是民主國家建立起來的長期和平,而是包含部分民主國家和部分非民主國家,但是是多國體系,既不是完全和絕對的和平,也沒有兩次世界大戰和冷戰那種總體性的戰爭,而是春秋式的或者十九世紀以前歐洲那種有限的、週期性的小規模衝突,這樣一個系統比完全和平的系統和總體戰的系統都更有利於自由和文明。

:你怎麼看普世主義?

劉仲敬:我可以很有把握地說,從路徑積分的演算法來看,普世主義實現的可能性很小。普世主義產生的時間異常的早,至少在古希臘時期就已經產生了。它曾經多次接近於成功,但是每一次都重新由成功轉為失敗。基督教曾經以為,如果消除了異教城邦,在基督教的兄弟友愛之下,天下將會大同,但是實際上,馬上基督教內部的教派糾紛就取代了原來的糾紛。你以為你能消滅原有的糾紛,但實際上你只是用新的糾紛取代了過去的糾紛。從實然這個角度來講,普世主義取得勝利的可能性非常之小。從應然的角度來講,我對它也抱有極大的懷疑,因為普世主義所帶來的和平幸福隱含著消滅各種差異性、使文明變得單調貧乏的巨大危險。文明的生動和發展並不是沒有代價的,其中有一部分代價,從局部來看,似乎是跟痛苦有不解之緣的。一個完全幸福和平的系統,本身不是一個能夠自我持續的系統,也不是能夠不斷產生新秩序、有利於自由文明的系統。

(完)


node-in-debugging

$
0
0

node-in-debugging

《Node.js 调试指南》是本人整理的从事 Node.js 开发这几年的一些调试经验和思路,希望授人以鱼也能授人以渔。

开发环境

  • MacOS|Linux(Ubuntu@16.04 64位)
  • Node.js@8.9.4

目录

由全面接触转向全面围堵 中美关系将何去何从

$
0
0

由全面接触转向全面围堵 中美关系将何去何从

(2018-03-06 11:44:43)

文/感悟生活

  本号主按:前天写了一篇分析中美关系走向的长文章,从晚上6点一口气写到第二天凌晨2点。昨天早上请了三位朋友帮忙校对,然后上传到微信公众号“shsp_888”上,但改了多次无论如何无法通过审核,只好拆分成几篇文章分别发表,能发出来多少是多少。昨天成功发出来的第一篇(微信公众号每天只能发一篇文章)。文章发出来后,得到了许多朋友的热情鼓励和赞赏(二维码打赏金额超过6800元,另获得同等金额的广告收入),在此表示由衷的感谢。现在这个是分拆出来的第二篇。

由全面接触转向全面围堵 中美关系将何去何从

我在上篇文章中,分析了中美关系发生困难的主要原因,以及中美对抗中双方各自的底牌与底线,这篇分析何以判断中美关系发生了重大转折,美国敢不敢跟中国全面对抗,以及未来中美关系将如何演变,对普通人的生活会产生怎样的影响。

 (一)美对华政策由全面接触转为全面围堵

由于美国对中国全面接触并诱导中国和平演变的图谋彻底破产,中国强势崛起不但吓尿了美帝,而且吓尿了日本、印度、澳大利亚、东南亚和欧洲各国,台湾民进党当局则每年吓昏过好几回;在成人纸尿片全球脱销之后,为确保婴儿纸尿片有充足供应,以美国为首的西方敌对势力,现在转而公开推行对中国全面围堵的战略。

从奥巴马第二个任期希拉里提出亚太再平衡战略,到特朗普联大演讲不指明批评中国,再到《美国国家安全战略报告》和《美国国防战略报告》明确把中国列为超越恐怖主义的对美最大威胁,并清晰地规划出对中国从政治、军事、经济各方面进行全面围堵的战略,以及美国国会最近两年连续推出一系列突破“一中”底线的法律、法案,标志着美国朝野在对华政策由全面接触转向全面围堵上达成了高度一致。任何人若对此心存幻想,必是自欺欺人。惟有未雨绸缪,沉着应对,方为上策。

显然,高层意识到了中美关系发生了重大问题,因此在不到一个月时间内,中国两位中央政治局委员应邀访美,特别是作为中国高层核心决策层的刘鹤同志,在全国“两会”前应美国政府邀请访美5天,正如我在新华社发布此消息后第一时间分析的那样,传达出的信息确实非同小可——在我发出这篇文章几个小时后,人民日报的一篇文章做了同样判断。可惜,也正如我事先预料的那样,中美双方终于还是未能就巨大分歧达成共识,特朗普非但没有会见刘鹤同志,而且还发出了清晰的极不友好声音,扬言要跟中国打贸易战。

新华社前天发布的新闻稿说双方确定尽快在北京开始下一轮会谈,但今天美国总统府公开表示,双方没有达成这样的共识,美方也拒绝启动去年4月两国领导人高峰会确定的四个战略对话。据接近特朗普的人士透露,特朗普认为去年进行的这些对话双方全是各说各话,根本不能达成实质成果,纯粹就是浪费时间。

山雨欲来风满楼。随着美国对华政策的重大转变,中美两国由过去双方刻意忽略价值观的差异追求商业上的合作,必然转向政治上的公开对立和经济上的互不相让,或者说中美关系结束过去四十年政治上的求同存异、经济上的友好合作,转向全面的冷对抗,甚至不排除在台湾问题上,中美两国进行直接的军事对抗。

 (二)美国敢不敢跟中国全面对抗

这个问题非常重要,因此我必须重复前天在《中美贸易战一触即发 看吓尿的特朗普如何疯言疯语》一文中提到的一些基本观点和基本事实。

我们的贸易官员、主流媒体和专家们一直告诉我们,中美关系互为依重,你中有我,我中有你,谁也离开不了谁,甚至说中美关系事关世界稳定,事关全世界人民的幸福,当然首先是美国人民的温饱与幸福。

一些爱国者甚至认为,没有中国购买美国国债,美国早已破产;没有中国购买美国飞机,波音公司立马就得关门;没有中国为美国提供便宜商品,美国人民全都饥寒交迫。中国一生气,美国总统就吓尿。

中国著名学者、清华大学国情研究院院长胡鞍钢教授声称,通过他的团队科学严谨的研究,中国几年前就在综合国力、经济、科技、军事等各方面全面超越了美国,而且最近几年这个差距还在迅速扩大。也就是说,一旦发生中美对抗,无论是贸易战还是军事对抗,美国注定将一败涂地。

军事上的事,我不敢胡言乱语,绝对相信中国战无不胜。单纯就经济而言,中国主流媒体和专家们从来不说,如果中美彻底翻脸,没有美国每年提供的3500亿美元贸易顺差,人民币立马跌成卢布;如果停止每年出口美国4500多亿美元商品,有几千万人要失业;如果美国人关掉互联网根服务器,中国互联网大部分用户将立马崩溃;如果手机的安卓系统、IOS停止对中国手机授权使用,中国智能手机全得换成20年前的老式按键电话;如果小日本跟着美国与中国叫板,美日停止对中国出口高科技产品和元器件,中国银行、高铁、飞机的控制系统全得死机,大部分先进的医疗电气设备都将成为废铁……

中国主流媒体和专家们也从来不告诉国人:中国之所以大量购买美国国债,是因为美债是全球流动性最好、收益最稳定的投资标的,没有之一,且中国购买的国债总量不到美债发行总量的10%,中国可以随时抛光所持的全部美债,美国政府不会因此损失一分钱;即使中国不购买一架波音飞机,该公司的订单也排到5年之后;中国断绝对美出口全部商品,理论上最多给每个美国家庭增加200多美元的负担,而美国家庭平均年收入约6万美元,如何让所有美国人陷入生活困境……实际上,美国没有跟中国建交之前,早就成了世界上最强大、最富裕的国家;而中国只是在改革开放之后,才让绝大多数国人吃饱了饭,也正是美国把中国带入WTO之后,中国才成为世界工厂,才成了世界上最大的暴发户。

此外,中国主流媒体和专家们常常会说,中国是安理会常任理事国,美国不敢跟中国翻脸,否则中国在联合国安理会上处处跟美国唱反调,美国将在许多重大国际问题上一筹莫展。这个或许能吓着奥巴马这样的书呆子,但真吓不着特朗普这样的强人。实际上,特朗普一上台,就纷纷退出好多个国际多边合作组织,如退出TPP、退出巴黎气候协定、退出全球移民公约、退出联合国科教文组织,不顾国际社会强烈反对承认耶路撒冷为以色列首都……特朗普这些所作所为,哪一样不是惊世骇俗?何况,特朗普就曾猛烈批评联合国成了一个夸夸其谈的俱乐部,甚至扬言要退出联合国。再说,当年古巴导弹危机,美国准备与苏联大打出手,又何曾顾虑苏联拥有安理会常任理事国的地位?

因此,在我看来,美国不怕跟中国打贸易战,也不怕跟中国军事对抗。特朗普最近推文中所威胁的贸易战绝非虚言恫吓,而是很快面临的威胁。

 (三)中美对抗的三种可能或三个阶段

按照中美两国的对抗程度,又分为三种可能或三个阶段:

第一个可能或第一个阶段,中国在经贸问题上对美国做出实质性的重大让步,中美避免了即将发生的贸易战;同时中国主动在其他非经贸问题上降低与美国的对抗,从而避免中美关系急剧恶化对中国社会、经济造成巨大冲击。但即使中国做出巨大让步,美国仍将利用301条款、201条款、232条款一系列组合拳,来不断敲打中国;同时中国也会像前些年那样,做出一些不痛不痒的回击,来体现主权对等与国家尊严。

第二个可能或第二个阶段,中国在减少贸易不平衡问题上对美做出的重大让步最终没有完全兑现,或者没有达到特朗普政府认为的满意效果,同时中美在非经贸问题上的对抗有增无减,导致特朗普宣布对中国实行严厉的报复措施,中美爆发贸易战,最终造成两国贸易额急剧萎缩。这将对中国经济带来严重的负面影响。但即使如此,中美贸易关系也不会完全断绝,除了失业人数会显著增加,其他人生活不会受到太大影响。

第三个可能或第三个阶段,由于中美关系恶化,失去美国每年3500亿美元贸易顺差导致中国外汇急剧减少引发金融体系不稳定,同时对美国、日本等西方发达国家的出口大幅萎缩导致中国失业率急剧上升,为凝集国内民心,促进社会稳定,中国发起武力统一台湾的军事行动,导致中美直接发生军事对抗,因此中国遭受全世界封锁。不过,以中国的强大实力,我们有信心、有能力打败一切敌对势力——到时一定不是全世界孤立中国,而是中国孤立全世界一切敌对势力。

就目前看来,第一个可能性最大,最三种可能性最少,第二种可能性介于两者之间;但鉴于一方面美国主流民意和两大政党的对华政策都发生了根本性改变,另一方面任何敌对势力都无法阻挡中国的强势崛起,中国也绝不可能在损害国家重大利益的问题上做出任何实质性的重大让步,因此,随着时间的推移,第三种可能性将变得越来越大。

中国现在能做的最佳选择,就是在坚持原则的前提下,改变策略,放低姿态,争取更多的时间,累积更强的实力,以便在将来中美对抗中,永远立于不败之地。当然,按照国内主流媒体和专家们的满满自信,美国压根就不敢跟中国叫板,即使美帝发出挑衅,也是兵来将挡,水来土掩,打得它屁滚尿流,服服帖帖,永远不得翻身。

 

Start with Solidity

$
0
0

Start with Solidity

Ethereum and Solidity环境配置

作者:孔令坤,转载请注明出处

由于Remix版本的更新,Metamask的更新已经Ethereum rinkeby network对Github账号申请eth的限制,我发现原来的配置教程其实并不太适用于当前的版本了,所以在这里我简单的介绍一下开发的一些基本配置。在接下来的配置内容中,我借鉴了许多来自IC3 Ethereum/Cornell Bootcamp的内容,主要对其中Github部分的内容做了更新。

Requirements:

Introduction of Things:

Ethereum

Ethereum is an open-source, public, blockchain-based distributed computing platform featuring smart contract (scripting) functionality.

Metamask

MetaMask is a bridge between Google Chrome and the Ethereum blockchain. It allows you to run Ethereum Dapps in your browser without running a full Ethereum node. MetaMask includes a secure identity vault, providing a user interface to manage your identities on different sites and sign blockchain transactions.

Solidity

Solidity is a programming language used to code smart contracts that are compatible with Ethereum. The documentation for Solidity is located here. We will be using Remix when developing our smart contracts. Remix is an online development environment that allows you to code, deploy, and test smart contracts on the public Ethereum networks and test Ethereum networks.

Rinkeby

Rinkeby is a public Ethereum test network that is used to deploy and test smart contracts for free. In order to receive Rinkeby ether coins, you will need to visit https://www.rinkeby.io/ once you have your Metamask client installed.

Start with Ethereum and Solidity:

a. Setting up Metamask

  1. Install the Metamask Chrome plugin.
  2. Open Metamask (there should be an orange fox icon in your browser toolbar).
  3. Click through the license agreements.
  4. Create a new “den” which will house your Ethereum account.
  5. COPY THE 12 WORDS SOMEWHERE SAFE.
  6. Click the network selection button on the top left part of the Metmask app. It should say “Ethereum Mainnet” or “Ropsten”. Change that to Rinkeby.
  7. Copy your Ethereum account address by clicking the “Copy” icon above the “Buy” and “Send” buttons. Mouse over the icons to reveal their label.

b. Get Rinkeby Testnet Ether

  1. Login into your Twitter account.
  2. Paste your Ethereum address you copied in step a.7 into the “What’s happening?” content boxs to make a new tweet. The Ethereum address should be a jumble of letters and numbers like this: 0x9bcd107A7De7C3cee1be15dFa06B5586672912e9
  3. Click “Tweet” to gennerate a new Tweet.
  4. Copy the URL of the Tweet. Click the button in the upper right of your tweet and select the option of “Copy link to Tweet”. The link should be similar to this:https://twitter.com/316980786Kong/status/946989538890588161
  5. Visit the Rinkeby website and click “Crypto Faucet”.
  6. Paste your Tweet URL in the box provided and click “Give me Ether – 3 ethers/8 hours”.
  7. A box should pop up with with your Twitter icon indicating that your request for testnet ether is being processed.
  8. Wait 10 seconds.
  9. Look at your Metamask client and verify that you received 3 Rinkeby testnet ether.

c. Writing your first smart contract.

  1. Go to the Learning Solidity Part 2: Commit-Reveal Voting.
  2. Walk through the blog and write your first smart contract.

非名校出身的我,是如何拿到Facebook、谷歌、微软、亚马逊和Twitter的Offer的?

$
0
0

非名校出身的我,是如何拿到Facebook、谷歌、微软、亚马逊和Twitter的Offer的?

达达 • 刚刚 • 职场漫谈
非名校出身,也没有知名科技公司的工作经验,他竟同时拿到了美国5家顶尖科技公司的Offer。他究竟是如何做到的?
非名校出身的我,是如何拿到Facebook、谷歌、微软、亚马逊和Twitter的Offer的?

这篇文章是专门为那些即将开始找工作的人写的。很多正在找工作的人可能会担心因为自己不是毕业于常青藤名校而无法在顶尖科技公司找到一份理想的工作。还有可能其他人会告诉你说因为你不够优秀而无法在微软或Facebook找到一份工作。但是我想告诉你的是,即使你不是出身名校,你依然可以在全球顶尖的科技公司找到一份你理想中的工作。下面我分享一下我是如何找到我梦寐以求的工作的。

这篇文章将主要包含以下几部分内容:

(1)我的个人背景。

(2)我是如何获得众多全球顶尖科技公司的面试机会的,这些公司包括Facebook、Amazon、LinkedIn、微软、Twitter、Pinterest、Snapchat和其他公司。

(3)我是如何拿到几家顶尖科技公司的软件工程师职位的Offer的。

(4)我从面试经历中学到的经验。

我的个人背景

我并非毕业于常青藤名校(常青藤联盟成员包括哈佛大学、耶鲁大学、宾夕法尼亚大学、普林斯顿大学、哥伦比亚大学、布朗大学、达特茅斯学院、康奈尔大学)。我在爱达荷州的一所社区大学读了两年书,然后在一所小型天主教大学拿到了计算机科学学位。

我是在大三的时候就开始学习计算机科学的,因为当时我觉得这门学科听起来非常有趣。在我成长的过程中,我拥有的的唯一一件类似电脑的产品就是超级任天堂的中国山寨版。甚至在当时,每次我放一盘磁带进去的时候,它都会崩溃。

为了在大学期间能够自力更生养活自己,我做了很多份的兼职。当我毕业的时候,我并没能很快就找到一份工作。我申请了尽可能多的大型科技公司的职位,并有幸获得了几次电话面试的机会。

当时我对technical screen电话面试没有任何概念,所以也就不知道该如何为这种面试做准备。我参加这些面试之前想当然地认为面试官可能会问我链表或者二叉树是什么这类面试问题。

在参加的所有几个电话面试中,我都没有通过。

勇往直前

我没有过多地探究自己是否优秀。我知道我的学习能力非常强。我需要的只是一个机会。正如大家所说的那样,要广撒网。而这正是我做的。

我接下来做了一件让我特别引以为傲的事情。我写了一个简单的Python脚本,它在Craigslist上抓取了一些含有一些关键字的职位列表,并在电子表格中收集这些职位的电子邮件联系方式。这并不是最聪明的解决办法,但在Craigslist上发帖的人对他们所要招聘职位的描述出奇地准确。然而,Craigslist并不喜欢人们抓取他们网站上的内容。为了解决这个问题,我通过一个VPN运行我的脚本,并有一个计时器,每隔几分钟就会暂停脚本。虽然它兵不完美,但却运行得很好。最后,我搜集了来自旧金山、波特兰、斯波坎和西雅图的公司的大约500封招聘电子邮件。我根据这些职位的具体发布时间和其它信息对结果进行了过滤,并通过添加越来越多的特性来改进它。后来我发现已经有一些机器人在爬Craigslist上的信息并发送自动电子邮件。这些公司大多是海外公司,它们希望将自己的公司推销给美国市场。

我采用的一个变通方法是,我精心制作了电子邮件,我在邮件标题里使用了那些公司发布的招聘信息里的一些关键词。然后,我在邮件正文部分添加了更多的细节信息,让邮件内容看起来更个性化。我做了一个快速的A/B测试,就这样,我收到的应聘公司的回复率从2-3%增加到了10%。

在发送的大约500封应聘电子邮件中,我收到了大约50份回复,其中一小部分给了我电话面试的机会。我之所以只发500封电子邮件,这是因为我时间不够,需要尽快找到一份工作。我会尽可能提高面试通过率,而不是获得尽可能多的面试机会。

幸运的是,我最终在西雅图的一家创业公司找到了一份初级软件工程师的工作。这家创业公司当时位于Kirkland,所以我必须坐45分钟的巴士才能赶上面试的时间。

在接下来的3年半的时间里,我一直在这家公司工作。我在那里学到了很多东西,比如亚马逊AWS、EC2、DynamoDB、SQS和Docker。我在这段时间里成长了很多。我学习了如何编写模块化的、可维护的代码,我学会了如何对软件设计进行推理,我也学会了如何处理人事方面的问题。

我周围全是一群聪明的人,他们有的在微软工作,有的在Amazon工作,有的在LinkedIn工作,我努力成为这群人中的一块“海绵”,我尽可能多地从他们身上进行学习,这对我的职业生涯产生了非常巨大的影响。

在创业公司工作的日子

我在加入的第一家创业公司工作期间,我做的几乎全部都是后台开发方面的工作,中间会涉及一些开发运维。我开始编写一些函数来添加或修改一个影响范围很小的特性,不过这是一个了解代码库并进行一些代码审查的好机会。一年之后,我开始负责代码库的一部分,然后我的任务是将一组特性转换为服务。这是这家创业公司SOA阶段的开始。我们开始将站点的各种组件转换为服务,我就是在这个过程中学习更多有关RESTful服务、身份验证、AWS服务、发布-订阅、分布式系统等方面的知识的。

有趣的是,我并不是通过书本或正规的教育来学习这些知识的。相反,是因为我在实际工作中需要开发完成一系列功能部件,但我在这方面存在知识瓶颈。所以我想,那就边学边做吧。很多时候,我都陷入了分析瘫痪状态,在这种状态下,我过度分析了各种情形场景,最终无法取得进展。

那些艰难的时刻其实是最好的学习机会。我开始学习功能范围、监视、警报和文档方面的知识。这个过程的每一步都揭示出我需要学习更多的东西。在过去的2-3年时间里,我成长地最快,无论是作为一个个人还是作为软件工程师都是如此。

我是如何准备面试的?

在经历了第一次求职面试中的各种艰难曲折后,我告诉自己,在未来的求职面试中我必须做好充足地准备。

我开始通过对我擅长的、不擅长的以及我可以改进的地方进行概述,从而为未来的面试做好充分准备。我将它分为三个类别:数据结构、算法和系统设计

我在自己的正式职业生涯中基本都是在PHP领域工作,在大学里也学过C++,所以我想尝试一些更简单、更不繁琐的面试。因为这个原因,我选择了Python。这是一门用来学习的非常好的语言,它很容易学习,支持许多开箱即用的数据结构,并且可以在白板上快速书写。我是通过Youtube上的一些视频教程学习Python的,并阅读了教学文档。另外,我选择学习Python的另一个原因是,它具有很高的可读性,而且在白板上书写很容易。这是C++和Python之间的一个简单的比较:

下面是用C++语言写的降序排序:

非名校出身的我,是如何拿到Facebook、谷歌、微软、亚马逊和Twitter的Offer的?

下面是用Python写的版本:

非名校出身的我,是如何拿到Facebook、谷歌、微软、亚马逊和Twitter的Offer的?

我积累的经验的是,很多应聘者在面试过程中会在简洁方面犯错。在45分钟的面试中,你需要用大部分的时间来解决实际问题。

黄金小建议:选择一种不那么冗长的语言,这样你就可以在白板上更快地写代码了。

面试准备模式

我花了大约一个星期的时间在LeetCode、HackerRank和Project Euler中做了一些简单的测试挑战,以便熟悉它们的接口,并让自己开始习惯用Python编写代码。

第一周我了解了我在某些编程语言方面的能力水平。我又花了一周时间来进行一些设计上的挑战,并尽可能做到深入和广泛。

这对我来说是非常有趣的,因为我经常查看iOS应用,并试图弄清楚它们是如何做到的。例如,你如何从头开始重新开发Instagram?(我在Facebook面试时曾被问到这个问题)。我的专业背景是API设计和服务导向式架构。因此,我借此机会展示了我将如何设计我自己的Instagram版本。因为我在一些业余项目中积累了一点iOS应用编程经验,所以我在回答这个面试问题时可以稍微讲一下回调函数等方面的内容。我一开始讲的是我想在我自己的Instagram版本中加入的一些功能:赞、上传照片和简单的时间线。功能范围使我能够构建一个非常可靠的API,因为我非常了解这些场景。然后我画了一些概要设计图片,介绍了客户端机如何与后端交互,以及后端如何存储数据。

我从小处着手,然后在需要的地方添加更多的组件,并主动寻找瓶颈所在。我做了一些有根据的猜测(而非盲目的猜测),以及每一项技术是如何融入进去的的。同样重要的是,什么技术无法很好地融合进去。例如,为什么要使用Cassandra而非MySQL来存储某些信息,为什么要使用OAuth而不是通过简单的认证,是使用Cassandra还是Memcached来缓存数据,是使用流媒体还是批处理处理等等。

在这里,你需要探索的领域还有很多。因此仅仅通过一个小时的沟通是不够的。为了能够更好地回答这类面试问题,你必须阅读并学会权衡取舍。一个行业的技术优势和劣势是什么。为此,我推荐一个网站:HighScalability。

回答这类面试问题时,要做到就像和同事进行一次典型的头脑风暴一样,做尽可能广泛和深入地探索。你要知道,这些设计面试的目的是要了解你的知识面有多广,以及你了解的有多深入,这是一个让你脱颖而出的机会,这一点很重要。我在Youtube上看了一段关于如何解决设计问题的视频,它给了我深刻的洞察力,为我在回答设计类面试题中提供了巨大的帮助。我从中学到的两个主要经验是:推动设计对话、展示你所知道的。

我列出了自己在下面这些领域里的能力水平:数据结构(链表、散列映射、二进制树、二进制搜索树、堆、数组)、算法(二进制搜索、哈希、动态规划、排序)和特定语言的语法和库(例如,Python的lambda、附加和索引)

我选择了我最不擅长的领域,并开始研究它:算法。算法从来都不是我的强项。我大学毕业已经有一段时间了,在我的日常职业生涯中,我没有花太多时间在二进位搜索上。我对每个算法的运行原理在使用场景一个初步的了解,但我无法在10分钟内写出二分查找程序,不管是在白板上还是在面试官面前都是如此。

我买了一堆精美的细马克笔,效果非常好。但在面试室里的马克笔通常都不好用,我通常在面试室里会花2-3分钟找一支能用的笔,而这2-3分钟是你浪费不起的。另外,细马克笔允许你在一个典型的白板上写5-8行代码。

黄金小建议:自己准备一盒马克笔。

我从Costco花了50美元买了一块白板,从亚马逊买了一些相关书籍,然后开始了我的编程实践。我确保我在二分查找、递归、动态规划、BFS和DFS上做了专门的提升练习。很多的面试问题都是围绕递归和二分查找展开的。我所见过的最好的面试问题是那些有很多不同解决方案的面试问题。

在参加Google的面试中,我曾被问到一个与文件系统目录有关的问题,以及如何遍历这些目录(提示:递归)。我很快就解决了这个问题,然后面试官问了如何在那个目录中找出一个丢失的文件。这个问题相对更难一点,但是我还是解决了。然后我们讨论了如何重建目录,如何对它进行序列化和反序列化,我们花了大量的时间讨论文件目录在底层是如何运行的。对我来说,这是一次非常愉快的面试。

参加顶尖科技公司的面试

可以这么说,参加这类面试是一次令人神经崩溃的经历,给人的感觉如同做过山车。

我是根据下面这个方式来分配我的时间的:20%的时间用于简历制作,20%的时间用于调查研究,60%的时间用于面试准备。

我将自己20%的时间都用在整理自己的简历上了,而我的简历至少有三年时间都没有更新过了。我仔细研究了我过去做过的所有事情,并选择了一些我从头负责到底至的项目,不用考虑项目的复杂性如何。

我之所以会这么做,主要有两个方面的原因。从头到尾负责一个项目需要纪律和领导能力,这是我想向面试官重点突出的两个能力。其次,对于那些我从头至尾负责的项目,我可以向面试官深入且广泛地描述项目的各个方面。这一点在我参加Twitter的面试时回答有关设计的面试问题时发挥了重要作用,在Twitter的面试中,面试官不仅对我负责的项目的设计工作进行了严格的考察,而且还对背后的决策进行了考察。

我会将20%的时间用于调查研究。这里说的调查研究是指对我感兴趣的公司进行尽职调查,并寻求内部推荐的机会。通过内部推荐的方式能够大大提高求职信的回复率。根据我自己的实际经验,我向20多家创业公司和中等规模的公司发送了求职cold message,只有少数几家公司回复了。但是如果得到对方公司内部员工推荐的话,那么对方公司几乎都会在一周时间内内给我回复信息。

我并不善于交际,我认识的能将引荐给我感兴趣的公司的人其实并不多。为了解决这个问题,我会经常使用LinkedIn。LinkedIn里有一个搜索功能,我经常用它来搜索1 度联系人和2度联系人。所谓1度联系人,就是通过接受邀请直接建立联系的会员。你可以查看他们的个人档案和人脉信息,不受限制地向对方发送站内信,还可以在你的个人首页看到对方在领英的动态消息。所谓2度联系人,就是已经与你的1 度联系人建立联系的会员。通俗理解就是你好友的好友,一般是没有建立直接联系,但和你可能有交点的人群。免费账户可以看到2度人脉的个人档案,可以看到和对方的共同联系人,但不可以直接发站内信。

非名校出身的我,是如何拿到Facebook、谷歌、微软、亚马逊和Twitter的Offer的?

LinkedIn的搜索功能

这是非常重要的,因为给一个人你不认识的人直接打求职电话是非常困难的。当接到不请自来的陌生人打来的电话时,人们通常都非常谨慎,通过这种方式很难很快建立信任关系。LinkedIn在我调查研究阶段对我的帮助非常大。

回顾我面试过的所有公司,以下是我对每一家公司的看法:

  • Facebook/Google:很机械化。标准的面试流程,我和这些公司无法建立任何情感连接。
  • Pinterest:在这家公司的面试体验并不是最好的,但这家公司是一个很酷的公司,产品也是很酷的产品。
  • 微软:我非常喜欢我所面试的团队,尤其是团队经理。标准的面试问题,但是非常个性化。是我的第二选择,当然这个因人而异,微软每个团队的面试风格是各不相同的。
  • Amazon:标准的面试流程。大概有50%的人会喜欢这种面试风格,也有大概50%不喜欢这种面试风格。
  • Twitter:面试流程非常有趣和个性化。我个人非常喜欢它的面试流程,非常重视个人和我过去做过的事情。
  • Snapchat:在洛杉矶有非常酷的办公室,有很多人都决定在创业的大潮中加入其中。
  • Lyft:离我住的地方不远,办公室很不过,标准的面试流程,我对这家公司没有太强烈的感觉。

下面分享一下我最喜欢的一家公司及其面试流程

从很多方面来说,我认为要通过Twitter的面试都是非常困难的。但与此同时,Twitter的面试流程比我面试过的其他任何公司都更有趣、也更个性化。

Twitter的面试流程大概是这样的:与一个工程经理进行简单的介绍性电话面试。接下来是一到两轮的技术电话面试,这取决于你的表现。如果通过电话面试,他们会把安排你到应聘工作地点进行现场面试,我是在西雅图参加的现场面试。一共有3轮1小时15分钟的现场面试,每场面试都有两个面试官。

最开始的两轮电话技术面试都是标准化面试,你需要在一个共享的编码文档中通过编程来解决实际的问题。

现场面试更像是一种双方的互动交谈,也不会让人感到太害怕恐惧。面试官会问你一些关于你过去参与过的项目的深度问题,他们会询问你过去做过的事情。如果你过去曾负责过一个项目,那么面试官就会问一些有关这个项目的问题。面试官鼓励你用这些项目作为参考,并从中来试探你的想法。

其它公司的面试感受

相比之下,我觉得Facebook和Google的面试更加机械化。他们有1-2轮的技术电话面试,5到6轮的现场编码考核。每一轮面试都需要你在白板上进行编码,还要要求你在一个相对合理的时间内完成一个近乎完美的解决方案。

Facebook有两轮编码面试,一个设计面试,一轮行为面试。在一天面试快要结束的时候,我又参加了一轮shadow面试((即老员工面试,自己旁听),这部分面试并没有计入我的面试总分。

Google有5轮编码面试,没有一轮有关设计的面试,期间没有一位面试官问我之前做过的项目。虽然我并不认为这是一种糟糕的面试方法,但这种面试让我感觉太机械化了,并没有给工程师提供多少机会来展示他们的能力。有些人在这种面试中表现得非常好,就像有些学生在考试中表现优异一样。

我并不是喜欢在Pinterest的面试体验。我认为Pinterest这款产品本身非常有意思,他们的工程技术团队似乎也在解决一些非常酷的技术问题。但是我在Pinterest的面试体验却是非常糟糕的。

Pinterest有三轮编程面试、一轮设计面试。在这4轮面试中,设计面试是最让我失望的。为什么这么说呢?面试官迟到了,他花了几分钟时间在我浏览了一下我的简历,然后开始在白板上画一些API。他简短地描述了他期望API做什么,并问我该如何解决这个问题。我们阐明了API的特性,然后我开始使用白板描述我的解决方案,大概5分钟后,我转过头发现他竟然睡着了。这次面试体验太糟糕了。我在一项调研问卷中向招聘人员反馈了这个问题,但是没有收到任何回复。

我就不详细和大家分享我在面试中被问到的所有问题的细节了,不过我想和大家分享我在准备面试的过程中学到的一些经验和有用的技巧。

我学到的东西:

(1)简历内容一定要做到实事求是。大多数公司的面试官会问你一些关于你的简历上的内容的问题,面试官通常能够根据你的回答很容易判断你是否在简历内容上作假了。此外,对一个项目做到100%的了解要比对10个不同项目有10%的了解要好得多。

(2)简历最好只用一页。对于科技公司来说尤其如此,因为科技领域有一个普遍的共识,只有当你有博士后的研究经历或者亲自深度负责过很多项目,这时你的简历有2页或更多页才是合理的,否则最好用一页。

(3)多出去社交并建立一个自己的人脉网络。软件工程师职位的竞争非常激烈,这些顶尖的科技公司每天要筛选成千上万份简历。如果你应聘的公司内部有员工帮你引荐,那么你的简历被关注的可能性会更高。

(4)精心准备面试内容。每一个对你感兴趣的公司都想知道你为什么对他们感兴趣。一个糟糕的回答是:我现在急需找到一份工作帮赚钱支付账单。一个不那么糟糕的回答是:我在网上浏览,发现了你们公司,好像你们在做一款非常有趣的产品。一个很好的回答是:我知道你们公司在X领域做了一些有趣的工作来实现Y。我在过去做过一些工作,这是我学过的关于A、B、C的知识,这些知识可能与X领域有关。我对Y非常感兴趣,因为……(不要将这当作一个固定的模板。相反,你应该从中找到模式,——做充分的调查研究,向你应聘的公司展示为什么你和这家公司是非常匹配的。)

其它一些建议

技术面试是非常困难的。然而,最好的机会是留给那些准备好的人。

(1)早做准备,而且要做充分地准备。每个人都知道他们应该为面试做准备,但大多数人都不知道如何才能真正做好准备。就像任何值得做的事情一样,需要刻意练习才能在某件事上有出色得表现。而刻意练习意味着你需要有一套系统。

(2)建立一套用来练习技术技能的系统。我会根据1-10分的评分方式对自己的表现进行评分,并努力提升我自己最不擅长的领域。我花了好几天时间研究不同类型的面试问题,直到我完全掌握了每个概念。我每天都在Evernote上做笔记,笔记内容包括编程技巧、常见错误和误解、用于解决特定问题的框架等等。

非名校出身的我,是如何拿到Facebook、谷歌、微软、亚马逊和Twitter的Offer的?

我的Notebook

(3)将你掌握和学会的知识记在本子上。我同时使用Evernote和OneNote来记录和追踪事情。我用OneNote来记录技术方面的内容或代码,因为我可以按照我喜欢的方式来对这些笔记进行格式化。我用Evernote主要写一些文章或感想。上面的图片显示的是我在架构和系统设计上的一些想法。

非名校出身的我,是如何拿到Facebook、谷歌、微软、亚马逊和Twitter的Offer的?

Evernote主要用于记录想法/技巧

(4)把所有的事情都记录下来,即使你认为你不会用到它也要记录下来。我非常健忘,所以我会将我学会的任何东西都记录下来,包括shell命令。我会时不时地阅读技术博客,如果我发现任何有趣的东西,我都会立刻在Evernote上将其记录下来。我会每星期或每月对记录过的内容做一次整理优化。这个习惯在我的职业生涯中对我的帮助很大。

(5)模拟面试。这绝对是非常有价值的,我极力推荐大家这样做。我会和朋友一起进行模拟面试,并尽可能多地练习。如果你找不到朋友一起练习模拟面试,那么我推荐你使用Refdash,这是一款“面试即服务”的产品。这个平台上有一群在Google、Facebook和微软等大型科技公司工作的面试官。这些面试官会评估你的编码和设计技能。最重要的是,在每次模拟面试后它都会给你打出一个分数,并给出一些具体可行的改进方法。

(6)允许自己失败。在我整个应聘过程中,我经历过很多次的失败。有时失败只是因为你运气不好。即使你面试失败了,这对你来说也不是世界末日。公司在招聘的过程中倾向于说“不”,因为这对他们来说风险更低。从长远来看,犯假阳性的错误比假阴性的错误的成本更高。最初的几次拒绝给人造成的打击最大。当我刚开始面试的时候,我几次电话面试都没有通过,我的自信心也受到了严重打击。我对自己的能力也开始心存怀疑,并开始担心自己的技能在当今的就业市场中已经不受待见了。然而,我给自己支了一招:如果你失败了10次,那么再多尝试10次。你所需要的只是一次成功,这种安慰给了我很大的信心,让我能够不断尝试,当我拿到第一个Offer之后,后来的其它Offer来得就会容易很多。

我花了大约两个月的时间来为我的面试做准备和并做各种模拟练习。我每周大概会在这方面花20个小时,或者每个月花80小时,在全职工作之余进行学习和记笔记。

为了充实我的简历,我花了3年半的时间去专心刻意地工作。在日常工作中,我会有意识地选择那些困难棘手的工作,这样我就能比其他人学到更多东西。尽管我并非毕业于常青藤名校,之前也没有在顶尖科技公司工作的经验,但我对我所负责过的项目有一个清晰透彻的理解,并在简历中体现出这一点,从而让自己在面试中能脱颖而出。这是有可能做到的,因为我做了很多研究,并将我学到的所有东西都记录了下来,并建立一个用来练习技术技能的系统。

要记住:坚强的人能够生存,坚韧的人能够茁壮成长。

小结:不要放弃,为机会而时刻准备着,多练习,并始终怀有希望。专注于过程,并在整个过程中采用严格、专门的方法。

我推荐的书籍和工具:

  • 书籍《Elements of Programming Interviews: The Insiders’ Guide》 :对解决那些非常难的编程问题非常有帮助。
  • 书籍《Cracking the Coding Interview: 189 Programming Questions and Solutions》:很好地覆盖了基本的CS知识。
  • OneNote:我使用这款工具来存储所有的代码片段。
  • Evernote:我使用这款工具来记录存储其它所有东西。
  • CodeRunner:我非常喜欢这款Mac应用,我曾多次使用它来运行特定的Python脚本和函数,而且效果非常好。
  • Jobscan:我听说过很多关于它的很酷的事情,建议你试试它的简历筛选工具。
  • Refdash:由一群前Google员工运营的产品。用这款产品来模拟面试的效果非常赞。我在Refdash上碰到的面试官曾在Google工作过,他为我指出了很多我应该关注的地方,以及Google面试的主要评分依据。我强烈建议你尝试一下。
  • CodePath:一个帮助人们进入科技行业工作做准备的非盈利组织。公司的两位负责人Tim和Nathan都是很棒的人,我从他们那里学到了很多。这个社区非常有帮助,每个人都愿意伸出援手。

编译组出品。编辑:郝鹏程。

原文链接:https://medium.freecodecamp.org/how-i-landed-offers-from-microsoft-amazon-and-twitter-without-an-ivy-league-degree-d62cfe286eb8

EthOS

$
0
0

EthOS/eth.txt

#echo -n “http://vi.zenithnet.org/ETH.txt&#8221; > /home/ethos/remote.conf && putconf && r

#disallow && minestop && sleep 1 && ethos-update && sleep 5 && allow && r
#echo ‘-allpools 1’ >> /home/ethos/claymore.stub.conf
#echo ‘-esm 3’ >> /home/ethos/claymore.stub.conf

custompanel virosa420137

#autoreboot false

#globalbranch development
#branch eb19aa development

## Claymore ETH NH
#claymore=proxypool1 daggerhashimoto.usa.nicehash.com:3353
#claymore=proxypool2 daggerhashimoto.eu.nicehash.com:3353
#claymore=proxywallet 15qpQXHz9mVcJmnzd5YEsxKz9JkdNQSLJQ
#claymore=poolpass1 x
#claymore=poolpass2 x
#stratumproxy nicehash

## Claymore ETC NANO
#claymore=proxypool1 etc-us-east1.nanopool.org:19999
#claymore=proxypool2 etc-us-west1.nanopool.org:19999
#claymore=proxywallet 0x5844e06306ccaeefbe3a832d540e3bab64a0083b
#claymore=poolpass1 x
#claymore=poolpass2 x

## Claymore ETH NANO
claymore=proxypool1 eth-us-east1.nanopool.org:9999
claymore=proxypool2 eth-us-west1.nanopool.org:9999
claymore=proxywallet 0x5a9fc9284b91a22780d796ff385cde69666c5d85
claymore=poolpass1 x
claymore=poolpass2 x

## ethminer ETH NANO
#ethminer=proxypool1 eth-us-east1.nanopool.org:9999
#ethminer=proxypool2 eth-us-west1.nanopool.org:9999
#ethminer=proxywallet 0x5a9fc9284b91a22780d796ff385cde69666c5d85
#ethminer=poolpass1 x
#ethminer=poolpass2 x
#stratumproxy miner

## sgminer-gm ETC NANO
#sgminer-gm=proxypool1 etc-us-east1.nanopool.org:19999
#sgminer-gm=proxypool2 etc-us-west1.nanopool.org:19999
#sgminer-gm=proxywallet 0x5844e06306ccaeefbe3a832d540e3bab64a0083b
#sgminer-gm=poolpass1 x
#sgminer-gm=poolpass2 x

## sgminer-gm ETH NANO
sgminer-gm=proxypool1 eth-us-east1.nanopool.org:9999
sgminer-gm=proxypool2 eth-us-west1.nanopool.org:9999
sgminer-gm=proxywallet 0x5a9fc9284b91a22780d796ff385cde69666c5d85
sgminer-gm=poolpass1 x
sgminer-gm=poolpass2 x

globalfan 70
maxgputemp 92

#101 280x x5@ 180W/ea + 280 x1@ 160W // GPU1 UV seem, prone to crashing under heat
cor 194107 1025 1000 1020 1045 1050 1000
mem 194107 1500 1500 1500 1500 1500 1250
#fan 194107 0 90 0 0 0 0
pwr 194107 20 20 20 20 20 20
loc 194107 101
miner 194107 claymore

#102
cor 193fae 1125 1140 1000 1000 1000 1000
mem 193fae 1625 1625 1250 1250 1250 1250
#fan 193fae 78 78 78 78 87 95
loc 193fae 102
miner 193fae claymore

#104
cor 874af0 1180 1180 1180 1180 1180 1180
mem 874af0 2150 2140 2170 2170 2180 2180
fan 874af0 50 50 50 50 50 50
pwr 874af0 7 7 7 7 7 7
driver 874af0 amdgpu
miner 874af0 claymore
loc 874af0 104

#110
cor eb19aa 900
mem eb19aa 1500
#fan eb19aa 40
pwr eb19aa 4
loc eb19aa 110
#driver eb19aa amdgpu
miner eb19aa claymore

#201
cor 1946a2 1150 1150 1150 1150 1150 1150
mem 1946a2 1600 1600 1600 1600 1600 1600
#fan 1946a2 80 80 80 80 80 80
loc 1946a2 201
driver 1946a2 fglrx
miner 1946a2 ethminer

#202 760W on 750G2
cor fb200f 1100 1125 1110 1100 1135 1125
mem fb200f 1625 1600 1550 1500 1600 1600
#fan fb200f 80 80 80 80 80 80
#mxt fb200f 54 54 54 54 55 55
loc fb200f 202
miner fb200f claymore

#203
cor 302e95 1180 1140 1180
mem 302e95 2180 2090 2190
pwr 302e95 7 7 7
#fan 302e95 75 75 75
loc 302e95 203
miner 302e95 sgminer-gm

#204 480 RIG
cor e3c61b 1180 1180 1180 1180 1180 1180
mem e3c61b 2180 2180 2180 2180 2180 2180
pwr e3c61b 7 7 7 7 7 7
#fan e3c61b 80 80 80 80 80 80
#sel e3c61b 0 2 3 4 5
loc e3c61b 204
driver e3c61b amdgpu
miner e3c61b claymore

#205 480 RIG
cor 36eb44 1180 1180 1180 1180 1180 1180
mem 36eb44 2175 2170 2190 2170 2190 2190
pwr 36eb44 7 7 7 7 7 7
#fan 36eb44 80 80 80 80 80 80
loc 36eb44 205
driver 36eb44 amdgpu
miner 36eb44 claymore

#206
cor 98b98b 1180 1165 1180 1180 1180 1180
mem 98b98b 2140 2140 2180 2180 2180 2180
pwr 98b98b 7 7 7 7 7 7
#fan 98b98b 79 79 79 79 79 79
loc 98b98b 206
miner 98b98b claymore

#207 380x/380
cor 9de955 890 890 890 890 890 890
mem 9de955 1575 1575 1575 1575 1575 1575
#fan 9de955 80 80 80 80 80 80
loc 9de955 207
#driver 9de955 fglrx
miner 9de955 claymore

#208
#cor 0ce6ca 1125 1000 1000 1125 1000 850
#mem 0ce6ca 1600 1500 1250 1650 1500 1500
fan 0ce6ca 70 70 50 50 70 70
sel 0ce6ca 0 1 2 3
loc 0ce6ca 208
miner 0ce6ca claymore

#209 125.6~ before 1140 OC 290
cor fb20c3 1100 1100 1100
mem fb20c3 1250 1500 1500
fan fb20c3 75 75 65 65 75 75
pwr fb20c3 20 50 50 50
loc fb20c3 209
miner fb20c3 claymore

#210
cor 047b3b 1180 1180 1180 1140 1180 1180
mem 047b3b 2150 2180 2150 2090 2170 2180
pwr 047b3b 7 7 7 7 7 7
loc 047b3b 210
miner 047b3b sgminer-gm

#211
cor 9dd995 1150 1150 1150 1150 1150 1150
mem 9dd995 2100 2100 2100 2100 2100 2100
pwr 9dd995 7 7 7 7 7 7
loc 9dd995 211
miner 9dd995 claymore

EthOS/zec.txt

#echo -n “https://raw.githubusercontent.com/Virosa/EthOS/master/zec.txt&#8221; > /home/ethos/remote.conf && r
#disallow && minestop && sleep 1 && ethos-update && sleep 5 && allow && r

custompanel virosa420137

autoreboot 2

#globalbranch development
#branch eb19aa development

#NICEHASH
#stratumproxy nicehash
#proxywallet 15qpQXHz9mVcJmnzd5YEsxKz9JkdNQSLJQ
#proxypool1 equihash.usa.nicehash.com:3357
#proxypool2 equihash.eu.nicehash.com:3357

#ZCASH
proxywallet t1e2Ev2vnRWGFgXc8362g2ijpoaLdpUDPjz
proxypool1 us1-zcash.flypool.org:3333
proxypool2 eu1-zcash.flypool.org:3333

#globalminer optiminer-zcash

## Claymore ETH NH
#claymore=proxypool1 stratum+tcp://daggerhashimoto.usa.nicehash.com:3353
#claymore=proxypool2 stratum+tcp://daggerhashimoto.eu.nicehash.com:3353
#claymore=proxywallet 15qpQXHz9mVcJmnzd5YEsxKz9JkdNQSLJQ
#claymore=poolpass1 x
#claymore=poolpass2 x

 

## Claymore ETH ethpool
claymore=proxypool1 us1.ethpool.org:3333
claymore=proxypool2 us2.ethpool.org:3333
claymore=proxywallet 0x5a9fc9284b91a22780d796ff385cde69666c5d85
claymore=poolpass1 x
claymore=poolpass2 x

globalfan 90
maxgputemp 89
flags –cl-local-work 256 –cl-global-work 8192 –farm-recheck 1000

#101 280x x5@ 180W/ea + 280 x1@ 160W // GPU1 UV seem, prone to crashing under heat
cor 194107 1025 1000 1020 1045 1050 975
mem 194107 1500 1500 1500 1500 1500 1250
fan 194107 80 85 92 80 80 80
pwr 194107 20 20 20 20 20 20
loc 194107 101
miner 194107 optiminer-zcash

#102
cor 193fae 1000 1000 975 975 975 975
mem 193fae 1500 1500 1250 1250 1250 1250
fan 193fae 0 0 90 0 0 0
loc 193fae 102
miner 193fae optiminer-zcash

#103
cor 047c5f 1100 1100 1100 1100
mem 047c5f 1500 1500 1500 1500 1500 1500
#fan 047c5f 85 95 85 85 85 85
loc 047c5f 103
miner 047c5f optiminer-zcash

#104 480NT
cor 874af0 1170 1190 1190 1190 1180 1190
mem 874af0 2100 2100 2100 2100 2100 2100
#fan 874af0 75 75 75 75 75 75
#flg 874af0 –cl-global-work 16384 –farm-recheck 1000
pwr 874af0 7 7 7 7 7 7
loc 874af0 104
driver 874af0 amdgpu
miner 874af0 optiminer-zcash

#110
#cor eb19aa 1200
#mem eb19aa 2100
fan eb19aa 40
#pwr eb19aa 4
3flg eb19aa –cl-local-work 256 –cl-global-work 16384 –farm-recheck 1000
loc eb19aa 110
#driver eb19aa amdgpu
miner eb19aa optiminer-zcash

#201
cor 1946a2 1110 1120 1075 1120 1120 1120
mem 1946a2 1550 1575 1525 1575 1575 1575
#fan 1946a2 80 80 80 80 80 80
loc 1946a2 201
driver 1946a2 fglrx
miner 1946a2 optiminer-zcash

#202 760W on 750G2
cor fb200f 1100 1100 1100 1100 1100 1100
mem fb200f 1550 1550 1550 1550 1550 1550
fan fb200f 0 0 0 0 0 80
loc fb200f 202
miner fb200f optiminer-zcash

#203
cor 302e95 1075 1080 1055
mem 302e95 1250 1250 1250
#fan 302e95 60 60 60
pwr 302e95 50 50 50
loc 302e95 203
miner 302e95 optiminer-zcash

#204 480 RIG
cor 9dd995 1170 1190 1240 1240 1142 1200
mem 9dd995 2000 2000 2000 2000 2000 2000
pwr 9dd995 7 7 7 7 7 7
#fan 9dd995 80 80 80 80 80 80
flg 9dd995 –cl-global-work 16384 –farm-recheck 1000
#mxt 9dd995 46 48 47 48 49 56
loc 9dd995 204
driver 9dd995 amdgpu
miner 9dd995 optiminer-zcash

#205 480 RIG
cor 36eb44 1160 1190 1180 1180 1170 1190
mem 36eb44 2000 2000 2000 2000 2000 2000
pwr 36eb44 7 7 7 7 7 7
#fan 36eb44 60 60 60 60 80 80
loc 36eb44 205
driver 36eb44 amdgpu
miner 36eb44 optiminer-zcash

#206 480 RIG
cor 98b98b 1190 1180 1160 1160 1170 1190
mem 98b98b 1600 1600 1600 1600 1600 1600
pwr 98b98b 7 7 7 7 7 7
#fan 98b98b 70 70 70 70 70 70
loc 98b98b 206
miner 98b98b optiminer-zcash
driver 98b98b amdgpu
#driverless 98b98b enabled

#207 380x/380
cor 9de955 880 880 880 880 880 880
mem 9de955 1575 1575 1575 1575 1575 1575
#fan 9de955 0 0 0 0 0 0
flg 9de955 –cl-local-work 256 –cl-global-work 8192 –farm-recheck 1000
loc 9de955 207
#driver 9de955 fglrx
miner 9de955 optiminer-zcash

#208
cor 0ce6ca 0 0 1000 1000 0 900
mem 0ce6ca 1600 1500 1250 1250 1500 1500
#fan 0ce6ca 70 50 50 70 70 100
#flg
loc 0ce6ca 208
miner 0ce6ca optiminer-zcash

#209
cor fb20c3 1000 1000 1000 1000 1000 1000
mem fb20c3 1500 1500 1500 1500 1500 1250
#fan fb20c3 55 45 0
#flg fb20c3 –cl-local-work 256 –cl-global-work 8192 –farm-recheck 1000
loc fb20c3 209
miner fb20c3 optiminer-zcash


PingWest:庄家杜均

$
0
0

PingWest:庄家杜均

01 现身

如果不是区块链和加密货币(crypto-currency)的概念一夜之间炙手可热,“币圈”的庄家们可能还在过着闷声发大财的逍遥日子。

但现在这种平衡被打破了。最近一年,数字货币和替代性加密货币的价格暴涨,各种版本的炒币暴富神话在网络上流传。2017年9月,中国的监管机构下令禁止境内的ICO(首次代币发行,是用区块链把使用权和加密货币合二为一,来为开发、维护、交换相关产品或者服务的项目进融资的方式。来源:维基百科)交易,并陆续屏蔽境外ICO交易平台的域名。这非但未能消灭“圈外人”的入场热情,反而激发了公众的窥探欲,更引发了传统风险投资界的焦虑和参与。

2018年除夕,一系列名为“三点钟无眠区块链”的微信群横空出世,在各种区块链微信群里呼风唤雨的,是薛蛮子、徐小平、蔡文胜和王峰这样的传统天使风险投资人。大佬们坐而论道,谈区块链技术的未来和区块链的应用场景,号召人们关注区块链,拥抱区块链的未来。无独有偶的是,他们在微信群里的每一次“私密分享”,都会成为广为流传的微信朋友圈素材和媒体报道的来源,更是把“全民区块链”的热情推向高潮。甚至区块链之外的互联网产业都被戏称为“古典互联网”,现有的私募股权投资模式也被调侃为“古典互联网投资”。

传统互联网的苍天死了,区块链的黄天立了。有意思的是,这些突然闯入的“前古典投资大佬”表现出对区块链异乎寻常的兴趣,却绝口不谈比特币和其它加密代币,或者干脆直接与“炒币的”划清界限。但微信群里的信徒们和所有关注他们言论的看客们,几乎无一不试图从他们的言论和态度中,寻找、坐实并放大币的交易价值。

也并没有人真正清楚这些大佬们炒不炒币,持有多少币,赚了多少钱。

这些群里也有一些几乎从不发言,但闷声发财的人。这些人不求虚名,比活跃的新晋区块链意见领袖们,赚到了更多的钱。

他们是区块链加密货币交易世界的庄家。

2017年底,一个名为IOST(Internet of Service Token)的区块链项目正在筹划ICO,募资数额巨大。在ICO之前的私募阶段,该团队宣传称其背后的投资方有真格基金、红杉中国和险峰长青等知名风投机构。阵容可谓豪华。随即有媒体发现,“IOST”项目团队与真格基金投资的“多拉打印”团队在人员上高度重合,质疑项目是”多拉打印”的融资马甲,猜测IOST只是一个“空气币”(即背后没有真正运营的项目支撑,单纯以发行加密货币为目的吸引人们认购)项目。

此事后来不了了之,但一个叫“杜均”的名字浮出水面——

“IOST”是由火币网旗下Huobi Labs孵化的项目。火币网是其主要投资方,也是联合首发的交易所,而杜均是火币网的联合创始人、独立董事和股东。

除火币网和真格基金之外,“IOST”和另一个项目“DATA”的共同投资方还有一家叫“节点资本”的机构,该机构专注区块链领域投资,杜均也是节点资本的创始合伙人。

与此同时,“IOST”在一家区块链垂直媒体——“金色财经”上,曾被积极推荐,而“金色财经”的实际控制人,又是杜均。

利益交叉复杂,线索却再清晰不过。从项目孵化开始,到登陆交易所公开流通,再到垂直媒体的配合炒作,一场ICO的每一个环节,杜均都深涉其中。

PingWest品玩发现,自2013年与李林等人一起创办“火币网”起,杜均渐次在“币圈”里建立起了自己的产业链,时至今日,他已然坐拥私募股权投资、垂直行业媒体和数字货币交易所三大核心资源。而这三大资源平台,恰恰又是一场ICO最依赖的部分,也是各种内幕交易和暗箱操作的温床。

如果以股票市场作比,杜均是一个身兼承销商、证券媒体以及坐市商三大角色于一体的“超级庄家”。

数字货币和各类代币虽脱胎于“去中心化”的美好愿景,但在实际运行过程中,由于被大量“中心化”的机构垄断资源,项目发行“空气币”涉嫌欺诈融资、私募代投和操纵币价的乱象盛行,已经发展到不能忽视的程度。

“超级庄家”杜均和他背后的产业链,可谓是展示当下整个数字货币交易市场坐庄手法的一个样本案例。

02 杜均其人

杜均,重庆开县人,1986年出生。

媒体鲜有关于杜均的报道,零星的信息大多来自2017年9月之前他集中接受的一些媒体专访。但这些足以让我们了解到他的发迹史:

杜均有很强的赚钱意识,这源于他的成长经历。杜均父亲在其幼年做生意经常赔钱,从小的耳濡目染,使得“赚钱”从那时开始便成了他最重要的人生目标;

初中期间,杜均接触到了刚刚在中国兴起的互联网。他曾靠打游戏卖装备、建站赚广告费谋生,是早年间国内互联网野蛮生长时代孕育的无数个人站长之一。以此为契机,杜均接触到了与实体经济截然不同的虚拟经济;

他没有完成大专学业就毅然辍学北上,一度沦在餐厅打工。但凭借常年混迹互联网圈积累的经验和圈子,杜均成功进入知名企业家和天使投资人戴志康创立的康盛创想,在旗下Discuz!担任产品设计相关职务。康盛创想于2010年被腾讯全资收购,只有高中文凭的杜均得以进入中国最大的互联网公司工作。

据说,杜均私下曾跟人宣称,自己22岁就已经实现了财务自由。这一说法的真实性无从考证,但有一点却是事实:杜均年轻时确实靠倒卖域名掘到了第一桶金。

在频繁触网的那段时间,杜均知道了“蔡文胜”这个名字,后者倒卖域名发家致富的经历深深地刺激了他。他依样画瓢,不停买入有升值潜力的域名,等其升值后卖出。多处关于杜均的报道中都提到,他在团购领域“千团大战”时靠囤积带有“团”字的域名发了一笔不小的财。在一篇由杜均自述构成的报道中,他罗列了自己在2006年到2013年之前每一年的域名买卖情况,每一笔交易的投入和回报都有详细记录。

这时候,比域名更刺激的“比特币”出现在他眼前。

2013年下半年,杜均从腾讯辞职,与李林等人联合创立数字货币交易所——火币网。昔日的领导戴志康则成了火币网的天使投资人。

后来的事实告诉我们,这绝对是一次回报极高的投资。

杜均的职务是火币网首席营销官(CMO)。火币网在2013年底上线,立即打出了“免交易手续费”的旗号,狠狠戳中当时交易所收取交易费的软肋。再加上杜均在站长时期积累的运营经验,平台很快一跃而起。只不过,等到火币网发展壮大、杜均退出直接管理隐居幕后时,它随即连同国内几大交易所重新开始收取手续费,甚至开始向项目收取巨额的ICO“上币费”,这些都是后话了。但无论如何,周鸿祎在中国互联网行业将“免费”逻辑发扬光大,杜均是这一方法论在币圈的早期践行者。

这时,他的人生高潮刚刚开始。

现在看来,他的确对低买高卖有着很好的感觉,先是域名,后来是数字货币,两者都是极具潜力的投资标的和炒作素材。

其实杜均并不算是站在大潮最前沿的那个人。当他开始倒卖域名,跟当时的个人站长们打成一片时,蔡文胜早已靠此起家,还被人称作“个人网站教父”;他接触到比特币投资虽然比行内大多数人早,可也不过是2013年左右的事情,很难确定他对加密货币和背后的区块链技术有什么积累和信仰;当他辞职参与创办火币网时,距离交易额一度占到比特币总额80%、圈内人戏称为“马桶盖”的Mt. Gox上线已过去了好几年,国内市场也诞生了“比特币中国”这样的交易所先驱。

但他有着比别人更强的行动力,以及赚钱的欲望。

火币网上线一年多之后,杜均退出火币网管理层,创办了区块链代币媒体“金色财经”,又顺势募集了自己的基金”节点资本”。从某种意义上说,金色财经和节点资本相当于火币网的衍生产品,三者共同织就了一张覆盖整个ICO链条的网络。

随着这张网络的铺开,杜均个人在圈内的影响力也日益强大。当他再次低调亮相时,已然身兼“节点资本创始合伙人”、“金色财经创始人”和“火币网联合创始人”三个头衔。

在很多没有参与过传统股票交易市场的“币圈人”眼里,杜均这是在“布局产业链上下游”,但倘若以金融市场的角度看待数字货币交易,他的角色简直不可思议。

数字货币的本质是金融产品,各类数字货币在交易所内和场外的币币买卖已经构成事实上的类证券交易行为。而杜均所谓的“产业布局”,实际上相当于将券商、交易所和媒体,由一人或者同一利益方全权掌握。三个市场角色之间没有任何隔离和第三方监督,同时又因为数字货币没有被承认为法定货币,或不适用于现有金融监管条例,这使得杜均和他的“产业布局”,在操纵项目ICO全程,以及“上市”后的币价走势上,简直轻而易举。

事实上杜均的确也这么做了。

03 超级庄家

相信很多人都曾看到过下面这张图:

在这副所谓的“币圈大佬扑克牌”中,杜均被排在一个不起眼的位置。不必说与比特币发明者中本聪、以太坊创始人Vitalik Buterin或是中国比特币第一人李笑来相比,杜均在圈内稍有名望的大佬中也排不上号。他的人物介绍是:“金色财经创始人”。

这其实不符合金色财经这家媒体在币圈的影响力,也不符合杜均的江湖地位。

金色财经是币圈最早、也是流量最大的“媒体”之一。除了针对国内读者的中文站,另有英文、韩文、日文和俄文分站,分别面向全球数字货币交易最热门的几个国家:中国、美国、新加坡、韩国、日本和俄罗斯。在这里你可以看到币圈发生的一切——币价行情、最新消息、知识普及和观点评论等等。当然,其中还掺杂着大量区块链项目的推广软文,以及各类ICO的促销广告。

币圈人对金色财经褒贬不一。有人视其为币圈的风向标,“金色财经说什么就是什么”;有人则怒斥它经常对外放捕风捉影的消息,操纵币价。但多数人都承认一点,金色财经在币圈有着很大影响力,是这个圈子里少有的掷地有声的大媒体之一。

众所周知,无论是传统的证券市场还是数字资产交易市场,新闻媒体都是买卖双方最主要的信息来源。在价值投资缺位的币圈,消息左右币价的能力更加强大。

但证券市场有着充分的监管限制和信息披露,这是各类ICO项目和数字货币交易所不具备的。既然数字货币不适用于现有的证券法律法规,那么作为“币圈证券媒体”而存在的金色财经无论发布什么信息,其内容倾向如何,理论上也都不受制约。

根据天眼查披露的企业工商信息,杜均为金色财经背后的企业主体“北京财到信息技术有限公司”最大单一个人股东,持股52.27%,为实际控制人。

金色财经构成了杜均坐庄网络上的第一个关键节点:控制消息发布。

继续沿着此线索追溯,可以发现:杜均虽然已经从火币网离职,但其实藕断丝连。在火币网的国内企业主体之一“北京火币天下网络技术有限公司”中,杜均仍持有4.22%的股份,同时还担任着该公司的独立董事。而“北京火币天下网络技术有限公司”也参股了“北京财到信息技术有限公司”。

也就是说,火币网也是金色财经的股东。这也就不难解释为什么金色财经上存在着大量火币网的利好消息了。

值得多提一句的是火币网的股权结构。火币网总部位于新加坡,在全球各地都有团队,所以中国境内的“北京火币天下网络科技有限公司”只是其企业实体之一。在国内的工商信息中可以查询到,一家注册在香港的Huobi Universal (HK) Limited公司与火币网及关联公司有着诸多交叉持股关系。

不过,火币网官方网站上显示的戴志康、真格基金、红杉中国等投资方与火币网的持股关系,在国内的工商信息系统中,并没有得到完整的体现。

这意味着火币网有着周密的股权安排,国内这家公司只是冰山一角。火币网的公司实体和真实股东分布在多个国家,其完整结构难以彻底查清。

即便如此,至少有一点可以确认,即杜均、火币网和金色财经之间为交叉持股关系,在公司层面是典型的利益关联方。

这构成了杜均庄网上的第二个关键节点:持有交易所股份,分享操盘收益。

与证券交易所不同,数字资产交易所完全是私人企业,不需要承担社会责任,可以参与到前期发币和上市后炒币的任意一个环节中。圈内人都清楚,这是一门稳赚不赔的生意:每个ICO项目想要登陆交易所都要缴纳价值上千万人民币的上币费用,以法币、以太坊、代币的形式缴纳,或三者混合;无论币价涨跌,任何买卖交易交易所都能从中收取手续费,杠杆交易中交易所还能收取高额的借币利息;交易所可以利用沉淀在交易所里的用户资产操盘炒股,甚至无需动用本金制造虚拟交易……可谓无所不能。

根据全球虚拟货币和交易所统计网站CoinMarketCap的实时数据,火币网在24小时交易量中一直稳居全球交易所前五名,经常挤进前三。

理论上只要掌握交易所这一核心资源就可以坐庄。但杜均的圈子胃口不仅限于此。

杜均的最后一重身份是“节点资本”创始合伙人。这是一家私募投资基金,也是杜均庄网上的最后一个关键节点。

像大多数专门投资区块链及数字货币项目的私募投资机构一样,节点资本很年轻,2015年才正式成立。这类机构的投资模式与传统私募股权投资不同,通常使用数字货币和法币结合的方式投资项目,行为发生得极为隐蔽。

在节点资本的官方网站上我们可以看到,节点资本也是火币网和金色财经的投资方。换句话说,杜均不但自己参股了火币网,其控制的节点资本也是火币网的股东之一,这说明杜均在火币网中的持股并非只有4.22%。

初步统计,节点资本的投资组合里,其中有一半项目完成了ICO,而这些ICO大多是在最近几个月时间里完成的,这其中就包括炒币者们耳熟能详的Gerano Network、IOST、YEE和aelf等项目。

基于杜均的“三重身份”,他可以用“节点资本”投资早期项目,项目ICO后登陆自己持股的交易所,手上的媒体资源又可以为项目“保驾护航”。这是一个完整的生财体系。

这在传统二级市场完全不可想象。待上市企业、证券媒体、证券公司和交易所,它们分别是独立的存在,每一部分的行为都在证券法规的严格控制之下。这样做的目地是让二级市场的交易运作透明、规则公平,消除公共投资者的信息不对称,是全球通行的基本法则。但在币圈,它们之间非但没有隔离,甚至可以是同一个人在幕后操盘,坐享ICO每一个节点上的巨额利润。

比起一些仅参与了部分ICO链条的币圈名人,杜均某种程度上掌握着比他们更大的话语权,是名副其实的“隐形大佬”。

条件皆已具备。随着全球范围内数字货币交易逐渐升温,ICO井喷,坐庄的机会自己就找上门来。

04 诡异的乌龙

炒币者们可能永远都忘不了2017年12月代币“WAX”登录“火币Pro”交易所后,狂跌99%的惨烈景象。

2017年9月4日,有关部门对ICO的监管禁令出台,中国内地原有的交易所格局发生了一场戏剧性的变化:比特币中国直接宣布当月底停止交易,后来市场上传出其被香港投资基金收购的消息,但没有对外披露任何交易细节。原本默默无闻的小交易所“币安”立即行动,将平台迁至海外,项目也趋之若鹜,币安也一跃成为交易额最大的交易所之一;火币网则将交易平台整体迁至海外,并改名为“火币Pro”,同时还上线了多个语种的交易平台。

而戏剧性的是,各类代币ICO井喷的时间点,都发生于2017年9月4日ICO禁令之后。

据不完全统计,2017年11月至12月的短短两个月时间里,“火币Pro”上币数量达到近40个,2018年前两个月的数量高达45个。换句话说,超过80%的币种,都是集中在最近四个月时间里登录火币Pro的。

火币网正式将所有币种的交易迁至火币Pro之后,开始的两个多月,项目上币是不收取费用的。直到“WAX”的ICO事件。

2017年12月,一家叫做OPSkins的游戏虚拟资产交易平台宣布ICO,公开发行自己的代币WAX(Worldwide Asset Exchange)。按照原定计划,WAX将在2017年12月20日在火币Pro上线交易。

然而就在正式上币的2天前,WAX项目团队突然在Twitter和Medium等社交网络上发出通知:将代币数量拆分,增发至原有10倍,币价瞬间贬值至原价的一成。但火币Pro在20日却仍以原价格上线WAX,这使许多没有看到通知的散户投资者,在不知情的状况下以原价买入。不出所料,WAX上线后币价旋即跌去99%,大量投资者被套牢。

WAX乌龙事件震惊币圈。6天后,也即12月27日,火币网就此事件召开发布会,CEO李林出面解释事件原委。李林称:此事并非WAX团队恶意增发,而是因为双方商务团队没有及时沟通所致。火币网随后出台了一项赔偿计划,称会拿出1亿元全额赔付用户,并承诺在2018年1月31日前赔付完毕。

与赔偿计划一起,火币Pro宣布立即停止免费上币服务,对项目ICO收取上币费用,并进行资质审核(火币网称审核基础为自主研发的SMARTChain评估模型)。

现在看来,WAX事件仍存在重重疑点:

第一,WAX在上线前至少2-3天即在Twitter上宣布增发,并于12月19日在Medium上发表公告宣布此事。而作为WAX唯一且首发的交易所,火币Pro称对此完全不知情,团队在上币前两天与项目方没有任何信息沟通。

第二,WAX是由OPSkins这一项目的团队发行的,该项目上线于2016年,自称全球领先的虚拟游戏装备交易平台。但Google、维基百科、Steam社区以及各种公开资料中,这个交易平台的信息甚少。

第三,节点资本恰好是WAX的投资者。WAX是OPSkins团队的代币项目,杜均进入WAX的方式很可能只是公开交易前的私募阶段。火币网的独立董事及股东之一杜均,作为项目的私募投资方,竟然也不知道WAX要1:10拆币的消息,或者是知情,但没有跟火币网的任何人进行沟通。三者之中没有在两天的时间里互通信息,本身就非常不合常理——毕竟,这次事件的赔偿金高达1亿元人民币,而它又是由一个如此荒谬的原因造成的。

最后,无论是火币网官方还是李林的澄清,都对火币网和WAX之间的关系只字不提。

更意味深长的是,WAX事件之后,金色财经上随即出现了几篇为该事件和火币网“澄清”的文章,它们也同时被群发在了各个网站渠道上。

现在没有确切的证据显示这是一场有预谋的欺诈事件,但火币网和WAX团队也的确没有针对以上的疑点作出符合常理的解释。

无论如何,从WAX事件开始,在火币Pro上币更难而且更贵了——目前,几家平台的上币费都暴涨至几千万人民币。另据一位试图在火币Pro上币的项目方透露,火币对他们只收现金作上币费。可这丝毫没有浇灭项目们的热情。

另一边,在此之后的两个月里,杜均和节点资本似乎完全没有受到WAX影响似的,出手的ICO项目更多、更频繁了。

05 庄技

庄家,通常指能够影响金融证券市场行情的大户投资者,在股市中常常是上市公司所有者、投机游资和基金机构。

以1990年12月上海证券交易所正式开业为起点,中国内地股市经历了单一庄家坐庄、金融集团坐庄和基金机构坐庄等几个时期。1995年到2005年的十年间,国内股市庄家横行,利用监管空白、信息不对称和资本优势狂洗股民。此后,随着上市企业增多、股票流通盘扩大,加上大量散户投资者涌入股市,庄家虽不复当年的辉煌,但仍然分散隐身于市场之中伺机而动。

另一边的散户们永远对庄家又爱又恨——跟着“小道消息”和庄家同进退,一直是散户投资者,准确地说是投机者的渴望。然而,历史证明,跟庄成功者少,被庄家玩弄者众。

《庄家之死》一书的作者陈斯文曾评价这一现象:直至今日,国内股市仍未摆脱“庄家炒作、民众投机”的怪圈。诚然,在后来2007年和2015年的两次大牛市中,大众的投机心理与此前混乱的十年并无不同。

中国股市的庄家史给当下的币圈提供了一个绝佳的参照系。

非主流代币(创新币)公开交易(ICO)后与上世纪90年代中国股市上的股票们并无二致,炒币者的潜在收益更大,面临的环境也更加混乱凶险。

与IPO(首次公开募股,即上市)类似,ICO有着一套独立的发币、私募、承销和公募流程。在项目的私募阶段,基石投资者、早鸟投资者以及其他早期投资者分别用一定折扣认购代币份额,拿到大份额的承销商则会向下分发,帮助散户代投赚取差价。另外,官方还会利用各种社群活动空投糖果,在币圈媒体作广告投放,或是直播空投等方式免费赠送一部分代币,刺激散户参与。

多数项目ICO时只有团队和白皮书,没有实体业务和资产,因此需要靠币圈大佬站台,知名人士作为顾问,以及私募投资者和承销商做销售背书,才能获得投资者的关注和信任,并认购份额。2018年初,币圈名人“宝二爷”(郭宏才)在一次行业分享中说:自己为项目做顾问站台的收费标准是1%的待发代币,前不久在美国给几个项目“云站台”就净赚500万美元。行业中顾问们的暴利可想而知。

这其中隐含着一个事实:项目早期的股权投资人、创始团队和代币私募阶段拿到份额的大户投资者和顾问们,在公开交易前都通过认购或是被赠送的方式持有为数不少的代币,有着共同的利益诉求——希望自己手上的币升值。

这种扭曲的行业关系和“健康的ICO市场环境”,几乎背道而驰。

根据公开资料的不完全统计,在2017年11月至2018年2月的短短4个月时间里,节点资本投资的ICO项目至少有12个,几乎所有项目都得到了金色财经的推荐,其中还有不少联合火币Pro进行了首发促销活动。

一位业内人士对PingWest品玩透露:金色财经与其它大多数媒体不同的是其掌握的“交易所资源”(火币网),金色财经的商务方案,包括火币Pro的交易所作为资源打包提供给ICO项目。

杜均一手投资ICO,一手用金色财经帮这些项目摇旗呐喊,身兼运动员和啦啦队两个角色,各不耽误。

这还不是这场局中最精彩的部分——如果仔细观察这些代币ICO后在火币Pro上的走势你会发现,杜均还是裁判之一。

以下是杜均投资的部分项目在ICO后的盘面。在币币交易中,分析盘面的指标与股票市场基本一致,因此各类股票分析工具同样适用于于币价分析。

在此我们选择股票分析两个核心指标:“佳庆资金流量”和“成交量摆荡”。

佳庆资金指标(Chaikin Money Flow,简称CMF)为股票市场常用分析工具,它用于描述一支股票的强弱状态。这个指标与股价的关系是:CMF会随着股价缓缓上升,股价下跌CMF也会跟着下跌。当CMF指标大于0时,市场向好,反之则向坏。波动越大,买入/卖出的压力越大。在同一时间点,CMF如果与价格呈相反状态(如价格上涨CMF下跌),就意味着行情的转变。

成交量摆荡是一种用曲线方式展示交易量的工具,短期成交量高于长期平均成交量时曲线为正,反之则为负,用来描述交易量的短期变化。

将这两个经典指标与价格走向叠加之后,可以基本判断出主力资金的进出情况(因为创新币只能与BTC或ETH交易,所以该币与ETH和BTC其中一个在图形上有相关波动,即可视作庄家用的是这一币种操盘)。这个指标组合存在滞后,但描述清楚过去一段时间里大额资金的流动足够了。

根据几个指标的关系,

CMF和成交量摆荡同时拉高,在币价达到最高点之前达到顶点并出现向下信号,意味着行情反转,庄家开始出货;
CMF从0线以下向上抬升、成交量摆荡出现异常波动,但价格未有相应明显变化,说明庄家正在吸货;
CMF弱于0线、成交量摆荡波动小,同时价格也趋于平稳,说明此时市场上大额资金很少,主要是散户在博弈;
如果成交量摆荡大幅波动,CMF和币价却没有出现相应的大幅波动,说明市场上存在大量对敲交易(左手倒右手),这是典型的操纵价格现象。
在DTA、IOST、WAX和YEE等几个币种中,都出现了以上一种或几种大额资金的操盘痕迹(以上盘面图中已用红色竖线标出)。其中有几个币种在刚刚上线交易时有明显拉盘现象。

通过对一些“币圈”人士的采访,PingWest品玩了解到其中一部分事实:币圈的“控盘者”主要是项目团队本身、机构投资者和交易所三拨人。在证券市场中,释放消息拉盘砸盘、掌握筹码对倒操纵价格、震荡洗盘、拉升股价后高位抛货,这些一直是股市庄家们乐此不疲的坐庄伎俩。而在币圈,这些手法一样都没被庄家落下。

但不一样的是:同样是有着庄家存在,证券交易所的运行在国家的严格监管之下,庄家想要坐庄,必须具备大量本金,吸收大量筹码,而且多账户同时操作,才可能实现(局部)控盘;而在币圈,交易所在散户真正提币之前,一切的交易都是虚拟数字,前台运行的买卖手完全可以是自动运行的机器人程序,不需要真正的币币流动。

另有一个现象可以为庄家操盘提供侧面佐证。根据上文的表格,自2017年12月开始,每个币种登录火币Pro开始交易后,开放充值和提现的间隔时间越来越长——较早登录的项目通常当天即开放充值和提现,慢慢地,提现时间至少要间隔2天,甚至更久。这相当于交易所人为地设定了一段封仓时间,而很多代币在这段时间里,足以完成几轮操盘了。

实际上,许多散户投资者非常清楚有庄家和交易机器人的存在。在火币Pro官方Telegram群组和一些项目的官方讨论群中,有的散户甚至直接呼吁交易所和项目拉盘。他们一边在社群里骂骂咧咧,一边乐此不疲地参与其中。

炒币的投机本质暴露无遗。

最近发生的一起疑似交易所直接操盘事件来自2月25日ABT(ArcBlock)的ICO。2月26日上午,ABT在火币Pro上由于“技术问题”出现卡单(同时其它币种正常交易),许多挂出的高价单无法撤回,但页面显示仍有挂单在成交。卡单导致币价急剧下跌,投资者损失惨重。此事在火币Pro的官方Telegram群里引发大量用户投诉,火币客服则一直以“正在解决”和“汇报给领导”为由搪塞,没有对异常现象作出澄清说明,投资者们的质疑和谩骂也是置之不理。

整个“庄网”的做法大抵如此:节点资本投资并推动项目ICO,金色财经参与鼓吹,火币网上坐庄拉高价格出货或砸盘做空——无论这些行为是否由杜均亲力亲为,杜均都会以股东身份享有整个链条的巨额收益。

06 “圈外人”的掮客

庄网自然不止杜均这一张,掌握着核心资源的大佬也不止杜均一个。除了投资机构,各地还出现了不少利益捆绑的圈内联盟,大庄外围形成了不少小庄。积累了大量资本的庄家们织成了无数纵横交错的网络,或是联合投资,或是暗自较量,结果就是核心资源牢牢掌握在少数人手里。

如此明目张胆的坐庄行为,在证券交易市好比刀尖上舔血,在币圈的“圈内人”看来却是一种护盘的保证。

不止一位币圈散户投资者告诉PingWest品玩:圈外有什么负面消息和“黑幕”揭露,圈内人几乎没人在意——在他们眼里,无论有什么样的负面消息(他们统统看作“砸盘”)放出,跌到一定程度圈内大佬总会护盘,不会让所有人都血本无归。看起来,大家都把庄家们看作“善庄”了。

究其根本,无非是一种跟庄心态在作祟。私募阶段的投资者能以较低的折扣拿到代币,对于公募后的散户有着巨大的成本优势。ICO之前的低价份额掌握在庄家和大户投资者手里承销,为了拿到份额,中小投资者们往往默认让庄家赚大头,自己喝汤。

久而久之,圈内就形成了这样一种微妙的平衡——大家都想向各个庄家靠拢赚更多的钱。

这种平衡下的暴利势必会遭到圈外人的觊觎。新的投资者被金钱的味道吸引过来了,杜均的庄网也没放过这个机会,顺势当了一把掮客。

2017年年底,真格基金悄悄入场。

关于真格基金和区块链的关联,最有名的当属徐小平群内发言“泄露”事件。这一事件可谓正式引爆了整个互联网舆论对区块链和币圈的关注,“沾区块链和ICO就火”的现象由此愈演愈烈。

可圈内人都清楚,在徐小平发言泄露之前,真格基金参与的几个项目的ICO早已经在圈内炒得沸沸扬扬。公开资料显示,真格基金在2017年底密集参与了IOST、DATA、HOT和LINO至少四个项目的发币。目前,除了LINO之外,另外三个币种已经上所交易,LINO没有公开ICO。但LINO的Telegram群里每天都非常活跃,官方闷头投放糖果,投资者呼吁登录币所交易。

但代表真格基金在币圈活动的不是徐小平,而是合伙人戴雨森。

戴雨森,前聚美优品产品副总裁,于2017年7月离开聚美优品加入真格基金,担任合伙人职务。在戴雨森的LinkedIn页面上,最新的履历中清晰地写着自己目前担任IOST、DATA、LINO和HOT四个项目的顾问,这几个项目都是由真格基金投资的。这又是一处证明。

在2017年底一张由币圈媒体和交易所联合统计的“国内一线基金近期投资区块链项目一览图”里,除了几个新近成立的专门投资区块链的机构之外,传统风险投资机构中,只有真格基金一家参与颇深。

真格基金深度参与的这四个项目,节点资本都是联合投资方,最新上线火币Pro的EDU还完成了一整个链条的运作:节点投资、金色炒作和火币上币。

其中,IOST和DATA又是火币旗下Huobi Labs的孵化项目——考虑到真格基金同时是火币网的投资方,基本能判断这些项目都是由节点资本、火币网和真格基金联手投资和推动的。

可以说,带着真格入圈的掮客,正是杜均和他的庄网。

然而经过进一步调查,PingWest品玩发现:真格基金在币圈的作为似乎不止这些。在我们拿到的一份波场(TRON,代币TRX)ICO的私募材料中,首轮私募投资者中戴雨森也赫然在列。这些信息没有在波场的公开募资信息中披露,却在私募阶段悄悄地通过社群和私下传播,被派发到了无数早期投资者手里。

再后来,事情的走向开始有些失控。高潮在2018年除夕到来:“三点钟”系列微信群建立,陈伟星和朱啸虎之间爆发“区块链”和“古典”之争。一夜之间,50多家区块链或币圈媒体冒了出来,拥抱区块链成为风潮。

传统风险投资机构也纷纷按捺不住了,不再“与币隔绝”。“三点钟”的各个分支群里活跃着各种各样来自传统风投的合伙人和投资经理。

原有平衡已然被打破,但这个圈子是否能够包容得下更多野心和贪欲,形成新的平衡,还是个未知数。

07 危局

2018年春节过后的币圈,形势看起来一片大好。

可“圈内人”都感觉得到,利益再也无法平均分配,财富开始明显地向一些头部资源流动。最典型的现象就是,对于项目方来说,ICO的成本越来越高,却无法保证高额收益。

2月28日,火币Pro的HADAX平台第一期投票结束。HADAX平台是火币Pro推出的“投票上币”项目,旨在由投票来决定哪些新币可以登录火币Pro交易。第一期投票结束,有10个新币种得到了上币资格。

这可不是意味着火币Pro想试着将ICO从“核准制”向“注册制”过渡。在HADAX上每向一个项目投票,用户需要花费0.1个HT(HT是火币自己发行的代币)。有媒体测算,按照2月28日当天的HT汇率,第一名EGCC项目花费近4800万元人民币,这些都进了火币的腰包。这还只是一个项目的费用。

此举遭到了多数媒体和圈内人士的质疑,认为这是火币网变相涨上币费的手段,与竞价排名别无二致。迫于舆论压力,火币Pro迅速开通“退币”机制,承诺可以退还投票费用,并公开向用户征集第二期投票上币规则的完善意见。

有圈内人士直言:如今的项目方,完全就是在给交易所打工!

据说,在一次近期举行的闭门交流论坛上,有ICO项目的宣发人员诉苦:称目前金色财经的打包宣发费用已经达到几百万。3月3日,新媒体“铅笔道”发表的一篇文章称,币圈媒体推荐项目ICO的软文收费惊人,甚至达到了一篇文章收费10万元的程度,但点击数只有200多。业内人士称,金色财经所收取的广告费只会比这个数字更大。

帮着项目方算一笔账,顾问费、上币费和宣发费用,一场ICO下来,手上拿到的钱所剩无几,这剩下的一点钱当中,又有多少能用来做产品开发?莫不是真的在“开发”空气币?

另外一个疯狂且危险的信号触动着每个币圈人的神经。

ICO后狂涨的美好景象破碎,大量代币上线火币Pro后破发,而且有着愈演愈烈的趋势。有圈内人士私下询问币圈知名投资人、FBG Capital创始人周硕基对这件事的看法,后者只说了一句话“看项目背后的团队”便再不作声。讽刺的是,随着破发的ICO越来越多,圈内竟然出现了“破发险”的险种。

看似热闹的币圈,慢慢地变成了一个零和博弈的战场——财富在大户手头流动,靠着频繁的交易维持盘面的热闹。然而,越来越多的散户体会到了“上市即破发”的痛,越来越多的财富被尽情地收割。

3月3日,全国政协十三届一次会议开幕,中国进入“两会时期”。就在大会召开前的一天,两大数字货币交易所火币网和OKEx的微信公众帐号突然消失,前者被删除“火币网”,被迫改名“huobicom”;OKEx则直接被封号,屏蔽一切消息。

这被舆论视作币圈“大事发生”的前兆,谣言四起。至本文发表为止,火币网和OKEx官方没有对此发表公开声明解释,两大交易所业务一切照旧。

08 “是时候了”
去年开始业内即有传言,包括杜均在内,币圈主要人物已经被限制出境。有几位独立信源先后向PingWest品玩证实了这个消息。当我们试图联系到其中一位早在站长时代就与杜均相识的人想要谈一些关于他的事,对方婉拒了采访请求,称“现在谈他太敏感”,不愿多说。

一张在圈内流传的微信对话截图显示:央行将会在315期间“有动作”,并称火币CEO和COO已经被限制出境。甚至有人说,不排除采用叫停矿厂挖矿的严厉措施。

就在3月开始后的几天,节点资本的网站信息,没有任何征兆地由中文全部替换成了英文。

越来越多的信息显示,国内新一轮的措施就要到来。

但大佬们似乎没有受到影响似的,在三点钟群里谈笑风生,私下里筹划币圈的“下一件大事”。

2月27日晚,币圈很多有头有脸的人物出现在北京的一个酒吧。起初这只是一个少数人的小聚会,但随着消息在社交网络上传开,越来越多的人赶来现场,小小的酒吧瞬间被包场。

小局变成大局,大局中又套小局。在一个只有核心人物的小局上,几个大佬商量,由最近在舆论中倍受瞩目的陈伟星牵头成立一个新基金,名为“2100”。关于2100这个名字有几个说法,一说是入会的人起码得是2100个比特币以上的身价(相当于近1.5亿人民币),一说是这是陈伟星自己之前一个基金的名字,还有人说加入的人起码能搞定2100个比特币的资金。

当然,杜均也在其中。

文章写到结尾,我们与一位圈内人士确认关于“2100基金”和杜均的消息。对方得知的来意后,说了一句话:

“也是时候了。”

2018-02-13 用树莓派3搭建Storj实验节点

$
0
0

2018-02-13 用树莓派3搭建Storj实验节点

96
sggggy 
2018.02.13 14:58* 字数 502 阅读 179评论 0

总述

有不少爱好者希望提供树莓派搭建Storj节点的教程,在此梳理一篇。但一定注意树莓派天生低功耗与低内存的特性。树莓派的内存只能跑一个节点,而且可能性能还偏低,时不时还会有节点重启记录。

文章的要点,烧录好系统后,初始化所需软件,接着创建非root账号进行storj相关软件的安装,并且最终以非root账号启动storj。

PS:如果你的网络连通性不好,比如无法连接到github,在捣鼓的过程可能会遇到各种nodejs的报错。

物料

  • 树莓派3
  • TF卡 16G或以上,记得要有TF卡转USB写入的转换器
  • 树莓派外壳 可选,裸板直接跑也没啥大问题
  • 移动硬盘 上限8T,2.5寸移动硬盘可以靠树莓派供电,3.5寸的移动硬盘需要额外供电
  • 网线

准备阶段

本文档以CentOS7为例:

  • 首先下载镜像文件CentOS-Userland-7-armv7hl-Minimal-1708-RaspberryPi3.img.xz
  • 下载烧录软件etcher
  • 利用软件将镜像烧录到TF卡中
    烧录
  • 将TF卡插入树莓派,接上网线并通电
  • 去路由器后台查找树莓派的IP地址,默认情况下会通过路由器的DHCP服务,分配到IP地址
  • 通过ssh协议连接到树莓派,root的初始密码为centos:
###修改密码
[root@centos-rpi3 ~]# password 你的新密码

### 升级补丁并安装所需软件
[root@centos-rpi3 ~]# yum update -y
[root@centos-rpi3 ~]# yum -y install vim wget git epel-release htop git gcc-c++ make

### 创建非特权账号,root账号保留不使用
[root@centos-rpi3 ~]# useradd storj
[root@centos-rpi3 ~]# password storj

### 从root切换到storj账号进行后续操作
[root@centos-rpi3 ~]# su - storj
[storj@centos-rpi3 ~] wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.3/install.sh | bash
[storj@centos-rpi3 ~] nvm install --lts
[storj@centos-rpi3 ~] npm install --global storjshare-daemon -registry=https://registry.npm.taobao.org

Storj 节点配置

## 创建Storj节点,其中YOUR_STORJ_TOKEN_WALLET_ADRESS为你的myetherwallet收款钱包地址,storage后面跟着的是文件存储的路径
[storj@centos-rpi3 ~] storjshare create --storj=YOUR_STORJ_TOKEN_WALLET_ADRESS --storage=/mnt/storjmerge/storj.io/

范例如下,请把–storj=后面的内容替换成你自己的,不然赚取的货币就都送给我了

[storj@centos-rpi3 ~] storjshare-create --storj=0xa682270bC2045171873eB17bB195B2273Fea9066 --storage=/data/

Storj 节点启动

## 启动守护进程
[storj@centos-rpi3 ~] storjshare daemon

## 启动节点
[storj@centos-rpi3 ~] storjshare start --config /path/to/storjconfig/xxxx.json

范例如下:

[storj@centos-rpi3 ~] storjshare daemon

[storj@centos-rpi3 ~] storjshare start --config /root/.storjshare/configs/6666666666666666666666.json

Storj 节点验证

## 运行命令查看节点状态
[storj@centos-rpi3 ~] storjshare status
sample

调优

 "storageAllocation": "2GB",
  // Max size of shards that will be accepted and stored
  // Use this and make this lower if you don't have a strong internet connection
  "maxShardSize": "150MB",

React dApp (decentralized app) boilerplate using Ethereum’s blockchain.

基于Ngrok端口转发实现storjshare和siacoin farming

$
0
0

基于Ngrok端口转发实现storjshare和siacoin farming(上)

WHY?

在我们进行Siacoin、storj和burst的Hosting(或者叫HDD farming)时,都会遇到需要端口转发的问题,原因要么缺乏公网ip,要么所谓公网ip还是个大局域网,解决方法有:

  1. 让电信等服务商调整为真实的公网ip,进行路由器的端口转发,然后申请一个域名,实时绑定公网ip到DNS,比如No-ip;
  2. 进行内网穿透。

准备

服务器域名,阿里云需要在安全组策略开放端口4000-4002和9981-9982VULTR主机商相对便宜,可以使用支付宝,按小时计费并且可以摧毁服务器以更换ip,支持快照,可以很快完成服务器更换;软件需求:putty和SecureFXPortable。

ngrok

什么是ngrok?ngrok通过安全隧道暴露本地服务器(如你自己的电脑或内网服务器,处于NAT环境和防火墙内)至公共网络。网上教程很多(比如Sunny ngrok教程并不能成功,他应该是使用的github上面一个项目,叫做Lanproxy,https://github.com/ffay/lanproxy),大多没有附带依赖包,对于没有linux经验的朋友基本难以实现,但此处给出的都是具有依赖包,按顺序安装能够实现,CENTOS6、7,Ubuntu16.04、17.10和树莓派Jessie,服务端和客户端都已经测试,没有问题。

  • 添加域名解析,需要设置ngrok服务的域名和子域名都要添加解析,例如设置后面的ngrok.yourdomain.com,那么ngrok和*.ngrok的解析均需要添加A记录:
  • 根据自己主机平台下载对应的go安装包,使用putty登录后:
  • 配置go环境变量:
  • 下载ngrok源代码:
  • 这里说明一下自定义密钥的原因,文档中说明ngrok only makes TLS-encrypted connections,客户端的合法连接依靠证书体系来确定,可以认为服务端和客户端的二进制文件是一一对应的,不过服务端在运行时可以指定证书(server.crt)和私钥(server.key),如果不指定将会使用编译时的证书和私钥(位于assets/server),而rootCA.pem(根证书)编译进客户端是不能与我们的域名完成匹配的,所以我们继续有(下面代码,只用把ngrok.yourdomain.com替换成你自己的域名就可以了):

 

  • 此处该进行编译了,直接编译会报错,我们先执行一下,看看报什么错:
  • 上述问题是由于进行无法交叉编译,需要去掉$GOBIN的变量声明,解决方法如下:
  • 好了,开始进行服务端编译:
  • 编译客户端:
  • 全部编译完成,再在服务器内输入(端口可以根据需要任意修改,但是tunnelAddr 17543端口,客户端和服务端要保持一致):
  • 在使用SecureFXPortable登陆我们的主机,在文件夹ngrok/bin中,可以下载到对应用于运行storjshare和siacoin的服务器、树莓派或电脑的ngrok,下载后,在我们运行storjshare和siacoin的机器上,ngrok所在文件夹,还需要一个ngrok.conf文件,storjshare默认端口4000-4002,siacoin是9981-9982(不要开放9980,如果开放端口9980,其他节点可以偷取你的siacoin):
  • windows下使用.bat启动ngrok(ngrok.exe -config=ngrok.conf start-all),使用软件SecureFXPortable传输到非windows系统一定使用二进制方式传输ngrok程序,linux命令为(注意ngrok路径对不对):
  • 正常情况,应该呈现:

转载请注明出处,源自密币之家

基于Ngrok端口转发实现storjshare farming和siacoin farming(下)

前序

  1. 比较siacoin(sc)和storjshare(storj),密币之家曾经认为,具有自有区块链的sc会远胜于使用ERC20的storj,然而目前看来,这一切变得更微妙;
    SC优点
    对于存储空间需求方是几乎没有什么费用的,相当便宜的单价,需求方可以很容易在sc自有区块链找到持续时间26周、50sc/TB或者更便宜的合约;
    SC致命弱点
    对于存储空间需求方来说,最头疼的是同步日益扩大的钱包区块链数据,目前已经超过8个GB,这是个弊病,需求方本是属于自有存储空间很少,还让需求方首先同步几个GB的数据,并且这会越来越大;
    此外,对于存储空间提供商,不仅需要付出购买机器的成本、网费和2000sc的抵押金(collateral),提供商目前还不能获得任何来自合约的收益;
    同时密币之家也注意到,storj在discord上的社区用户活跃度日益减少,sc团队将大量时间用于矿机预售,并且传言说好赠送给购买矿机的用户的T-shirt也没有发货,整个矿机官网除了一种神秘感之外没有任何技术公开,密币之家发现其重大的一次更新仅仅是在原有矿机图片上Photoshop上去一些散热孔;
    sc钱包由于仅仅支持64位系统,对32位系统或ARM架构的IoT设备的支持力度不够;
    损耗,sc的区块链日益不断出现新的区块,自然会不断的周期性读取和写入数据,移动硬盘不到半年基本会罢工,机械硬盘不是红盘,损耗也会很大,这一点可以通过长期I/O读写日志数据来获得证实;
    关于SC在线存储空间提供商也近乎半年多没有任何增长,数据是通过Siahub进行统计,用户可以自行观察,当你的存储提供平台正常上线后,siahub都会显示你所提供的空间信息;
    最后,没有集成内网穿透功能,没有公网ip的用户在sc钱包host界面会显示(红叉)”host is unreachable“或者(黄叉)”host is inactive
    sc正在被很多交易所下架,例如http://www.cryptopia.co.nz,也有很多交易所不再考虑上架sc,例如okex.com
    storj优点
    对于存储空间需求方来说,较为便宜的单价,不需要任何区块链同步(依赖以太坊Ethereum的区块链),使用方便;
    可以使用API进行OSS和FTP存储,有心的用户还可以到Github上寻找一下,社区的一个用户开发了的存储空间需求方具有UI的程序,storj社区极为活跃,技术不断进步,目前提供商的版本也越来越流畅,加入Bridge之后,连接更加稳定;
    storjshare是没有抵押金的,选择硬盘即用,即使你所分享的数据被你丢失(类似于采样定理,只要保持网络节点的一定比例数据冗余率,所有数据都是可恢复的),存储空间需求用户也不会因此丢失数据,你也不会被扣费,快速再次上线即可;
    没有周期性读写硬盘,损耗相对sc减少非常多,即使频繁接收合约数据,一旦完成该合约数据同步,你的平台马上都会进入休眠;
    storjshare正被很多交易所上架,起初只有bittrex参与,后来Poloniex也上架了,更值得注意的是,okex.com最近也将storj上架了。
    storj蹩脚
    很遗憾地是,也因为没有自有区块链进行合约费用算法控制,对于存储空间提供商合约费用支付是通过社区每月中旬集体由storj团队手工发送(打工资?),但团队保证后期会引入mini fee payout算法机制,通过storjshare进行自动实时付费,这一功能将在后期storjshare版本中看到;
    和sc一样,不具有内网穿透功能,bridge的生效必须是你曾经与外网发生了链接,对于没有公网ip用户都会显示Tunnel
  2. 现在给出storj如何进行HDD farming硬盘出租(或许国内第一篇),并不是像百度“storj”出来内容中“简书”上的一个用户所说,storj只针对部分用户开放,而现在storj是对每个人开放的,大家都可以进行参与存储空间分享。
  3. By the way, Siacoin farming,在linux 64位和windows 64位系统中很容易实现,在官网获取具有GUI的钱包之后,完成钱包区块链同步,存入2000个sc,即刻开始分享存储空间或者存储内容到区块链,在IoT设备中,如树莓派,社区的一个用户基于GENtoo 64位linux写入了siacoin钱包,并命名为siaberry,大家有兴趣可以烧录到树莓派,实践一下,siacoin的介绍就到此,资料内容均可在上文找到。

步骤一、Check!

一定在进行下面步骤之前,保证用于storj的平台,已经进行内网穿透或者(拥有公网ip)路由端口转发,二者一定需要做一个,这非常重要,相关内容请看上篇

步骤二、系统

 

(最廉价)方案 1. 树莓派系统

 

storj支持很多系统与架构,甚至IoT设备,如对于树莓派,官方给出了详细的手把手教程,硬件选择也很简单,树莓派+装在硬盘盒子内的机械硬盘(推荐),或者是,树莓派+移动硬盘,长期读写的应用场景不适合使用移动硬盘,鉴于成本考虑,不建议使用SSD,没有必要像官方那样组装硬盘,直接使用硬盘盒子,请自行京东,下面以两块硬盘为例(再次重申,确保你已经进行了内网穿透或者拥有公网ip的用户进行了路由端口转发);

  • 创建硬盘挂载目录和设置访问权限,不能使用root用户,storjshare只能由非root用户使用,例如我们假如使用demo,demo用户拥有sudo权限
  • fdisk对两块硬盘分区之后(略),再进行格式化,命令如下
  • 安装用于聚合存储空间为一个挂载点的mergerfs
  • 使用sudo blkid命令查看机械硬盘UUID号后,修改fstab,使得硬盘能开机自动挂载,注意修改UUID为你自己的号码,以及注意fsname是合并存储空间的挂载点目录
  • 重启后,输入命令df -h能看到如下合并的空间就是正常的了
  • 使用demo用户输入以下命令
  • 上个命令完成后,退出这个命令输入终端Terminal,然后再开启一个新的命令输入终端Terminal,还是使用demo登入,输入以下命令
  • 上个命令完成后,退出这个命令输入终端Terminal,然后再开启一个新的命令输入终端Terminal,还是使用demo登入,输入以下命令
  • npm install命令可能会运行很久,喝一杯咖啡,然后看到结果中有很多黄色ip地址加@的节点信息就证明已经安装成功,下面我们需要使用你自己的storj地址,okex.com上或者myetherwallet可以获得,不能使用其他没有上架storj的交易所或者不支持ERC20的以太坊地址
  • 会得到以下的结果
  • 上句命令也是启动命令,但是我们需要先等等,修改一下配置文件再启动,47cc82204e418626993257eb4c19c6031eb5e569即是你的节点号码nodeID,我们先看看配置文件,别被吓到,其实大部分是解释内容,实际填写很简单
  • 更改一下目录权限,正式进行storjshare运行时这个目录/home/demo/.config/storjshare里面会有三个文件,分别是configs、shares和logs
  • 启动storjshare
  • 常见问题是当输入storjshare start时提示daemon没有启动,但当再次启动daemon又说daemon已经运行,此时通常是由于运行storjshare的用户没有目录权限或者daemon没有存储目录/mnt/s的读写权限造成的,其他问题可以查看日志,正常情况下,你已经可以观看当前状态,命令为storjshare status,下图是二十多个小时后的状态

  • storjshare的常用控制命令有如下,更多命令可以使用help命令发现

(最具扩展性) 方案 2. Linux64位系统

 

密币之家通过多次实践和尝试后,使用了该种方案,树莓派虽然很优秀,但是性能上还是有所欠缺,特别是要进行搭建多项服务时,资源局限性更会凸显

密币之家安装的linux系统为64位ubuntu 16.04LTS版本,上述步骤,完全可以适用,除了挂载硬盘时所用mergerfs聚合硬盘不同,具体可以参看github页面mergerfs,命令为

然后按照方案1的方法成功设置后,输入storjshare status,可以看到

 

由于之前密币之家重装系统,所以时间上只有10天,其实密币之家参与storjshare已经数月有余,上月获得了17个多一点的storj,每月可以到storj社区查看自己storj地址收入多少storj币,社区访问不需要VPN,但是他们的payouts表格是通过google表格进行分享,所以你需要VPN才能访问payouts表格,然后Ctrl+F,查找自己的地址,结算日期为上月1日至上月最后一天,每月中旬进行结算,具体请常常访问社区,如下

 

(最简单) 方案 3. windows系统

 

一般都作为日常工作娱乐的平台,很少会让其24小时开机,所以windows系统方案作为最后推出,但是实现很简单

  • 首先到storj官网(storj.io)下载新版钱包,我们选择win64.exe

  • 安装完成后,需要net time辅助时间同步,微软自带时间同步工具无法满足storjshare的应用,时间同步后在启动storjshare,第一步填地址

  • 选择存储目录后,设置分享的存储空间大小,再选择你的端口,密币之家提前做了内网穿透,然后需要勾选reachable,下步填写你的内网穿透所用域名即可,对于有公网ip用户,填路由所转发的端口,没有绑定公网ip至域名则填写你的公网ip

  • 大功告成!

验证:

需要注意的是:如果你的节点一切正常,但就是没有获得任何Allocs或者Shared,那么首先去https://api.storj.io/contacts/Nodeid,nodeid换成你自己的,本文是47cc82204e418626993257eb4c19c6031eb5e569(非本文作者真实nodeid,仅为举例),那么https://api.storj.io/contacts/47cc82204e418626993257eb4c19c6031eb5e569,点开该链接会获得一个节点信息,里面必须有一项参数response time ,响应时间,如果不存在该项参数,只能回到步骤storjshare create –storj=填写你自己的storj地址 –storage=/mnt/s ,再次重新创建,直到成功为止,这是官方BUG,目前没有修复,这也是Storj官方给出的解决办法,亲测有效。

步骤三、运维

  • 官方推荐了grafana,监控节点的网络数据,其实有更接地气的面板,宝塔面板,bt.cn,Ubuntu/Deepin系统安装命令为

 

 

 

  • 打开数据监控之后,隔几天就能看到有意思的数据出现

步骤四、整合

有了宝塔面板,该平台不仅可以用于storjshare,大家还可以考虑安装一个nextcloud/owncloud在上面,nextcloud为免费使用,有PC平台/手机平台,其他后续内容将在未来公布。

BUILD YOUR OWN ETHEREUM MINING RIG

$
0
0

BUILD YOUR OWN ETHEREUM MINING RIG, PART 1: HARDWARE

Ethereum GPU mining rig testbed.

It’s finally time for an update to my popular 2013 Litecoin mining guide! It’s four years later, and Ethereum mining is where it’s at for GPU miners, so that’s what I’ve focused on. I’ve kept the same format and detail level as my old guide, so if you were around back then, you’ll know what to expect.

If you’re new to the world of crytocurrency mining, this guide should give even an absolute beginner all of the knowledge needed to put together an efficient Ethereum (or other GPU-minable altcoin) mining rig using readily-available consumer hardware.

This guide will be broken into several parts, each focusing on a different aspect of building your first mining rig. First, let’s take a look at what you’ll need in terms of hardware to put a respectable Ethereum miner together.

Build your own Ethereum Mining Rig, part 1:  Hardware

Here is the list of hardware that I recommend. Don’t worry if you’re not able to get exactly what’s on this list, I provide some excellent alternatives below the table.

Motherboard 1 x Asus B250 Mining Expert $180
Processor 1 x Intel Celeron G3900 CPU $45
Memory 1 x 4GB DDR4 DIMM $40
Power Supply 1 x 1200w Platinum PSU $260
GPUs 3+ Radeon RX 570 video cards (*see below) ~$200 each
Boot Device 1 x 60GB SSD -or- USB stick (Linux) $5 – $35
Case 1 x build your own (see bottom) -or- open frame case $30 – $200

Some explanations and alternatives for each item:

Motherboard

Generally, any motherboard with PCIe slots on it is suitable for mining—typically one GPU per PCIe slot. The PCIe slots don’t need to be full-length, as we can attach GPUs to 1x slots with the help of risers. With that said, there are potentially some limitations when you start to pack a large number (4+) of GPUs onto one motherboard, even if that board has enough PCIe slots to physically accommodate them. That’s why picking a suitable motherboard is probably your biggest hardware headache if you want to run as many GPUs as possible in your rig.

My top choice is currently the Asus B250 Mining Expert board. It’s literally made for mining, with support for up to 19 (!) GPUs and 3 power supplies right out of the box. Even if you don’t intend to initially run more than a few GPUs, the included mining-centric diagnostic features and ability to expand later probably make the price premium over less-robust boards worth it.

The ASRock H110 Pro BTC+ is another excellent choice for mining, with support for up to 13 GPUs. However, it currently costs about the same as Asus’s mining board, and for the money I’d rather stick with Asus. If you know that you’ll definitely stick to a single PSU and a small handful of GPUs (e.g.: the majority of us), this is a fine choice, especially if you find a deal on it.

Finally, the Biostar TB250-BTC is also aimed at miners, and costs considerably less than the Asus and ASRock offerings. The Biostar board “only” supports 6 GPUs, but that’s likely all that the majority of us need. If price is your primary consideration, the TB250-BTC should be at the top of your list for 6 GPU rig builds.

If you only want to use 3-4 GPUs in your rig, then you’ll have a much easier time. Most boards with up to four PCIe slots should accommodate a GPU in each. Keep in mind that you can use old hardware that you have sitting around—the board doesn’t have to be recent. I dug out an old ASRock 970 Extreme4 that I used four years ago for litecoin mining, and it still works fine today for up to 4 GPUs (5 is possible with some work). So it’s possible to pick up an ancient board on eBay/Craigslist for nearly nothing and mine with less than 6 video cards.

CPU / Processor

This one is easy: buy the cheapest CPU that works with whatever motherboard you pick. When it comes to mining, the GPUs do all the work. Your CPU will essentially sit idle, so there is no reason to waste money on anything other than the bare minimum.

All of the motherboards that I recommended based on Intel’s LGA 1151 socket, so that means the Celeron G3900is probably the best choice.

If you go with an AMD motherboard, a Sempron CPU will do nicely.

Memory

4GB is fine. Overkill really, at least for Linux. If you have an old 2GB stick (or even 1GB!) sitting around and plan to run Linux, you’re good to go. If you want to run Windows, then 4GB is probably a realistic minimum.

While Ethereum mining is pretty memory-intensive, everything happens on the GPUs. System memory will be pretty much unused, so there is no reason to spend money here, especially with DDR4 prices so high.

PSU / Power Supply

The power supply is extremely important—don’t skimp on it! A good, efficient PSU will keep your electricity costs to a minimum and more than pay for itself over the long run. Seasonic, EVGA, and Corsair are all generally top brand choices. The 1200W unit that I’ve linked may seem like overkill, but power supplies are most efficient when they’re not running near their rated maximum load. A 6 GPU rig will draw about 750 watts (assuming 6x RX 570 cards, properly optimized), which means a 1200W PSU will have sufficient headroom to perform efficiently.

If you’re planning on running only 3-4 GPUs, you can save a bit of money and go for their 850 watt model instead.

GPUs / Video Cards

The top Ethereum mining choice is currently the Radeon RX 570 / RX 580 line*. The RX 570 delivers nearly the same performance as the RX 580 (within 4-7% or so) for a bit less power consumption—they’re essentially equal from an efficiency standpoint. The RX 570 is usually significantly cheaper than the 580, so generally the 570 is the best choice.

Which model to pick, though? While literally any RX 570/580 card will do, the most important thing to look for is memory speed if you want the best performance. Cards with a higher memory clock speed will generally perform a bit better while mining ETH (and can generally be overclocked more). Memory capacity isn’t really important beyond 4GB, so all other things being equal, there is no reason to shell out extra cash for the 8GB version of a card. It’s true that every GPU needs to be able to hold Ethereum’s DAG file in memory, and that file is slowly increasing in size—but it won’t surpass 4GB until late 2019 (and ETH’s switch to PoS will likely occur before then, anyway).

With all of that said, the 8GB versions of the cards tend to have faster-clocked memory than most of the 4GB cards, so if the price difference isn’t too large, spring for whatever is the fastest. Most of the cards fall between 1650 Mhz (6600 Mbps effective) to 2000 Mhz (8000 Mbps effective). The slower 1650 Mhz memory GPUs will hash at 21-23 Mh/s, and the fastest 2000 Mhz ones will do 25-28 Mh/s (both can potentially be pushed higher with BIOS mods and good luck).

The best advice is usually to just pick up whichever 570/580 card you can get your hands on for the least money, as mining speed differences between brands/models are pretty small after optimization. These 8GB MSI RX 570 cards are $220 each as of 11/29/2017, and I’m running mine at 28 Mh/sec without pushing them too hard.

If you can still find old RX 470/480 cards on the secondary market, they’re just as good the RX 570/580 cards that replaced them.

*While my guides deal with setting up and optimizing AMD’s GPUs, nVidia’s 1060 / 1070 video cards are also excellent for mining. Generally these days I tend to recommend whichever is cheaper (and right now, that’s AMD). But if you find a deal on some nVidia 1070 GPUs, don’t hesitate to grab them—they perform just as well as AMD’s offerings, and are arguably easier to set up (just remember to install nVidia drivers instead of AMD’s if you follow the rest of my guide!).

Boot Device

If you plan to run Linux, you can use pretty much anything, including a ~$5 16GB USB stick (we’ll be using Claymore miner, which doesn’t write Ethereum’s DAG file to disk, so we don’t need to worry about wearing a USB stick out due to constantly writing to it, like with the stock ethminer). With that said, SSDs are pretty cheap nowadays and it might be nice to have one in case you want to try Windows at some point.

If you plan to run Windows, then a cheap 60GB+ SSD is your best bet. If you have an old mechanical hard drive laying around, that’ll work fine too.

The Case

I highly recommend against trying to cram a bunch of GPUs into a conventional PC case. You have two realistic options here: buy a purpose-built mining frame, or build something yourself.

The first option is straightforward, if not a bit more expensive. Here is an example of an open-air frame that will accommodate up to 6 GPUs. Here’s another option. You’ll pay a premium going this route, but it’ll save you some time and effort.

Building your own is much cheaper, and (arguably) more fun! If you’re handy, you can put together a simple aluminium frame yourself for a fraction of the cost of buying one. If you don’t have the necessary skills or tools for that, I popularized building mining rigs inside plastic crates back in 2013, and that still works fine today (for up to 4 GPUs or so, anyway). At the bottom of this post, you’ll find instructions on how to build a plastic crate “case”.

Risers & Miscellaneous Stuff

If you’re building your own case (whether it’s from a plastic crate, or aluminium, or something else), you’ll need risers to connect your GPUs to your motherboard. If you’re buying a mining frame, most include risers. Risers tend to be pretty misunderstood among new miners, so here is what you need to know:

  1. Risers can be powered or unpowered. A riser is unpowered if it simply connects a GPU to a motherboard PCIe slot. A riser is powered if it additionally accepts power from the PSU (generally via a molex-type connector). Unpowered risers allow GPUs to receive up to 75 watts of power through the motherboard’s PCIe bus, just as if they were plugged in directly. Powered risers will take that additional power directly from the PSU instead, bypassing the motherboard.
  2. You may mix unpowered and powered risers, but the total number of unpowered risers should not exceed two (this includes GPUs plugged directly into the motherboard)! Motherboards are generally not designed to deliver more than 150 watts of total power through the PCIe bus, so two GPUs on unpowered risers is the safe maximum (2 x 75 watts).
  3. The newer USB-style powered risers often include SATA-to-molex power adapters. Throw these adapters away! SATA plugs are not designed to deliver 75 watts safely, and these can get hot enough to potentially be a fire risk (admittedly, 99% of the time you’ll be fine, but it’s not worth the risk). Instead, connect the molex plugs on the riser directly to your PSU (no more than two risers per PSU plug). Newer versions of these USB risers forego the molex adapter and instead use a PCIe connector for power.

The different PCIe riser types.

I do think the newer USB-style risers are the way to go—they’re longer and easier to work with than the old ribbon-style cables. Here is a 6-pack of USB risers with the newest (and safest) PCIe connectors. It’s always smart to buy an extra or two, as defects are relatively common. If you have older ribbon-type risers laying around, or can get them cheaply, they’ll work just fine.

If you’re building or buying a large frame, you might need extenders for some of your molex plugs and PCIe power plugs.

You’ll also need a power button, unless your motherboard has one built in (which is fairly rare). This will do the trick, or you can build one into your plastic crate if you plan to go that route (see below).

Some people have reported that their rigs won’t boot unless they have a monitor connected, although this seems to be fairly rare (my own rig boots fine without a display attached). If this happens to you, you’ll need a dummy plug.

Building your Mining Rig “Case” from plastic milk crates

(I’ve copied the instructions from my original 2013 guide here and updated them slightly.)

Here is what you’ll need to create a simple DIY plastic crate housing for your miner:

Plastic milk crate (can stack two and put your PSU in the lower one) $10 each
Plastic stand-offs $3
6 x #4 3/8″ wood or metal screws $1
Brace to rest GPUs on (1″ PVC pipe works great!) $2
a few cable ties (8″ or so) $2
power switch & LED (optional) $5

You can get plastic crates in most home improvement stores if you don’t want to ship it from Amazon (it’ll be cheaper, too!). I picked mine up at Lowe’s for under $5 each. You should be able to get everything else on the list at Lowe’s if you happen to have one near you, too. As far as tools go, you’ll need a drill and a knife capable of cutting into whatever plastic crate you buy.

 Assembly Steps:

First, attach your CPU & heatsink/fan to your motherboard, and place your RAM into the memory slot(s). Then follow the general steps below to mount everything into your plastic crate.

Click the images for a close-up look at each step.

  1. Step 1Place plastic standoffs on the bottom of your plastic crate, and rest your motherboard on top of them. Make sure that all of the essential ports are accessible (SATA, USB, keyboard, mouse, etc). Use your knife to cut away pieces of the crate if necessary so that all ports you plan to use are exposed. Then plug your riser cables into the PCI-E slots of your motherboard.
  2. Step 2Place your brace (1″ PVC pipe is really ideal and won’t flex over time) so that it is sitting above the motherboard, high enough for your GPUs to rest on. Cut the brace so that an inch or two sticks out on either end of the crate.
  3. Step 3Drill holes in your brace so that you can secure it with cable ties (see image). Do not simply rest the brace on the crate! An accidental bump can cause it to fall into the crate, along with ~$1000 worth of GPUs if you do that!
  4. Step 4Connect each GPU to it’s corresponding riser cable, resting the bracket end on the lip of the crate and the other end on your brace.
  5. Step 5Screw each GPU down into the lip of the crate. If you drill small pilot holes ahead of time (mark where to drill with a sharpie), this is much easier.
  6. Step 6If you have a power switch and LED, mount them into one of the crate’s corners. I was pretty sloppy with mine, but it’s functional.

 

You’re done! Simply connect everything to your power supply and you should be ready to power your rig on for the first time. If you have a second crate, you can put your power supply in there (along with your harddrive if you’re using Windows), and stack it under your main crate to save some space.

BUILD YOUR OWN ETHEREUM MINING RIG, PART 2: LINUX SETUP

In this second installment of our DIY Ethereum mining guide, we’ll look at how to install and configure Linux to setup your rig as an automated, remotely-manageable appliance. Don’t be dissuaded if you’ve never used Linux before—our step-by-step guide makes it simple!

Why Linux over Windows? First, it’s free—and saving ~$100 on the operating system is a big plus when you’re trying to maximize profitability. Other reasons include lesser hardware requirements (Linux is perfectly happy running from a USB stick plugged into ancient hardware!), simpler remote administration capabilities, and oftentimes better stability. The downside of running Linux is that video driver support isn’t on the same level as Windows, and things like GPU undervolting are trickier (but still possible via BIOS mods).

If you missed the hardware portion of our guide, make sure to check it out first. Otherwise, read on.

Build an Ethereum Mining Rig, part 2:  Linux Setup

The following is heavily adapted from my original 2013 Litecoin mining guide, updated for the latest Xubuntu LTS version, the new AMDGPU-PRO drivers, and necessary ethereum mining software (all up-to-date as of 11/29/2017). If you’re a bit nervous because you’ve a complete Linux newbie, don’t be. Simply follow the step-by-step instructions exactly as they’re written, and you’ll be fine. Even if you’ve never done anything like this before, you should be up and running in roughly an hour.

Step 1: Configure BIOS settings

Before we even get to Linux, let’s take a minute to make sure that your mining computer’s BIOS settings are in order. Power on your computer, and press the “delete” key a few times immediately after power on. You should end up in the BIOS configuration area. Do the following, then save & exit:

  • Change power options so that the computer automatically turns itself on whenever power is restored. The reason for this is two-fold: first, it’ll make sure that your miner automatically starts up after a power outage. Second, it makes powering the computer on much easier if you don’t happen to have a power switch connected to the motherboard.
  • Make sure that your USB stick is first in the boot-up order (you may need to have a USB stick attached).
  • Disable all components that you don’t plan to use. This may save a little bit of power, and since your miner will likely be running 24/7, it’ll add up. For me, that meant disabling onboard audio, one of the SATA controllers, the USB 3.0 ports (I only had a 2.0 USB stick), the Firewire port, and the serial port.
  • If you’re running a lot of GPUs (4+), additional tweaks might be necessary to ensure that they’re all recognized by the OS. Exact tweaks vary by motherboard, but setting the PCIe speed to Gen1 is usually a good place to start. No need to change anything now, but make a mental note that you may need to come back and play around a bit if all of your GPUs don’t show up in the OS later.

Step 2: Install Xubuntu Desktop on your miner

Xubuntu is a lightweight version of Ubuntu, a popular Linux distribution. Most other distros should work just fine, but be aware that the GPU drivers require the presence of Xorg, which means server distros that don’t have a GUI will not work properly.

  • Xubuntu 16.04.3 is the latest LTS release at the time of this guide, so that is what I recommend you use. You can download it here.
  • You’ll need to either write the installation ISO image to a USB stick (highly recommended), or burn it to a DVD. If you use a DVD, you’ll need to temporarily hook up a DVD drive to your mining rig for the installation (make sure you temporarily enable your SATA controller if you disabled it in step 1!).
  • Once you have the installation media prepared, you’re ready to install Xubuntu to your miner’s boot device (whether it’s an SSD, mechanical harddrive, or another blank USB stick). Boot using your new installation media (make sure it’s first in your miner’s BIOS boot order list). The Xubuntu installer should appear.
  • Follow the prompts, and make sure to click the “auto-login” box on the last step of the installer (otherwise, all of the default options are fine).
  • When the installation is complete, you should automatically boot into the Xubuntu desktop. Make sure to remove your installation media.

Step 3: Install SSH and package updates

At the Xubuntu desktop, press CTRL+ALT+T to open a terminal window.

  • Install SSH by typing:
    sudo apt-get install openssh-server

With SSH installed, you can unplug the keyboard/mouse/monitor from your miner, and complete the rest of the installation from your desktop computer. Simply download Putty onto your desktop, run it, and enter the IP address of your mining rig (type ifconfig at the Xubuntu terminal to find your miner’s address if you don’t know it—it will probably look like 192.168.0.x). That should bring up a remote terminal session to your miner, which is more or less just like sitting at the keyboard in front of it.

If you plan to manage your mining rig remotely over the internet, you’ll need to forward port 22 on your router to your miner. Make sure that you use a strong Xubuntu password!

Setup should be pretty quick from this point, as now you can simply copy text from this webpage (highlight it and press CTRL+C) and then paste it into your Putty session by simply right-clicking anywhere inside the Putty window. I highly recommend that you complete the remainder of the guide in this manner, as it eliminates the risk of typos!

  • Install package updates by typing (or copying & pasting via right-click into Putty) the following command:
    sudo apt-get dist-upgrade

Step 4: Install AMDGPU-PRO drivers

Next up, we’ll install AMD’s video drivers. AMD has special blockchain compute drivers available for mining that give far superior performance compared to their standard drivers, so that’s what we’ll be using (version 17.40, which is the latest as of 11/29/2017).

  • Type the following commands (press “enter” and wait for the operation to complete at the end of each line):
    cd ~/Downloads
    wget --referer=http://support.amd.com https://www2.ati.com/drivers/linux/beta/ubuntu/amdgpu-pro-17.40-483984.tar.xz
    tar -Jxvf amdgpu-pro-17.40-483984.tar.xz
    cd amdgpu-pro-17.40-483984
    ./amdgpu-pro-install -y
  • Some of these steps may take a minute or two to complete. When the installation is complete, type the following:
    sudo usermod -a -G video $LOGNAME
  • Next we need to install and configure the ROCm component:
    sudo apt install -y rocm-amdgpu-pro
    echo 'export LLVM_BIN=/opt/amdgpu-pro/bin' | sudo tee /etc/profile.d/amdgpu-pro.sh
  • Finally we need to enable large page support, which will dramatically improve mining performance. Type the following to open your grub file in nano for editing:
    sudo nano /etc/default/grub
  • Find the line that reads GRUB_CMDLINE_LINUX_DEFAULT=”quiet splash”. Modify it to:
    GRUB_CMDLINE_LINUX_DEFAULT="quiet splash amdgpu.vm_fragment_size=9"
  • Save the file and quit nano by pressing CTRL+X and then answering (Y)es to save the changes. When you’re finished, update grub and reboot:
    sudo update-grub
    sudo reboot

The final command will reboot your rig, which will cause you to immediately lose your SSH (Putty) connection. Wait a few seconds to give the computer a chance to boot, and then re-establish a new connection via Putty, and re-login.

Step 5: Install Ethereum software

(Note: you may skip step 5 entirely if you already have an ethereum wallet address that you intend to use!)

Next up, we’ll install the Ethereum software that will let us create a new wallet address. We’ll need this to store the coins we receive from mining.

  • Type the following to install the necessary ethereum packages:
    sudo add-apt-repository ppa:ethereum/ethereum
    sudo apt-get update
    sudo apt-get install ethereum geth
    
  • Now it’s time to create your Ethereum wallet address:
    geth account new

You’ll be prompted to enter a password, and then to confirm it (use a strong password!). The output will be a long string between two curly braces { }. That’s your new wallet address—make a note of it (highlight it within Putty to copy it to your clipboard).

Important: The combination of the password you just used to create this address *and* the associated encrypted key file is what gives you control over your new wallet address. If you lose either of these, you’ve also lost control of your wallet and all of the coins associated with it—and there is literally nothing that anyone will be able to do to help you. Remember your password, and keep multiple backups of your key file(s)!

Your key file(s) are stored in the ~/.ethereum/keystore directory. Copy the entire /keystore folder someplace safe to backup your wallet (backups are covered in more detail heredon’t forget to make multiple backups and keep them in a secure offline location!).

If you forget your wallet address, you can type geth account list to see your addresses and the location of their key files.

Step 6: Install Claymore’s Ethereum miner

There are several options as far as mining software, and I’ve experimented with all of the popular ones. I think Claymore’s miner is the best option, even if it does have two fairly significant downsides: it’s closed-source, and it’s not free (~1% of your mining time benefits the creator of the miner).

Two alternatives are the stock ethereum miner (ethminer) and Genoil’s fork of the stock miner. They’re both open-source and free, but they have pretty crippling downsides.

The stock ethminer is much slower than Claymore’s miner (by a margin of over 5% on my test rig). In addition, ethminer creates the Ethereum DAG file on disk instead of in GPU memory, which is slow and uses a lot of space (and if you’re running off a USB stick, all those writes may eventually wear it out).

Genoil’s fork seems to be nearly as fast as Claymore’s, and it doesn’t use physical disk space for the DAG, but it’s not stable (at least not for me). It often crashes, especially on startup (whereas I have yet to see a single crash on Claymore’s miner after nearly a week of full-time mining). The author abandoned development months ago, so improvements are unlikely.

So, explanation aside, here is how to setup Claymore’s miner:

  • First return to your downloads directory and grab the latest version (10.2 as of 11/29/2017). I’m pulling the file directly from the author’s Google Drive repository, if the link is broken check here for a newer release or updated link):
    cd ~/Downloads
    sudo apt install curl
    curl -L -o claymore_10.2_miner.tar.gz https://drive.google.com/uc?id=1t25SK0lk2osr32GH623rR8aG2_qvZds9
    
  • Then create a new directory for it, and unpack it there:
    sudo mkdir /usr/local/claymore10.2
    sudo tar -xvf claymore_10.2_miner.tar.gz -C /usr/local/claymore10.2
    
  • Then let’s head over to the installation directory and create a startup script. Note that commands 2-5 below just clean up the installation directory a bit by removing an intermediary directory that was included in the original tar archive:
    cd /usr/local/claymore10.2
    cd Clay*
    sudo mv * /usr/local/claymore10.2
    cd ..
    sudo rm -r Clay*
    sudo chown root:root ethdcrminer64
    sudo chmod 755 ethdcrminer64
    sudo chmod u+s ethdcrminer64
    sudo nano mine.sh
    
  • Nano will open a new blank text file; enter the following into it:
    #!/bin/sh
    export GPU_MAX_ALLOC_PERCENT=100
    ./ethdcrminer64 -epool eth-us-east1.nanopool.org:9999 -ewal YOUR_WALLET_ADDRESS/Miner01 -epsw x -mode 1 -allpools 1 -tt 68
    

    Where it says YOUR_WALLET_ADDRESS, use the address you created in step 5 (you’ll need to put “0x” in front of it). The “Miner01” following your address can be changed to any friendly label that you want to give your miner (only important if you plan to run multiple rigs). It’s easiest to copy the last line from my guide into something like notepad, then replace YOUR_WALLET_ADDRESS with your actual address there, and then copy the finished line into putty via right-click to get everything into nano without typos.

  • Save the file and quit nano by pressing CTRL+X and then answering (Y)es to save the changes, then enter the following to give your new script execute permission:
    sudo chmod +x mine.sh

Note that I’m using nanopool.org as the mining pool here. I’ve tried a few, and it seems to be a top pick, but feel free to pick your own pool. Most don’t require registration, and simply payout to whatever wallet address you supply whenever a certain threshold is met (usually whenever you accumulate 1+ ETH). Assuming you stick with Nanopool, you’ll be able to check on your miner’s status by going to this URL after you start mining: https://eth.nanopool.org/account/%5BYOUR WALLET ADDRESS]

  • Now is a good time to test things. You can fire up your miner by typing:
    ./mine.sh

You should see the Claymore miner start up. It’ll take a minute or two before it actually starts mining, but it should get there eventually. When you see a scrolling log of outputs that includes non-zero hashrates (expect hashrates in the low to mid 20s for unoptimized GPUs), you’re good to go. If the script fails to start, or you see errors, make sure that you’ve created the script exactly as outlined in the guide.

Press CTRL+C to exit the miner when you’re satisfied that it’s working.

Step 7: Create auto-start scripts

We’re almost done! We want to set up our rigs automatically start mining whenever the rig is powered on. That way, we keep mining losses to a minimum whenever a power outage occurs, and we don’t have to worry about manually starting it back up in other situations.

  • First, install screen:
    sudo apt install screen
  • Then type the following to create a new script in your home directory and open it in nano:
    cd ~
    sudo nano miner_launcher.sh
  • Enter the following text into the editor (substitute your actual Xubuntu username for YOUR_XUBUNTU_USERNAME where necessary!):
    #!/bin/bash
    DEFAULT_DELAY=0
    if [ "x$1" = "x" -o "x$1" = "xnone" ]; then
       DELAY=$DEFAULT_DELAY
    else
       DELAY=$1
    fi
    sleep $DELAY
    cd /usr/local/claymore10.2
    su YOUR_XUBUNTU_USERNAME -c "screen -dmS ethm ./mine.sh"
  • Save and quit nano (CTRL+X), and then type:
    sudo chmod +x miner_launcher.sh
  • Now we need to call our new script during startup; we do that by adding it to /etc/rc.local. Type the following to open /etc/rc.local in nano:
    sudo nano /etc/rc.local
  • Add the following text, right above the line that reads “exit 0” (substitute your own username!):
    /home/YOUR_XUBUNTU_USERNAME/miner_launcher.sh 15 &

Then save and quit out of nano (CTRL+X).

Step 8: Create an alias to easily check on the Claymore miner process

We’re essentially done at this point, but you’ll probably want to manually SSH into your miner from time to time to manually check on your hashrates & GPU temperatures, etc. Creating an alias will make that easy.

  • Type:
    sudo nano .bashrc
  • Scroll to the end of the file, and then add this text above the line that reads “# enable programmable completion…”
    alias miner='screen -x ethm'
  • Save and quit out of nano.

That’s it—you’re done! You’ll probably want to run a full test now. The easiest way to do that is to close your Putty session and power down your miner. Turn it back on and the following should happen:

  1. Your miner should boot into Xubuntu. This may take up to a minute, depending on the speed of your boot device (it’ll be much faster on an SSD).
  2. 15 seconds after Xubuntu has loaded, the Claymore miner will automatically start and begin mining. You might notice the fans on your GPUs spin up a bit when this happens.
  3. You should be able to SSH into your miner at any time and type miner to monitor the miner’s process. To close the screen (but keep the miner running), press CTRL+A, then CTRL+D.
  4. If you ever need to start the Claymore miner manually (because you quit out of it, or kill it, etc), simply type ~/miner_launcher.sh

(update 1/15/2018: **IMPORTANT** please read this if your hashrate is lower than expected!)

Congratulations—you have your own headless linux ethereum miner!

The next section of this guide covers setup under Windows, and then we’ll take a look at optimizing miner settings for better performance.

BUILD YOUR OWN ETHEREUM MINING RIG, PART 3: WINDOWS SETUP

Ethereum & WindowsNo doubt some of you saw the Ethereum mining guide for Linux that I published last week and balked at all of that “command-line nonsense”. Linux isn’t everyone’s thing, and that’s ok—if Windows is your OS of choice, then this guide is for you!

While Linux offers some significant advantages when it comes to GPU mining, Windows does have one potentially important edge: undervolting your GPUs currently requires quite a bit less effort under Windows. If you want your mining rig to run at its maximum efficiency, you’ll want to keep power consumption to a minimum, and with Linux that generally requires flashing a custom BIOS to each GPU—whereas in Windows you can usually accomplish this at the driver level with a simple software setting.

The bad news is that if you want maximum performance out of your rig, you’ll probably eventually want to flash your GPU BIOS under either operating system, but we’ll get into that in part 4 of this guide. But if you already know that overwriting your GPU BIOS with a custom replacement is outside of your comfort zone, then sticking with Windows will at least allow you to undervolt.

So with all of that in mind, if Windows sounds like the best option for you, read on for our setup guide!

Build an Ethereum Mining Rig, part 3: Windows Setup

I won’t go into quite the same excruciating level of detail as I did with my Linux guide, as it’s probably a safe assumption that anyone reading a guide about building a custom cryptocurrency mining rig is already quite comfortable with basic Windows tasks. The steps outlined below should be more than adequate for the average Windows user, but feel free to leave comments if anything is unclear!

Step 1: Configure BIOS Settings

Before we even get to Windows, make sure your mining computer’s BIOS settings are in order. Power on your computer, and press the “delete” key a few times immediately after power on. You should end up in the BIOS configuration area. Do the following, then save & exit:

  • Change power options so that the computer automatically turns itself on whenever power is restored. The reason for this is two-fold: first, it’ll make sure that your miner automatically starts up after a power outage. Second, it makes powering the computer on much easier if you don’t happen to have a power switch connected to the motherboard.
  • Disable all components that you don’t plan to use. This might save a little bit of power, and since your miner will likely be running 24/7, it’ll add up. For me, that meant disabling onboard audio, the USB 3.0 ports, one of the SATA controllers, the Firewire port, and the serial port.
  • If you’re running a lot of GPUs (4+), additional tweaks might be necessary to ensure that they’re all recognized by the OS. Exact tweaks vary by motherboard, but setting the PCIe speed to Gen1 is usually a good place to start. No need to change anything now, but make a mental note that you may need to come back and play around a bit if all of your GPUs don’t show up in the OS later.

Step 2: Install Windows 10

Any 64-bit edition of Windows 10 should work fine (a 32-bit OS is not capable of running the Ethereum mining software). Windows 7 and 8 will work as well (as long as they’re 64-bit versions), although you may need to do a bit of extra work to recognize all of your GPUs if you’re running more than 4. The guide is written assuming that you have Windows 10, but the steps for 7/8 should be pretty similar.

I’m going to assume that everyone reading this is capable of installing a fresh copy of Windows. Complete the installation and boot into the Windows desktop before proceeding to the next step. If necessary, also install the LAN/Ethernet driver that came with your motherboard so that you can get online.

Step 3: Configure automatic login

If you’re building a dedicated mining rig, then you probably want your mining rig to boot up and start mining automatically, without any user intervention. We’ll need to enable auto-login for that to be possible.

  • Right-click on the Start Menu and select “Run”. Type “netplwiz” (without the quotes) at the prompt, and click “ok”.
  • Uncheck the box that says “Users must enter a user name and password to use this computer”.
  • Click “Apply”. You’ll be prompted to enter your password to confirm the change.

Step 4: Change power settings to prevent sleep

By default, Windows will go to sleep after 30 minutes without user interaction. Obviously, we don’t want that behavior on our mining rigs. To disable it:

  • Right-click the Start Menu -> Control Panel -> System & Security -> Power Options.
  • “Balanced” should be selected. Click on “Change plan settings” next to it.
  • Change “Put the computer to sleep” to “Never”, then click “Save changes”.

Step 5: Minimize unscheduled reboots due to Windows Updates

Windows 10 introduced forced updates as a pretty controversial “feature”, and not having control over when your mining rig is rebooted to install OS patches could be frustrating. We’ll be setting things up so that your mining rig automatically begins mining any time Windows boots, so leaving automatic updates in place certainly wouldn’t be disastrous if you want to skip this section. But if you’d prefer to retain control over downtime, here are some workarounds:

Keep in mind that if this is a fresh install of Windows, it’s a good idea to let the OS install any available updates first (right-click start -> settings -> windows update -> check for updates).

Step 6: Allocate at least 16GB of virtual memory

The author of the mining software that we’ll be using recommends this step, although I’ve never encountered issues with a smaller pagefile (edit 4/19/17: I tried mining on a machine with only 4GB of physical RAM and got terrible performance until I increased my pagefile to 16GB). Here’s what you need to do:

  • Right-click the Start Menu -> System -> click “change settings” on the right side of the window (if you don’t see “change settings”, click “system info” first)
  • Click on the “Advanced” tab, then in the “Performance” area, click “Settings”
  • Click the “Advanced” tab, then click “Change” in the area labeled “Virtual Memory”
  • Uncheck the box at the top that says “Automatically manage paging file size for all drives”, then click on the “Custom Size” radio button.
  • Enter “16384” (without the quotes) in both the Initial and Maximum size fields, then click “Set”. You’ll need to reboot for the change to take effect.

Step 7: Disable unnecessary Windows visual effects

On systems with borderline hardware, this may increase performance a bit and help keep the OS a bit more responsive during mining:

  • Right-click the Start Menu -> System -> click “change settings” on the right side of the window (if you don’t see “change settings”, click “system info” first)
  • Click on the “Advanced” tab, then in the “Performance” area, click “Settings”
  • On the “Visual Effects” tab (which should be open by default), click on the radio button labeled “Adjust for best performance”, then click “Apply”

Step 8: Install AMD GPU drivers

AMD offers special mining-specific “blockchain compute” drivers that deliver considerably more performance than their standard drivers, so that’s what we’ll be using. If the computer that you’re installing to will not be a dedicated mining rig (eg: you plan to also play games on it, etc), you may prefer to use the latest available standard driver.

It’s ok to simply pick all of the default options during installation. Skip including ReLive when asked, as we don’t need it.

Reboot after the driver installation is complete.

Step 9: Generate a wallet address

You can skip this section if you already have an Ethereum wallet address. Otherwise, you’ll need to create one to mine with. There are many ways to generate your own wallet address, but I’ll show you how to do it using the official open-source Ethereum software. Be wary about trusting other methods, as some online creation tools are potentially scams designed to later steal your coins.

  • Download the latest release of Geth for Windows here.
  • When the download is finished, run the installer and select all of the default options.
  • Open a command prompt window (right-click the Start Menu -> Command Prompt).
  • Type the following to switch to the Geth installation directory (assuming you installed it in the default location):
    cd \Program Files\Geth
  • Type the following to create a new wallet address:
    geth account new

If you see a warning about starting the Ledger hub here, you can ignore it. You’ll be prompted to enter a password, and then to confirm it (use a strong password that you won’t forget!). The output will be a long string between two curly braces { }. That’s your new wallet address—make a note of it. You can easily copy it by right-clicking anywhere in the command prompt window, selecting “Mark”, highlighting your new address by holding left-click and dragging the mouse over the entire address, and then right-clicking again to copy to your clipboard. From there, you can paste your address anywhere using standard Windows shortcuts (CTRL+V).

Important: The combination of the password you just used to create this address *and* the associated encrypted key file is what gives you control over your new wallet address. If you lose either of these, you’ve also lost control of your wallet and all of the coins associated with it—and there is literally nothing that anyone will be able to do to help you. Remember your password, and keep multiple backups of your key file(s)!

Your key file(s) are stored in the %APPDATA%\Ethereum directory. For a fresh Windows 10 install, that means the C:\Users\[YOUR WINDOWS USERNAME]\AppData\Roaming\Ethereum\keystore folder (note that the AppData folder is hidden by default). Copy the entire keystore folder someplace safe to backup your wallet.

If you ever forget your wallet address, you can open a command prompt, return to your Geth installation folder, and type geth account list to see your addresses and the location of their key files.

Step 10: Install Claymore’s Ethereum miner

I talked about my reasons for selecting Claymore’s miner over other alternatives in my Linux guide, but to sum up: it’s currently the fastest, most stable Ethereum miner that’s still under active development. The downside is that it’s not free—about 1% of your mining time will benefit the creator of the software instead of you. However, even after the usage fee, you’ll come out ahead compared to the alternatives.

  • Download the latest version of Claymore’s ETH miner (v10.2 at the time of this post). Make sure to get the .zip file and not the Linux tar (also check here for newer releases)!
  • Extract the downloaded archive into a folder on your mining computer.
  • Open the folder where you extracted the miner, and create a new text file called “mine.bat” (you can use notepad for this).
  • Enter the following text into your mine.bat file exactly as written (but do make sure to substitute your own wallet address—see note below):
    timeout /t 15
    setx GPU_FORCE_64BIT_PTR 0
    setx GPU_MAX_HEAP_SIZE 100
    setx GPU_USE_SYNC_OBJECTS 1
    setx GPU_MAX_ALLOC_PERCENT 100
    setx GPU_SINGLE_ALLOC_PERCENT 100
    ethdcrminer64.exe -epool eth-us-east1.nanopool.org:9999 -ewal YOUR_WALLET_ADDRESS/Miner01 -epsw x -mode 1 -allpools 1

    pause

Where it says YOUR_WALLET_ADDRESS, use the address you created in step 9 (you’ll need to put “0x” in front of it). The “Miner01” following your address can be changed to any friendly label that you want to give your miner (only important if you plan to run multiple rigs).

Note that I’m using nanopool.org as the mining pool here. It’s a fairly typical ETH pool that seems to have good reliability, but feel free to pick your own pool. Most don’t require registration, and simply payout to whatever wallet address you supply whenever a certain threshold is met (usually whenever you accumulate 1+ ETH). Assuming you stick with Nanopool, you’ll be able to check on your miner’s status by going to this URL after you start mining: https://eth.nanopool.org/account/%5BYOUR WALLET ADDRESS]

Save and close notepad when you’re done.

Now is a good time to perform a quick test. Simply double-click your mine.bat file to launch the miner. It’ll take a minute or two before it actually starts mining, but it should get there eventually. When you see a scrolling log of outputs that includes non-zero hashrates (expect hashrates in the low to mid 20s for unoptimized GPUs), you’re good to go. If the script fails to start, or you see errors, make sure that you’ve created the script exactly as outlined in the guide.

Press CTRL+C to exit the miner when you’re satisfied that it’s working.

Step 11: Configure your miner to start automatically

We want our rig to automatically start mining whenever it’s powered on or rebooted. That way, we keep mining losses to a minimum whenever a power outage occurs, and we don’t have to worry about manually starting it back up in other situations.

  • Open Windows Explorer and navigate to the folder where you created “mine.bat” in the previous step.
  • Right-click on your mine.bat file, and pick “Copy”.
  • Now, navigate to %AppData%\Microsoft\Windows\Start Menu\Programs\Startup (should be something like C:\Users\[YOUR WINDOWS USERNAME]\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup).
  • Right-click anywhere on the empty background of the Startup folder and select “Paste shortcut”.

You should see a shortcut to your mine.bat file appear in the startup folder. Windows should automatically execute it upon bootup.

At this point, we’re done with the essentials. If you’ve done everything correctly, you should be able to reboot and watch your rig automatically start mining shortly after the Windows desktop loads. There are a couple more steps that may be important to you, though.

Step 12 (optional): Optimize clock speeds and undervolt (basic)

We’ll get into more advanced optimization in the next section of this guide, but as long as we’re on Windows, it doesn’t hurt to see what we can accomplish via some basic driver setting adjustments. We should be able to squeeze out some extra performance on most RX 470/480 cards and save a bit of power without venturing into the realm of BIOS mods.

  • Open the Radeon Settings app. There should be an icon for it in your system tray. If not, it’s located here: C:\Program Files\AMD\CNext\CNext\RadeonSettings.exe
  • Click on the “Gaming” tab at the top left.
  • Click on the “Add” button near the top right, then click “Browse”.
  • Navigate to the folder where you installed Claymore’s miner, select “EthDcrMiner64.exe”, and then click “Open”.
  • You should see a new profile appear on the Radeon Settings App window labeled “EthDcrMiner64”. Go ahead and click it.
  • Click on the “Profile OverDrive” tab.

AMD's WattMan

You should see something that looks like the image on the left (click for full-size). I’ve cropped in on the two areas that we’re interested in (they’re labeled “GPU” and “Memory”). Find them and start by setting the Frequency to “Dynamic” and the Voltage Control to “Manual” in both areas.

Before we go any further, I’ll just throw out this disclaimer: changing the factory voltage settings on your GPU can result in system instability, crashes, and/or damage. Proceed at your own risk! Honestly, the risk here is tiny—we’re still constrained to basically safe values by AMD’s software, and in the case of a crash we’ll just reboot and be back to factory settings (where we can try again with less-aggressive values).

We’re aiming to accomplish three things here:

  1. We want to lower the core clock speed as low as possible without impacting performance.
  2. We want to increase the memory clock speed as high as possible without impacting stability.
  3. We want to lower both the core and memory voltage as low as possible without impacting stability.

Before we go changing any values, if you haven’t run your miner at stock settings already for a few minutes to get a decent idea of its baseline performance, now is a good time to do that. Look for output along the lines of “ETH: GPU0 XX.XXX Mh/s” while Claymore’s miner is running. There will be some variance from line to line, but that XX.XXX number is the hash rate for that individual GPU. When you have a good idea of your average hash rate, close the miner—it’s time to start making some changes!

  • Start by decreasing your core clock speed to 1000 mhz from whatever the factory setting was (in the “GPU” area, change the values for state 6 and 7 to 1000 on the Frequency row). Click “Apply” (at the top right). Restart your miner and see how performance looks. There is a good chance that it’s unchanged. If that’s the case, repeat the process, but decrease the core clock speed by another 50 mhz or so. Keep moving down in 50 mhz increments until you notice mining performance drop. When that happens, bump the core clock back up to the previous value—that’s the sweet spot.
  • We’re going to basically do the reverse with the memory clock speed, but there are some important things to know. If you have a GPU that is factory-clocked at 1750 mhz or less (virtually every 4GB RX 470/480 GPU, and most RX 470 8GB GPUs as well—the Sapphire Nitro being the notable exception—then 1750 mhz is going to probably be your limit via this method. Increasing the memory clock beyond 1750 mhz will likely result in a change to less-aggressive memory timings that will result in a loss of performance, and there is no way to prevent this outside of BIOS modifications. So if you have a card clocked at under 1750 mhz, bump it up to exactly 1750 mhz, which will give you a decent performance boost. If you have a 2000 mhz card, you can increase it incrementally, like the reverse of what we did with the core clock. Eventually you’ll experience system instability: artifacts on the screen, a GPU crash, bluescreen, etc. When that happens, back down a bit until things are stable.
  • When you’re satisfied that you’ve found the sweet spot for both clock speeds, it’s time to lower voltages. This is pretty straightforward: drop values 25 mV at a time until you experience instability, then bump it back up to last stable value. You should be able to reduce your power consumption a fair bit this way without impacting performance at all (these are great if you want to measure your electricity usage at the wall).

While more significant performance gains are possible by flashing a custom GPU BIOS (which I’ll cover in the next part of this guide), you should at least be able to realize some significant power savings (which has the added benefit of lowering GPU temperatures as well).

The screenshot in this section is from a factory-clocked 1650 mhz 4GB RX 470 GPU. Feel free to use the settings pictured as your starting point if you have a 4GB GPU, I haven’t found any cards that aren’t stable at these settings yet; most go a bit lower on the voltages.

 Step 13 (optional): Configure remote administration

Configuring remote administration will allow you to disconnect the monitor, keyboard, and mouse from your mining rig and manage it from another computer—even over the internet, if you wish. Windows 10 Professional and up have the built-in option to use Remote Desktop, although it’s disabled by default and must be configured. It’s a fine option if you’re looking for something basic and don’t want to install additional software.

There are a host of other options available, if you’re on a Home edition of Windows and/or want something a bit more robust. I recommend TightVNC: it’s lightweight, simple, cross-platform, and free. Here are the basic setup instructions for TightVNC:

  • Download TightVNC.
  • Install TightVNC on your mining rig. Choose a custom installation and make only the server portion of the application available.
  • Now install TightVNC on the other computer(s) that you plan to manage your rig with. Choose a custom installation and make only the client portion of the application available.
  • If you plan to manage your miner across the internet, forward port 5900 on your router to your mining rig (make sure you choose a strong password if you do this!).

That’s it—you’re done! You’ll probably want to test everything now. The easiest way to do that is to power down your miner. Turn it back on and the following should happen:

  1. Windows should boot up as usual.
  2. You should see a 15 second countdown to the Claymore miner’s launch shortly after the Windows desktop appears.
  3. After the countdown, the miner will start, and your GPUs should start mining.
  4. You should be able to VNC into your rig at any point after the desktop loads to monitor your miner’s progress and GPU temperatures.
  5. If you ever need to start the Claymore miner manually (because you quit out of it, or it crashed, etc), simply double-click your mine.bat file, located in your Claymore miner installation folder.

Congratulations—you have your own headless windows Ethereum miner!

The screenshot above shows a single 4GB RX 470 mining at the settings pictured in section 12. I was able to get about a 10% performance gain over factory settings while reducing power consumption at the same time. That’s good, but we can do better (sometimes much better!) if we’re willing to venture into the world of GPU BIOS mods—and I’ll show you how to do exactly that in the next section of my guide.

BUILD YOUR OWN ETHEREUM MINING RIG, PART 4: OPTIMIZATION

This fourth installment of our Ethereum mining guide will focus on optimizing your rig’s performance via GPU clock speed and voltage setting tweaks to achieve maximum efficiency.

The tweaks that I outline in this article are applicable whether you’re using Linux or Windows. If you’re using the hardware that was recommended in the first part of this guide (or very similar hardware), you should expect to achieve Ether mining performance gains of 20-25%, compared to stock settings! At the same time, you’ll reduce power consumption by 10-15% (and consequently, lower GPU temperature and fan noise).

More speed for less power—how is that possible? Click “read more” to find out, in our mining performance optimization guide!

 Build an Ethereum Mining Rig, part 4: Optimization

Let’s get the bad news out of the way up front: achieving these levels of performance gain require flashing your GPU BIOS with custom replacements. Doing this incorrectly may leave you with a non-working GPU that can be difficult or (sometimes) impossible to restore to factory settings. The steps that I outline in my guide will show you how to minimize the risk that you end up with a bricked GPU, but always remember that messing around with BIOS settings can potentially result in unstable hardware.

Disclaimer: Installing a custom BIOS and/or changing factory clock speed & voltage settings on your graphics card(s) may cause system instability, may harm your hardware, and probably invalidates your warranty. I assume no responsibility for hardware damage if you choose to follow this guide!

With that said, I’ve flashed probably close to a hundred GPUs, and I haven’t destroyed any hardware yet. =) If you proceed, just make sure to follow the steps in order, don’t take any shortcuts, and stop if there is anything that you’re confused or unsure about.

What you’ll need

There are ways to create and flash custom BIOS mods to your GPUs without some of these things, but I believe this method is by far the most user-friendly:

  • A computer running Windows
    You’ll flash your GPUs with this computer. My mining rigs run Linux, but I keep a small/cheap SSD loaded with Windows 10 handy for testing/BIOS flashing purposes (I simply swap the SATA connector between disks when I want to switch OSes). Any version of Windows 7, 8, or 10 will work fine (note that you don’t have to activate Windows to install it). Or, you can simply temporarily move your GPUs to another computer running Windows to flash them.
  • ATIFlash / ATIWinFlash
    You can download the latest version of ATIFlash here (v2.74 at the time of this article). We’ll use this to read and write BIOS files to our GPU hardware.
  • Polaris BIOS editor
    You can download the latest version of Polaris BIOS editor here (v1.4.1 at the time of this article). We’ll use this to modify BIOS files.
  • ATI Pixel Clock Patcher
    You can download the latest version of ATI Pixel Clock Patcher here (v1.4.5 at the time of this article). We’ll need this to get AMD’s Windows driver to recognize a modded BIOS.
  • Kill-a-Watt electricity usage monitor (or similar device)
    Not strictly required, but I highly recommend this—it’ll pay for itself! I have two of these and consider them invaluable in dialing in the performance of my mining rigs. When doing optimization tests, I often find that the last few percentage points of speed gain come at a much larger cost in power consumption (and thus, a decrease in overall profitability)—having an electricity monitor allows me to find the efficiency sweet spot between raw speed and electricity usage.
  • Some baseline information on each of your GPU’s factory performance to compare your modifications against. If you haven’t already, let each GPU run for 5+ of mining and record its speed, temperature/fan speed, and power consumption at the wall (assuming you have a Kill-a-Watt). This will be immensely useful later when trying to figure out if your mods are beneficial or not.

From this point on, I’m going to assume that you’re following directions on a Windows computer with the above software available, ideally with a Kill-a-Watt connected for testing. I’m also going to assume that you have a single GPU installed. If you have multiple GPUs, I highly recommend that you disconnect all but one, and work on them one at a time. All of the software does support multiple GPUs, but you’ll keep confusion and the potential for mistakes to a minimum by only connecting one video card at a time. The times that I’ve made mistakes with BIOS flashing, it has always been because I flashed the wrong card due to having multiple GPUs connected!

Step 1: Make a backup of your factory GPU BIOS

Saving your GPU BIOS with ATIWinFlashBefore we start, open your Radeon Settings and disable any overclocking/undervolting that you have set up through WattMan (if you followed my Windows setup guide, you’ll need to temporarily disable the “EthDcrMiner64” profile that you created in step 12). After that:

  • Open ATIWinFlash (extract the .zip file you downloaded and double-click ATIWinflash.exe).
  • You should see your GPU detected at the top under “System Video Devices”. Again, I highly recommend that you have only a single GPU connected for this entire process!
  • Click “Save” to make a backup of your GPU’s BIOS data. Don’t lose this file!

Your computer might appear to freeze for a few seconds while your GPU BIOS data is being saved—this is normal. When ATIWinFlash is done, you can close it for now.

Step 2: Open your GPU’s factory BIOS with Polaris BIOS editor

Here is where we’re going to be making all of our modifications. Editing the BIOS data gives us access to a few values that we normally wouldn’t have any control over—most importantly, the memory timing values.

  • Open Polaris BIOS Editor (extract the .zip file you downloaded and double-click PolarisBiosEditor.exe).
  • Click “OPEN BIOS” in the top left, then browse to where you saved your GPU’s factory BIOS in step 1, and double-click it to open it.

You should see something like the image below (click for full-size). I’ve highlighted the areas that we’ll be modifying in blue—if you stick to these areas, you’ll generally be safe from getting yourself into too much trouble, as the GPU doesn’t enter these states until it’s mining or otherwise working hard. Note that the first entries in the “GPU” and “Memory” section are outside of the blue area and should never be touched unless you absolutely know what you’re doing. Likewise, the memory timings at 1500mhz and below should usually be left at default settings.

Factory BIOS in Polaris BIOS editor
My screenshot shows the default BIOS from an Asus 1650mhz factory-clocked RX 470 4GB GPU. If you have a 4GB RX 470, it should look pretty similar, although many of the values will likely differ by a small amount. At these factory settings, I get around 20 Mh/s in Claymore’s Ethereum miner, which isn’t spectacular.

If you don’t see memory timing values for your card, try this version of Polaris instead (click the “clone or download” button, then “Download ZIP”).

When you’re comfortable, let’s move on and start modifying some values.

Step 3: Modify BIOS memory timing values

At this point, you should still have Polaris BIOS editor open, with your GPU’s factory default BIOS loaded. We’re going to focus on the lower-right corner area containing memory timings.

If you have a RX 470/480 that has memory clocked at 1750mhz or less (eg: most 4GB cards), you may have noticed that it’s really easy to overclock past 1750mhz via the driver (in Windows, anyway). You probably also noticed that mining performance immediately tanks as soon as you do so: a 1751mhz overclock results in much slower performance than 1750mhz. You may have wondered why, and these memory timings are the answer. On most 4GB cards, the GPU switches over to less aggressive memory timings at clock speeds beyond 1750mhz, which results in slower performance even though the absolute clock speed is higher. We’re aiming to fix that.

This isn’t an exact science, and some experimentation may be necessary for you to achieve optimal results, but what follows is a good starting point and should work for 99% of you:

  • If you have a RX 470/480 that is factory clocked at 1750Mhz or less (eg: nearly all 4GB cards):
    Copy the value in the 1500Mhz field, and then paste it into all of the fields after it (1625mhz, 1750mhz, 2000mhz). The easiest way to do this is to click anywhere inside the 1500mhz value, then press CTRL+A to highlight the entire string, and then press CTRL+C to copy it. Then you can simply click into the remaining fields and press CTRL+A followed by CTRL+V to paste over the existing value.
  • If you have a RX 470/480 that is factory clocked at 2000Mhz or more (eg: nearly all 8GB cards):
    This is a bit trickier, but generally most cards will be most stable by simply copying the value in the 1750mhz field into the 2000mhz field. The easiest way to do this is to click anywhere inside the 1750mhz value, then press CTRL+A to highlight the entire string, and then press CTRL+C to copy it. Then you can simply click into the 2000mhz field and press CTRL+A followed by CTRL+V to paste over the existing value.

Once you’ve made the edit that is appropriate for your GPU, click on the “SAVE AS” button located at the top left. Save your modded BIOS with a new name (don’t overwrite your factory BIOS!), and then close the Polaris editor when you’re done.

Step 4: Flash your modified BIOS back to your GPU

Flashing your GPU BIOS with ATIWinFlashNow it’s time to write your custom BIOS back to your hardware. This can be a little scary if you’ve never attempted anything like this before, but generally if you’ve followed the steps as written, you shouldn’t have any issues. Again, there are no absolute guarantees, so proceed at your own risk!

  • Open ATIWinFlash back up.
  • Click on the “Load Image” button and select the modded BIOS that you created in step 3.
  • Click on the “Program” button to write the BIOS to your GPU. Your computer may appear to freeze for what might seem like a long time—this is normal.
  • You’ll be prompted to reboot when ATIWinFlash finishes. Don’t reboot yet—we have one more thing to do. Go ahead and close ATIWinFlash, though.
  • Unzip the ATI Pixel Clock Patcher utility that you downloaded and double-click atikmdag-patcher.exe. It should offer to apply a patch, let it. You only need to do this step once per GPU, even if you flash it multiple times. If you skip this step, when your computer reboots, the AMD display driver will refuse to load because it’ll detect that your GPU BIOS has been tampered with it.
  • Go ahead and reboot after the patch is applied.

If you’ve done everything correctly, your computer should boot normally, and you’ll arrive back at the Windows desktop, ready to test your changes.

Step 5: Test your modified GPU BIOS

Now is a great time to fire up your miner and see what kind of difference your changes made.

If you have a 4GB card, the timing change alone should be enough to get you from ~20 Mh/s to ~24 Mh/s. If you have a 8GB card, you likely went from ~24 Mh/s to ~28 Mh/s. We can do better, but that’s a pretty good start!

Power consumption will be unchanged (or even up slightly, due to the more aggressive timings), but we haven’t touched voltages yet.

Once you’ve recorded your GPU’s new metrics (speed, temperature/fan speed, power usage), we can move on.

Step 6: Find appropriate clock speed and voltage values for your GPU

Before we head back into Polaris BIOS editor to increase memory clock speed settings, it’s a good idea to have an idea of how high we can push them. It’s a lot easier (and faster) to make these tweaks in Windows via the driver (Radeon Settings/WattMan), and then once we’re confident on the proper values, write them to BIOS.

So if you haven’t already, read step 12 of my Windows guide to get an idea of the process around overclocking and undervolting via driver-level edits. If you’ve already gone through the process, you’ll need to repeat it, as your new more-aggressive memory timings invalidate all of your previous data—you won’t be able to push the memory clock speed as high as you previously could (but performance will be much better).

Using Radeon Settings/WattMan in the manner that I describe in my Windows guide:

  • Increase memory clock speed slowly until you see signs of system instability (incorrect share warnings in your miner, artifacts on screen, crashes)
  • Decrease core clock speed slowly until it starts to significantly negatively impact performance
  • Decrease memory voltage slowly until you see signs of instability (you may not be able to significantly lower memory voltage, depending on your card)
  • Decrease core voltage slowly until you see signs of instability

Don’t rush; make sure that your system is stable before moving on. It’s possible to reach speeds of nearly 29 Mh/s with 4GB cards, or over 31 Mh/s with 8GB cards, but watch out for power consumption and stability issues—it’s not always worth running at higher speeds. I’ve found that 25-26Mh/s for 4GB cards, and 27-29Mh/s for 8GB cards is right around the sweet spot for maximum efficiency and stability. When you feel confident that you have good clock speed and voltage values, then move on to the next step where we’ll write them to the BIOS.

Step 7: Write new clock speed and voltage values to GPU BIOS

Note that this step is not strictly necessary if you plan to use Windows for your miners long-term. You can certainly just dial in whatever values you found in the previous step at the driver/WattMan level and call it a day. I prefer to have everything done at the BIOS level, as then I don’t have to worry about software configuration, and can move GPUs between environments with ease.

If you’re running Linux, this is the only way (currently, at least) to overclock and undervolt.

  • Open Polaris BIOS Editor back up.
  • Load the modified BIOS that you created in step 3 (click “OPEN BIOS” in the top left and browse for your modded .rom file).
  • In the “Memory” area, carefully input your values for memory clock speed and voltage in the bottom row.
  • In the “GPU” area, carefully input your values for core clock speed and voltage in the bottom row. You’ll probably be overwriting a 65xxx value in the voltage column—that’s ok.
  • Still in the “GPU” area, fill in the table between the bottom row and the first row (but do not touch the first row!) with values that ramp up to whatever you entered in the bottom row. It isn’t super important to get these values “right”; you can look at the original table and see what percentage adjacent rows vary by, and just calculate new values that way.

Here is my finished, modded BIOS for my Asus RX 470 4GB (click for full size):

Factory BIOS in Polaris BIOS editor

The original factory BIOS is shown in step 2 for reference. Note that I’ve made absolutely no edits outside of the area I originally outlined in blue. I get over 25 Mh/s after the modifications (+25%), while using ~15% less power compared to stock. These changes are fairly conservative; I’m stable at nearly 27 Mh/s on this card with more aggressive settings, but the increase in power consumption isn’t worth it at my electricity rate.

If you’re looking for a good starting point, the settings pictured here should be stable in just about every 4GB card (in the timings section, just copy the 1500mhz value to every row below it).

When you’re done making your edits in Polaris, save your final BIOS (click “SAVE AS”) as a new file. Then open up ATIWinFlash and write the new .rom to your GPU (same as step 4). Reboot and test!

Step 8: Repeat steps 1-7 for each of your remaining GPUs

Yes, it’s a little tedious. But it goes quite a bit faster after your first one. Don’t be tempted to simply take the first BIOS that you create, and flash that to all of your other cards—every GPU is different, even between cards that are the same brand/model. It’s quite possible (likely, even, if you have a lot) that some of your cards will be capable of stable speeds 25+ mhz higher than others. Test them all; it’ll save you headaches later.

Analyzing the cost/benefit of different setups

If you’re stuck on whether or not an extra 1-2 Mh/s is worth 25 watts of additional power consumption, remember that you can use an online calculator to help simplify things. For example, here is a GPU hashing at 25 Mh/s @ 100 watts vs another GPU at 26 Mh/s @ 125 watts (assuming $0.15 per kWh, remember to plug in your own rate!). At the time that this was written, the slower GPU is slightly more profitable.

BIOS mods: before and after comparison

 

In the next and final installment of this Ethereum mining guide, I’ll post a mining FAQ and some other tidbits that didn’t quite fit anywhere else. Until then, thanks for reading, and feel free to leave questions or comments!

BUILD YOUR OWN ETHEREUM MINING RIG, PART 5: FAQ

In this fifth and final installment of our Ethereum mining rig guide, I answer some common questions about setting up your own rig, profit expectations, and mining in general. If you’ve read the rest of the guide and still have some unanswered questions, you might find what you’re looking for here.

Hit the “read more” button for the FAQ!

Build an Ethereum Mining Rig, part 5: FAQ

 General Questions

Technical Questions

Ethereum-specific Questions

Other

Answers

So how much money can I expect to make from mining, exactly?

This is the question that most people are interested in. The answer is fairly complicated, and changes daily.

Today, one ether is worth about $90. Last week, that same ether peaked at a value of nearly $100. A month before that, ether was trading at less than half its current value. The volatility in digital currency value is extreme—the price today could be very different than the price tomorrow.

On top of that, the difficulty involved with mining a coin is also changing constantly. Today, the rig depicted in our guide will produce nearly 5 ether per month. One month ago, it was producing at a rate of ~7 per month. As the popularity of mining increases (as it often does when the value of each coin increases), the time/computing power it takes to produce a coin increases.

You can answer the question for right now by using a calculator such as this one. If you’re building the exact rig outlined in the guide, then 150 MH/s is a good conservative estimate for speed, and 750 watts should be accurate for power usage if you undervolt and use an efficient PSU (make sure to plug in your own electricity rate, though). The calculator takes into account the current mining difficulty automatically.

At the time that I’m writing this FAQ, assuming you pay $0.10 per kWh for electricity, the calculator would tell you that you should expect to make nearly $400 per month from your mining rig. Remember to subtract 1-2 percent for your mining pool’s fee. Subtracting another couple percent for downtime and other unexpected issues is probably a good idea, too.

If the price of ether rises faster than the mining difficulty increases, then that profit figure will increase. If the mining difficulty outpaces the value growth of ether (and/or ether drops in value), then profit will decrease.

Since it is very difficult to predict the future, I’d strongly advise everyone reading this to treat mining as a hobby, and not a “get rich quick” scheme. Only invest what you’re comfortable losing, because losing is a very real possibility.

Why not just buy ether (or bitcoin, or litecoin, etc) directly, and then sell later at a profit?

If you believe that ETH is about to shoot up in value in the short-term, and you have a very high tolerance for risk, and you have some money that you won’t miss if it suddenly disappears, then this might be the best idea for you. Buying the digital currency directly enables you to get your hands on a bunch of it quickly, without having to wait for a mining rig to produce it for you. However, the “sell them later at a profit” part doesn’t always work out. =)

For most of us with a desire to jump into cryptocurrency, mining is probably the safer option (it’s more fun, too!). If you buy $1500 worth of ETH today, and tomorrow ether is suddenly worthless, then you’ve lost $1500. If you build a $1500 mining rig today, and tomorrow ETH is worthless, then you still have $1500 worth of hardware. You can sell it at a small loss, or re-purpose it (maybe try your luck at mining one of the other digital currencies, for example).

How noisy/hot are these rigs?

This is difficult to answer because it’s so subjective. An open-air mining rig with six RX 4xx/5xx GPUs in it will certainly not be silent. But a properly undervolted rig can be surprisingly quiet, especially compared to the previous generation of litecoin mining rigs (those old 7950 GPUs were noise & heat monsters!).

Using a free sound meter app on my phone, I measured the sound level of my test rig at 47 decibels (with the phone held about 2-3 inches away from the middle of the GPUs). From roughly 6 feet away, the sound level dropped to about 37 decibels, which I find to be completely acceptable. For reference, the sound level in an empty room that I subjectively consider to be completely quiet is 22 decibels, according to the app. If these numbers don’t mean much to you, this chart might be helpful.

My test rig contains a mix of four RX 470/480 GPUs running at a temperature target of 58C. The noise level could be reduced significantly by bumping the target up to 70C if desired (which would allow the fans to spin at a lower RPM), but it’s already more than quiet enough for me.

The heat that a rig produces may be more of an issue, depending on where you live. Most small consumer space heaters put out 1500 watts of heat. An undervolted 6-GPU rig will give off roughly half that, which is still a significant amount. It’s certainly possible to heat a small room with the heat from a single mining rig, but that extra heat can be a nuisance if you live in a warmer climate.

Ideally, you have someplace that you can tuck your rig(s) where they’re out of living spaces. Basements and garages are both good ideas if they’re relatively clean and temperatures don’t venture into extremes.

How do I convince my significant other that building a rig is a good idea?

You’re on your own with that one. Good luck! =) Anecdotally, I did convince my girlfriend to keep a litecoin mining rig in her apartment for most of 2013. She hated the noise (modern GPUs are much quieter), but she did make a tenfold return on her investment.

How do I turn my computer on without a case/power switch?!

So you didn’t opt to purchase a power switch, and now you’re sitting there staring at a bunch of assembled hardware, and wondering how the heck to turn the thing on for the first time. Don’t worry, you have a couple options.

First, check to see if there is a power button built right onto the motherboard. This is somewhat common nowadays, although many boards still don’t include them.

If you don’t have a power button on your motherboard, grab a flathead screwdriver. Now use the head of your screwdriver to temporarily short the two pins on the motherboard that the power switch would be connected to (if you had a power switch). Just touch the head of the screwdriver so that it makes contact with both pins for a brief moment. Your system should immediately power on (if it doesn’t, make sure that your PSU is plugged in, and the PSU power switch is in the “on” position”).

The first thing you should do at this point is enter the BIOS and change the power options to set your computer to automatically power on whenever power is restored. That way, you can use the switch on your power supply to turn it on and off going forward.

Why the Radeon RX 470 GPU? Why not a RX 480/570/580, or another video card entirely?

The Radeon RX 470 GPU is currently gives the best hashrate/watt ratio, and also has an excellent hashrate/purchase price ratio. It’s really the ideal GPU for mining, at least for now.

That said, the RX 470/480/570/580 are all very close performance-wise when properly clocked and undervolted via BIOS mods. In fact, the difference is so close that purchase price should probably be your primary consideration—buy whichever RX 4xx/5xx GPU you can get for the least money, as long as you plan to flash your GPU BIOS (I show you how in part 4 of my guide).

I generally don’t mention nVidia GPUs because they cost so much more than AMD cards. The GTX 1070 is a fine card for mining, with hashrate and power consumption numbers comparable to RX 4xx/5xx cards when properly configured. I don’t recommend it simply because it costs 2-3 times as much as an RX 470, and that has a tremendous negative impact, ROI-wise.

Can I mix different brands and/or models of GPUs in the same rig?

You can always mix different brands of the same model GPU in the same rig (for example, RX 470 GPUs made by MSI, Sapphire, and Asus).

You can additionally mix different models of cards together as long as whatever video driver you’ve installed in your OS supports all of them.

In Windows, you can mix RX 470 and RX 480 cards together with no issues, and you can also mix RX 570 and RX 580 cards. You’ll run into issues if you try to mix RX 4xx cards with RX 5xx cards, because they use different video drivers (it’s possible to make it work, but involves jumping through some extra hoops).

In Linux, I believe that all of the RX 4xx and RX 5xx cards share the same driver, so they should all coexist together without problems.

My own Linux rig runs a mix of different RX 470 and RX 480 cards, all different brands. I have an RX 570 GPU card running in another desktop that I haven’t tried dropping into the rig yet.

Why stop at 6 GPUs? Is it possible to pack more than that onto one motherboard?

Possible? Yes—I know some people have made 7, or even 8 GPUs work on a single motherboard.

I generally don’t recommend it unless you’re pretty savvy and willing to work through a lot of potential headaches, though. Generally, achieving 8 GPUs on a single motherboard is done via use of PCIe splitters (eg: something like this), and they don’t always work well.

7-8 GPUs also generally works best with two power supplies, and that ups complexity (and risk of hardware damage, if done improperly) a bit, as well. In addition, depending on which GPUs you use and how much you undervolt them, an 8 GPU rig may come quite close to the safe continuous load rating on a typical 15 amp household circuit (which is 80% of 1800 watts, or 1440 watts).

To me, 6 GPUs feels like the current sweet spot between maximizing GPU density and minimizing complexity/risk.

Don’t I need more than 4GB of RAM? A lot of other guides recommend more.

Nope—mining uses the memory on your GPUs, so you don’t need much system memory at all. You can get by just fine with 1-2GB of RAM in Linux, and 4GB is enough in Windows (you’ll need to bump your virtual memory settings up to at least 16GB though, covered in step 6 of my Windows guide).

I’m running with a single 1GB DIMM on my own Linux rig, and most of that memory is available while mining.

Why do I need a 1200 watt power supply if I’m undervolting? Won’t I only be using 700-800 watts with 6 GPUs? And is it worth paying so much for a high efficiency unit?

If you’re running six properly undervolted RX 470 GPUs, your “at the wall” power consumption should be around 750 watts. Which means that yes, it’s possible to run such a rig on a smaller PSU without issues.

The reason that I recommend a 1200 watt PSU is due to efficiency variance at different load levels. PSUs are generally most efficient when supplying about 50% of their rated maximum power (you can read a bit about ratings on Wikipedia here). So a platinum-rated 93% efficient unit may only reach that efficiency level when supplying ~40-60% of the unit’s maximum rated power. It’s not uncommon for PSUs rated at 90%+ efficiency to drop down to ~85% when operating near their limit (and also when delivering very little power).

Example time: let’s first assume that your rig needs 700 watts of power to operate (maybe 6x 110 watts for the GPUs, and 40 watts for the rest of the system—this is a fairly realistic number).

Now let’s first assume that you decided ~$250 for a platinum-rated 1200 watt PSU is ridiculous, so you opted for a $100 bronze-rated 850 watt PSU instead (which is still a fairly solid unit!). You’ll be pulling about 854 watts at the wall (700 watts / .82 efficient) with this setup.

Now let’s assume that you want to be as efficient as possible, but since you you know you don’t really need 1200 watts, you go for a $180 platinum-rated 850 watt unit—not realizing that its efficiency rating drops from 93% @ 50% load to 89% @ 100% load. That doesn’t sound like much, and at least it’s still significantly better than a bronze-rated unit, right? With this setup, you’ll end up pulling about 787 watts (700 watts / .89 efficient) at the wall.

Now let’s assume that you just followed my guide and bought the 1200 watt Seasonic that I recommend(platinum-rated units by EVGA, Corsair, and some others are all fine too—they’re likely rebadged OEM Seasonics anyway). Since you’re running the unit at only ~58% of it’s maximum, it should run very near its peak 93% efficiency. Which means this setup will pull about 753 watts (700 watts / .93 efficient) at the wall.

The difference between the first and last example is 101 watts at the wall. Assuming that you run your rig 24/7 and pay 15 cents per kWh, that’s a $133 difference in electricity costs every year! The “expensive” 1200 watt Seasonic pays for itself compared to the much “cheaper” $100 bronze unit in roughly one year of use (the Seasonic has a 7 year warranty, so the odds are that you’ll be using it for quite a long time).

If you want to measure your own “at the wall” power consumption numbers, I highly recommend that you shell out a few bucks for a kill-a-watt. They’re invaluable.

Can I utilize my mining rig for anything else while it’s mining?

It’ll make a great space heater in the winter. =) Oh, you mean application-wise.

The CPU, memory, and disk will mostly be unused while your rig is mining, but anything GUI-related will be pretty unresponsive. Applications that run in the background or over the network are good candidates, if you’re looking to get some extra use out of your rig. You should be able to run things like file servers and low-traffic web servers just fine without impacting mining performance.

How much of my internet bandwidth will my mining rig use?

Not much. Mine averages around 30 kb/sec when it’s mining at full speed, which is less than half of one percent of the average broadband speed in the US (~55 mb/sec). Bandwidth is basically a non-issue—you could run a mining rig off a dial-up connection (in terms of bandwidth, anyway—I absolutely recommend a wired ethernet connection for latency/reliability reasons).

My rig won’t boot properly unless a monitor is connected—what’s up with that?

I’m not sure why some people experience this (I did with my own LTC rig back in 2013, but not my newer ETH rigs), but if your rig won’t boot into the OS without a monitor attached, then you need a dummy plug (a device that plugs into your GPU, fooling the hardware into detecting a display). You can make you own for a few bucks by simply following these instructions (you can buy the resistors that you need on Amazon). Or you can buy pre-made HDMI plugs, although they’re more expensive (it shouldn’t matter if you use DVI or HDMI plugs). You should only need one plug attached to your primary video card, although some people use dummy plugs on all of their GPUs.

I’m getting fan speed errors using the latest version of Claymore’s miner—how do I fix them?

This “failed to set fan speed” issue seems to occur in later Claymore releases (10 and up), and requires a few extra commands to setup the Claymore executable with the permission it needs to control your GPU fans. I’ve incorporated these commands into the latest version of my Linux guide, but in case you followed an earlier version and recently upgraded Claymore to 10.x or later, simply enter these commands:

cd /usr/local/claymore10.2
sudo chown root:root ethdcrminer64
sudo chmod 755 ethdcrminer64
sudo chmod u+s ethdcrminer64

Note that if Claymore is located somewhere other than /usr/local/claymore10.2, you’ll need to substitute the proper location in the first command.

I rebooted and now my GPUs are hashing 20% lower than previously—what happened?
If you’ve just rebooted for the first time since January 9, 2018, you may find that your system has automatically updated to linux kernal 4.13.0-26. The update is designed to patch the Meltdown/Spectre vulnerabilities present on Intel CPUs, but it may also wreak havoc with your mining hashrates. If you’re seeing significantly lower hashrates compared to before the last time you rebooted, you can manually roll back the update by entering these commands:

sudo apt-get remove linux-image-4.13.0-26-generic && sudo apt autoremove -y
sudo update-grub

Reboot (sudo reboot now) and your hashrates should be back to normal.

To stop your system from performing automatic updates in the future, you can use one of the methods described here.

Isn’t Ethereum moving to proof-of-stake soon? Won’t that make our rigs obsolete?

Ethereum will eventually make the switch to PoS, which will make current methods of mining impossible. However, there isn’t currently a timeline for the switch in place, and one of Ethereum’s co-founders stated that an informal estimates of “late 2017” was “too rosy”. Most people close to Ethereum seem to feel that the second half of 2018 is a realistic target for the switch, which still leaves plenty of mining time.

When the switch does occur, it’ll be easy to transition our mining rigs to another coin (which you can then trade for ETH/BTC/LTC, if you don’t want to hold another altcoin).

I have an old video card with 2GB of memory laying around. Can I use it to mine ETH?

Unfortunately, no. Every individual GPU must be able to fit Ethereum’s DAG file into its own video memory to mine. The DAG file is slowly getting larger over time, and as of today, the DAG file is over 2GB, which means only cards with 3GB or more can mine ETH.

Sometime around April 2018, the DAG file will grow beyond 3GB.

The 4GB limit will be reached somewhere around September 2019, although it’s likely that Ethereum will have already moved to proof-of-stake by that point.

Other guides say that you shouldn’t run Linux off a USB drive if you plan to mine ETH, because constant DAG file writes will quickly wear the stick out. Your guide says that a USB stick is ok for a Linux-based ETH mining rig. What gives?

Any guide that cautions against installing Linux to a USB stick for ETH mining was probably written more than 6 months ago. The stock Ethereum miner (geth), writes the (very large) DAG file to disk fairly frequently, which can cause issues for media not rated for large numbers of writes (USB sticks, for example). Claymore’s miner (which we’re using) creates the DAG file in GPU memory, so we don’t have any excessive writes to worry about.

Just when I was about to reach 1 ETH at my mining pool, my balance went to zero! Did I get hacked?

Most mining pools (including ethermine.org, which I use in my guide’s setup examples) hold your earned balance until you reach a certain threshold (usually 1 ETH). When that threshold is reached, they transfer your balance to whatever wallet address you specified. If you’ve been watching your balance accumulate at your mining pool, and then it suddenly went to zero, most likely the pool just transferred your coins to your wallet. You can easily check the balance of your wallet address with a web-based blockchain explorer, such as this one.

How do I keep my ETH wallet safe?

Backup your wallet to multiple secure, offline devices (a few small USB sticks are great for this). If you created your wallet using my guide, then you’ll find your wallet file(s) on your mining rig at the following location:

Linux:   ~/.ethereum/keystore
Windows:   %APPDATA%\Ethereum\keystore

Just copy the entire keystore directory someplace safe. To access the ether held in your wallet addresses, you’ll need both these encrypted key files, and the password that you used to create them. So make sure that you can remember your password(s) as well! Keeping some sort of password “hint” document (that only you would understand) on the backup USB sticks containing your key files isn’t a bad idea. Keep at least one copy off-site (eg: with somebody you trust, or a bank deposit box, etc).

After you’ve made multiple backups of your wallet keys, it’s probably a good idea to remove the keys from your mining rig (simply delete the /keystore directory). It’s generally best to not store your keys long-term on any computer that is connected to the internet. If a hacker successfully gains access to your rig and finds your private keys, you’re going to lose all of the funds stored in the associated wallets. Be absolutely sure that you’ve verified your backups work (read the answer to the next question, and test out the process using your backed-up private keys) before deleting /keystore from your rig, of course.

So I’ve mined all this ether—how do I actually move/use it?

If you’re a masochist, you can move ether around right from the command line of your rig using geth. But I don’t recommend that as it’s tedious, confusing, and prone to mistakes.

A much better way is to download and install Mist (you can do this on any computer, it doesn’t have to be on your mining rig—do make sure that the computer is free from malware first, though!). Mist is essentially a GUI front-end for geth that hides all of the tedious command-line stuff from the user.

Once Mist is installed, you can simply import your wallet key files (see previous question if you don’t know where they’re located), and Mist will show the current balance of each. From there, you can simply click “Send” to move ether out of one of your own wallets to any other wallet address.

Important note: after you install Mist, it’s going to want to sync the blockchain to your computer. This can take anywhere from an hour to a day the first time you do it, depending on the speed of your internet connection (you’ll see a progress bar in the lower left corner). Until this finishes, the balance of all of your wallets will likely show up as zero. Don’t stress, this is normal. Once the sync is complete, all of your balances should show up properly.

I see that Claymore supports dual mining—what is that, and should I use it?

I wrote a dedicated blog post on this subject; you can read it here.

When it comes to buying/selling cryptocurrency, which exchange do you recommend?

There are so many exchanges, and frankly a lot of them are sketchy and operating in countries where regulation isn’t exactly tight. We’ll probably see another Mt. Gox at some point in the future because of this.

For now, I tend to recommend Coinbase. They’re based in San Francisco and seem to be doing all the right things with regard to regulation and insuring users’ funds.

As a general rule, don’t leave your currency in an exchange any longer than necessary (eg: don’t treat exchanges like banks!). Keep your funds in wallet addresses that you control, and move them to exchanges only when you want to trade.

Can I buy you a beer? Your mining guide has been a huge help!

Certainly! Well, virtually, anyway. I’d be happy to accept donations at the below wallet addresses:

Bitcoin: 1DpnANRtMDPe8jG3FXfkyczLFevM94Yjxv
Litecoin: LPuwBa3LbZZzcJaR3kEsGDBivAoc64fPUr
Ethereum: 0x32FD4a5DF96Af70b0D4644Cf4dce44cFc988BEE4

用树莓派做Bitcoin Unlimited全节点

$
0
0
用树莓派做Bitcoin Unlimited全节点
 github-kfty     2017-03-09 17:55:16

这是一个用树莓派做Bitcoin Unlimited全节点的示例。对于没用使用过全节点钱包,也不熟悉命令行操作的朋友,建议先看这篇教程,尝试在PC或Mac上安装和同步区块链,这样更容易理解这个示例。

为什么要用树莓派做全节点?

树莓派体积小,耗电小,无噪音,非常适合24小时工作。比特币节点对系统性能要求不高,专门24小时开着一台电脑,耗电和噪音都是很不环保的,且性能有极大的浪费。树莓派耗电仅和手机充电器相当,也没有风扇。你甚至不需要为树莓派安排地方,随便塞在哪里就行了,操作可以在其他的电脑上,通过SSH进行。用树莓派搭建节点,也可以学习到基本的Linux系统操作知识。搭建节点之后,树莓派上可以继续搭建其他服务,比如做个人云盘,BT挂机下载等等。

准备工作

需要准备如下几样东西。此例使用树莓派3B,这版有1GB内存,也有wifi,性能是目前树莓派家族最好的。512MB内存的树莓派2或者zero也是可以用的。清单如下:
– 树莓派 3B(配盒子,电源)
– 16GB的SD卡Class 10 microSDHC
– 外置硬盘或U盘
– 网线(可选,wifi也行,但用网线会更稳定一点)
– 键盘,鼠标,显示器,HDMI线(不用买,仅在安装时临时用一下,安装好以后可以远程SSH接入树莓派)

树莓派系统安装

下载Ubuntu系统镜像

树莓派原生的系统是Rasbian,出于个人偏好,此例使用Ubuntu-mate的ARM版。首先下载系统的镜像文件 Ubuntu Mate 16.04.2 LTS 的 RaspberryPi 版本 https://ubuntu-mate.org/raspberry-pi

把镜像文件导入SD卡

  • Windows系统:可以使用7-zip解压下载到的文件,用Win32 Disk Imager把img文件装载到SD卡里
  • Macbook:把下载的img文件解压到桌面;插上SD卡后,在Terminal里使用diskutil查看SD卡到情况

    diskutil list

    输出里可以看到/dev/disk0之类的盘,根据他们的大小,可以判断出来哪个是我们的SD卡。此例中是/dev/disk2,大小15G。用dd命令来把镜像文件写入(本例是ubuntu.img)

    sudo dd if=~/Desktop/ubuntu.img of=/dev/rdisk2 bs=1m

    这里/dev/disk2写成/dev/rdisk2,速度会较快。等待几分钟后显示完成。

给树莓派按照系统

下面,把做好的SD卡装到树莓派上,给树莓派连上显示器,键盘鼠标,接上电,应该就会看见树莓派启动,并开始安装UbuntuMate系统。和装其他系统一样,顺着引导一路next就行。这个阶段我们要做的是给Ubuntu设置好用户名和密码,打开SSH。用户名在此例中是pi,如果你设置的不一样,那么在接下来的一些指令中要把pi替换成你的用户名。如果你使用wifi,在这里把wifi连一下。
在Ubuntu里进入Terminal命令行,使用

  1. sudo raspi-config

sudo是以管理员身份运行的意思,接下来也是常用的。进入raspi-config界面后看到几个选项,我们要做的是:
1,改密码;
2,在BootOptions里把开机选项由Desktop GUI改为Text console,这样禁用了图形界面,节省系统资源,反正我们不打算接着显示器用树莓派,而SSH也不支持图形界面。
3,在Interfacing里面把SSH打开,
4,在AdvancedOption里面进行Expand Filesystem,
5,在AdvancedOption里面把Memory Split改为16,即只留16MB内存给显示。因为我们没有开图形界面,这样可以尽量多把内存给程序用。

设置完毕,重启树莓派。现在可以把键盘鼠标和显示器拔掉了,接下来的步骤,我们会通过SSH进行。

设置路由器

用电脑进入路由器的设置页面,此例中是https://192.168.1.1/。在这里,我们要做两件事,1,给树莓派固定一个内网ip,2,给树莓派设置端口映射
不同品牌的路由器设置方法大同小异,必要的话可以搜一下说明书。查看已经连接的设备,给树莓派设置一个固定的ip比如192.168.1.2。也许你需要重启路由器才能生效。找到端口映射的设置,外网端口范围8333到8333,内网端口一样,目标指向192.168.1.2 。端口映射的目的是叫外网向你的路由器8333端口发送请求的时候,路由器把数据转给树莓派,这样别人才能访问到你的节点。

设置成功后,即可通过SSH控制树莓派。Windows系统推荐Putty,Mac推荐vSSH,填上地址192.168.1.2,端口22,链接后输入用户名pi,密码,即进入远程命令行。

设置树莓派

mount 外置硬盘或U盘

我们在电脑上准备区块链数据。树莓派的性能不适合从头同步区块链,很容易在中途出错。推荐在电脑上把区块链同步好。如果运行裁剪节点,也先在电脑上完成裁剪。
区块链数据是如下这些目录和文件:

  1. banlist.dat
  2. blocks
  3. chainstate
  4. db.log
  5. debug.log
  6. fee_estimates.dat
  7. peers.dat
  8. wallet.dat

裁剪节点:prune模式可以删除旧的交易细节,仅保留交易结果(余额)。裁剪后,你的节点不能为网络提供旧的区块数据,仍然能帮助网络验证转发新的区块和交易。

在本例中,电脑是Win10系统,节点程序安装在c:\BitcoinUnlimted\bitcoin-qt.exe,区块链数据在c:\BlockData, 新建一个bitcoin-qt的快捷方式,右键进属性,在目标栏的bitcoin-qt.exe 后面加上

  1. -datadir=c:\BlockData -prune=3000

然后用这个快捷方式启动一次,即可看见c:\BlockData明显缩小了。prune=3000意思是保留3000MB的新区块。裁剪下来,体积大约是4G,因为里面还有旧区块的交易结果。将来继续带着prune=3000这个参数运行,区块链体积不会再明显增大。裁剪后的区块链数据,找一个U盘就可以装下了。你可以根据情况选择这个参数,最小是550,再低就失效了。

把外置硬盘(完整数据)或U盘(裁剪数据)格式化成FAT32格式,然后把电脑上已经准备好的区块链数据拷贝进来。

把外置硬盘或U盘插上树莓派,通过SSH运行

  1. sudo fdisk -l

可以根据容量判断,找到新插上的硬盘或U盘的代号,应该是/dev/sda1之类。

SSH进来的目录是/home/pi,我们在这里建一个文件夹blkdata来装载

  1. mkdir blkdata

把硬盘或U盘加载到这个目录里

  1. sudo mount /dev/sda1 /home/pi/blkdata

自动装载:
如上的装载,重启后要运行mount。我们可以通过fstab表来实现开机后自动装载。

  1. sudo blkid

可以看到设备的信息,这里我们需要知道的是UUID号,本例是AE7F-E97A。编辑fstab表:

  1. sudo nano /etc/fstab

在里面加上一行(中间是用Tab键分隔)

  1. UUID=AE7F-E97A /home/pi/blkdata vfat auto,user 0 0

然后ctrl+x退出nano编辑器,打Y确认保存。

装载成功的话,进入这个目录:

  1. cd blkdata

列出文件:

  1. ls -l

应该可以看到我们放进来的区块链数据。在用一次cd命令,退回到原来的目录里。

设置虚拟内存

我们要为树莓派布置一些虚拟内存
首先看一下内存的情况:

  1. free -h

看到有1GB内存(树莓派3),虚拟内存swap是0。建立一个swap 文件,此例中是swapfile,大小2GB。

  1. sudo dd if=/dev/zero of=/home/pi/swapfile bs=1m count=2000

稍等几分钟完成。
给swap文件设置一下属性

  1. sudo chmod 600 /home/pi/swapfile
  2. sudo mkswap /home/pi/swapfile

加载上虚拟内存

  1. sudo swapon /home/pi/swapfile

再试试

  1. free -h

现在应该显示有2G的虚拟内存了。同样,这个设置会在重启后失效,我们得把他加到fstab里自动加载才行。

  1. sudo nano /etc/fstab

加一行

  1. /home/pi/swap/swapfile none swap sw 0 0

安装节点

现在,我们开始安装节点(终于。。。)
先设置好BU的PPA服务器

  1. sudo apt-get install software-properties-common
  2. sudo add-apt-repository ppa:bitcoin-unlimited/bu-ppa

更新一下列表

  1. sudo apt-get update

开始安装

  1. sudo apt-get install bitcoind

bitcoin.conf的设置

启动节点以前,先写一个bitcoin.conf,作为参数的设置。

  1. nano bitcoin.conf

用nano编辑器写一些参数设置,本例中使用:

  1. prune = 3000
  2. checklevel = 0
  3. mempoolexpiry = 24
  4. disablewallet = 1
  5. maxconnections = 30
  6. maxmempool = 144
  7. minlimitertxfee = 1
  8. server=1
  9. rpcuser=C9dWYgs6
  10. rpcpassword=oXVZ4x2yQuxSGTqATiAkLPpsWCQBr
  11. rpcclienttimeout=60
  12. rpcport=8332
  13. rpcconnect=127.0.0.1

如果修剪的话,prune参数要和之前在电脑上设置的一样。如果是不修剪的节点,这里设置为0或不写。rpcuser 和 rpcpassword随便设。

终于,我们可以启动节点了。启动时要加上数据目录的位置,和conf文件的位置,还有-daemon让节点后台运行

  1. sudo bitcoind -daemon -datadir=/home/pi/blkdata -conf=/home/pi/bitcoin.conf

检查节点是不是在工作了

  1. bitcoin-cli getinfo

能看见version等信息就是OK了。再用电脑去bitnodes.21.co,下面Check Node那里填上自己的IP地址(自动识别填好了的),如果能Check出来你的节点版本那就是通了。

设置自动启动bitcoind

把自动启动的服务打开

  1. sudo systemctl enable rc-local.service

编辑/etc/rc.local

  1. sudo nano /etc/rc.local

exit 0 上方写:

  1. sleep 10
  2. sudo bitcoind -daemon -datadir=/home/pi/blkdata -conf=/home/pi/bitcoin.conf

一些可能出现的问题

想到什么写什么吧:

移动硬盘不稳定

树莓派都USB口供电不行,如果移动硬盘是不带电源的,可能会不稳定。解决方法:

  1. sudo nano /boot/config.txt

找到max_usb_current,设置为1,可以调高USB口的电流。

sudo每次都要打密码特别烦

进visudo

  1. sudo visudo

最底下加入一行

  1. pi ALL=(ALL) NOPASSWD: ALL

pi是用户名

How to Build a Bitcoin Full Node on a Raspberry Pi

$
0
0

How to Build a Bitcoin Full Node on a Raspberry Pi

Hello there!

Today, I’m going to show you how to build a Bitcoin full node on the Raspberry Pi. This is a great project for anyone who wants to support the Bitcoin network while validating their own transactions. As the Bitcoin network grows, it’s important that people maintain their full nodes. We need to constantly bring new nodes onto the network to keep it decentralized and healthy.

Glossary:

1. Setup the Rasfpberry Pi 3
2. Install the External Hard Drive
3. Increase the Swap File
4. Install the Bitcoin Core Dependencies
5. Install Bitcoin Core
6. Starting the Bitcoin Core Client
7. Download the Blockchain on another Machine (Optional)

 

What is a Bitcoin Full Node?

A Bitcoin full node is much simpler than it sounds. A full node is simply a computer that is running the Bitcoin Core Wallet. The Bitcoin Core Wallet, by default, downloads a full copy of the Blockchain.

Why do you need a full copy of the Blockchain?

Similar to BitTorrent and other peer to peer networks, you have to download the Blockchain from other people. If you’ve ever downloaded a torrent, you’ll notice that some of them have seeders while other don’t. These “seeders” are people who have already downloaded the file, and have opted to let you download part of the file from them. Without seeders, the BitTorrent network wouldn’t exist.

The Bitcoin network operates the same way. When people try to access their Bitcoin, they are using a wallet that has access to at least part of the network. If people didn’t have full nodes, we wouldn’t be able to verify transactions or see transactions from the past. You wouldn’t be able to access your Bitcoin because ultimately, without nodes, your Bitcoin wouldn’t exist.

How do you Build a Bitcoin Full Node?

We are going to use a Raspberry Pi 3. The Raspberry Pi is a small, inexpensive computer, that has just enough specifications to allow us to operate a full node. We are going to download the Blockchain on an external hard drive on a separate machine using the Bitcoin Core Wallet.

After we have downloaded a full copy of the blockchain, we are going to connect the external hard drive to the Raspberry Pi so that it can continue to build it.

It is possible to directly download the blockchain onto the Raspberry Pi, but it will take a lot of time.

Things we are going to Need:

 

Raspberry Pi 3

The Raspberry Pi is a phenemonal computer. What makes it so great is that it’s about the size of a credit card and it costs less than $40. The Raspberry Pi can run both Linux and Windows.

For our Bitcoin full node, we are going to use Linux. This is due to the fact that Linux is more lightweight and we are going to need all of the resources that the Raspberry Pi can offer.

Usually Raspberry Pi’s will come barebones. The kit that we purchased comes the Touchscreen, Case, SD Card (which will hold the operating system), and Heatsinks.

LCD Touchscreen

The LCD Touchscreen is an optional component for this project. The Raspberry Pi has a HDMI port built in which can be used to project on any monitor/tv that is HDMI capable. For my full node, I wanted to have a touch screen that displays the current price of Bitcoin.

Plus I plan on sending and receiving Bitcoin directly from my node, and having a designated screen would make this process much easier. Plus it looks cool.

Our kit will use a LCD Touchscreen that is compatible with the Raspberry Pi. It also fits perfectly in the case.

Raspberry Pi Case

The Raspberry Pi case once again is optional. I wanted something that would contain both my Raspberry Pi and LCD Touchscreen. The kit that I purchased provided one that was simple and lightweight. This is perfect since I want my Raspberry Pi to be simple yet stylish.

Raspberry Pi Wireless Keyboard

This little device is optional, but it makes operating the Raspberry Pi way easier. Without it, you will have to plug in a desktop USB and Mouse or SSH into the Pi.

I definitely recommend picking it up since its only $20 and it will make your life a lot easier.

1 TB Hard Drive


The 1TB Hard Drive is necessary for storing the Blockchain. At the time of writing this (08/13/17)  the Bitcoin blockchain is approximately 130GB. You can check the current size by clicking on this link.

Currently, the blockchain is growing at about 50GB a year. As Bitcoin gains popularity in the coming years, it is destined to grow at a much faster rate. For the sake of longevity, I strongly recommend that you purchase a hard drive that will last for years to come.

If a 1TB Hard Drive is too far out of your price range, you can always start smaller and upgrade once you outgrow it.

How to Build a Bitcoin Full Node on a Raspberry Pi


1. Setting up the Raspberry Pi

Setting up the Raspberry Pi is simple. If you purchased a Raspberry Pi kit that already has Raspbian installed, you simply need to put in the SD card and plug it in.

For those of you that need to install linux on a blank SD card, you can follow this guide on the RaspberryPi.org website.

Update the the Raspbian Software

sudo apt-get update

Update Raspbian Repositories

sudo apt-get upgrade

Update Raspberry Pi


2. Install the External Hard Drive

Now that we have Raspbian up and running, we are going to partition the hard and mount it.

First, let’s connect the external hard drive to the usb port on the Raspberry Pi.

After we have connected the external hard drive to the Raspberry Pi we are going to run a command to see if it was identified.

sudo fdisk -l

List External Hard Drive

As you can see, the hard drive is showing up at the bottom, and it’s labeled “/dev/sda”. We are now going to access the drive, format it, and partition it. Just as a warning, anything on the drive is going to be erased after this process. If you have anything important on it, I advise you to transfer off that information before doing this.

Type in the following command.

sudo fdisk /dev/sda

 

Now that we are in the drive, you should see this screen.

Enter “d” so that we can delete the partitions that are currently on the hard drive. Keep entering “d” until you receive a message telling you that there are no more partitions on the hard drive.

d

 

Now, it’s time to create our new partition. To do this, type in “n”.

n

 

You will be given the options to create a primary partition or an extended partition. Type in “p” to choose primary partition.

p

 

You will now be prompted to number the partition. Choose “1” so that your drive will be named “/dev/sda1”.

/dev/sda1

 

For the next two questions about the first and last sector, simply hit enter for both of them so that it chooses the default.

Now that you have created your new partition, it’s time to exit out of “fdisk” Type in “w” to exit fdisk.

w

 

Now it’s time tor format your new partition. We are going to partition it as “Fat 32”. By partitioning the system as Fat32, we ensure that the hard drive will be compatible with both Windows and Mac. This will come in handy if you decide to download the blockchain using one of those two operating systems.

sudo mkdosfs -F 32 -I /dev/sda1

After the command has finished, you will have a newly partitioned hard drive! Now it’s time to set the drive to automatically mount.

Before we edit the configuration file, let’s create the Bitcoin data directory.

mkdir .blockchain

Now it’s time to make modifications to the configuration file. Use the command below to access the configuration file.

sudo nano /etc/fstab

Once we are in this configuration file, we will add this line so that the hard drive is automatically mounted to our “.blockchain” folder. Remember to replace “pi” with whatever your Raspberry Pi’s username is.

/dev/sda1 /home/pi/.blockchain vfat umask=0002,gid=users 0 0

Hit Ctrl-x and then hit Y so that we can save the file. Now, restart the Raspberry Pi so that we can confirm that the Raspberry Pi is automatically mounting the external hard drive.

Run the command below so that we can see if the drive has be mounted under our folder “.blockchain”.

df -h

If you see your drive “/dev/sda1” mounted on “/home/pi/.blockchain” then you are ready to proceed!


3. Increase the Swap File

A swap file allows the Micro Sd Card in the Raspberry Pi to be used as ram. This step is important if you are going to download the whole blockchain using the Raspberry Pi. If you plan on downloading it on a separate device, this step isn’t necessary.

Let’s start by editing the file “/etc/dphys-swapfile”.

sudo nano /etc/dphys-swapfile

We are going to change the default size of the swap file from 100 to 1000.

Find the line:

CONF_SWAPSIZE=100

To:

CONF_SWAPSIZE=1000

Hit CTRL-X and then Y to save the file.

Run the commands below to initiate this new swap file.

sudo dphys-swapfile setup
sudo dphys-swapfile swapon


4. Install the Bitcoin Core Dependencies

Before we install the actual Bitcoin Core software, we need to download certain dependencies that the software relies on.


sudo apt-get install protobuf-compiler libminiupnpc-dev libevent-dev libtool libssl-dev libboost-all-dev qt4-dev-tools libprotobuf-dev libqrencode-dev autoconf

After those dependencies are installed, we are going to need to install git. Git is going to be used to access download the Bitcoin Core source code from the GitHub repository. In case you don’t know what that is, it’s a commonly accepted platform that distributes source code for all types of applications.

sudo apt-get install git -y

Bitcoin Core uses Berkeley Database for their wallet system. It specifically relies on version 4.8. Berkeley is created by Oracle, which is the same company that creates Java.

We are going to make a directory that we can download and install the database into.

mkdir ~/bin
cd ~/bin

Now that we are in the new directory that we have created, let’s download the tar for the Berkeley Database.

wget http://download.oracle.com/berkeley-db/db-4.8.30.NC.tar.gz

Download Berkeley Database

Now that you’ve downloaded the Berkeley database, you’ll use the following command to extract it.

tar -xzvf db-4.8.30.NC.tar.gz

Now that we have extracted the Berkeley Database, let’s go into the directory prepare the source code for installation. This process can take anywhere from 5 to 20 minutes.


cd db-4.8.30.NC/build_unix/
../dist/configure --enable-cxx
make

Once the command has finished, it’s time to install the Berkeley Database.


sudo make install

Excellent! Now that the Berkeley Database is installed, we are now ready to install the Bitcoin Core Client!


5. Insall the Bitcoin Software

The first thing we are going to do is go back into the bin directory. Once we are in the bin directory, we are going to down the Bitcoin Core source code into it.

The “git” command is going to pull the source code from the GitHub repository. Use “-b” to specify to the version/branch of the source code that you want to download.

You can visit: https://bitcoincore.org to find out which version of Bitcoin Core is most recent.

Note: This command will download the latest version of Bitcoin Core V.14. You will want to replace the 0.14 with the latest version that is currently out.


cd ~/bin

git clone -b 0.14 https://github.com/bitcoin/bitcoin.git

cd bitcoin/

 

Now that we have download the Bitcoin Core source code, it’s time to prepare it for installation. After you run the “make” command, be prepared to wait a few hours before you are ready to complete the installation.


./autogen.sh

./configure CPPFLAGS="-I/usr/local/BerkeleyDB.4.8/include -O2" LDFLAGS="-L/usr/local/BerkeleyDB.4.8/lib" --enable-upnp-default --with-gui

make

 

Bitcoin Core is now ready to be installed. Run the code below to finish the install.

sudo make install

Congratulations! Your Bitcoin Core client is now installed!

6. Starting the Bitcoin Core Client

Before you start your Bitcoin client, you have to open port 8333 on your router and point it to your Raspberry Pi. This is required so that your new full node can allow incoming connections.

To Start the Bitcoin Core Client, simply type in the command below. This will start the Bitcoin core client using our mounted hard drive “.blockchain”.

If you followed the section that explained how to mount your external hard drive then it should start downloading directly onto your hard drive.

This process can take a long time since the Raspberry Pi’s resources aren’t that of a full blown desktop. If you want to speed up this process, go to step 7 and download the Blockchain on another computer.

bitcoin-qt -datadir=/home/pi/.blockchain

After you have completely synced your Bitcoin Core Client with the Blockchain,  hover your mouse over the little icons at the bottom right of the client. A little display will pop up showing how many connections your client has. If you are showing more connections than 8, you have successfully configured your full node!


7. Download the Blockchain on a separate Computer (Optional)

To speed of the download of the blockchain, I recommend downloading it on your main machine. You can download Bitcoin Core on Windows, Mac, and Linux.  After you download Bitcoin Core, start it up and let the blockchain sync. This can take several days to complete, so make sure that whichever computer you use can withstand being run non-stop during that time.

Downloading the Blockchain on Ubuntu

It is just as simple to download the blockchain on Ubuntu as it is on the Raspbian OS. Once you have downloaded and installed Ubuntu on your main computer, open terminal.

Installing Bitcoin Core on Ubuntu

This first command will tell Linux where to download the Bitcoin Software. The second will update Linux’s information on which packages are available.

sudo add-apt-repository ppa:bitcoin/bitcoin
sudo apt update

This command will install both the Bitcoin Core command line and the Bitcoin Core GUI interface.

sudo apt install bitcoind bitcoin-qt

This command will update your Linux Distribution.

sudo apt upgrade

Mounting the External Hard Drive to your Ubuntu System

Create a new .blockchain directory

sudo mkdir ~/.blockchain

Find out the name of the external hard drive’s partition

sudo fdisk -l

Below you can spot out your hard drive usually in this area.

Mount the external hard drive

sudo mount /dev/sda1 ~/.blockchain

These two commands will give your user the permissions to access the external hard drive. This is necessary for the Bitcoin Core software to access the drive.

sudo chown pinode /home/ubuntu/.blockchain
sudo chgrp pinode /home/ubuntu/.blockchain

Now that we have installed Bitcoin Core and mounted the hard drive, it is time to start the Bitcoin Core Client!

bitcoin-qt -datadir=/home/pi/.blockchain

The GUI for Bitcoin Core should open following this command. It will show you a screen that has details regarding how many more blocks need to be downloaded, how long it will take, what time period of the blockchain you are downloading (This part is cool, it’s kind of like going back in time).

After the blockchain has completely downloaded, let’s unmount it and then mount it on the Raspberry Pi.

sudo umount /dev/sda1

Unplug the external hard drive from your main machine and then plug it into the Raspberry Pi.

Restart or turn on your Raspberry Pi, and run the Bitcoin Core Client.  After the Bitcoin Core Client starts up, check if the blockchain is fully downloaded by hovering your cursor over the checkmark at the bottom right of the client.

In Conclusion

Building a Bitcoin full node on a Raspberry Pi is much simpler than it seems. After you purchase all of the parts, it’s simply a matter of running the necessary commands and opening the port 8333 on your router.

A full node isn’t necessary to send and receive Bitcoin, but it’s necessary to keep the network healthy. By allowing incoming transactions to your node you are verifying transactions and allowing the blockchain to be downloaded. What makes Bitcoin so special is it’s ability to be maintained by the people who use it.

Let’s continue to keep Bitcoin alive and well by doing all that we can to let out voice be heard throughout the Bitcoin network.

If you have any questions or contributions to this guide, I’d love for you to either comment below or email me at Nick@BuildaMiningRig.com!


How to Build a Bitcoin Full Node on a Raspberry Pi

$
0
0

How to Build a Bitcoin Full Node on a Raspberry Pi

Hello there!

Today, I’m going to show you how to build a Bitcoin full node on the Raspberry Pi. This is a great project for anyone who wants to support the Bitcoin network while validating their own transactions. As the Bitcoin network grows, it’s important that people maintain their full nodes. We need to constantly bring new nodes onto the network to keep it decentralized and healthy.

Glossary:

1. Setup the Rasfpberry Pi 3
2. Install the External Hard Drive
3. Increase the Swap File
4. Install the Bitcoin Core Dependencies
5. Install Bitcoin Core
6. Starting the Bitcoin Core Client
7. Download the Blockchain on another Machine (Optional)

 

What is a Bitcoin Full Node?

A Bitcoin full node is much simpler than it sounds. A full node is simply a computer that is running the Bitcoin Core Wallet. The Bitcoin Core Wallet, by default, downloads a full copy of the Blockchain.

Why do you need a full copy of the Blockchain?

Similar to BitTorrent and other peer to peer networks, you have to download the Blockchain from other people. If you’ve ever downloaded a torrent, you’ll notice that some of them have seeders while other don’t. These “seeders” are people who have already downloaded the file, and have opted to let you download part of the file from them. Without seeders, the BitTorrent network wouldn’t exist.

The Bitcoin network operates the same way. When people try to access their Bitcoin, they are using a wallet that has access to at least part of the network. If people didn’t have full nodes, we wouldn’t be able to verify transactions or see transactions from the past. You wouldn’t be able to access your Bitcoin because ultimately, without nodes, your Bitcoin wouldn’t exist.

How do you Build a Bitcoin Full Node?

We are going to use a Raspberry Pi 3. The Raspberry Pi is a small, inexpensive computer, that has just enough specifications to allow us to operate a full node. We are going to download the Blockchain on an external hard drive on a separate machine using the Bitcoin Core Wallet.

After we have downloaded a full copy of the blockchain, we are going to connect the external hard drive to the Raspberry Pi so that it can continue to build it.

It is possible to directly download the blockchain onto the Raspberry Pi, but it will take a lot of time.

Things we are going to Need:

 

Raspberry Pi 3

The Raspberry Pi is a phenemonal computer. What makes it so great is that it’s about the size of a credit card and it costs less than $40. The Raspberry Pi can run both Linux and Windows.

For our Bitcoin full node, we are going to use Linux. This is due to the fact that Linux is more lightweight and we are going to need all of the resources that the Raspberry Pi can offer.

Usually Raspberry Pi’s will come barebones. The kit that we purchased comes the Touchscreen, Case, SD Card (which will hold the operating system), and Heatsinks.

LCD Touchscreen

The LCD Touchscreen is an optional component for this project. The Raspberry Pi has a HDMI port built in which can be used to project on any monitor/tv that is HDMI capable. For my full node, I wanted to have a touch screen that displays the current price of Bitcoin.

Plus I plan on sending and receiving Bitcoin directly from my node, and having a designated screen would make this process much easier. Plus it looks cool.

Our kit will use a LCD Touchscreen that is compatible with the Raspberry Pi. It also fits perfectly in the case.

Raspberry Pi Case

The Raspberry Pi case once again is optional. I wanted something that would contain both my Raspberry Pi and LCD Touchscreen. The kit that I purchased provided one that was simple and lightweight. This is perfect since I want my Raspberry Pi to be simple yet stylish.

Raspberry Pi Wireless Keyboard

This little device is optional, but it makes operating the Raspberry Pi way easier. Without it, you will have to plug in a desktop USB and Mouse or SSH into the Pi.

I definitely recommend picking it up since its only $20 and it will make your life a lot easier.

1 TB Hard Drive


The 1TB Hard Drive is necessary for storing the Blockchain. At the time of writing this (08/13/17)  the Bitcoin blockchain is approximately 130GB. You can check the current size by clicking on this link.

Currently, the blockchain is growing at about 50GB a year. As Bitcoin gains popularity in the coming years, it is destined to grow at a much faster rate. For the sake of longevity, I strongly recommend that you purchase a hard drive that will last for years to come.

If a 1TB Hard Drive is too far out of your price range, you can always start smaller and upgrade once you outgrow it.

How to Build a Bitcoin Full Node on a Raspberry Pi


1. Setting up the Raspberry Pi

Setting up the Raspberry Pi is simple. If you purchased a Raspberry Pi kit that already has Raspbian installed, you simply need to put in the SD card and plug it in.

For those of you that need to install linux on a blank SD card, you can follow this guide on the RaspberryPi.org website.

Update the the Raspbian Software

sudo apt-get update

Update Raspbian Repositories

sudo apt-get upgrade

Update Raspberry Pi


2. Install the External Hard Drive

Now that we have Raspbian up and running, we are going to partition the hard and mount it.

First, let’s connect the external hard drive to the usb port on the Raspberry Pi.

After we have connected the external hard drive to the Raspberry Pi we are going to run a command to see if it was identified.

sudo fdisk -l

List External Hard Drive

As you can see, the hard drive is showing up at the bottom, and it’s labeled “/dev/sda”. We are now going to access the drive, format it, and partition it. Just as a warning, anything on the drive is going to be erased after this process. If you have anything important on it, I advise you to transfer off that information before doing this.

Type in the following command.

sudo fdisk /dev/sda

 

Now that we are in the drive, you should see this screen.

Enter “d” so that we can delete the partitions that are currently on the hard drive. Keep entering “d” until you receive a message telling you that there are no more partitions on the hard drive.

d

 

Now, it’s time to create our new partition. To do this, type in “n”.

n

 

You will be given the options to create a primary partition or an extended partition. Type in “p” to choose primary partition.

p

 

You will now be prompted to number the partition. Choose “1” so that your drive will be named “/dev/sda1”.

/dev/sda1

 

For the next two questions about the first and last sector, simply hit enter for both of them so that it chooses the default.

Now that you have created your new partition, it’s time to exit out of “fdisk” Type in “w” to exit fdisk.

w

 

Now it’s time tor format your new partition. We are going to partition it as “Fat 32”. By partitioning the system as Fat32, we ensure that the hard drive will be compatible with both Windows and Mac. This will come in handy if you decide to download the blockchain using one of those two operating systems.

sudo mkdosfs -F 32 -I /dev/sda1

After the command has finished, you will have a newly partitioned hard drive! Now it’s time to set the drive to automatically mount.

Before we edit the configuration file, let’s create the Bitcoin data directory.

mkdir .blockchain

Now it’s time to make modifications to the configuration file. Use the command below to access the configuration file.

sudo nano /etc/fstab

Once we are in this configuration file, we will add this line so that the hard drive is automatically mounted to our “.blockchain” folder. Remember to replace “pi” with whatever your Raspberry Pi’s username is.

/dev/sda1 /home/pi/.blockchain vfat umask=0002,gid=users 0 0

Hit Ctrl-x and then hit Y so that we can save the file. Now, restart the Raspberry Pi so that we can confirm that the Raspberry Pi is automatically mounting the external hard drive.

Run the command below so that we can see if the drive has be mounted under our folder “.blockchain”.

df -h

If you see your drive “/dev/sda1” mounted on “/home/pi/.blockchain” then you are ready to proceed!


3. Increase the Swap File

A swap file allows the Micro Sd Card in the Raspberry Pi to be used as ram. This step is important if you are going to download the whole blockchain using the Raspberry Pi. If you plan on downloading it on a separate device, this step isn’t necessary.

Let’s start by editing the file “/etc/dphys-swapfile”.

sudo nano /etc/dphys-swapfile

We are going to change the default size of the swap file from 100 to 1000.

Find the line:

CONF_SWAPSIZE=100

To:

CONF_SWAPSIZE=1000

Hit CTRL-X and then Y to save the file.

Run the commands below to initiate this new swap file.

sudo dphys-swapfile setup
sudo dphys-swapfile swapon


4. Install the Bitcoin Core Dependencies

Before we install the actual Bitcoin Core software, we need to download certain dependencies that the software relies on.


sudo apt-get install protobuf-compiler libminiupnpc-dev libevent-dev libtool libssl-dev libboost-all-dev qt4-dev-tools libprotobuf-dev libqrencode-dev autoconf

After those dependencies are installed, we are going to need to install git. Git is going to be used to access download the Bitcoin Core source code from the GitHub repository. In case you don’t know what that is, it’s a commonly accepted platform that distributes source code for all types of applications.

sudo apt-get install git -y

Bitcoin Core uses Berkeley Database for their wallet system. It specifically relies on version 4.8. Berkeley is created by Oracle, which is the same company that creates Java.

We are going to make a directory that we can download and install the database into.

mkdir ~/bin
cd ~/bin

Now that we are in the new directory that we have created, let’s download the tar for the Berkeley Database.

wget http://download.oracle.com/berkeley-db/db-4.8.30.NC.tar.gz

Download Berkeley Database

Now that you’ve downloaded the Berkeley database, you’ll use the following command to extract it.

tar -xzvf db-4.8.30.NC.tar.gz

Now that we have extracted the Berkeley Database, let’s go into the directory prepare the source code for installation. This process can take anywhere from 5 to 20 minutes.


cd db-4.8.30.NC/build_unix/
../dist/configure --enable-cxx
make

Once the command has finished, it’s time to install the Berkeley Database.


sudo make install

Excellent! Now that the Berkeley Database is installed, we are now ready to install the Bitcoin Core Client!


5. Insall the Bitcoin Software

The first thing we are going to do is go back into the bin directory. Once we are in the bin directory, we are going to down the Bitcoin Core source code into it.

The “git” command is going to pull the source code from the GitHub repository. Use “-b” to specify to the version/branch of the source code that you want to download.

You can visit: https://bitcoincore.org to find out which version of Bitcoin Core is most recent.

Note: This command will download the latest version of Bitcoin Core V.14. You will want to replace the 0.14 with the latest version that is currently out.


cd ~/bin

git clone -b 0.14 https://github.com/bitcoin/bitcoin.git

cd bitcoin/

 

Now that we have download the Bitcoin Core source code, it’s time to prepare it for installation. After you run the “make” command, be prepared to wait a few hours before you are ready to complete the installation.


./autogen.sh

./configure CPPFLAGS="-I/usr/local/BerkeleyDB.4.8/include -O2" LDFLAGS="-L/usr/local/BerkeleyDB.4.8/lib" --enable-upnp-default --with-gui

make

 

Bitcoin Core is now ready to be installed. Run the code below to finish the install.

sudo make install

Congratulations! Your Bitcoin Core client is now installed!

6. Starting the Bitcoin Core Client

Before you start your Bitcoin client, you have to open port 8333 on your router and point it to your Raspberry Pi. This is required so that your new full node can allow incoming connections.

To Start the Bitcoin Core Client, simply type in the command below. This will start the Bitcoin core client using our mounted hard drive “.blockchain”.

If you followed the section that explained how to mount your external hard drive then it should start downloading directly onto your hard drive.

This process can take a long time since the Raspberry Pi’s resources aren’t that of a full blown desktop. If you want to speed up this process, go to step 7 and download the Blockchain on another computer.

bitcoin-qt -datadir=/home/pi/.blockchain

After you have completely synced your Bitcoin Core Client with the Blockchain,  hover your mouse over the little icons at the bottom right of the client. A little display will pop up showing how many connections your client has. If you are showing more connections than 8, you have successfully configured your full node!


7. Download the Blockchain on a separate Computer (Optional)

To speed of the download of the blockchain, I recommend downloading it on your main machine. You can download Bitcoin Core on Windows, Mac, and Linux.  After you download Bitcoin Core, start it up and let the blockchain sync. This can take several days to complete, so make sure that whichever computer you use can withstand being run non-stop during that time.

Downloading the Blockchain on Ubuntu

It is just as simple to download the blockchain on Ubuntu as it is on the Raspbian OS. Once you have downloaded and installed Ubuntu on your main computer, open terminal.

Installing Bitcoin Core on Ubuntu

This first command will tell Linux where to download the Bitcoin Software. The second will update Linux’s information on which packages are available.

sudo add-apt-repository ppa:bitcoin/bitcoin
sudo apt update

This command will install both the Bitcoin Core command line and the Bitcoin Core GUI interface.

sudo apt install bitcoind bitcoin-qt

This command will update your Linux Distribution.

sudo apt upgrade

Mounting the External Hard Drive to your Ubuntu System

Create a new .blockchain directory

sudo mkdir ~/.blockchain

Find out the name of the external hard drive’s partition

sudo fdisk -l

Below you can spot out your hard drive usually in this area.

Mount the external hard drive

sudo mount /dev/sda1 ~/.blockchain

These two commands will give your user the permissions to access the external hard drive. This is necessary for the Bitcoin Core software to access the drive.

sudo chown pinode /home/ubuntu/.blockchain
sudo chgrp pinode /home/ubuntu/.blockchain

Now that we have installed Bitcoin Core and mounted the hard drive, it is time to start the Bitcoin Core Client!

bitcoin-qt -datadir=/home/pi/.blockchain

The GUI for Bitcoin Core should open following this command. It will show you a screen that has details regarding how many more blocks need to be downloaded, how long it will take, what time period of the blockchain you are downloading (This part is cool, it’s kind of like going back in time).

After the blockchain has completely downloaded, let’s unmount it and then mount it on the Raspberry Pi.

sudo umount /dev/sda1

Unplug the external hard drive from your main machine and then plug it into the Raspberry Pi.

Restart or turn on your Raspberry Pi, and run the Bitcoin Core Client.  After the Bitcoin Core Client starts up, check if the blockchain is fully downloaded by hovering your cursor over the checkmark at the bottom right of the client.

In Conclusion

Building a Bitcoin full node on a Raspberry Pi is much simpler than it seems. After you purchase all of the parts, it’s simply a matter of running the necessary commands and opening the port 8333 on your router.

A full node isn’t necessary to send and receive Bitcoin, but it’s necessary to keep the network healthy. By allowing incoming transactions to your node you are verifying transactions and allowing the blockchain to be downloaded. What makes Bitcoin so special is it’s ability to be maintained by the people who use it.

Let’s continue to keep Bitcoin alive and well by doing all that we can to let out voice be heard throughout the Bitcoin network.

If you have any questions or contributions to this guide, I’d love for you to either comment below or email me at Nick@BuildaMiningRig.com!

Bitcoin Full Node on RBP3 (revised)

$
0
0

View story at Medium.com

https://medium.com/@meeDamian/bitcoin-full-node-on-rbp3-revised-88bb7c8ef1d1

Bitcoin Full Node on RBP3 (revised)

This is a revised version of the previous guide, that covers the upgraded Raspbian Stretch & Bitcoin v0.15.1 .

View story at Medium.com

This guide assumes you’re on MacOS, comfortable with terminal and want to run a headless Bitcoin Full Node on a Raspberry Pi 3, setting it up w/o attaching any peripherals to RBP3.

Things you need:

  • Raspberry Pi 3;
  • MicroSD card —as of Dec 2017 Bitcoin blockchain is 170GB in size, so you need at least 200GB+ for a full non-pruned node (recommended) or 8GB++ for a pruned node (the more free space is left on the card the longer it will last);
  • a way to plug the microSD card into your Mac;
  • around 5 weeks of time for the initial sync (as of late 2017);

Get Raspbian Lite image

Either via torrent or by abusing Raspberry Pi Foundation servers.

Download latest version directly:

wget --content-disposition https://downloads.raspberrypi.org/raspbian_lite_latest

Verify (hash below is for 2017-09-07-raspbian-stretch-lite.zip)

# NOTE: 2 spaces are needed between hash & filename
echo "bd2c04b94154c9804cc1f3069d15e984c927b750056dd86b9d86a0ad4be97f12  2017-09-07-raspbian-stretch-lite.zip" | shasum -a 256 -c -
# the output should be something like:
#  2017-09-07-raspbian-stretch-lite.zip: OK

If the downloaded filename is different, go to the raspbian download pageand get the correct SHA-256 checksum from there.

Put image on the SD card

# Extract .img file from .zip archive
unzip 2017-09-07-raspbian-stretch-lite.zip

Plug the SD card into your computer and run this to identify the disk of your SD card:

diskutil list | grep external

Assuming it’s /dev/disk2:

# Unmount it
diskutil unmountDisk /dev/disk2
# Copy image to the SD card
sudo dd bs=1m if=2017-09-07-raspbian-stretch-lite.img of=/dev/disk2

For OSs other than MacOS, see here.

The above step should leave you with /Volumes/boot already mounted.

Enable ssh

Starting with Raspbian 2016–11–25 SSH is disabled by default. To enable it, a file named ssh needs to be created in the root of the SD card.

touch /Volumes/boot/ssh

More about it here.

Add WiFi credentials

To avoid using ethernet cable & simply speed things up, you can add your first WiFi credentials already (as per this SE post):

nano /Volumes/boot/wpa_supplicant.conf

And put there this:

country=XX
ctrl_interface=/var/run/wpa_supplicant GROUP=netdev update_config=1
network={
    ssid="YOUR_SSID"
    psk="YOUR_PASSWORD"
}

Replace XX with your country code, fill-in network details, and use ctrl+xyenter to exit nano 😉.

Unmount

diskutil unmountDisk /dev/disk2

Connect & secure Raspberry

Once above is done, put the card into your Raspberry & power it up.

After a few minutes, it should boot up. Now it’s time to find its IP address.

There are multiple ways to do that, the easiest one would probably be logging into your router interface (most commonly: 192.168.1.1 or 192.168.0.1) and trying to find it there.

If that doesn’t work you can also try:

# MAC prefix 'b8:27:eb:' is reserved for RBP Foundation
# see more: http://hwaddress.com/?q=B827EB000000
arp -a | grep 'b8:27:eb'

Or, if that doesn’t work, you can try nmapping your local network for open 22/tcp ports:

nmap -A '192.168.0-1.*' -p T:22 --open

Assuming the IP of your RBP is 192.168.1.102ssh to it (default password is raspberry):

ssh pi@192.168.1.102

Note: You might be greeted with a bunch of locale warnings. Feel free to ignore them for now.

Change user password

If you’d rather decrease the chances of your Pi joining some IoS botnet, change your password right away:

## run on RBP:
passwd
exit

Use keys to auth with ssh

Now that we’ve located the RBP and changed its password, let’s make things more secure.

I use Ed25519 keys and I strongly encourage you to do the same. Here’s an easy why & how to switch guide. That being said, you can pass a path to any key in the command below:

## on Mac:
ssh-copy-id -i ~/.ssh/id_ed25519.pub pi@192.168.1.102

Next we need to disable password authentication. Either manually:

## On Mac:
ssh pi@192.168.1.102
## On RBP:
# edit ssh daemon config file
sudo nano /etc/ssh/sshd_config
# Find `#PasswordAuthentication yes` & below it add:
PasswordAuthentication no

Use ctrl+xyenter to exit nano 😉😉.

Or using a oneliner:

## On RBP:
sudo sed -i '/#PasswordAuthentication yes/a PasswordAuthentication no' /etc/ssh/sshd_config

Listen to ssh-audit.py

It’s a good tool that offers good advice. If you want to see recommendations it gives, run:

## on computer:
git clone git@github.com:arthepsy/ssh-audit.git
cd ssh-audit
./ssh-audit.py 192.168.1.102

I won’t go into details here, but to follow its recommendations put this into /etc/ssh/sshd_config file on RBP3:

# make sure these are in the file and NOT commented out:
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_ed25519_key
# make sure these are either gone or commented out:
#HostKey /etc/ssh/ssh_host_dsa_key
#HostKey /etc/ssh/ssh_host_ecdsa_key
# add the below lines
KexAlgorithms curve25519-sha256@libssh.org
Ciphers chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes128-gcm@openssh.com,aes256-ctr,aes192-ctr,aes128-ctr
MACs hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,umac-128-etm@openssh.com

For Termius to work on mobile, you need to add diffie-hellman-group-exchange-sha256 to KexAlgorithms and hmac-sha-256 to MACs 😭.

For ConnectBot to work on mobile you only need to add hmac-sha2-512 to MACs 😢, as it supports Ed25519 curves.

Save the file and reload config of the ssh daemon:

## on RBP:
sudo service ssh reload

Note: If you disconnect now you will need to remove line containing 192.168.1.102 from ~/.ssh/known_hosts on your Mac before connecting again.

Permanent IP

To make things a bit more reliable for the future you might want to set a permanent IP for your Pi.

The easiest way to do it is to head over to your router admin page (likely 192.168.1.1 or 192.168.0.1) and find a “permanent IP” / ”DHCP Address Reservation section — each router is different, so you’re on your own here, but it will look something like:

Note: If you set it up & restart your router before reconnecting, you will nothave to fiddle with known_host file.

Public IP

To have your node as an active and contributing participant in the network, you might want to make sure you have a public (and static) IP. If not, most ISPs can usually provide it for a small fee.

Configure the Raspberry

All following commands are run on RBP, unless specified otherwise.

Localization, Time Zone, etc…

Run the below and feel free to play with the wizard there. You might want to change time zone and WiFi country. Also, “expanding the filesystem” is no longer necessary, as it happens automatically on the first boot (ref: scroll thisto 2016–05–10).

sudo raspi-config
# And if it didn't ask you to, run:
sudo reboot

Note: If you’ve set-up the localisation correctly, all the locale warnings should be gone now.

Get all the shiny updates

sudo apt update
sudo apt upgrade

Disable SWAP

Constant writing to an SD card can kill it in 30 days (according to the internet), so to minimize writes let’s:

# disable SWAP
sudo swapoff --all
# remove package that manages SWAP altogether
sudo apt-get remove dphys-swapfile
# I had some orphans left and this helped
sudo apt-get autoremove

Note: at this point storage taken by the system & updates is around 1.1GB.

Finally, the good stuff

The below steps are mostly, but loosely, based on the official UNIX BUILD NOTES.

Dependencies

Before we start, we need to install all required dependencies.

sudo apt-get install git build-essential libtool autotools-dev automake pkg-config libssl-dev libevent-dev bsdmainutils libboost-system-dev libboost-filesystem-dev libboost-chrono-dev libboost-program-options-dev libboost-test-dev libboost-thread-dev libminiupnpc-dev libzmq3-dev jq

Get Bitcoin client

Go to github.com/bitcoin/bitcoin/releases and see what’s the newest stable release. As of December 2017 it’s v0.15.1:

Knowing that:

cd ~
git clone -b v0.15.1 https://github.com/bitcoin/bitcoin.git
cd bitcoin

Note: As gruesome as “detached HEAD” sounds, it’s exactly as it should be and there’s no reason to panic.

Wallet

At this point you need to decide whether you want your node with wallet or not. You can change it later, but it will require recompilation.

  • If you intend to run this node on testnet only, there are no real drawbacks to having it compiled with a wallet.
  • If you intend to run this node on mainnet and want to use it to store funds/sign transactions, I recommend you make sure your RBP is very well secured (ex. bitcoin node running as a separate user, nothing else running on the same RBP, etc, etc…). It is also not recommended to store non-insignificant funds on an internet-connected device.

Berkeley DB (optional)

If you chose the path with wallet you need a very specific version (4.8) of Berkeley db. Luckily, there’s now a convenient script in the Bitcoin repo that does it for you — send love for that to James O’Beirne :).

If you used tag later than v0.15.1 it’s probably enough to:

./contrib/install_db4.sh $(pwd)

Otherwise, run this instead:

wget -qO- https://raw.githubusercontent.com/bitcoin/bitcoin/3d6ad407770e13958e157bf026cae0bfb9254899/contrib/install_db4.sh | sh -s $(pwd)

Bitcoin Client

./autogen.sh

If you want it with wallet, run:

export BDB_PREFIX=$(pwd)/db4
./configure LDFLAGS="-L${BDB_PREFIX}/lib/" CPPFLAGS="-I${BDB_PREFIX}/include/" CXXFLAGS="--param ggc-min-expand=1 --param ggc-min-heapsize=32768" --enable-cxx --without-gui --disable-shared --with-pic --enable-upnp-default

If you want it without wallet, run:

./configure CXXFLAGS="--param ggc-min-expand=1 --param ggc-min-heapsize=32768" --enable-cxx --without-gui --disable-shared --with-pic --enable-upnp-default --disable-wallet

Regardless of the choice above continue:

# this might take 5+ hours
make check
sudo make install

Note: during make check you might see a lot of warnings, fixing them might be a low-hanging-fruit way of becoming a Core contributor ;).

Configure

Probably the best way to get a well optimised ~/.bitcoin/bitcoin.conf file is to use the generator created by Jameson Lopp.

That being said, let’s create the required app data directory:

mkdir ~/.bitcoin

And put the minimal configuration to ~/.bitcoin/bitcoin.conf (note the dot in front of .bitcoin):

# makes client run in background
daemon=1
# magic RBP optimisations
dbcache=100
maxorphantx=10
maxmempool=50
maxconnections=40
maxuploadtarget=5000

Other optional, but useful:

  • upnp=1 — will try to automagically open a port on your router;
  • txindex=1 — will allow you to call getrawtransaction  on alltransactions (as opposed to only ones in the mempool and/or not fully spent). It’s a good idea to decide on this before the initial sync, changing it later will require a full -reindex;
  • testnet=1 — runs your node on a testnet, as opposed to mainnet;
  • rest=1 — enables REST interface on 127.0.0.1:8332;
  • server=1 — enables JSON-RPC interface;
  • prune=X — Removes past validated state beyond last X MB. I recommend against node pruning, unless you don’t have an SD card that’s big enough. As an example a reasonable value for a 64GB card would be prune=42000(42GB);

Run

bitcoind
Bitcoin server starting

Make sure it works

It might take a few minutes to start. You can watch progress by running:

tail -n 100 -f ~/.bitcoin/debug.log
# or (in case of testnet)
tail -n 100 -f ~/.bitcoin/testnet3/debug.log

And here’s a few of handy commands that you can later use:

bitcoin-cli getinfo
            getnetworkinfo
            getwalletinfo
            getblockchaininfo
            getpeerinfo

Make sure it’s accessible from outside

If you have public IP & chose upnp=1 your node should be accessible for the outside world. You can check it with:

curl -sL https://bitnodes.earn.com/api/v1/nodes/me-8333/
# or for testnet:
curl -sL https://bitnodes.earn.com/api/v1/nodes/me-18333/

If the response is {"success":true}, just skip to the next step.

Otherwise, there are still some things that can be done, but since they’re all very setup-specific, I will just list some ideas that might be worth pursuing:

  • Wait a bit (UPnP is currently renewed every 20 minutes),
  • Restart node and wait until it boots up completely,
  • Make sure UPnP is supported and enabled on your router,
  • Assign a permanent local IP to Raspberry Pi, and
  • Manually set up port forwarding (for port 8333 or 18333),
  • Make sure your ISP provides you with a public IP (see above).
This is how a successful UPnP might look like

Note: If neither of the above worked, your node will still connect to 8 peers and, from your perspective, will still be fully functional. The only difference being it will not be able to relay blocks and serve SPV wallets.

Now wait, and wait, and wait…

Now, that the node is running it will download and process the entire Bitcoin blockchain. This process will take between one or two months. Just leave it running and it will get there eventually.

Run on reboot

To avoid starting the node manually after each reboot, cron can be used:

which bitcoind
/usr/local/bin/bitcoind
crontab -e

And add this line to the end:

@reboot sleep 8; /usr/local/bin/bitcoind

The sleep 8 part is necessary to avoid this error:

Binding RPC on address 127.0.0.1 port 8333 failed.

Trusted Node

Once the sync completes your node is ready for the grand cooperation with the excellent Samourai Wallet ❤. To set it up just follow the simple guide here:

Other thingies

Logs

If something goes wrong, or you just want to see your node working, you can peak in here:

tail -f -n 100 ~/.bitcoin/debug.log
# or for testnet
tail -f -n 100 ~/.bitcoin/testnet3/debug.log

Note: Each restart generates a bunch of empty lines, so it’s really easy to spot it.

Make ssh welcome message pretty

There’s no reason to see that awful block of text every time you log in. Making it prettier was inspired with stuff from here.

TL;DR:

wget -qO- https://gist.github.com/meeDamian/0006c766340e0afd16936b13a0c7dbd8/raw/b4e98a66b54530d1d13729e13c53c5adbe9436b5/na%25C3%25AFve-rbp-btc.sh | sudo sh

Note: This script has to run as sudo, consider reading what it does before running.

Manual

Save this as /etc/update-motd.d/20-raspberry-bitcoin, and:

chmod +x /etc/update-motd.d/20-raspberry-bitcoin

After either, just log in again, and you should be greeted with:

RBP greeting

Note: You can summon the view above at any time with:

run-parts --lsbsysinit /etc/update-motd.d

Improvements? Mistakes?

If you’ve found anything incorrect in this guide, or have an idea on how to improve it, feel free to either leave a comment, btc AT meedamian DOT com or @meeDamian me.

Other Guides…

This is a third guide in a series of planned:

  1. Litecoin Full Node on RBP3,
  2. (obsolete) Bitcoin Full Node (with or w/o BIP148 UASF 🙊) on RBP3,
  3. Bitcoin Full Node on RBP3 (revised),
  4. Bitcoin through Tor on RBP3,
  5. Lightning Network (c-lightning) on RBP3,
  6. Lightning Network (lnd) on RBP3.

万字解读《区块链革命》:区块链会是互联网的重生法宝吗?

$
0
0

雷锋网(公众号:雷锋网)AI金融评论注:本文转载自公众号“方军读书会”,作者方军。原文标题为《万字解读〈区块链革命〉:区块链是互联网的二次革命》。方军曾在2016年读过《区块链革命》,此次在热潮中参照自身的实践,分享了对比重读此书中英文版的收获。他表示,原著作者注意到中本聪提出了一个新的“协议”(protocol):

这个协议以分布式计算技术为基础设定了一系列的规则——这让在脱离可信第三方中介的情况下,数十亿的设备能够在彼此之间安全地交换信息。

This protocol established a set of rules—in the form of distributed computations—that ensured the integrity of the data exchanged among these billions of devices without going through a trusted third party.

方军在本文重点关注到这是一次「信用层」的改变,它给原本的信用中介角色带来巨大的冲击。

▎上篇:可信的协议与价值互联网

区块链这个新协议带来的是两个关键词:「可信的协议」与「价值的互联网」。

1. 展望未来的框架

《区块链革命:比特币底层技术如何改变货币、商业和世界》作者是我非常喜欢的数字经济的专家唐·塔普斯科特,他写的《维基经济学》最早揭示了大规模协作的趋势,比《认知盈余》那本超级畅销书还要早。维基百科,至今仍是人类在互联网上协作、创造的最大的知识体之一。这本书是唐和他的儿子亚力克斯一起写的,亚力克斯是多伦多大学研究员,也是一个著名的区块链权威。

按我的理解,《区块链革命》这本书,核心讲了两件事:

第一,区块链这样一个革命性的技术,它的核心原则是什么,这也就是「区块链经济的七大设计原则」。

第二,区块链在几个产业的应用,包括金融、公司组织、商业模式、物联网、文化产业等等。

它为我们理解这个新技术可能带来的变革,提供了一个有用的框架:一组基本原则,然后看它们在各个产业的应用。这是我非常喜欢的讨论框架——原则可以抽象,在各个产业的应用, 又可以丰富和验证这些原则。

《区块链革命》这本书的价值在于,它不是讲具体技术的,而是讲未来的,它在只有很少的树木的时候(这本书最早出版是2016年,当时数字货币市场还未经历2017年下半年的大爆发)。

老唐和小唐通过一点点线索看到未来的苗头,帮我们描绘:未来,繁茂的森林会是什么样?

2. 比特币底层技术如何改变货币、商业和世界

这本书有一个副标题:比特币底层技术如何改变货币、商业和世界。

我们先解读一下这个副标题:

一,区块链,是比特币的底层技术。

互联网的人也喜欢叫它「协议」,区块链从比特币中独立出来之后,可能带来巨大的变化。我认为这是互联网的二次革命,现在我们就像处在1994年互联网刚刚兴起的那个阶段,这次区块链带来的变革会超过2010年左右开始的移动互联网。

二,区块链可能给货币、商业和世界三个东西带来改变:

改变货币,比特币最初的设想就是创造一种货币;

改变商业,区块链会重构很多商业逻辑与商业关系;

改变世界,它的影响不会局限在商业,它会给世界(比如个人、政府、公益)带来巨大的改变。

称区块链是一场技术的革命,并不是夸张的说法。

想想互联网在过去20年里给我们带来多大的改变,在未来十到二十年里面,区块链也可能给我们带来多大的改变。

3. 来自比特币的创新

对未来的所有展望,都是建立在区块链是什么的基础上的。搞明白它是什么,会给我们后续的讨论奠定一个基础。

区块链是比特币的底层技术,中本聪这个匿名的人 在发明比特币的时候,同时发明了区块链。关于比特币是什么,中本聪在那篇创世论文的标题中说得很清晰:

「比特币:点对点电子现金系统」
Bitcoin: A Peer-to-Peer Electronic Cash System

他想创造的是,是在数字世界中可以使用的现金,到今天,他的目标基本上达成了,8年时间,在数字世界中,他创造了一种像我们在现实世界中使用的现金一样的东西,而且几乎可以说是唯一一种。

它的原理其实很朴素,用数学的方法把比特币生成出来,就像大自然在几万年中生成黄金、人类去挖矿淘金一样。和黄金一样,比特币也是稀缺的、不可再生:比特币也有一个总量限制,一共可以产生2100万枚,并且越来越难挖到。

区块链是从比特币开始的,因此,现在和区块链相关的热潮,大众关注的重点是 「数字货币」或「加密数字货币」,它似乎有着某种财富效应。

区块链还是一个刚刚萌芽的新事物,每个人有每个人的理解,想象它不同的未来。结合我自己的实践,我这次重读《区块链革命》,我形成了我的理解,包括三点。

4. 区块链第一面:比特币的底层技术

对区块链的准确描述之一是,区块链是比特币的底层技术。

中本聪发明的比特币,实际上包括三层:

最上层,是我们说的,比特币这样一种数字世界中的电子现金。

中间一层,是生成和使用比特币的全套机制,人们也称这是「比特币协议」。

如果把比特币真的类比成现实世界中的货币的话,这个所谓的「比特币协议」就是中央银行、银行、在线支付、收钱的商家组成的发行和使用货币的金融体系。

最底层,就是我们讨论的「区块链」,在比特币这里,它是比特币的数据存储方式。

形象地说,它是一个存储在所有比特币相关的计算机(也就是所谓节点中的)、任何人都可以查阅的大账本。这个账本还有一个关键特点是,一旦大家对一个交易数据形成了共识、记录下来了,它就再也无法更改,这是人们通常说的区块链的「不可篡改」特性。

这就是我们理解的区块链的第一面:它是比特币的底层技术。

5. 区块链第二面:全球互联、分布式的、公开的大账本

对于比特币来说,它底层的区块链,其实就是一个全球互联的大账本,它存着比特币的所有的交易信息。

它的特点除了「不可篡改」外,还有一个重要特点是「分布式」。

「分布式」什么意思呢?

「案例讨论:支付宝 vs 比特币」

拿支付宝来对比下,我们在支付宝账户里面可能有些零钱,支付宝在背后也有一个巨大的账本,也就是一个超大型的数据库,这个数据库是由阿里巴巴和蚂蚁金服维护和管理的,蚂蚁金服就是中心。我们打开支付宝,看到自己的余额,或者支付,都是联网去跟这个数据库进行交互。

比特币背后的「区块链」这个大账本,不是像支付宝这样运作的,它的数据库不是存在一个集中的地方,现在比特币全球网络有1万多个节点,也就是运行全节点的计算机,逻辑上讲,每个全节点都有一份完整的账本。只要你愿意,你也可以把大账本下载下来,运行在自己的笔记本电脑里,未来运行在智能手机也是可能的。

这样带来的好处是,这一万多个比特币节点,哪一台出问题都没关系,一个数据只要存储下来,就再也不会丢失了。同时,由于它的机制设置,这些已经存下来的数据也不可篡改。

这其实是最早美国国防部高级研究局(APPA)发明阿帕网(APPANet)的基本思路,网络中没有中心,任何一个节点受到攻击,网络整体上还是可以运行的。

以我们刚才拿支付宝做类比,你可能也发现这样的设计还有一个好处:在这个里面,不再需要一个支付宝了。现在,全球的几百万人可以相互转比特币,未来,可能几亿人都可以相互转现金、证券、基金甚至房产这些有价值的数字资产,但不需要一个像支付宝这样的中介。

很自然地,这个网络中的巨大财富也就不会被一个中心拿走很多,现在,支付宝的母公司蚂蚁金服可能估值超过1000亿美元,而将来,由于不需要这样一个中心,所有的价值将被参与者共同分享。

这就是我理解的区块链的第二面:它是一个全球互联的账本,重要特点是:1)不可篡改;2)分布式;3)向所有人公开。

互联网历史上过去最重要的进步是蒂姆·伯纳斯-李发明的,也就是WWW(World Wide Web,万维网),也就是Web。

《区块链革命》 把区块链称为「世界账本」(World Wide Ledger),它是全球互联账本。这个名字也暗示,区块链可能是继Web之后最重要的互联网发明。

6. 无信任的信任(Trustless Trust)

那么,我们为什么相信这个账本中存在的信息是真实的?我们相信中央银行,比如美联储,我们相信互联网巨头,比如支付宝,是因为,我们认为它们已经建立了自己权威和可信的基础。

但是,我们现在相信这个世界账本中的交易信息的真实性,是采用的完全不一样的逻辑,这也是区块链为什么挑战很多人的基本认知:

过去,我们相信美联储,是我们认为有这样一个机构值得相信;

现在,我们相信这个世界账本中存储的信息,是因为:

我们假设任何单独的人、单独的机构都不可信,但是,通过一种巧妙的机制设计,所有人共同形成账本,又变得可信了。

这是就是所谓不信任的信任(Trustless Trust)。

重复一遍:区块链的假设是,没有单独的人、单独的机构是可信的,任何人都不可信任,而用机制确保所有人共同达成的共识是可信的,即所有人组成的集体是可信的。

这大概是为什么英国《经济学人》杂志称「区块链」是「信任的机器」,这个机器能从所有各方相互不信任的假设中,制造出信任或者信用(Trust)来。

这就引出了我看到的区块链的第三面。

7. 区块链第三面:聪明的机制与可信的账本

区块链采用聪明的机制、达成共识,形成了一个可信的账本。从不信任的基本假设中,产生集体的信任。

「共识」这个词,在讨论时,经常被无限引申。在我的理解中,仅就区块链技术而言,共识不是人与人之间的一致意见。在比特币和区块链技术的语境中,共识有两种含义:

第一,由数百万人共同形成的账本,对参与的所有人来说,是可信的。这是宏观的共识。

第二,在每一个新的交易时,比如我把一笔比特币转给你,或者一个比特币矿工因为挖出一个数据块而获得奖励,所有人对这个交易的一致认可,也是共识。这是微观的共识。

那么,让区块链能够成立的聪明的机制是什么呢?它来自这样三点:

  • 一,区块链,这个数据结构,让微观上达成共识的数据是可信的。具体说,就是数据块串成一个链条,新的数据也就是链条的新的一环,这环中,除了自己数据,也包括了上一个数据块的哈希值,也就是数据的指纹。这样,如果上一个数据块发生了变化,它和数据指纹就对不上号了,我们就知道它被篡改了。
  • 二,宏观的信任,它来自于一个简单的基本规则:所有人只相信最长链条上的所有数据。只有最长链是可信的。
  • 三,比特币挖矿机制。比特币矿工,并不是像淘金的矿工在地底下挖矿,他们的计算机按照某种既定的规则计算复杂的数学运算,全球几万个节点在争夺谁能最快算出来。最先算出来的矿工,就给区块链增加了一个新的数据块;最先算出来的矿工,也获得相应的比特币作为奖励。

之前挖出一个数据块可以获得25个比特币奖励,现在已经减半只能获得12.5个比特币奖励。这个机制,也就是通常人们说的工作量证明(PoW),比特币矿工的计算机进行复杂计算,争夺记账的权利,并得到相应的回报。

到这里,我们就可以基本上回答「区块链是什么」这个问题:

  1. 区块链是比特币的底层技术。
  2. 区块链是一个全球互联、分布式的、公开的大账本。
  3. 区块链采用聪明的机制、达成共识,形成了一个可信的账本。

8. 当比特币和区块链分开

在比特币发展一段时间之后,人们很快发现,打破各国央行的控制,在数字世界中,通过算法来发行一种「货币」可能过于离经叛道,难以一下子接受。

但是,比特币背后的「区块链技术」似乎可以独立出来,这可是一个革命性的协议,可以用来变革金融业,在技术上它也极有特点,区块链技术在过去几年中,就开始孕育,出现大量的创新项目。老唐父子最早是在2016年采访大量比特币与区块链社群的人士,写出《区块链革命》这本书的。

在互联网中,区块链这个账本逐渐地扩展,变成了一个「可信的协议」(The Trust Protocol)或「信用层」(The Trust Layer) 。

《区块链革命》这本书第一章的标题就点出了这一点,区块链是一个「可信的协议」(the trust protocol)。区块链是新一代的协议,上一个是WWW(万维网协议)。协议级的改变,通常会带来巨变,因此区块链革命来了。

信用层是区块链专家、以太坊顾问董事威廉·穆贾雅在《商业区块链》提出来的,用他的话说,“信用的去中心化”使得“无须中介的价值流动”成为可能。

这个区块链信用层成为与WWW协议并列的层次,用于处理信用和价值转移。由此,在互联网中,在信息流动的WWW协议层旁边,多了一个价值流动的区块链信用层。

万字解读《区块链革命》:区块链会是互联网的重生法宝吗?(上篇)

9. 价值的互联网

区块链这个新协议带来的是两个关键词:一是「可信的协议」。第二个关键词是「价值的互联网」。

我们现在的互联网,从本质上讲是信息的互联网。信息相互链接成网状,在网上流动的是信息。

信息的流动有什么特点呢?我发一个电子邮件给你,其实只是把邮件的副本给你了,我自己的电脑上这个信息还在。实际上我的邮件服务器上、你的邮件服务器上,这个邮件在传递过程中经过的服务器,都有这个信息的副本,信息的流动方式是复制。

这样的方式传递信息很好,但当我们要把金钱,也就是价值,转给别人时,这种方式就不行了。

我把钱给你,我手上必须没这个钱了。其实,不只是钱,现实世界中的有价值的物品的传递,都不是信息复制的逻辑——我把一个苹果给你,我手上就不应该还有一个苹果。

在区块链这个全球互联账本之上,中本聪发明的比特币协议和比特币,就是想创造一种像现金一样的东西:在实体世界中,我给你一百块钱现金,我手上就没有这一百块了。比特币协议,的确创造出了一种跟现金一样性质的东西,我把一个比特币给你,我手上就没有了。

这个比特币值得多少钱不是关键,它可能是最早1万个比特币值25美元的两个披萨,也可能是现在一个比特币值1万美元。关键是,通过这种协议,我们可以在数字世界里,在人与人之间转移类似现金这样的所谓「价值」了,不需要任何中介机构的参与和背书。

因此,区块链技术也被认为是下一代互联网的基础:

现在的互联网是基于WWW协议,它只能传递信息;基于区块链技术的下一代互联网,它可以传递价值。

下一代互联网, 就是「价值的互联网」,这是我们讨论的区块链技术的第二个关键词。

总的来说,区块链是一个基础协议级的变革,可以用两个关键词描述:可信的协议;价值互联网。

区块链经济的七个设计原则:

  • 网络化诚信 Networked Integrity,原则:信任源自内在,而非外在。(Trust is intrinsic, not extrinsic.)
  • 分布式权力 Distributed Power,原则 :系统通过一个点对点网络来分配权力,而不再进行单点控制。任何参与者都无法关闭系统。
  • 把价值作为激励 Value as Incentive,原则 :系统把所有利益相关者的奖励都结合到一起。
  • 安全性 Security,原则 :网络中嵌入的安全措施是不会出现单点故障的,它们不光保证机密性,而且保证所有活动的真实性以及不可抵赖性。
  • 隐私 Privacy,原则 :人们应当控制他们自己的数据。他们可以自主决定哪些身份信息、在什么时候、以何种方式、透露多少给其他人。
  • 权利保护 Rights Preserved,原则: 所有权公开透明且可执行。个人自由是可以被承认和尊重的。
  • 包容性/普惠 Inclusion,原则: 经济发展的最佳状态就是它能兼顾到所有人。也就是说,要降低对参与者设定的门槛,要为资本主义分布式发展创建平台,而不仅仅是重新分配式的资本主义。

如果你这七个原则感兴趣,你可以去阅读书的第二章,每个原则,他们都分别讲了原则本身,有待解决的问题,以及对区块链经济的影响。

下篇:去中介化

新的中心取代旧的中心,新的中介取代旧的中介,整个产业价值链被完全重构。

其中,受到最大冲击的是信用中介。

10. 去中介化:去掉信用中介

那么,区块链可能带来的产业变革是什么?我认为:

区块链带来的变革,可能是把产业中的占据主导地位的中介推翻,并重建新的产业价值链条。

有人喜欢把这种特性叫「去中心化」,或者像在1990年代人们讨论互联网时喜欢用的词「去中介化」,但实际上都是:新的中心取代旧的中心,新的中介取代旧的中介,整个产业价值链被完全重构。

在具体讨论之前,我们先看几个可以类比的案例:

讨论比特币时我们看到,比特币设计让两个人可以直接转账,而不用依靠类似于支付宝这样的中介。——这是所谓的「去中介」。

但互联网的发展历史一再表明,电商不是去中介化,是线上的亚马逊、淘宝、天猫、京东,取代了线下效率不那么高的书店、商场、超市。——这是高效率中介,取代低效率中介。

过去七年,移动互联网的发展带来了美团、滴滴、Uber、AirBnb,他们是在生活服务方面,用更高效率的中介取代低效的中介。比如,Uber、滴滴,取代了出租车公司,减少了中间的浪费,为消费者提供了更好的服务。

迄今为止的所有的去中介化,是因为「效率」:高效率中介取代低效率的中介。比如,淘宝、京东、滴滴等在匹配效率上远优于传统中介。当然,他们也一定程度上起到了信用中介的角色。

书店、商场、超市有着巨大的成本,而电商可以通过各种方式削减成本,让生产商、消费者都受益,电商平台从整个产业价值中获取的份额,远少于线下渠道,少于国美、苏宁原来从产业链中攫取的份额。

但区块链带来的「去中介化」,变革的核心不是效率,而是信用。比如,支付宝提升的主要不是匹配效率,它的主要作用是信用中介。

现在,区块链让一种可能性出现,我们不必完全仰赖支付宝这样的信用中介了。这必将带来巨变。

仍以比特币和支付宝做对比,如果不需要支付宝,那么,这中间被支付宝这个中介取走的价值就少了很多,而让更多人受益了。

区块链,作为新一代的互联网基础协议,在颠覆产业中原有的中介,用新的中介、中间人取代它们,重建新的产业价值链,它带来的变革会超出我们现在的想象。

11. 信用中介的变化:这是互联网在换发动机

我们可以用类比的方式再看下:

过去几年,以特斯拉为代表的电动车快速发展,虽然车的外形还看起来没有变化,虽然车里面看似只是由燃油发动机,换成电池和电动机,但是,仅就车本身看,非常根本的变化已经发生了。

车里面原来围绕燃油发动机的整套装置都要被废弃掉了,汽车的机械设计比过去简单很多。

更不用说,和车相关的一系列外部设施都会发生变化,加油站变成了充电点,4S店的服务内容发生变化,等等。

也就是,一个关键的变化,带来后续一系列的变化。

现在,从WWW与信息的互联网,到区块链与价值的互联网,正可以类比成,互联网这个汽车在换发动机。

接下来,我们就选几个产业领域的案例来看看,区块链可能会带来什么样的变化,怎样颠覆掉旧中介、旧中心,成为新中介、新中心,怎样重建全新的产业价值链?

我们主要来看看金融、文化等两个领域的案例。

12. 账本的演变

由于比特币最初是跟货币和金融相关的,在相当长的时间里,区块链被视为一种金融科技(FinTech),直到最近人们才认为它有着比金融更大的使用场景。我们先回到金融领域,来看看区块链,究竟可以怎样在金融领域里面消除中间人?
区块链,最简单的说,就是一种全球互联的、不可篡改的账本。

在商业世界里,账本是最基本的东西,比如有一整套会计学和会计、审计体系是围绕账本展开的。现在,区块链这样一种全新的数字化账本,自然会给会计这件事带来巨大的变革。

人类记账的历史,大体上分这样几个阶段(资料源自于《图说区块链》(徐明星等/著),账本演变:一本账的兴衰发展史):

最初,人类是靠头脑来记忆,很显然,这样的账本很小、很不可靠。之后,人类用简单刻画和直观绘图的方式,把要记录的数字记录下来。

再之后,人类学会了「结绳记事」,这可以看成是账本的起源。

在原始社会末期,人们按照时间发生的顺序,把各种账目记下来,这就是流水账。这也叫单式记账。

之后,记账历史上最重要的发明就发生了,也就是复式记账法。任何一个交易, 都必须同时分别记录到两个或两个以上的账户中去。比如,我们公司花五万元买了服务器,那么,我们的资产表中,现金就要记录减少了5万元,而资产则要记录增加了5万元。

复式记账法到现在仍是当代会计的基础。当然,当代公司的会计体系又要复杂很多,比如会计的计算机化,比如ERP系统,比如一家公众公司的账目要由独立第三方的会计事务所来进行审计。

13. 区块链给账本带来的

那么,区块链这样一个全球互联、透明的、不可篡改的账本,如果应用到公司的账目记录中,会带来什么变化呢?

第一,如果账目不可篡改,那么,外部会计师事务所所做的审计工作,就要简单很多。一家上市公司的财务链条上很多东西,都因此可以被简化。在最极致的情况下,如果一家上市公司的账本是对所有人都是公开的,那么整个公司体系可能都会发生巨变。

第二,即便这个账本不是对所有人公开,我们再设想一种情况:当代的公司往往是嵌入在一个复杂的商业网络中,每个公司都要与很多合作方有账目往来。如果区块链的技术被用起来,让合作方能够根据需要,查询它们相关的账本,这样,也可以做到:极大地增强合作方之间的信任。

上面仅是以公司的账目为例,实际上,在全球金融体系中,主要的账目是银行的账目,很多关于把区块链用于账本的项目是围绕银行的账本展开的,比如全球众多银行建立的R3联盟,现在随着区块链往各个细分领域渗透,我们刚才设想的场景也有项目在做。

简单讨论就可以看到,如果把区块链看成是新的账本技术,如果它被应用到账本中,不管是对所有人公开,还是仅对合作伙伴公开,会计链条中很多方面都会被改变,至少会计师事务所这个审计中间人,会受到冲击。

14. Ripple:变革全球货币兑换体系

区块链不只是账本技术,现在区块链技术上最重要、最知名的应用是比特币。数字货币这个事物如果用在全球金融体系中,也会带来巨大的变化。现在全球排名第三的虚拟币Ripple(瑞波)就已经给我们完美地展示了这种可能性。

对很多坚持比特币和区块链的基本理念的人来说,Ripple不是一个真正的公有链,它是由众多银行支持的。但如果我们抛开这些争议,我们会发现,Ripple这个基于区块链的系统,给全球货币兑换体系带来巨大的变革。

万字解读《区块链革命》:区块链会是互联网的重生法宝吗?(下篇)

图片来源:《价值互联网》

过去,当公司需要跨国转账的时候,金钱需要经历非常复杂的过程,可能要经过很多天。Ripple的设想和做法很简单,也就是,所有的参与者都认可瑞波币,在一方,将所要汇款的金钱折算成瑞波币,然后通过Ripple的全球区块链网络转移到另一国,在另一边,再将瑞波币转换成该国的货币。

这样,所有参与的金融机构进行跨国转账的过程就变得简单了,中间大量的环节消失了,时间也由几天变成了几分钟这样近似是即时的。

我们看到,通过采用区块链技术,在跨国转账时,Ripple和它的金融业联盟消除了很多中间人,提高了效率。

采用这种方式,还有一个重要特点,过去,由于有众多的中间人,一笔跨国转账需要支付很高的费用,这使得小额转账很难进行,但在新的场景下,也许一美元这样的金额都是可以转的。《区块链革命》中强调:这将扩大全球金融体系的「包容性」,实现普惠金融,让穷人也能受益。

仅就开放账本和Ripple跨国转账这两个例子,我们就看到,应用区块链技术,可以大幅度地消除原有的低效率中间人,用新的中介取代旧的中介。

15. 在区块链上解放文化产业

我们再来看区块链可能给文化产业带来什么样的变化。

老唐父子看到了文化产业的很多问题,其中最严重的问题是,各种中间人拿走了大部分收益,而让创作者拿不到应得的收益,他们因而专门有一章讨论:「在区块链上解放文化产业」。

他们在讨论这个问题时,是有着一种理想主义情怀的,比如他们说:

区块链技术把音乐艺术家放在产业模式的中心位置,这样艺术家们既能享受表达的自由,又能将其知识产权所带来的精神价值和物质价值最大化。

不会再有庞大的、贪婪的中介机构。

的确,音乐商业链条中的各种中介机构,夺取了市场中的最大份额。如果音乐人可以通过区块链发布音乐,然后用户每一次收听,音乐人都能自动地收到一笔由知识产权而来的报酬,这样,这样就可以把很多中间人的角色消除掉了。

我认为,由于音乐、文字、视频等内容本来就是数字化,这会成为区块链变革的最前沿。相对而言,那些把线下尚未数字化的资产与区块链挂钩、上链的,所要跨越的障碍太多。

由于音乐、文字等内容,是原本就是数字化的,它们从来都是互联网上各种技术和商业变革的前沿:

– 互联网门户变革的是内容;

– Web2.0和博客,让每个人都可在网上发布文章;

– 140个字母的Twitter和微博,极大地降低了发声的门槛;

– 微信公众号形成了自媒体浪潮;

– 视频直播降低了主播与观众互动的门槛。

区块链技术很自然地也会在「数字内容」这个向来是创新试验田的地方有些动作。实际上,有些项目已经非常吸引很多创作者和用户:

比如Steemit这样一个文章发布平台,鼓励用户们为自己喜欢的文章赞助比特币等虚拟货币。中国也有一个名为「币乎」的类似项目。

题外话一句,我个人认为Steem这个以社交内容为场景区块链以及它上面的内容应用Steemit设计了一个精妙的经济系统,它包括四种代币类型:基础代币Steem,股权代币Steem Power,稳定代币/类债券代币Steem Blockchain Dollar(SBD),以及类ERC20标准代币Smart Media Token(SMT)。

区块链在内容产业的应用,现在还很初步,但是,我们可以相信,由于这个产业本来就高度数字化,在这个领域会出现非常独特的创新模式。现在人们在设想用区块链去变革很多产业,但可以快速落地的,数字内容一定是其中之一。

16. 茂密的森林与多样的生态

鲸鱼是世界上最大的哺乳动物,那么,世界上最大的生物体是什么呢?

这个世界上最大的生物体是位于美国犹他州的Pando。它有多大呢,它占地42公顷,重量超过6000吨。

你可以认为它是一棵树,或者是许多棵树,这要看你怎样定义一棵树。说它是一棵树也是对的,因为尽管地面上有很多棵树,但在地底下,它们有着同一个庞大的根系。

在八万年前,这个现在被称为Pando的世界上最大的生命体,可能是一棵树,但现在已经变成了庞然大物。

在过去的20年中,互联网以这样的方式生长,而从2018年开始,人们发现,新一代的互联网——基于区块链的价值互联网,可能再次以这样的方式生长。

现在,信息互联网已经是一片庞大的森林,价值互联网在地表上,仍是稀稀拉拉的几棵树,虽然这几棵树可能看着很不一样。

但是,下面的根已经非常庞大。我们现在也并不知道,这个根系,与信息互联网是紧密缠绕成更大的整体根系,还是相对独立的。但不管怎样,未来,价值互联网因为和实体世界联系更紧密,恐怕比信息互联网还要庞大。

《区块链革命》这本书,值得一读再读,因为它在只有几棵树的时刻,在我们看不清地底下庞大的根系会如何生长的时刻,带我们跨越到未来,看到了茂密的森林。

How to setup mount / auto-mount USB Hard Drive on Raspberry Pi

$
0
0

How to setup mount / auto-mount USB Hard Drive on Raspberry Pi

Follow the simple steps in the order mentioned below to have your USB drive mounted on your Raspberry Pi every time you boot it.

These steps are required especially if your are setting up a Samba share, or a 24×7 torrent downloader, or alike where your Raspberry Pi must have your external storage already mounted and ready for access by the services / daemons.

Step 0. Plug in your USB HDD / Drive to Raspberry Pi If you are using a NTFS formatted drive, install the following

sudo apt-get install ntfs-3g

Step 1. Log on pi using ssh terminal and execute:

sudo blkid

You will see something like the following:

lrwxrwxrwx 1 root root 10 Jan 1 1970 0AC4D607C4D5F543 -> ../../sda1 Note down the value of the UUID –> 0AC4D607C4D5F543

Step 2. Create a location for mount point:

sudo mkdir /mnt/volume

Give proper permission:

sudo chmod 770 /mnt/volume

Step 3. Get the uid, gid for pi user and group with id command (usually 1000)

Step 4. Mount the USB Drive and then check if it is accessible at /mnt/volume

sudo mount -t ntfs-3g -o uid=1000,gid=1000,umask=007 /dev/sda1 /mnt/volume

Or:

sudo mount /dev/sda1 /mnt/volume

Note: ntfs-3g for NTFS Drives vfat for FAT32 Drives ext4 for ext4 Drives

Step 5. Now, we will configure RasPi to do this after every reboot: Take a backup of current fstab and then edit

sudo cp /etc/fstab /etc/fstab.backup
sudo nano /etc/fstab

Add the mount information in the fstab file (replace UUID with your own):

UUID=0AC4D607C4D5F543 /mnt/volume ntfs-3g uid=1000,gid=1000,umask=007 0 0

Or:

/dev/sda1 /mnt/volume ntfs defaults 0 0

Step 6. Reboot

sudo reboot

Step 8. (Optional, required if using as data storage for owncloud) If you are configuring ownCloud’s data directory on your NAS drive, it should be having a 770 permission for www-data user. You can simply add user www-data to pi group, since its already having 770 as permission as set above in fstab.

sudo usermod -a -G pi www-data

Alternative 2

This is a short guide on how to connect an External Hard Drive to the Raspberry Pi! Most external Hard Drives are quite juicy and will require a USB Hub to run in a stable manner, so please do check this before trying to install your drive!

First step is to plug it in, and then switch on your Pi! It should boot up as normal, so go ahead and log in to Raspian as usual.

Step 1. Is it there?!

If you want to check for the current storage devices attached to your Pi, simply run the command:

sudo blkid

This reveals that we currently have our “Seagate Expansion Drive” attached.

Step 2. Check the Partitions

We now need to check the boot name of our Seagate’s partition.

sudo fdisk –l

Reveals that our drive is located at /dev/sda1

Step 3. Mounting it.

Now we know where our drive is, we need to mount it:

sudo mount /dev/sda1 /mnt/volume

The folder “/mnt” is the standard location for mounting permanent media, but you can always create your own folder if required using the “mkdir” command.

That’s it! Our drive is mounted.

Step 4. Permissions.

As our drive is formatted in NTFS, we might need to change the /mnt drive permissions in order to enable proper access. Simply run the following command:

sudo chmod 775 /mnt/volume

This will change your permissions and allow you to access the drive.

To test this, let’s try to create a folder. . .

cd /mnt/volume
sudo mkdir /IMAFOLDER
cd /IMAFOLDER

Great! So we can read and write to our hardrive!

Step 5. Automounting our drive.

If you want your Hard Drive to mount from boot, we need to set this up!

First step is to edit our “fstab” file

sudo nano /etc/fstab

This will open up the file in nano text editor:

We need to add the following line to have our hard drive mount at boot!

/dev/sda1 /mnt/volume /ntfs defaults 0 0

You can now reboot your Raspbery Pi, and your Hard Drive will automatically mount!

Step 5. How to unmount.

To unmount the drive, simply run the command:

sudo umount /mnt/volume

As long as you’re not currently accessing the drive, it should unmount successfully.

bitcoin-cli dumpprivkey

$
0
0

bitcoin-cli getnewaddress

bitcoin-cli dumpprivkey 1someBTCaddressxlkdFNndmf

Viewing all 759 articles
Browse latest View live