nannxnann
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
      • Invitee
    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Versions and GitHub Sync Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
Invitee
Publish Note

Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

Your note will be visible on your profile and discoverable by anyone.
Your note is now live.
This note is visible on your profile and discoverable online.
Everyone on the web can find and read all notes of this public team.
See published notes
Unpublish note
Please check the box to agree to the Community Guidelines.
View profile
Engagement control
Commenting
Permission
Disabled Forbidden Owners Signed-in users Everyone
Enable
Permission
  • Forbidden
  • Owners
  • Signed-in users
  • Everyone
Suggest edit
Permission
Disabled Forbidden Owners Signed-in users Everyone
Enable
Permission
  • Forbidden
  • Owners
  • Signed-in users
Emoji Reply
Enable
Import from Dropbox Google Drive Gist Clipboard
   owned this note    owned this note      
Published Linked with GitHub
Subscribed
  • Any changes
    Be notified of any changes
  • Mention me
    Be notified of mention me
  • Unsubscribe
Subscribe
# 使用Use OurChain ## 1.安裝 Install 備註 PS: 1. <font color="#ff0000">**依個人電腦需求加 sudo / Depend on personal need to do sudo**</font> 2. 沒有Linux環境請使用docker實驗 [參考這裡 here](https://hackmd.io/Bo8C0LogQfmq_eSuOExr0w?both#4%E7%94%A8Use-Docker%E5%BB%BA%E7%BD%AE-Build-OurChain) 3. Ubuntu 22.04 **安裝相關依賴套件, Installation of Dependent Package** ``` sudo apt-get update sudo apt-get install build-essential libtool autotools-dev automake pkg-config libssl-dev libevent-dev bsdmainutils sudo apt-get install software-properties-common ``` **根據不同 Ubuntu 版本需安裝不同的程式庫,若為 Ubuntu 16.04 或更舊版本,請執行** ``` sudo add-apt-repository ppa:bitcoin/bitcoin # for Ubuntu 16.04 ``` **若為 Ubuntu Ubuntu 18.04 或更新版本,請執行** ``` sudo add-apt-repository -y ppa:luke-jr/bitcoincore # for Ubuntu 18.04, 20.04, 22.04 ``` **接著繼續安裝必要套件** ``` sudo apt-get update sudo apt-get install libdb4.8-dev libdb4.8++-dev sudo apt-get install libboost-system-dev libboost-filesystem-dev libboost-chrono-dev libboost-program-options-dev libboost-test-dev libboost-thread-dev sudo apt-get install libqt5gui5 libqt5core5a libqt5dbus5 qttools5-dev qttools5-dev-tools protobuf-compiler sudo apt-get install libzmq3-dev libgmp-dev sudo apt-get install git vim sudo apt-get install -y libgflags-dev libsnappy-dev zlib1g-dev libbz2-dev liblz4-dev libzstd-dev cd ~ \ && git clone --branch v10.4.2 https://github.com/facebook/rocksdb.git \ && cd rocksdb \ && make -j"$(nproc)" shared_lib \ && sudo make install-shared \ && cd ~ \ && rm -rf rocksdb \ && sudo ldconfig ``` ##### note: 最新版本的RocksDB(10.5)無法使用C++17編譯,所以先指定使用10.4版本 ##### note: 亦可參考 https://github.com/bitcoin/bitcoin/blob/master/doc/build-unix.md **下載 Download OurChain code** ``` git clone https://github.com/OurLab408/OurChain ourchain-release ``` **編譯 Compile OurChain** ```shell cd ourchain-release/ ./autogen.sh ./configure make -j$(nproc --all) make install # sudo if needed ldconfig # sudo if needed ``` :::danger Ubuntu 20.04 版本以上 boost library 有變動,需 在 <font color="#888888">`util.h`</font> 加上下行程式 ```c= using namespace boost::placeholders; ``` 在 <font color="#888888">`qt/trafficgraphwidget.cpp`</font> ```c= #include "QtGui/qpainterpath.h" ``` 和在 <font color="#888888">`sync.h`</font> ```c= #define BOOST_BIND_GLOBAL_PLACEHOLDERS ``` ::: **新增 Add ~/.bitcoin/bitcoin.conf** * For regtest ```shell= mkdir ~/.bitcoin vim ~/.bitcoin/bitcoin.conf server=1 daemon=1 regtest=1 rpcuser=test rpcpassword=test rpcport=8332 rpcallowip=0.0.0.0/0 ``` 恭喜你裝完了 --- ## 2.實驗 Experience **啟動比特幣回歸測試節點** --regtest代表回歸測試,在你的電腦上創建一個測試鏈,而非連到當前的主要OurChain(or Bitcoin)網路 **(若在bitcoin.conf裡面有加regtest=1則不需要加)** ``` bitcoind --regtest --daemon ``` **使用 bitcoin-cli 與你剛剛架設起來的測試 OurChain 溝通實驗** 在實驗的時候記得加上--regtest 代表你用 bitcoin-cli 要互動的對象是你創的回歸測試鏈 ``` bitcoin-cli --regtest getblockchaininfo ``` bitcoin-cli 是 Bitcoin 提供的一個 RPC interface 可以把他想成一個與 Bitcoin 整個鏈互動的街口 透過 bitcoin-cli 提供的 function 來與整個 Bitcoin 互動 有了 bitcoin-cli 你就可以開始你想要的實驗了 bitcoin-cli 提供了很多跟 OurChain 互動的方法 像是剛剛的 getblockchaininfo 包含其他像是創建地址、轉錢、挖礦等, 所有比特幣功能 備註:OurChain 是基於 Bitcoin 修改來的 所以適用以上功能 [請參考這裡了解所有 bitcoin-cli 提供的方法, all these supports](https://bitcoin.org/en/developer-reference#bitcoin-core-apis) 恭喜你 到這裡 你應該就有能力寫一個 blockchain explorer 或是寫個簡單版本的 wallet 了 主要就是透過 python(或你偏好的語言)找他的 rpc-call 套件 去訪問 Bitcoin 網路取得你所需要的資料 並顯示在你的網頁上 或 APP上 --- ## 3.怎麼寫 OurContract <font color="#ff0000">**直接參考 [link](https://github.com/OurLab408/OurChain/blob/master/doc/ourcontract.md)**</font> ### 如何在OurChain上執行合約 How to execute: 首先開啟ourchain後,確定自己有足夠多錢支付執行合約的手續費後,使用下面指令來發布合約並執行合約一次後 bitcoin-cli --regtest deploycontract [contract_path] 會獲得合約的名稱[contract_address] { "txid" : "[txid]" "contract address" : "[contract_address]" } 未來要再次執行合約,使用 bitcoin-cli --regtest callcontract [contract_address] ... 就可以再次執行合約,之後主動或等待他人挖礦後,合約就會自動被 OurChain 執行。 --- ## 4.用Use Docker建置 Build OurChain * [Dev by docker](https://github.com/leon123858/OurChain/blob/main/doc/dev-docker.md) * ~~[教學 Instruction](https://hackmd.io/@jKIkT8QLQ4SzITq06RQTvQ/H1108hT9V?type=view)~~

