From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 19AB196F for ; Mon, 28 Aug 2017 15:50:46 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-it0-f66.google.com (mail-it0-f66.google.com [209.85.214.66]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 6EED23F5 for ; Mon, 28 Aug 2017 15:50:45 +0000 (UTC) Received: by mail-it0-f66.google.com with SMTP id w204so573443ita.1 for ; Mon, 28 Aug 2017 08:50:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=0IbS5gRc7wQ+0T5bl8y9wXQZyUtU5w3SHbj5ixowDT0=; b=jgKa9p7rPOYwuEntxILMTfLJybhWyrRJpyafL2PeZMcVyftvqP2e4z/+ptsZAQJM+9 PYNeFhh6TWD5M5TTDxnt9AgBRh4aIWBxX/eZlv334evq/+qWPBBujNZyqNEBqOGfMX9l jWWV4giQTF2ZvLfUeHl8SZxv1kXyNmMk6KYT+/Cpm0IR3c5l0SdooUCbBoHcAAqsLMIv N2iWAkO14QEaK+8fZxRWUzAIbMNha8dx+26bqLArJaJwHoKh9fTgadaX4sp04+VQxuJf XGPO9wvgi+PLfQIyOsFcPTmiTUVlSnKomz17JxzSB3Xqwm7gpb8GjToLyzXqDrVMMEeZ bWnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=0IbS5gRc7wQ+0T5bl8y9wXQZyUtU5w3SHbj5ixowDT0=; b=Wv7JomM9CHdjB1t1CfKnHQjxLBMitbHh+4lVoeSgi7CrMC7LWxHlEAoFEMcClF2hzD VGykZSVx0MLqEMB7G02mog9K+wD3Wfq+kaMfpYKN3G8ZNhhlY+8MebhSgJILgpSSPGrf 0lvtqQ65JSVGYMBxk147R+qBuzWYKOKR8XAjLj9q79SFe21lZdIn+udP7Z0Yx+uU+dUV r6tpiIdNhRZaArOuScno8aMUvJxL85xEKBYaW5sHEzsZEZS4Q6/GS/rEYlSwuO3qrNI3 IY3yjUHDxCgK4M3aLOn66scf0qbM+r/RYOHuH00AvLmBkPFXolp//w+sdSBg7py2kVcu bvow== X-Gm-Message-State: AHYfb5hAf01X9e6VxcMOfm2ZyG6Y2R2rOCAQQwEW0O4jlXOVn2MbNm8S /Bja2wie/m8dIJzHU42TmYvdrZOOhLZOTMU= X-Received: by 10.36.52.74 with SMTP id z71mr1052913itz.142.1503935444275; Mon, 28 Aug 2017 08:50:44 -0700 (PDT) MIME-Version: 1.0 Received: by 10.2.120.29 with HTTP; Mon, 28 Aug 2017 08:50:23 -0700 (PDT) From: Riccardo Casatta Date: Mon, 28 Aug 2017 17:50:23 +0200 Message-ID: To: bitcoin-dev@lists.linuxfoundation.org Content-Type: multipart/alternative; boundary="001a11473df6ebd7600557d241a0" X-Spam-Status: No, score=0.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM autolearn=disabled version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org X-Mailman-Approved-At: Mon, 28 Aug 2017 16:05:38 +0000 Subject: [bitcoin-dev] "Compressed" headers stream X-BeenThere: bitcoin-dev@lists.linuxfoundation.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: Bitcoin Protocol Discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Aug 2017 15:50:46 -0000 --001a11473df6ebd7600557d241a0 Content-Type: text/plain; charset="UTF-8" Hi everyone, the Bitcoin headers are probably the most condensed and important piece of data in the world, their demand is expected to grow. When sending a stream of continuous block headers, a common case in IBD and in disconnected clients, I think there is a possible optimization of the transmitted data: The headers after the first could avoid transmitting the previous hash cause the receiver could compute it by double hashing the previous header (an operation he needs to do anyway to verify PoW). In a long stream, for example 2016 headers, the savings in bandwidth are about 32/80 ~= 40% without compressed headers 2016*80=161280 bytes with compressed headers 80+2015*48=96800 bytes What do you think? In OpenTimestamps calendars we are going to use this compression to give lite-client a reasonable secure proofs (a full node give higher security but isn't feasible in all situations, for example for in-browser verification) To speed up sync of a new client Electrum starts with the download of a file ~36MB containing the first 477637 headers. For this kind of clients could be useful a common http API with fixed position chunks to leverage http caching. For example /headers/2016/0 returns the headers from the genesis to the 2015 header included while /headers/2016/1 gives the headers from the 2016th to the 4031. Other endpoints could have chunks of 20160 blocks or 201600 such that with about 10 http requests a client could fast sync the headers -- Riccardo Casatta - @RCasatta --001a11473df6ebd7600557d241a0 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi everyone,

the Bitcoin hea= ders are probably the most condensed and important piece of data in the wor= ld, their demand is expected to grow.

When sending= a stream of continuous block headers, a common case in IBD and in disconne= cted clients, I think there is a possible optimization of the transmitted d= ata:
The headers after the first could avoid transmitting the pre= vious hash cause the receiver could compute it by double hashing the previo= us header (an operation he needs to do anyway to verify PoW).
In = a long stream, for example 2016 headers, the savings in bandwidth are about= 32/80 ~=3D 40%
without compressed headers 2016*80=3D161280 bytes=
with compressed headers 80+2015*48=3D96800 bytes

<= /div>
What do you think?


In Ope= nTimestamps calendars we are going to use this compression to give lite-cli= ent a reasonable secure proofs (a full node give higher security but isn= 9;t feasible in all situations, for example for in-browser verification)
To speed up sync of a new client Electrum starts with the download = of a file= =C2=A0~36MB containing the first 477637 headers.=C2=A0
For this k= ind of clients could be useful a common http API with fixed position chunks= to leverage http caching. For example /headers/2016/0 returns the headers = from the genesis to the 2015 header included while /headers/2016/1 gives th= e headers from the 2016th to the 4031.
Other endpoints could have= chunks of 20160 blocks or 201600 such that with about 10 http requests a c= lient could fast sync the headers


-- =
Riccardo Casatta - @RCasatta
<= /div>
--001a11473df6ebd7600557d241a0--