天天看點

區塊鍊學習區塊鍊學習

區塊鍊學習

本Markdown編輯器使用StackEdit修改而來,用它寫部落格,将會帶來全新的體驗哦:

  • Markdown和擴充Markdown簡潔的文法
  • 代碼塊高亮
  • 相關資料 

    相關資料及安裝過程的日志可通過我的百度雲盤擷取。

  • 其他 

    簡識hyperledger febric 

    入門安裝詳細步驟

  • vagrant和docker比較 

    vagrant和docker異同 

    fabric-sdk-java在IDEA中的使用參考:http://www.cnblogs.com/maobuji/p/7206563.html

  • 碰到的問題
  • 不能正确更新nodejs版本,一直是老版本。(Why does installing node 6.x on Ubuntu 16.04 actually install node 4.2.6?)

更新到6.x的腳本:

curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -     sudo apt-get install -y nodejs      sudo apt-get install -y npm           
  • 1
  • 2
  • 3

錯誤資訊:

sudo apt-get install -y nodejs      Reading package lists... Done     Building dependency tree            Reading state information... Done     The following packages were automatically installed and are no longer required:       gyp libboost-python1.58.0 libjs-inherits libjs-node-uuid libjs-underscore       libssl-dev libssl-doc libuv1-dev linux-headers-4.4.0-18       linux-headers-4.4.0-18-generic linux-headers-4.4.0-21       linux-headers-4.4.0-21-generic linux-image-4.4.0-18-generic       linux-image-4.4.0-21-generic linux-image-extra-4.4.0-18-generic       linux-image-extra-4.4.0-21-generic linux-signed-image-4.4.0-18-generic       linux-signed-image-4.4.0-21-generic python-configobj python-pycurl       python-pyexiv2 python-pyexiv2-doc     Use 'sudo apt autoremove' to remove them.     The following NEW packages will be installed:       nodejs     0 to upgrade, 1 to newly install, 0 to remove and 0 not to upgrade.     Need to get 0 B/3,162 kB of archives.     After this operation, 13.2 MB of additional disk space will be used.     Selecting previously unselected package nodejs.     (Reading database ... 329473 files and directories currently installed.)     Preparing to unpack .../nodejs_4.2.6~dfsg-1ubuntu4_amd64.deb ...     Unpacking nodejs (4.2.6~dfsg-1ubuntu4) ...     Processing triggers for doc-base (0.10.7) ...     Processing 1 added doc-base file...     Registering documents with scrollkeeper...     Processing triggers for man-db (2.7.5-1) ...     Setting up nodejs (4.2.6~dfsg-1ubuntu4) ...     update-alternatives: using /usr/bin/nodejs to provide /usr/bin/js (js) in auto mode           
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29

解決方案:

  1. Create a new file: /etc/apt/sources.list.d/nodesource.list 

    You’ll need to create this file with sudo, but when you create the file, put this inside it:

deb https://deb.nodesource.com/node_6.x xenial main     deb-src https://deb.nodesource.com/node_6.x xenial main           
  1. Download the GPG Signing Key from Nodesource for the repository. 

    Otherwise, you may get NO_PUBKEY errors with apt-get update:

curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | sudo apt-key add -           
  1. Manually run sudo apt-get update. 

    This refreshes the data from the nodesource repo so apt knows a newer version exists. 

    If you get a NO_PUBKEY GPG error, then go back to Step 2

  2. Check apt-cache policy nodejs output. 

    This is not done by the script, but you want to make sure you see an entry that says something like this in the output:

Version table:         6.2.1-1nodesource1~xenial1 500            500 https://deb.nodesource.com/node_6.x xenial/main amd64 Packages         4.2.6~dfsg-1ubuntu4 500            500 http://archive.ubuntu.com/ubuntu xenial/universe amd64 Packages           

If you do not see entries like this, and only see 4.2.6, start over. Otherwise, proceed. 

5. Install the nodejs binary. Now that you have confirmed 6.x is available on your system, you can install it: sudo apt-get install nodejs 

6. nodejs –version should now show v6.2.1 or similar on output (as long as it starts with v6. you’re on version 6 then). 

解決方案參考連結 

nodejs安裝

  • Platform-specific Binaries 下載下傳問題 

    通過以下方式下載下傳,國内受網絡限制,基本連不上,即使連上速度也很慢。可通過手動方式下載下傳。

curl -sSL https://goo.gl/Q3YRTi | bash           

手動下載下傳hyperledger-fabric binaries,根據系統版本下載下傳對應tar包,我下載下傳的是hyperledger-fabric-linux-amd64-1.0.3.tar.gz 

FQ國外風景 

下載下傳成功後根據官網的介紹,解壓後會得到一個bin檔案夾,将其解壓至*/fabric-samples目錄下即可運作first-network等項目。 

因是手動下載下傳的zip,對應的bash并沒有執行,需要我們手動下載下傳fabric鏡像

bwf@ubuntu:/usr/hyperledger/fabric-samples$ ls bin 

configtxgen cryptogen get-docker-images.sh peer 

configtxlator get-byfn.sh orderer 

bwf@ubuntu:/usr/hyperledger/fabric-samples$ cd bin 

bwf@ubuntu:/usr/hyperledger/fabric-samples/bin$ ./get-docker-images.sh