Import from clipboard

Paste your markdown or webpage here...

Advanced permission required

Your current role can only read. Ask the system administrator to acquire write and comment permission.

This team is disabled

Sorry, this team is disabled. You can't edit this note.

This note is locked

Sorry, only owner can edit this note.

Reach the limit

Sorry, you've reached the max length this note can be.
Please reduce the content or divide it to more notes, thank you!

Import from Gist

Import from Snippet

or

Export to Snippet

Are you sure?

Do you really want to delete this note?
All users will lose their connection.

Create a note from template

Create a note from template

Oops...
This template has been removed or transferred.
Upgrade
All
  • All
  • Team
No template.

Create a template

Upgrade

Delete template

Do you really want to delete this template?
Turn this template into a regular note and keep its content, versions, and comments.

This page need refresh

You have an incompatible client version.
Refresh to update.
New version available!
See releases notes here
Refresh to enjoy new features.
Your user state has changed.
Refresh to load new user state.

Sign in

Forgot password

or

By clicking below, you agree to our terms of service.

Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
Wallet ( )
Connect another wallet

New to HackMD? Sign up

Help

  • English
  • 中文
  • Français
  • Deutsch
  • 日本語
  • Español
  • Català
  • Ελληνικά
  • Português
  • italiano
  • Türkçe
  • Русский
  • Nederlands
  • hrvatski jezik
  • język polski
  • Українська
  • हिन्दी
  • svenska
  • Esperanto
  • dansk

Documents

Help & Tutorial

How to use Book mode

Slide Example

API Docs

Edit in VSCode

Install browser extension

Contacts

Feedback

Discord

Send us email

Resources

Releases

Pricing

Blog

Policy

Terms

Privacy

Cheatsheet

Syntax Example Reference
# Header Header 基本排版
- Unordered List
  • Unordered List
1. Ordered List
  1. Ordered List
- [ ] Todo List
  • Todo List
> Blockquote
Blockquote
**Bold font** Bold font
*Italics font* Italics font
~~Strikethrough~~ Strikethrough
19^th^ 19th
H~2~O H2O
++Inserted text++ Inserted text
==Marked text== Marked text
[link text](https:// "title") Link
![image alt](https:// "title") Image
`Code` Code 在筆記中貼入程式碼
```javascript
var i = 0;
```
var i = 0;
:smile: :smile: Emoji list
{%youtube youtube_id %} Externals
$L^aT_eX$ LaTeX
:::info
This is a alert area.
:::

This is a alert area.

Versions and GitHub Sync
Get Full History Access

  • Edit version name
  • Delete

revision author avatar     named on  

More Less

Note content is identical to the latest version.
Compare
    Choose a version
    No search result
    Version not found
Sign in to link this note to GitHub
Learn more
This note is not linked with GitHub
 

Feedback

Submission failed, please try again

Thanks for your support.

On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

Please give us some advice and help us improve HackMD.

 

Thanks for your feedback

Remove version name

Do you want to remove this version name and description?

Transfer ownership

Transfer to
    Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

      Link with GitHub

      Please authorize HackMD on GitHub
      • Please sign in to GitHub and install the HackMD app on your GitHub repo.
      • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
      Learn more  Sign in to GitHub

      Push the note to GitHub Push to GitHub Pull a file from GitHub

        Authorize again
       

      Choose which file to push to

      Select repo
      Refresh Authorize more repos
      Select branch
      Select file
      Select branch
      Choose version(s) to push
      • Save a new version and push
      • Choose from existing versions
      Include title and tags
      Available push count

      Pull from GitHub

       
      File from GitHub
      File from HackMD

      GitHub Link Settings

      File linked

      Linked by
      File path
      Last synced branch
      Available push count

      Danger Zone

      Unlink
      You will no longer receive notification when GitHub file changes after unlink.

      Syncing

      Push failed

      Push successfully