APCLab / bitcoin

Bitcoin Core integration/staging tree
https://bitcoin.org/en/download
MIT License
1 stars 1 forks source link

start a new blockchain #8

Open mchliu opened 8 years ago

mchliu commented 8 years ago

請問 @iblis17 大大 目標是要建一個新的區塊鏈 聽你說目前是會連到原本的區塊鏈

所以我們要建一個新的是要把網路斷掉嗎?

阿實際該如何執行哩

iblislin commented 8 years ago

我估計要修改 zmq 這塊的 code

  1. ZMQ is a third-party lib. So try to figure out the conecpt of zmq first.
  2. Read some ZMQ API sample.
  3. Start to find out how bitcoin using ZMQ. Find out where is the API call in this bitcoin repo.
iblislin commented 8 years ago

Sorry for eng message. My IME is broken on this machine

iblislin commented 8 years ago

I guess here is a good start point: https://github.com/APCLab/bitcoin/blob/master/src/net.cpp

mchliu commented 8 years ago

NVM LET ME SEE SEE

hychang23 commented 8 years ago

@iblis17 你的意思是說看完這份嗎?還是說要找什麼東西

iblislin commented 8 years ago

@HuaYang-Chang Please figure out the following question. There is lots of API in net.cpp. Do not read the implementation first. Just show me:

  1. Which files are using net.hpp? Just show me a list of file name.
  2. Which api from net.hpp is invoked? Please show the chain of invoking.

Do NOT read the implementation, now, we only need to understand the architecture.

@HuaYang-Chang I guess 5 hr is enough for drawing this big picture. Doxygen may help you. Can you make it?

mchliu commented 8 years ago

@iblis17 我們找到了 在doxygen上都有 要全列出來嗎? 還是要接下一個任務了

hychang23 commented 8 years ago

https://dev.visucore.com/bitcoin/doxygen/net_8h.html#a13f289d6233bd32b78a38793f76bdccb

iblislin commented 8 years ago

OK, I figured out it already: The machinery is here: https://bitcoin.org/en/developer-guide#peer-discovery

The hard-coded DNS seed is here: https://github.com/bitcoin/bitcoin/blob/d612837814020ae832499d18e6ee5eb919a87907/src/chainparams.cpp#L117-L122.

Also found some doc about dns seed operators: https://github.com/bitcoin/bitcoin/blob/a6a860796a44a2805a58391a009ba22752f64e32/doc/dnsseed-policy.md

In order to build our own network, we can simply bypass the bootstrapping via DNS. We do not need DNS, we only need to provide a hard-coded peers.dat (this file is a BDB file). And bitcoin core will load the peers from it.

@mchliu So now please fetch a normal peers.dat from bitcoin network first. Exam the BDB file, then create a custom one for us.

mchliu commented 8 years ago

@iblis17 It's kind of hard for us to understand what u're saying although u said it cleary.

We don't really understand the whole structure of this whole network, so we can't understand what all these information that u mentioned is about, including what DNS seed is and what it's for.

Do u mind telling us its brief ideas? Or we can also try ask google some question.

iblislin commented 8 years ago

@mchliu The description on developer wiki (the link is previous mentioned) is quite clear already. Please try to understand it first. I think it already provide enough info about connection to peers.

After reading it, we tell me how to make bitcoin core connect to our own peer based on the machinery the wiki revealed to you.

mchliu commented 8 years ago

@iblis17 喔就把連的節點換掉阿^^

就 RPC getpeerinfo 不是會看到是連那些節點

就在code裡換成你想連的,都不連就變自己一條blockchain

mchliu commented 8 years ago

@iblis17 我去問了一下我同學他是JOHN說

iblislin commented 8 years ago

@mchliu 對啊

@mchliu 我看不懂你後面那篇回覆

mchliu commented 8 years ago

@iblis17 下面那則不重要啦哈 所以我們有需要改變方針嗎 還是繼續照你說的研究

iblislin commented 8 years ago

@mchliu 是啊

  1. 就是 peer descovery bypass 掉, 想辦法把這 dns seed code 砍掉
  2. 製作 custom 版本的 peers.data
mchliu commented 8 years ago

@iblis17 今晚也要是嘛

iblislin commented 8 years ago

@mchliu 對啊

mchliu commented 8 years ago

@iblis17 2130?

iblislin commented 8 years ago

@mchliu ok