通過如下指令啟動鏡像。(因手動下載下傳的鏡像,啟動腳本預設用latest版本,有可能報錯)

./byfn.sh -m up           

錯誤資訊

bwf@ubuntu:/usr/hyperledger/fabric-samples/first-network$ ./byfn.sh -m up     Starting with channel 'mychannel' and CLI timeout of '10000'     Continue (y/n)? y     proceeding ...     Creating network "net_byfn" with the default driver     Pulling orderer.example.com (hyperledger/fabric-orderer:latest)...     ERROR: manifest for hyperledger/fabric-orderer:latest not found     ERROR !!!! Unable to start network     Error response from daemon: No such container: cli     bwf@ubuntu:/usr/hyperledger/fabric-samples/first-network$           

解決方法1:修改鏡像版本為latest.(所涉及鏡像都要更新)

bwf@ubuntu:/usr/hyperledger/fabric-samples/first-network$ docker tag hyperledger/fabric-orderer:x86_64-1.0.3 hyperledger/fabric-orderer:latest           

解決方法2:修改相關*ymal,添加上對應版本号(所相關的都要改) 

例:bwf@ubuntu:/usr/hyperledger/fabric-samples/first-network/base$ cat docker-compose-base.yaml

image: hyperledger/fabric-orderer           

改為:

image: hyperledger/fabric-orderer:x86_64-1.0.3           

再次啟動即可。

快捷鍵

  • 加粗 

    Ctrl + B

  • 斜體 

    Ctrl + I

  • 引用 

    Ctrl + Q

  • 插傳入連結接 

    Ctrl + L

  • 插入代碼 

    Ctrl + K

  • 插入圖檔 

    Ctrl + G

  • 提升标題 

    Ctrl + H

  • 有序清單 

    Ctrl + O

  • 無序清單 

    Ctrl + U

  • 橫線 

    Ctrl + R

  • 撤銷 

    Ctrl + Z

  • 重做 

    Ctrl + Y

Markdown及擴充

Markdown 是一種輕量級标記語言,它允許人們使用易讀易寫的純文字格式編寫文檔,然後轉換成格式豐富的HTML頁面。 —— [ 維基百科 ]

使用簡單的符号辨別不同的标題,将某些文字标記為粗體或者斜體,建立一個連結等,詳細文法參考幫助?。

本編輯器支援 Markdown Extra ,  擴充了很多好用的功能。具體請參考Github.

表格

Markdown Extra 表格文法:

項目 價格
Computer $1600
Phone $12
Pipe $1

可以使用冒号來定義對齊方式:

數量
1600 元
12 元
1 元 234

定義清單

Markdown Extra 定義清單文法:
項目1
項目2
定義 A
定義 B
項目3
定義 C
定義 D
定義D内容

代碼塊

代碼塊文法遵循标準markdown代碼,例如:

@requires_authorization     def somefunc(param1='', param2=0):         '''A docstring'''         if param1 > param2: # interesting             print 'Greater'         return (param2 - param1 + 1) or None     class SomeClass:         pass     >>> message = '''interpreter     ... prompt'''           

腳注

生成一個腳注1.

目錄

用 

[TOC]

來生成目錄:

      • 數學公式
      • UML 圖
    • 離線寫部落格
    • 浏覽器相容

使用MathJax渲染LaTex 數學公式,詳見math.stackexchange.com.

  • 行内公式,數學公式為:Γ(n)=(n−1)!∀n∈NΓ(n)=(n−1)!∀n∈N。
  • 塊級公式:

x=−b±b2−4ac−−−−−−−√2ax=−b±b2−4ac2a

更多LaTex文法請參考 這兒.

UML 圖:

可以渲染序列圖:

張三張三李四李四嘿,小四兒, 寫部落格了沒?李四愣了一下,說:忙得吐血,哪有時間寫。

或者流程圖:

開始我的操作确認?結束yesno

  • 關于 序列圖 文法,參考 這兒,
  • 關于 流程圖 文法,參考 這兒.

即使使用者在沒有網絡的情況下,也可以通過本編輯器離線寫部落格(直接在曾經使用過的浏覽器中輸入write.blog.csdn.net/mdeditor即可。Markdown編輯器使用浏覽器離線存儲将内容儲存在本地。

使用者寫部落格的過程中,内容實時儲存在浏覽器緩存中,在使用者關閉浏覽器或者其它異常情況下,内容不會丢失。使用者再次打開浏覽器時,會顯示上次使用者正在編輯的沒有發表的内容。

部落格發表後,本地緩存将被删除。 

使用者可以選擇 把正在寫的部落格儲存到伺服器草稿箱,即使換浏覽器或者清除緩存,内容也不會丢失。

注意:雖然浏覽器存儲大部分時候都比較可靠,但為了您的資料安全,在聯網後,請務必及時發表或者儲存到伺服器草稿箱。

  1. 目前,本編輯器對Chrome浏覽器支援最為完整。建議大家使用較新版本的Chrome。
  2. IE9以下不支援
  3. IE9,10,11存在以下問題 
    1. 不支援離線功能
    2. IE9不支援檔案導入導出
    3. IE10不支援拖拽檔案導入

原文釋出時間為:2017年10月24日

本文作者:bwf1234

本文來源:

CSDN

,如需轉載請聯系原作者。

繼續閱讀