Skip to content

Instantly share code, notes, and snippets.

@n1bor
n1bor / RecreateTx.scala
Last active May 24, 2018 09:23
Regen Tx from data
package fr.acinq.eclair
import grizzled.slf4j.Logging
import fr.acinq.bitcoin.{BinaryData, OutPoint, Transaction}
import fr.acinq.eclair.wire.ChannelCodecs.{stateDataCodec,DATA_CLOSING_Codec}
import scodec.bits.BitVector
import fr.acinq.eclair.channel.HasCommitments
import fr.acinq.eclair.crypto.LocalKeyManager
import fr.acinq.eclair.channel.Helpers
import akka.actor.ActorSystem
import akka.actor.ActorLogging
@n1bor
n1bor / readme.md
Last active June 10, 2018 19:56
Bitcoin Chainstate Download

Chainstate only download - Proof of Concept

Introduction

The bitcoin blockchain is currently (9th Sept 2016) 88Gig but the Chainstate is only 1.7 Gig. That is a factor of 50 different. One concern for bitcoin at the moment is a lack of full nodes. This is partly due to the length of time to download and process the blockchain from scratch. And in addition a significant cost of hosting a full node is the cost of bandwidth for serving historical blocks - and a lot of this is to nodes that start downloading the blockchain and then abandon. A node can still operate as a full node with just a valid chainstate - there is little need for the full blockchain. From my tests only 30% of chains that start syncing get to completion.

Overview of proposal

  1. Every 100'th block nodes take a snapshot of the LevelDB chainstate database.
  2. They then calculate a hash of hashes of that 1.7gig database (takes about 2mins).