<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Blockchain &#8211; WONIZZ.LOG</title>
	<atom:link href="https://blog.wonizz.com/category/tech/blockchain/feed/" rel="self" type="application/rss+xml" />
	<link>https://blog.wonizz.com</link>
	<description>AI 자동화를 직접 굴려 본 개발자의 실무 교훈</description>
	<lastBuildDate>Tue, 20 Oct 2026 10:07:45 +0000</lastBuildDate>
	<language>ko-KR</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0.2</generator>

<image>
	<url>https://i0.wp.com/blog.wonizz.com/wp-content/uploads/2026/08/wz-siteicon-512.png?fit=32%2C32&#038;ssl=1</url>
	<title>Blockchain &#8211; WONIZZ.LOG</title>
	<link>https://blog.wonizz.com</link>
	<width>32</width>
	<height>32</height>
</image> 
<site xmlns="com-wordpress:feed-additions:1">152411368</site>	<item>
		<title>[블록체인] 1편 : 블록체인 기본 개념</title>
		<link>https://blog.wonizz.com/2021/05/25/block-chain-1/</link>
					<comments>https://blog.wonizz.com/2021/05/25/block-chain-1/#respond</comments>
		
		<dc:creator><![CDATA[워니즈]]></dc:creator>
		<pubDate>Tue, 25 May 2021 12:23:40 +0000</pubDate>
				<category><![CDATA[Blockchain]]></category>
		<category><![CDATA[Tech]]></category>
		<guid isPermaLink="false">https://blog.wonizz.tk/?p=1784</guid>

					<description><![CDATA[<p>The standard Lorem Ipsum passage, used since the 1500s<br />
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."</p>
<p>Section 1.10.32 of "de Finibus Bonorum et Malorum", written by Cicero in 45 BC<br />
"Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?"</p>
<p>1914 translation by H. Rackham<br />
"But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how to pursue pleasure rationally encounter consequences that are extremely painful. Nor again is there anyone who loves or pursues or desires to obtain pain of itself, because it is pain, but because occasionally circumstances occur in which toil and pain can procure him some great pleasure. To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure?"</p>
<p>Section 1.10.33 of "de Finibus Bonorum et Malorum", written by Cicero in 45 BC<br />
"At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Temporibus autem quibusdam et aut officiis debitis aut rerum necessitatibus saepe eveniet ut et voluptates repudiandae sint et molestiae non recusandae. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat."</p>
<p>1914 translation by H. Rackham<br />
"On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee the pain and trouble that are bound to ensue; and equal blame belongs to those who fail in their duty through weakness of will, which is the same as saying through shrinking from toil and pain. These cases are perfectly simple and easy to distinguish. In a free hour, when our power of choice is untrammelled and when nothing prevents our being able to do what we like best, every pleasure is to be welcomed and every pain avoided. But in certain circumstances and owing to the claims of duty or the obligations of business it will frequently occur that pleasures have to be repudiated and annoyances accepted. The wise man therefore always holds in these matters to this principle of selection: he rejects pleasures to secure other greater pleasures, or else he endures pains to avoid worse pains."</p>
<p>안녕하세요? 정리하는 개발자 워니즈입니다. 최근들어 블록체인의 개념에 푹 빠지게 되어서(?) 그 개념에 대해서 정리를 해보고자 합니다. 사실은 먼저 개념을 알기전에는 코인을 시작하다가&#8230; 코인의 베이스 개념인 블록체인의 기술에 대해서 알아보고자 이렇게 정리를 하게 됐습니다. 1. 블록체인 이란 무엇인가요? 기존 거래와 블록체인의 차이점? 기존 거래 방식은 중간 역할을 해주는 은행이 존재했기 때문에 거래가 진행이 되었습니다. 우측의 블록체인&#8230;&#160;</p>
<p>The post <a rel="nofollow" href="https://blog.wonizz.com/2021/05/25/block-chain-1/">[블록체인] 1편 : 블록체인 기본 개념</a> appeared first on <a rel="nofollow" href="https://blog.wonizz.com">WONIZZ.LOG</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>The standard Lorem Ipsum passage, used since the 1500s<br />
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."</p>
<p>Section 1.10.32 of "de Finibus Bonorum et Malorum", written by Cicero in 45 BC<br />
"Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?"</p>
<p>1914 translation by H. Rackham<br />
"But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how to pursue pleasure rationally encounter consequences that are extremely painful. Nor again is there anyone who loves or pursues or desires to obtain pain of itself, because it is pain, but because occasionally circumstances occur in which toil and pain can procure him some great pleasure. To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure?"</p>
<p>Section 1.10.33 of "de Finibus Bonorum et Malorum", written by Cicero in 45 BC<br />
"At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Temporibus autem quibusdam et aut officiis debitis aut rerum necessitatibus saepe eveniet ut et voluptates repudiandae sint et molestiae non recusandae. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat."</p>
<p>1914 translation by H. Rackham<br />
"On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee the pain and trouble that are bound to ensue; and equal blame belongs to those who fail in their duty through weakness of will, which is the same as saying through shrinking from toil and pain. These cases are perfectly simple and easy to distinguish. In a free hour, when our power of choice is untrammelled and when nothing prevents our being able to do what we like best, every pleasure is to be welcomed and every pain avoided. But in certain circumstances and owing to the claims of duty or the obligations of business it will frequently occur that pleasures have to be repudiated and annoyances accepted. The wise man therefore always holds in these matters to this principle of selection: he rejects pleasures to secure other greater pleasures, or else he endures pains to avoid worse pains."</p>
안녕하세요? 정리하는 개발자 워니즈입니다. 최근들어 블록체인의 개념에 푹 빠지게 되어서(?) 그 개념에 대해서 정리를 해보고자 합니다. 사실은 먼저 개념을 알기전에는 코인을 시작하다가&#8230; 코인의 베이스 개념인 블록체인의 기술에 대해서 알아보고자 이렇게 정리를 하게 됐습니다.

<h2>1. 블록체인 이란 무엇인가요?</h2>

<ul>
<li>기존 거래와 블록체인의 차이점?</li>
</ul>

<img data-recalc-dims="1" decoding="async" src="https://i0.wp.com/blog.wonizz.com/wp-content/uploads/2021/05/%E1%84%87%E1%85%B3%E1%86%AF%E1%84%85%E1%85%A9%E1%86%A8%E1%84%8E%E1%85%A6%E1%84%8B%E1%85%B5%E1%86%AB_6.png?w=1200&#038;ssl=1" alt="블록체인_6" />

기존 거래 방식은 중간 역할을 해주는 은행이 존재했기 때문에 거래가 진행이 되었습니다. 우측의 블록체인 방식을 뽀게 되면, 각 거래 내역을 여러명이 나눠서 저장을 합니다. 만약 한 네트워크에 10명이 참여하고 있다면 모든 사람에게 A와 B의 거래 내역이 전송, 저장이 됩니다. 나중에 거래 내역을 확인할 때는 블록으로 나눠 저장한 데이터들을 연결해 확인합니다.

<ul>
<li>블록체인 활용 분야</li>
</ul>

블록체인은 peer to peer(P2P) 네트워크를 통해서 관리되는 분산 데이터베이스의 한 형태로, 거래 정보를 담은 장부를 중앙 서버 한 곳에 저장하는 것이 아니라 블록체인 네트워크에 연결된 여러 컴퓨터에 저장 및 보관하는 기술로 다양한 분야에 활용이 가능한 기술입니다.

<img data-recalc-dims="1" decoding="async" src="https://i0.wp.com/blog.wonizz.com/wp-content/uploads/2021/05/%E1%84%87%E1%85%B3%E1%86%AF%E1%84%85%E1%85%A9%E1%86%A8%E1%84%8E%E1%85%A6%E1%84%8B%E1%85%B5%E1%86%AB_2.png?w=1200&#038;ssl=1" alt="블록체인_2" />

블록체인은 분산처리와 암호화 기술을 동시에 적용하여 높은 보안성을 확보하는 한편 거래과정의 신속성과 투명성을 특징으로 합니다. 보안성의 강화로 해커의 공격과 데이터의 왜곡 그리고 기존 중앙집중 서버 방식(Central Server)에서 가장 큰 문제인 디도스 공격을 원천적으로 방어할 수 있습니다.

보안성이 높고 위/변조가 어렵다는 특성 때문에 데이터 원본의 무결성 증명이 요구되는 다양한 공공/민간 영역에 적용되고 있으며, 새로운 신뢰사회 구현의 기반 기술로 주목을 받고 있습니다.

<table>
<thead>
<tr>
  <th align="center">분야</th>
  <th align="center">기능 및 효과</th>
</tr>
</thead>
<tbody>
<tr>
  <td align="center">인증</td>
  <td align="center">별도의 공인인증기관 없이 간편하고 안전한 대체 인증수단 제공</td>
</tr>
<tr>
  <td align="center">결제 및 송금</td>
  <td align="center">소액 결제 및 해외 송금서비스의 보안성 제고 및 수수료 비용절감</td>
</tr>
<tr>
  <td align="center">증권거래</td>
  <td align="center">통화, 장외주식, 파생상품 등의 거래에 소요되는 거래시간의 획기적인 단축</td>
</tr>
<tr>
  <td align="center">스마트계약</td>
  <td align="center">조건에 의해 거래가 자동적으로 성립됨에 따라 중간관리자에 의한 사기, 위조 방지</td>
</tr>
<tr>
  <td align="center">대출, 투자, 무역거래</td>
  <td align="center">중개자를 배제한 비대면 P2P 대출 서비스<br /> 송장 정보 공유를 통한 송장 사기 방지</td>
</tr>
</tbody>
</table>

<h2>2. 블록체인의 원리</h2>

블록체인 기술은 거래정보를 기록한 원장 데이터를 중앙 서버가 아닌 네트워크에 참가하는 모든 공동체가 거래를 기록하고 관리하는 P2P거래를 지향하는 탈중앙화를 핵심 개념으로 하는 기술입니다.

<img data-recalc-dims="1" decoding="async" src="https://i0.wp.com/blog.wonizz.com/wp-content/uploads/2021/05/%E1%84%87%E1%85%B3%E1%86%AF%E1%84%85%E1%85%A9%E1%86%A8%E1%84%8E%E1%85%A6%E1%84%8B%E1%85%B5%E1%86%AB_1.png?w=1200&#038;ssl=1" alt="블록체인_1" />

거래 정보는 다음과 같은 흐름으로 이루어집니다.

<ul>
<li>A가 B에게 송금 희망 등의 거래 요청을 합니다.</li>
<li>해당 거래 정보가 담긴 블록이 생성됩니다.</li>
<li>블록이 네트워크상의 모든 참여자에게 전송됩니다.</li>
<li>참여자들은 거래 정보의 유효성을 상호 검증합니다.</li>
<li>참여자 과반수의 데이터와 일치하는 거래내역은 정상 장부로 확인하는 방식으로 검증이 완료된 블록은 이전 블록에 연결되고, 그 사본이 만들어져 각 사용자의 컴퓨터에 분산 저장됩니다.</li>
<li>A가 B에게 송금하여 거래가 완료됩니다.</li>
</ul>

<h2>3. 블록체인의 기술적 개념</h2>

<h3>3-1. 해시 함수</h3>

블체인, 암호화폐 기술에 대한 내용에 매번 등장하는 것 중 하나가 해시함수(Hash Function) 입니다. 해시함수의 해시(Hash)는 어떤 데이터를 고정된 길이의 데이터로 변환 하는 것을 의미합니다.

<ol>
<li>해시함수의 유용성

해시수는 원본 데이터에 아주 작은 변화만 있어도 완전히 다른 해시값이 만들어지게 됩니다. 즉 해시 함수를 이용하게 되면, 원본 데이터의 사소한 변화도 쉽게 확인 할 수 있게 됩니다. 해시함수는 단방향 변환이며, 복원이 불가능 하기 때문에 블록체인 기술 및 전자 서명 등 암호화에 사용 될 수 있습니다.

만약에 서버가 해킹을 당해 사용자 정보가 유출이 되더라도 해시값으로 암호화된 값이 유출이 되면 원본 값을 복원할 수 없기 때문에 피해를 줄일 수 있습니다.

블록에 서명하고 이전 블록의 해시값을 다음 블록에 기록함으로써 체인 형태의 연결 리스트(linked list)를 형성하게 됩니다.

<img data-recalc-dims="1" decoding="async" src="https://i0.wp.com/blog.wonizz.com/wp-content/uploads/2021/05/%E1%84%87%E1%85%B3%E1%86%AF%E1%84%85%E1%85%A9%E1%86%A8%E1%84%8E%E1%85%A6%E1%84%8B%E1%85%B5%E1%86%AB_3.png?w=1200&#038;ssl=1" alt="블록체인_3" /></p></li>
<li>해시 함수를 사용하는 이유</p></li>
</ol>

<ul>
<li>공개키의 해시값을 지갑 주소로 활용하여 익명화된 거래를 수행</li>
<li>체인으로 연결된 블록의 무결성 검증에 사용 (머클루트)</li>
<li>합의 알고리즘에서 PoW(Proof of Work)방식을 사용할 경우, 해시값을 활용한 채굴문제에 활용</li>
</ul>

<h3>3-2. 머클 트리</h3>

거래내역을 확인하기 위해 전체 자료들을 일일이 비교하며 특정 트랜잭션(거래)가 위/변조 되었는지를 확인하는 방식은 너무 비효율적이며, 특정 트랜잭션의 위/변조 여부를 빠르고 효율적으로 조회할 수 있어야 하는데 이에 따라 등장한 방식이 머클트리 방식입니다.

<img data-recalc-dims="1" decoding="async" src="https://i0.wp.com/blog.wonizz.com/wp-content/uploads/2021/05/%E1%84%87%E1%85%B3%E1%86%AF%E1%84%85%E1%85%A9%E1%86%A8%E1%84%8E%E1%85%A6%E1%84%8B%E1%85%B5%E1%86%AB_4.png?w=1200&#038;ssl=1" alt="블록체인_4" />

블록체인의 구성정보

<ul>
<li>블록의 정체성을 띠는 데이터를 가진 블록헤더</li>
<li>해당 블록에 거래의 개수를 알려주는 거래 카운터</li>
<li>가장 많은 공간을 차지하는 거래목록</li>
</ul>

<h3>3-2. 거래를 묶어주는 머클트리</h3>

머클트리는 이진트리(binary trees)라는 이름으로도 알려져 있습니다. 여기서 이진트리는 쉽게 말해서 거래를 두개씩 묶는다는 말입니다. 이렇게 두 개씩 묶어서 올라가게 되면 거래량이 기하급수적으로 늘어나도 특정 거래를 찾는 경로는 단순합니다.

거래의 건수인 N이 증가할 때마다 특정 거래의 경로를 차즌ㄴ 경우의 수는 log2(N)으로 늘어나기 때문입니다.

<img data-recalc-dims="1" decoding="async" src="https://i0.wp.com/blog.wonizz.com/wp-content/uploads/2021/05/%E1%84%87%E1%85%B3%E1%86%AF%E1%84%85%E1%85%A9%E1%86%A8%E1%84%8E%E1%85%A6%E1%84%8B%E1%85%B5%E1%86%AB_5.png?w=1200&#038;ssl=1" alt="블록체인_5" />

특정 거래 데이터를 쉽게 찾을 수 있고, 거래의 위변조도 쉽고 빠르게 알 수 있게 되어 방지를 할 수 있습니다.

블록체인의 용량은 시간이 지날수록 지속적으로 늘어나기 때문에 이제는 성능이 좋은 컴퓨터만 모든 블록체인을 다운받는 풀노드(full node)가 될 수 있습니다. 하지만 이 머클트리의 이진트리 방식은 블록데이터의 일부만 다운받는 라이트 노드(light node)로 우리가 가지고 다니는 모바일로도 쉽고 빠르게 특정 거래를 찾도로 해줍니다.

<h2>4. 간단한 블록체인 만들기</h2>

<ul>
<li>초소형 블록 만들기
해싱을 이용하는 방법을 이해합니다. 먼저 간단하게 hash 하는 함수를 만들어보겠습니다.</li>
</ul>

<pre><code class="language-java line-numbers">public static String getHash(String input) {
  StringBuffer result = new StringBuffer();

  try {
    MessageDigest md = MessageDigest.getInstance("SHA-256");
    md.update(input.getBytes());
    byte bytes[] = md.digest();
    for(int i=0;i<bytes.length;i++) {
      result.append(Integer.toString((bytes[i] &#038; 0xff) + 0x100, 16).substring(1));
    }
  } catch(Exception e) {
    e.printStackTrace();
  } 
  return result.toString();
}
</code></pre>

그리고 nonce에대한 이해를 하기 위해서 다음의 코드를 작성했습니다. nonce란 유일하게 채굴자가 변경이 가능한 값으로써, 블록체인에 블록을 추가하기 위해서 제기된 문제에 대한 해답을 찾기 위해서 매칭되는 해시값을 찾게 해주는 값입니다.

<pre><code class="language-java line-numbers">int nonce = 0;
while(true) {
  if(Util.getHash(String.valueOf(nonce)).substring(0, 6).equals("000000")) {
    System.out.println("정답 : " + nonce);
    break;
  }
  nonce++;
}
</code></pre>

해시와 nonce를 이해하였으면, 간단한 초소형 블록을 만들어보겠습니다. 블록의 구조를 만들어주기 위해서 object를 다음과 같이 작성합니다.

<pre><code class="language-java line-numbers">public class Block {

    private int blockID;
    private int nonce;
    //private String data;
    private ArrayList<Transaction> transactionList;


    //이전 해시값. 
    private String previousBlockHash;

    public String getPreviousBlockHash() {
        return previousBlockHash;
    }
    public void setPreviousBlockHash(String previousBlockHash) {
        this.previousBlockHash = previousBlockHash;
    }
    public int getBlockID() {
        return blockID;
    }
    public void setBlockID(int blockID) {
        this.blockID = blockID;
    }
    public int getNonce() {
        return nonce;
    }
    public void setNonce(int nonce) {
        this.nonce = nonce;
    }

        //트랜잭션 관련 변경 
        public String getTransaction() {
            String transactionInformations = "";

            for(int i=0;i<transactionList.size();i++) {
                transactionInformations += transactionList.get(i).getInformation();
            }

            return transactionInformations;
        }
        public void addTransaction(Transaction transaction) {
            transactionList.add(transaction);
        }



        public Block(int blockID, String previousBlockHash, int nonce, ArrayList transactionList) {
            this.blockID = blockID;
            this.previousBlockHash = previousBlockHash;
            this.nonce = nonce;
            this.transactionList = transactionList;
        }

        public String getBlockHash() {
            return Util.getHash(nonce + getTransaction() + previousBlockHash);
        }

        public void showInformation() {    
            System.out.println("---------------------------");
            System.out.println("블록 번호: " + getBlockID());
            System.out.println("이전 해시: " + getPreviousBlockHash());
            System.out.println("채굴 변수 값: " + getNonce());
            System.out.println("블록 데이터: ");
            for(int i=0;i<transactionList.size();i++) System.out.println(transactionList.get(i).getInformation());
            System.out.println("블록 해시: " + getBlockHash());
            System.out.println("---------------------------");
        }

    //채굴을 수행하기 위한 함수. 
    public void mine() {
        while(true) {
            if(getBlockHash().substring(0, 4).equals("0000")) {
                System.out.println(blockID + "번째 블록의 채굴에 성공했습니다.");
                break;
            }
            nonce++;
        }
    }

}
</code></pre>

<ul>
<li>transsaction 만들기</li>
</ul>

트랜잭션은 블록의 데이터에 쌓이는 데이터 입니다. 이는 한개이상의 값들이 적재 되기 때문에 다음과 같이 arraylist의 형태로 object를 작성합니다.

<pre><code class="language-java line-numbers">public class Transaction {

    String sender;
    String receiver;
    double amount;

    public String getSender() {
        return sender;
    }
    public void setSender(String sender) {
        this.sender = sender;
    }
    public String getReceiver() {
        return receiver;
    }
    public void setReceiver(String receiver) {
        this.receiver = receiver;
    }
    public double getAmount() {
        return amount;
    }
    public void setAmount(double amount) {
        this.amount = amount;
    }

    public Transaction(String sender, String receiver, double amount) {
        this.sender = sender;
        this.receiver = receiver;
        this.amount = amount;
    }



    public String getInformation() {
        return "[" + Util.getDate() + "] " + sender + "이(가) " + receiver + "에게 " + amount + "개의 코인을 보냈습니다.";
    }
}
</code></pre>

<ul>
<li>실행</li>
</ul>

실제 상위에 만들어진 객체들을 활용하여 블록을 생성하고 체인을 연결하는 구조를 살펴봅니다.

<pre><code class="language-java line-numbers">public class BlockChainStarter {
    public static void main(String[] args) {
        //Transaction transaction = new Transaction("A", "B", 10.5);

        //System.out.println(transaction.getInformation());


        Block block1 = new Block(1, null, 0, new ArrayList());
        block1.mine();
        block1.showInformation();

        Block block2 = new Block(2, block1.getBlockHash(), 0, new ArrayList());
        block2.addTransaction(new Transaction("A", "B", 1.5));
        block2.addTransaction(new Transaction("C", "B", 0.7));
        block2.mine();
        block2.showInformation();

        Block block3 = new Block(3, block2.getBlockHash(), 0, new ArrayList());
        block3.addTransaction(new Transaction("D", "E", 8.2));
        block3.addTransaction(new Transaction("B", "A", 0.4));
        block3.mine();
        block3.showInformation();

        Block block4 = new Block(4, block3.getBlockHash(), 0, new ArrayList());
        block4.addTransaction(new Transaction("E", "D", 0.1));
        block4.mine();
        block4.showInformation();


    }
}
</code></pre>

<ul>
<li>결과</li>
</ul>

<pre><code class="line-numbers">1번째 블록의 채굴에 성공했습니다.
---------------------------
블록 번호: 1
이전 해시: null
채굴 변수 값: 34201
블록 데이터: 데이터
블록 해시: 000084397e5fff903eb9a48ed02faf69b974137df73914858261c3e0f2de0ae5
---------------------------
2번째 블록의 채굴에 성공했습니다.
---------------------------
블록 번호: 2
이전 해시: 000084397e5fff903eb9a48ed02faf69b974137df73914858261c3e0f2de0ae5
채굴 변수 값: 37413
블록 데이터: 데이터
블록 해시: 00009b25ea57c0a8ba1ace67cb5f05cc7c23321f66599735f5de9065dd89e5fe
---------------------------
3번째 블록의 채굴에 성공했습니다.
---------------------------
블록 번호: 3
이전 해시: 00009b25ea57c0a8ba1ace67cb5f05cc7c23321f66599735f5de9065dd89e5fe
채굴 변수 값: 51963
블록 데이터: 데이터
블록 해시: 000094aec5931e311b7241eb1ad136241ddb1f58f41a47d772640b53dec0cba5
---------------------------
4번째 블록의 채굴에 성공했습니다.
---------------------------
블록 번호: 4
이전 해시: 000094aec5931e311b7241eb1ad136241ddb1f58f41a47d772640b53dec0cba5
채굴 변수 값: 71429
블록 데이터: 데이터
블록 해시: 000008f6b0e91c5129c998eba8cfd6117cd0a30628918f90a8af4514a0e70375
---------------------------
</code></pre>

아래 내용은 아직 미비된 부분으로, 추후 포스팅에서 작성하겠습니다.

<ul>
<li>공개키/암호키 만들기</li>
<li>Wallet 만들기</li>
</ul>

<h2>5. 마치며...</h2>

이번 스터디를 진행하면서, 블록체인의 간단한 개념과 아키텍처 그리고 소스로 구현을 해보면서 이해를 하게 되었습니다. 실생활에서 어떤 방식으로 사용되는지는 좀더 학습을 진행해야겠다는 생각이 들었고, 가장 기억에 남는 키워드는 역시 보안성, 투명성, 신속성이라는 키워드가 기억에 남습니다. 확실히 유망한 기술이기에 앞으로 계속해서 학습을 해야겠다는 생각도 들었습니다.

<h2>6. 참조</h2>

<a class="wp-editor-md-post-content-link" href="https://medium.com/caulink/%EC%9E%90%EB%B0%94%EB%A1%9C-%EB%B8%94%EB%A1%9D%EC%B2%B4%EC%9D%B8-%EB%A7%8C%EB%93%A4%EA%B8%B0-part-1-9ac8bb0423d" title="자바로 블록체인 만들기" target="_blank" rel="noopener">자바로 블록체인 만들기</a>
<a class="wp-editor-md-post-content-link" href="https://wooaoe.tistory.com/19?category=822649" title="블록체인 이란? 블록체인 개념 이해하기" target="_blank" rel="noopener">블록체인 이란? 블록체인 개념 이해하기</a>
<h2>7. 2026년 기준: 그 사이 달라진 것</h2>

<p>이 글을 쓴 2021년 5월에는 합의 방식을 "참여자 과반수"가 거래를 검증하는 작업증명(PoW) 구조 하나로만 설명했습니다. 그 뒤 가장 큰 변화는 2022년 9월 이더리움이 "The Merge"를 거쳐 작업증명에서 지분증명(PoS)으로 합의 방식을 바꾼 일입니다. 채굴 경쟁 대신 보유한 코인을 담보로 검증자를 뽑는 방식이라, 이 글에서 설명한 "여러 명이 연산 경쟁을 벌여 과반수 데이터를 확인하는" 그림은 이더리움에는 더 이상 맞지 않습니다.</p>

<p>비트코인은 여전히 작업증명 방식을 유지하고 있고, 4년마다 채굴 보상이 절반으로 줄어드는 반감기도 2024년 4월에 한 번 더 지나 블록당 보상이 3.125 BTC로 내려갔습니다. 2021년 당시 "블록체인 = 과반수 검증" 설명은 2026년 지금은 체인마다 갈라졌다고 보는 게 더 정확합니다 — 비트코인처럼 작업증명을 유지하는 체인과, 이더리움처럼 지분증명으로 넘어간 체인이 공존합니다.</p>

<p>AI 도구로 초안을 만들고 직접 실행·검증한 내용입니다.</p>

<h2 class="wp-block-heading">함께 보면 좋은 글</h2>
<ul class="wp-block-list"><li><a href="https://blog.wonizz.com/2019/07/18/ansible-basic-example/">[Ansible] 기본 개념, 사용 환경 구성, 기초 사용법 정리</a></li><li><a href="https://blog.wonizz.com/2022/03/30/garbage-collector-1/">[DevOps] 1편 : Garbage Collector 동작 원리의 이해</a></li><li><a href="https://blog.wonizz.com/2021/06/21/devops-golang-grpc-server-1/">[DevOps] Golang gRPC 서버 구축하기 1편</a></li><li><a href="https://blog.wonizz.com/2020/07/28/toy-project-1/">[토이프로젝트] 1편 : 간단한 게시판 만들기</a></li></ul>
<p>The post <a rel="nofollow" href="https://blog.wonizz.com/2021/05/25/block-chain-1/">[블록체인] 1편 : 블록체인 기본 개념</a> appeared first on <a rel="nofollow" href="https://blog.wonizz.com">WONIZZ.LOG</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.wonizz.com/2021/05/25/block-chain-1/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">1784</post-id>	</item>
	</channel>
</rss>
