블록체인의 분기: 고아블록 (Branch of block chain: Orphan Blocks) by moonddo

View this thread on steempeak.com
· @moonddo · (edited)
$0.09
블록체인의 분기: 고아블록 (Branch of block chain: Orphan Blocks)
[PoW 방식 포스팅](https://steemit.com/pow/@moonddo/pow-proof-of-work)에도 설명했듯이, 해당 포스팅에서는 블록체인의 분기의 상황에 대해서 설명해보겠다.  

아시다시피 비트코인의 블록 채굴작업은 컴퓨팅파워만 된다면 누구든 참여할 수 있다.  
[비트노드](https://bitnodes.earn.com/) 사이트에 가보면, 현재 몇 개의 풀노드들이 어떻게 분포되어 유지가 되고 있는지 볼 수 있다.  
이 포스팅을 쓰는 시점에서는 현재 12128개의 노드들이 유지되고 있다.  
이렇다 보니 비트코인이 최대한 동시 채굴이 안되도록 난이도 설계를 했다고 하지만, 결국 분산화된 데이터 구조이기 때문에 비슷한 시간대에 네트워크로 전파되기 전 동시 채굴은 언제든지 발생될 수 있다.  
그럴 경우 어떻게 처리 되는지 살펴보도록 하겠다.  

먼저 블록체인에는 `메인체인` 과, 메인 블록체인에서 나와 브랜치를 형성하는 `2차체인` 이 존재한다.  
누적 난이도가 가장 큰 값을 가진 블록들은 언제든지 메인체인이 될 수 있다.  
또, 2차체인도 메인체인과 비교하여 누적 난이도가 높다면 2차체인으로 수렴되어 이를 메인체인으로 선택하게 된다.  

이해하기 쉽게 예를 들어보자,  

![](https://steemitimages.com/DQmWauwXeDYPR71SVuqbDv9cgZN2ktU4CYrnC57CHmegF1a/image.png)

위와 같이 파란색 블록을 마지막으로 비슷한 시기에 한쪽은 빨간색, 한쪽은 초록색 블록을 채굴하여 체인이 2개로 분기가 됐다고 가정해보자.  
이 상태에서 각각의 노드는 peer network로 블록을 전파할 것이고 (그림에선 지리학적으로 가까운 곳부터 전파되는 것처럼 보이지만, 실제로는 토폴리지 구성상 가까운 곳부터 이다.)  
주변의 노드들은 먼저 전파 받은 체인을 각각 유지하는 형태가 될 것이다.
이 상태에서 초록색 블록까지 동기화한 곳에서 새로 분홍색 블록이 채굴됐다면,  
전파 받는 곳에선 빨간색 블록을 받아도 이는 무시되고, 분홍색 블록이 담긴 체인을 메인체인으로 유지할 것이다.  

그렇다면 기존에 빨간색 블록을 메인체인으로 유지하고 있던 노드는 어떻게 될 것인가? 
분홍색 체인을 받는 순간 누적 난이도가 더 높은 분홍색 체인을 메인체인으로 채택하고, 기존 빨간 블록체인은 2차체인으로 변경할 것이다. 
이렇게 더 이상 이후로 쌓이지 않는 이러한 빨간색 블록을 고아블록(Orphan Blocks) 이라고 부른다.
그럼 빨간색 블록 즉, 고아블록에 생성된 트랜잭션 또한 어떻게 처리될지 궁금할 것이다.

일단 MEMPOOL 또한 동기화가 되기 때문에, 결국 해당 트랜잭션이 유실되는 일은 발생하지 않는다.
즉, 누적 난이도가 더 높은 분홍체인(더 길에 유지되고 있는 체인)에 빨간 블록의 트랜잭션이 이미 포함되어 있을 가능성이 매우 높고,
그렇지 않다고 하더라도 MEMPOOL 에 들어있기 때문에 블록에 기록되는 우선순위가 늦어지는 것일 뿐 언젠가는 블록에 포함된다.
그러니 유효한 트랜잭션이 맞다면, 유실될 걱정은 하지 않아도 된다.

이처럼 블록체인은 작업 증명을 가장 많이 시행한 블록체인을 선택해서 유지하려고 한다.  
이러한 체인을 Main Chain 또는 Longest Chain 또는 Greatest cumulative difficulty chain 이라고 부른다.  
모든 노드들이 최장 누적 난이도 체인을 선택한다면, 결국 비트코인 네트워크는 일관된 상태로 수렴하게 된다.  
또, 이런 분기는 대개 한 블록 내에서 해결이 된다.  
노드는 채굴하고, 빠르게 전파하지 않으면 결국 본인이 생성한 체인이 채택이 안될 수도 있기 때문에 채굴뿐만 아니라 전파도 게을리하지 않는다.
해서 분기는 거의 한 블록 내에서 끝나게 된다.  

위 설명한 고아블록(Orphaned Blocks)은 이라고 하는데,  고아블록은 [블록체인](https://blockchain.info/orphaned-blocks) 사이트에 들어가면 모두 확인해 볼 수 있다.  
그 중 하나를 설명해 보겠다.  

![](https://steemitimages.com/DQmZbQWAqhaHZfcWTJCiFHcwJrEiJnnZxQwo8hbHrvXqRVg/image.png)

현재 포스팅 시점에서 가장 최근에 생성된 고아블록이다.   
현재는 **#513142** 블록까지 생성되어있고 그중 가장 최근에 블록 분기가 일어난 시점이 **#503949** 블록에서 발생하였다.
해당 시점에 비슷한 시점에 2개의 블록이 채굴되었고, 그중 **GBMiners** 가 채굴한 블록이 포함된 체인이 메인체인으로 유지가 되고 있다.  

이렇게 되면, **SlushPool**이 채굴한 블록은 고아블록이 되고, **SlushPool** 는 아무런 보상을 받지 못한다.  
초기에 보상을 받는 것처럼! 되어있지만, 실제로 완벽히 승인이 되는건 메인블록에 포함되고 나서라고 보면 되겠다.  

해서 실제 거래에서도 트랜잭션이 발생하면 실제 블록에 포함되기까지 약 최소 10분정도 (블록이 생성되는 시간) 후에 거래가 승인된 것 처럼 보이지만,  
실제는 메인체인에 포함되는 최소 약 2-30분 후에나 완벽한 승인이 이루어진 것으로 볼 수 있다.  


> 참조: 비트코인, 블록체인과 금융의 혁신 - 안드레아스 M. 안토노풀로스
👍  , , , ,
properties (23)
post_id38,182,256
authormoonddo
permlinkbranch-of-block-chain-orphan-blocks
categoryblockchain
json_metadata"{"app": "steemit/0.1", "format": "markdown", "links": ["https://steemit.com/pow/@moonddo/pow-proof-of-work", "https://bitnodes.earn.com/", "https://blockchain.info/orphaned-blocks"], "image": ["https://steemitimages.com/DQmWauwXeDYPR71SVuqbDv9cgZN2ktU4CYrnC57CHmegF1a/image.png"], "tags": ["blockchain", "orphanblock", "bitcoin", "kr", "branch"]}"
created2018-03-12 16:19:45
last_update2018-03-12 16:29:27
depth0
children2
net_rshares30,167,071,580
last_payout2018-03-19 16:19:45
cashout_time1969-12-31 23:59:59
total_payout_value0.075 SBD
curator_payout_value0.016 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length2,627
author_reputation0
root_title"블록체인의 분기: 고아블록 (Branch of block chain: Orphan Blocks)"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
author_curate_reward""
vote details (5)
@steemitboard ·
Congratulations @moonddo! You received a personal award!

<table><tr><td>https://steemitimages.com/70x70/http://steemitboard.com/@moonddo/birthday1.png</td><td>Happy Birthday! - You are on the Steem blockchain for 1 year!</td></tr></table>

<sub>_You can view [your badges on your Steem Board](https://steemitboard.com/@moonddo) and compare to others on the [Steem Ranking](http://steemitboard.com/ranking/index.php?name=moonddo)_</sub>


**Do not miss the last post from @steemitboard:**
<table><tr><td><a href="https://steemit.com/drugwars/@steemitboard/drugwars-early-adopter"><img src="https://steemitimages.com/64x128/https://cdn.steemitimages.com/DQmYGN7R653u4hDFyq1hM7iuhr2bdAP1v2ApACDNtecJAZ5/image.png"></a></td><td><a href="https://steemit.com/drugwars/@steemitboard/drugwars-early-adopter">Are you a DrugWars early adopter? Benvenuto in famiglia!</a></td></tr></table>

###### [Vote for @Steemitboard as a witness](https://v2.steemconnect.com/sign/account-witness-vote?witness=steemitboard&approve=1) to get one more award and increased upvotes!
properties (22)
post_id71,335,284
authorsteemitboard
permlinksteemitboard-notify-moonddo-20190312t212220000z
categoryblockchain
json_metadata{"image":["https:\/\/steemitboard.com\/img\/notify.png"]}
created2019-03-12 21:22:21
last_update2019-03-12 21:22:21
depth1
children0
net_rshares0
last_payout2019-03-19 21:22:21
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length1,056
author_reputation38,705,954,145,809
root_title"블록체인의 분기: 고아블록 (Branch of block chain: Orphan Blocks)"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
@steemitboard ·
Congratulations @moonddo! You received a personal award!

<table><tr><td>https://steemitimages.com/70x70/http://steemitboard.com/@moonddo/birthday2.png</td><td>Happy Steem Birthday! - You are on the Steem blockchain for 2 years!</td></tr></table>

<sub>_You can view [your badges on your Steem Board](https://steemitboard.com/@moonddo) and compare to others on the [Steem Ranking](https://steemitboard.com/ranking/index.php?name=moonddo)_</sub>


**Do not miss the last post from @steemitboard:**
<table><tr><td><a href="https://steemit.com/steemitboard/@steemitboard/downvote-challenge-add-up-to-3-funny-badges-to-your-board"><img src="https://steemitimages.com/64x128/https://steemitimages.com/0x0/![](https://cdn.steemitimages.com/DQmUuJkZdnSpHVWssxF82ntymqXg4Pvk6K6bYvckUYVRsnj/image.png)"></a></td><td><a href="https://steemit.com/steemitboard/@steemitboard/downvote-challenge-add-up-to-3-funny-badges-to-your-board">Downvote challenge - Add up to 3 funny badges to your board</a></td></tr></table>

###### [Vote for @Steemitboard as a witness](https://v2.steemconnect.com/sign/account-witness-vote?witness=steemitboard&approve=1) to get one more award and increased upvotes!
properties (22)
post_id85,135,463
authorsteemitboard
permlinksteemitboard-notify-moonddo-20200312t152536000z
categoryblockchain
json_metadata{"image":["https:\/\/steemitboard.com\/img\/notify.png"]}
created2020-03-12 15:25:36
last_update2020-03-12 15:25:36
depth1
children0
net_rshares0
last_payout2020-03-19 15:25:36
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length1,180
author_reputation38,705,954,145,809
root_title"블록체인의 분기: 고아블록 (Branch of block chain: Orphan Blocks)"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000