Git Product home page Git Product logo

blockchain-example's Introduction

블록체인 샘플

작업증명

  • 새로운 블록을 블록체인에 추가하는 작업을 완료했음을 증명하는 것
  • 새로운 블록을 블록체인에 추가하기 위해선, 그 새로운 블록의 블록 해시를 계산해야함
  • 블록 해시를 계산하기 위해선 해당 블록의 nonce값의 계산을 통해 구해야함
  • 즉, nonce값을 구하는 것이 바로 작업증명

nonce값의 계산

  • nonce 값은, 이 nonce 값을 입력값 중의 하나로 해서 계산되는 블록 해쉬값이 특정 숫자보다 작아지게 하는 값을 말함
  • 해시함수의 특성상 특정 해시값의 역산으로는 입력값을 찾을 수 없기 때문에 결과가 동일해질때까지 입력값을 계속 바꿔가면서 찾아야함
  • 그때 입력값을 바꿀 수 있는 유일한 방법이 nonce
  • nonce값을 1씩 증가시키면서 반복적으로 계산한 해시값이 특정 숫자보다 작은 값이 나오면 그 때의 nonce값으로 계산한 블록 해시가 그 블록의 블록 해시로 확정
  • 블록 해시를 얻은 블록은 블록체인에 추가될 수 있음
  • 예시
    • 000003이라는 해시값이 있을때 이보다 작은 값을 나오게 해야함
    • nonce값이 80000일때 000002라는 해시값이 나왔으며 이는 목표 해시값 이하의 해시값임
    • 이 경우에 작업증명에 성공한 것이고, 이후에는 새롭게 블록체인에 해당 블록을 추가할 수 있음
    • 이때 000003이라는 해시값은 작업 난이도에 의해 정해지게됨

Trasaction의 역할

  • 코인의 오너만이 해당 코인을 사용할 수 있게 해줌
  • 새로운 블럭 생성 전 이미 접수된 트랜잭션에 대해 다른 사람들이 수정하지 못하도록 방지하는 기능
  • 체인의 블럭들은 많은 트랜잭션들을 취급하기 때문에 새로운 트랜잭션을 처리하는데 시간이 굉장히 오래 걸리 수도 있음
  • 이를 피하기 위해 사용되지 않은 모든 트랜잭션을 인풋으로 사용되게끔 함

Key의 역할

  • Public Key : 진위 확인
  • Private Key : 데이터 서명

참고자료

blockchain-example's People

Contributors

limheonjun avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.