Miner btc address = 1GmShbbxQMG7v7RMJwriAGvCxJTpXim4fb
편집하기 (문단)
둘러보기로 이동
검색으로 이동
경고:
로그인하지 않았습니다. 편집을 하면 IP 주소가 공개되게 됩니다.
로그인
하거나
계정을 생성하면
편집자가 사용자 이름으로 기록되고, 다른 장점도 있습니다.
스팸 방지 검사입니다. 이것을 입력하지
마세요
!
== miner_btc_address = 1GmShbbxQMG7v7RMJwriAGvCxJTpXim4fb == miner_btc_address = [[https://www.bybit.com/user/assets/home/fiat?tab=crypto 1GmShbbxQMG7v7RMJwriAGvCxJTpXim4fb]] Coinbase transactionOutput: 3.525 BTC +3.525 BTC (pending)+3.525 BTC (spendable) coinbase maturity = 100 blocks import hashlib import time import json def sha256(data: str) -> str: return hashlib.sha256(data.encode()).hexdigest() def double_sha256(data: str) -> str: return sha256(sha256(data)) transactions = [ "from": "alice_address", "to": "bob_address", "amount": 0.01, "fee": 0.0001 , "from": "john_address", "to": "kate_address", "amount": 0.2, "fee": 0.0003 ] total_fees = sum(tx["fee"] for tx in transactions) block_reward = 3.125 miner_address = "1GmShbbxQMG7v7RMJwriAGvCxJTpXim4fb" coinbase_tx = "from": "COINBASE", "to": miner_address, "amount": block_reward + total_fees block_transactions = [coinbase_tx] + transactions def calculate_merkle_root(transactions): tx_hashes = [] for tx in transactions: tx_string = json.dumps(tx, sort_keys=True) tx_hashes.append(double_sha256(tx_string)) while len(tx_hashes) > 1: new_level = [] for i in range(0, len(tx_hashes), 2): left = tx_hashes right = tx_hashes[i + 1] if i + 1 < len(tx_hashes) else left new_level.append(double_sha256(left + right)) tx_hashes = new_level return tx_hashes[0] merkle_root = calculate_merkle_root(block_transactions) previous_block_hash = "0001abc_previous_block" difficulty_prefix = "0001" # чем больше нулей, тем сложнее nonce = 1 while True: block_header = "previous_block_hash": previous_block_hash, "merkle_root": merkle_root, "timestamp": int(time.time()), "difficulty": difficulty_prefix, "nonce": nonce block_header_string = json.dumps(block_header, sort_keys=True) block_hash = double_sha256(block_header_string) if block_hash.startswith(difficulty_prefix): print("БЛОК НАЙДЕН!") print("Hash:", block_hash) print("Nonce:", nonce) print("Награда майнеру:", coinbase_tx["amount"], "BTC") print("1GmShbbxQMG7v7RMJwriAGvCxJTpXim4fb", miner_address) break nonce += 1 coinbase_tx = "from": "COINBASE", "to": miner_address, "amount": block_reward + total_fees if block_hash.startswith(difficulty_prefix): print("БЛОК НАЙДЕН!") coinbase_tx = "from": "COINBASE", "to": 1GmShbbxQMG7v7RMJwriAGvCxJTpXim4fb, "amount": block_reward + total_fees block_reward = 3.125 total_fees = 0.4 coinbase_tx = "from": "COINBASE", "to": "miner_btc_address", "amount": block_reward + total_fees print(coinbase_tx["amount"]) # 3.525 3.125 BTC block subsidy +0.400 BTC transaction fees =3.525 BTC total coinbase output
요약:
카미위키에서의 모든 기여는 다른 기여자가 편집, 수정, 제거할 수 있다는 점을 유의해 주세요. 만약 여기에 동의하지 않는다면, 문서를 저장하지 말아 주세요.
또한, 직접 작성했거나 퍼블릭 도메인과 같은 자유 문서에서 가져왔다는 것을 보증해야 합니다(자세한 사항은
카미위키:저작권
문서를 보세요).
저작권이 있는 내용을 허가 없이 저장하지 마세요!
취소
편집 도움말
(새 창에서 열림)
둘러보기 메뉴
개인 도구
로그인하지 않음
토론
기여
계정 만들기
로그인
associated-pages
문서
토론
한국어
보기
읽기
편집
원본 편집
역사 보기
더 보기
검색
둘러보기
대문
최근 바뀜
임의 문서로
미디어위키 도움말
특수 문서 목록
도구
여기를 가리키는 문서
가리키는 글의 최근 바뀜
문서 정보