Bitcoin Forum
June 14, 2024, 08:34:01 PM
Welcome,
Guest
. Please
login
or
register
.
News
: Latest Bitcoin Core release:
27.0
[
Torrent
]
Home
Help
Search
Login
Register
More
Bitcoin Forum
>
Bitcoin
>
Development & Technical Discussion
>
Why is there a target field in block headers?
Pages: [
1
]
« previous topic
next topic »
Print
Author
Topic: Why is there a target field in block headers? (Read 704 times)
olalonde
(OP)
Newbie
Offline
Activity: 25
Merit: 0
Why is there a target field in block headers?
March 31, 2014, 04:42:51 AM
Last edit: March 31, 2014, 08:15:37 AM by olalonde
#1
Block headers have a `bits` field representing the target at the time a block was mined (according to the
Bitcoin wiki
). Obviously, clients cannot trust this field as a malicious miner could simply set an easy target, rendering the PoW meaningless. What is the purpose of having a target field in block headers if it cannot be trusted?
Hawkix
Hero Member
Offline
Activity: 531
Merit: 505
Re: Why is there a target field in block headers?
March 31, 2014, 12:38:05 PM
#2
There are strict rules how the target is calculated, so miners cannot fake the target, otherwise the block is invalid.
For example, inside the 2016 window of the same difficulty, the target must match the previous one. On the boundaries, rules for adjusting the difficulty applies.
Donations: 1
Hawkix
7GHym6SM98ii5vSHHShA3FUgpV6
http://btcportal.net/
- All about Bitcoin - coming soon!
olalonde
(OP)
Newbie
Offline
Activity: 25
Merit: 0
Re: Why is there a target field in block headers?
March 31, 2014, 01:04:27 PM
#3
Sure, I know that. I know what the target is and how it is computed.
What I wonder is why is the target is stored in block headers when it should be calculated independently by verifiers? Seems like redundant information at best and a potential pitfall for naive client implementations at worse.
jl2012
Legendary
Offline
Activity: 1792
Merit: 1097
Re: Why is there a target field in block headers?
March 31, 2014, 01:18:08 PM
#4
Yes, I do not see why it should exist. With 293000 blocks so far, 293000*4=1.17MB is wasted. Not much, but I can't see why
Donation address: 374iXxS4BuqFHsEwwxUuH3nvJ69Y7Hqur3 (Bitcoin ONLY)
LRDGENPLYrcTRssGoZrsCT1hngaH3BVkM4 (LTC)
PGP: D3CC 1772 8600 5BB8 FF67 3294 C524 2A1A B393 6517
Hawkix
Hero Member
Offline
Activity: 531
Merit: 505
Re: Why is there a target field in block headers?
March 31, 2014, 04:40:33 PM
#5
Oh, now I understand. Not sure, but:
1) nBits (=target) in block header is stored on disc and verified when loading, you do not want to go all way back
2) there might be some interesting problems when you try to calculate nBits "on the fly" when there are reorgs of chains near the difficulty retarget
thus, it is probably better to keep the value in the header anyway. If there is another, more important reason, I would like to know it, too.
Donations: 1
Hawkix
7GHym6SM98ii5vSHHShA3FUgpV6
http://btcportal.net/
- All about Bitcoin - coming soon!
DeathAndTaxes
Donator
Legendary
Offline
Activity: 1218
Merit: 1079
Gerald Davis
Re: Why is there a target field in block headers?
April 01, 2014, 03:29:35 AM
#6
Nodes don't rely on the target value so in theory it could be removed however it does allow nodes to identify bad blocks quicker. If your node receives a relayed block which has a different target than what it is expecting then the block is invalid and validation can stop. IIRC at one time altcoin pump and dumpers didn't even have enough skill to realize they needed to change the magic values and ports to ensure the chain will be independent from bitcoin so the clients would be relaying blocks that are simply invalid for the Bitcoin network.
Technically that you are right it isn't needed and it shouldn't be relied upon. For efficiency sake nodes validate the header values first. If they are invalid the block is invalid. They validate the tx set next. If any tx is invalid the block is invalid. The merkle tree is constructed next. If the computed merkle tree root hash doesn't match the root hash in the header then the block is invalid. Finally only after all that validation is complete the node will hash the header and ensure it produces a hash below the target. The block is now valid and will be relayed to other peers.
olalonde
(OP)
Newbie
Offline
Activity: 25
Merit: 0
Re: Why is there a target field in block headers?
April 01, 2014, 05:47:36 AM
#7
> For efficiency sake nodes validate the header values first.
Makes sense. Thanks.
Pages: [
1
]
Print
Bitcoin Forum
>
Bitcoin
>
Development & Technical Discussion
>
Why is there a target field in block headers?
« previous topic
next topic »
Jump to:
Please select a destination:
-----------------------------
Bitcoin
-----------------------------
=> Bitcoin Discussion
===> Legal
===> Press
===> Meetups
===> Important Announcements
=> Development & Technical Discussion
===> Wallet software
=====> Electrum
=====> Bitcoin Wallet for Android
=====> BitcoinJ
=====> Armory
=====> Mycelium
=====> Hardware wallets
=> Mining
===> Mining support
===> Pools
===> Mining software (miners)
===> Hardware
=====> Group buys
===> Mining speculation
=> Bitcoin Technical Support
=> Project Development
-----------------------------
Economy
-----------------------------
=> Economics
===> Speculation
=> Marketplace
===> Goods
=====> Computer hardware
=====> Digital goods
=======> Invites & Accounts
=====> Collectibles
===> Services
===> Currency exchange
===> Gambling
=====> Games and rounds
=====> Investor-based games
=====> Gambling discussion
===> Lending
=====> Long-term offers
===> Securities
===> Auctions
===> Service Announcements
=====> Micro Earnings
===> Service Discussion
=====> Web Wallets
=====> Exchanges
=> Trading Discussion
===> Scam Accusations
===> Reputation
-----------------------------
Other
-----------------------------
=> Meta
===> New forum software
===> Bitcoin Wiki
=> Politics & Society
=> Beginners & Help
=> Off-topic
=> Serious discussion
===> Ivory Tower
=> Archival
===> Корзина
===> CPU/GPU Bitcoin mining hardware
===> Chinese students
===> Obsolete (buying)
===> Obsolete (selling)
===> MultiBit
-----------------------------
Alternate cryptocurrencies
-----------------------------
=> Altcoin Discussion
=> Announcements (Altcoins)
===> Tokens (Altcoins)
=> Mining (Altcoins)
===> Pools (Altcoins)
=> Marketplace (Altcoins)
===> Service Announcements (Altcoins)
===> Service Discussion (Altcoins)
===> Bounties (Altcoins)
=> Speculation (Altcoins)
-----------------------------
Local
-----------------------------
=> العربية (Arabic)
===> العملات البديلة (Altcoins)
=====> النقاشات
===> إستفسارات و أسئلة المبتدئين
===> التعدين
===> النقاشات الأخرى
===> منصات التبادل
=> Bahasa Indonesia (Indonesian)
===> Marketplace (Bahasa Indonesia)
===> Mining (Bahasa Indonesia)
===> Altcoins (Bahasa Indonesia)
===> Trading dan Spekulasi
===> Ekonomi, Politik, dan Budaya
===> Topik Lainnya
=> Español (Spanish)
===> Mercado y Economía
=====> Servicios
=====> Trading y especulación
===> Hardware y Minería
===> Esquina Libre
===> Mercadillo
=====> Mexico
=====> Argentina
=====> España
=====> Centroamerica y Caribe
===> Primeros pasos y ayuda
===> Altcoins (criptomonedas alternativas)
=====> Minería de altcoins
=====> Servicios
=====> Tokens (Español)
=> 中文 (Chinese)
===> 跳蚤市场
===> 山寨币
===> 媒体
===> 挖矿
===> 离题万里
=> Hrvatski (Croatian)
===> Trgovina
===> Altcoins (Hrvatski)
=====> Announcements (Hrvatski)
===> Off-topic (Hrvatski)
=> Deutsch (German)
===> Anfänger und Hilfe
===> Mining (Deutsch)
===> Trading und Spekulation
===> Projektentwicklung
===> Off-Topic (Deutsch)
===> Treffen
===> Presse
===> Altcoins (Deutsch)
=====> Announcements (Deutsch)
===> Marktplatz
=====> Auktionen
=====> Suche
=====> Biete
=> Ελληνικά (Greek)
===> Αγορά
===> Mining Discussion (Ελληνικά)
===> Altcoins (Ελληνικά)
=====> Altcoin Announcements (Ελληνικά)
=====> Altcoin Mining (Ελληνικά)
=> עברית (Hebrew)
=> Français
===> Actualité et News
===> Débutants
===> Discussions générales et utilisation du Bitcoin
===> Mining et Hardware
===> Économie et spéculation
===> Place de marché
=====> Échanges
=====> Produits et services
=====> Petites annonces
===> Le Bitcoin et la loi
===> Wiki, documentation et traduction
===> Développement et technique
===> Vos sites et projets
===> Hors-sujet
===> Altcoins (Français)
=====> Annonces
=> India
===> Mining (India)
===> Marketplace (India)
===> Regional Languages (India)
===> Press & News from India
===> Alt Coins (India)
===> Buyer/ Seller Reputations (India)
===> Off-Topic (India)
=> Italiano (Italian)
===> Guide (Italiano)
===> Progetti
===> Discussioni avanzate e sviluppo
===> Trading, analisi e speculazione
===> Mercato
=====> Mercato valute
=====> Beni
=====> Servizi
=====> Esercizi commerciali
=====> Hardware/Mining (Italiano)
=====> Gambling (Italiano)
===> Accuse scam/truffe
===> Mining (Italiano)
===> Alt-Currencies (Italiano)
=====> Annunci
===> Raduni/Meeting (Italiano)
===> Crittografia e decentralizzazione
===> Off-Topic (Italiano)
=> 日本語 (Japanese)
===> アルトコイン
=> Nederlands (Dutch)
===> Markt
===> Gokken/lotterijen
===> Mining (Nederlands)
===> Beurzen
===> Alt Coins (Nederlands)
===> Off-topic (Nederlands)
===> Meetings (Nederlands)
=> Nigeria (Naija)
===> Politics and society (Naija)
===> Off-topic (Naija)
=> 한국어 (Korean)
===> 대체코인 Alt Coins (한국어)
=> Pilipinas
===> Altcoins (Pilipinas)
=====> Altcoin Announcements (Pilipinas)
===> Pamilihan
===> Others (Pilipinas)
=> Polski
===> Tablica ogłoszeń
===> Alternatywne kryptowaluty
=====> Nowe kryptowaluty i tokeny
=====> Tablica ogłoszeń (altcoiny)
=> Português (Portuguese)
===> Primeiros Passos (Iniciantes)
===> Economia & Mercado
===> Mineração em Geral
===> Desenvolvimento & Discussões Técnicas
===> Criptomoedas Alternativas
===> Brasil
===> Portugal
=> Русский (Russian)
===> Новички
===> Бизнес
=====> Барахолка
=====> Обменники
===> Идеи
===> Кодеры
===> Майнеры
===> Политика
===> Трейдеры
===> Альтернативные криптовалюты
=====> Токены
=====> Бayнти и aиpдpoпы
===> Хайпы
===> Работа
===> Разное
===> Oбcyждeниe Bitcoin
=====> Новости
=====> Юристы
=> Română (Romanian)
===> Anunturi importante
===> Offtopic
===> Market
=====> Discutii Servicii
===> Minerit
===> Tutoriale
===> Bine ai venit!
===> Presa
===> Altcoins (Monede Alternative)
=====> Anunturi Monede Alternative
=> Skandinavisk
=> Türkçe (Turkish)
===> Bitcoin Haberleri
===> Pazar Alanı
===> Madencilik
===> Ekonomi
===> Servisler
=====> Fonlar
===> Proje Geliştirme
===> Alternatif Kripto-Paralar
=====> Madencilik (Alternatif Kripto-Paralar)
=====> Duyurular (Alternatif Kripto-Paralar)
===> Konu Dışı
===> Yeni Başlayanlar & Yardım
===> Buluşmalar
=> Other languages/locations
Loading...