hychang23 commented 8 years ago

@iblis17 我在執行bitcoind -daemon時出現 Error: Unable to start HTTP server. See debug log for details. 你知道哪裡出狀況嗎?

iblislin commented 8 years ago

@mchliu 這我當然不會知道。

試試把 之前在 background 跑的 bitcoind kill 掉

iblislin commented 8 years ago
ps aux | grep bitcoind

找到 pid 之後 kill

iblislin commented 8 years ago

@mchliu unix 的基礎知識 想辦法會啊....

iblislin commented 8 years ago

@mchliu 除非你現在跟我說「我不碰任何 open source software」,那麼不會就沒差

mchliu commented 8 years ago

@iblis17 你怎麼都TAG我哈哈哈哈 @HuaYang-Chang

iblislin commented 8 years ago

Ha, 看錯

mchliu commented 8 years ago

@iblis17
BTW 這些基本知識應該去哪邊吸收阿 我也是不會 :v 因為我又遇到昨天的那個already running 的問題了哈 胡搞瞎搞中

iblislin commented 8 years ago

@mchliu 上次說的鳥哥還記得嘛?

mchliu commented 8 years ago

@iblis17 還是鳥哥是吧 OK

mchliu commented 8 years ago

@iblis17 請問下 前幾次跑不過 過一陣子突然跑過了 這是什麼情況 電腦丟搞?

iblislin commented 8 years ago

@mchliu 要看看 log 了

這個問題就好像,今天你跑去問醫生:「醫生。之前幾天不太舒服,可是今天早上突然好了。這是啥情形?」 醫生則會 開始 debug: 第一步 查 log, 問問你之前的 就醫記錄,最近吃了啥 ... etc 這些都是 log

mchliu commented 8 years ago

@iblis17 了解 因為我發現一件有點難過的事情 就是peers.dat會重生 mcliu@doric:~$ cd .bitcoin/ mcliu@doric:~/.bitcoin$ ls banlist.dat blocks database debug.log wallet.dat bitcoind.pid chainstate db.log fee_estimates.dat mcliu@doric:~/.bitcoin$ ls banlist.dat blocks database debug.log peers.dat bitcoind.pid chainstate db.log fee_estimates.dat wallet.dat

iblislin commented 8 years ago

@mchliu peers.dat 重生沒問題啊, 而且重生也是預期的行為

重點是 peers.dat 裡面的內容,而不是重生的問題

mchliu commented 8 years ago

@iblis17 我用getpeerinfo看 找到的東西跟砍掉前找到的東西一樣

iblislin commented 8 years ago

@mchliu 是 bypass dns seed 的版本?

然後丟出個實際 output 上來看看

mchliu commented 8 years ago

@iblis17 bypass dns seed直接不能MAKE

iblislin commented 8 years ago

@mchliu show me the code?

You can copy/paste the output of git diff here

mchliu commented 8 years ago

@iblis17 研究如何使用GIT DIFF中 CODE只有單純把那段註解掉而已

iblislin commented 8 years ago

那麼 compile error 的 message ?

mchliu commented 8 years ago

那是華洋跑的 他還沒回我 我正在自己試 sry

mchliu commented 8 years ago

@iblis17 他說不能連到HTTP SERVER

hychang23 commented 8 years ago

hychang@doric:~/bitcoin/src$ Error: Unable to start HTTP server. See debug log for details. bitcoind: scheduler.cpp:19: CScheduler::~CScheduler(): Assertion `nThreadsServicingQueue == 0' failed.

mchliu commented 8 years ago

@iblis17 華洋在鬧 我成功

mchliu commented 8 years ago

@iblis17 是成功跑過了可是 還是會找到PEER

iblislin commented 8 years ago

@mchliu 那麼 code 丟出來,我也跑看看

mchliu commented 8 years ago

@iblis17 直接把我的branch拿走吧 mchliu

mchliu commented 8 years ago

@iblis17 嘔對了雖然還是找的到PEER 但是速度跟之前差很多 感覺是擋掉很大一部分了

mchliu commented 8 years ago

@iblis17 i tried to run instruction like getblocktemplate but it returns error: Bitcoin is not connected and getgenerate, setgenerate it returns error: method not found

I'm wondering that maybe something is missing

mchliu commented 8 years ago

@iblis17 BTW I edit the codes without peer connections and save them in my branch take it if u need them