Documentation
¶
Index ¶
- Variables
- func BlockToAddLeaves(blk wire.MsgBlock, remember []bool, skiplist []uint32, height int32) (leaves []accumulator.Leaf)
- func CheckMagicByte(bytesgiven []byte) bool
- func DedupeBlock(blk *wire.MsgBlock) (inskip []uint32, outskip []uint32)
- func GetBitcoinDataDir() (dir string)
- func GetHomeDir() string
- func GetUDataBytesFromFile(height int32) (b []byte, err error)
- func HasAccess(fileName string) bool
- func IsUnspendable(o *wire.TxOut) bool
- func MakePaths()
- func PopPrefixLen16(b []byte) ([]byte, []byte, error)
- func PrefixLen16(b []byte) []byte
- func UblockNetworkReader(blockChan chan UBlock, remoteServer string, curHeight, lookahead int32)
- type Hash
- type LeafData
- type PatriciaProof
- type ProofAndHeight
- type UBlock
- func (ub *UBlock) CheckBlock(outskip []uint32, p *chaincfg.Params) bool
- func (ub *UBlock) Deserialize(r io.Reader) (err error)
- func (ub *UBlock) FromBytes(argbytes []byte) (err error)
- func (ub *UBlock) ProofsProveBlock(inputSkipList []uint32) bool
- func (ub *UBlock) Serialize(w io.Writer) (err error)
- type UData
Constants ¶
This section is empty.
Variables ¶
var DarwinDataDir string = "/Library/Application Support/Bitcoin/"
var ForestDirPath string = filepath.Join(".", "utree/forestdata")
var ForestFilePath string = filepath.Join(ForestDirPath, "forestfile.dat")
forestdata file paths
var ForestLastSyncedBlockHeightFilePath string = filepath.Join(ForestDirPath,
"forestlastsyncedheight.dat")
var LastIndexOffsetHeightFilePath string = filepath.Join(OffsetDirPath,
"lastindexoffsetheightfile")
var LastPOffsetFilePath string = filepath.Join(ProofDirPath, "lastproofoffset.dat")
For resuming purposes. Stores the last index that genproofs left at
var LinuxDataDir string = "/.bitcoin/"
Bitcoin Core DATADIR
var MiscForestFilePath string = filepath.Join(ForestDirPath, "miscforestfile.dat")
var OffsetDirPath string = filepath.Join(".", "utree/offsetdata")
Directory paths
var OffsetFilePath string = filepath.Join(OffsetDirPath, "offsetfile")
offsetdata file paths
var PFilePath string = filepath.Join(ProofDirPath, "proof.dat")
proofdata file paths
Where the proofs for txs are stored
var POffsetFilePath string = filepath.Join(ProofDirPath, "proofoffset.dat")
Where the index for a proof for a block is stored
var PollardFilePath string = "pollardFile"
File paths
var ProofDirPath string = filepath.Join(".", "utree/proofdata")
var WinDataDir string = "\\AppData\\Roaming\\Bitcoin"
Functions ¶
func BlockToAddLeaves ¶
func BlockToAddLeaves(blk wire.MsgBlock, remember []bool, skiplist []uint32, height int32) (leaves []accumulator.Leaf)
BlockToAdds turns all the new utxos in a msgblock into leafTxos uses remember slice up to number of txos, but doesn't check that it's the right length. Similar with skiplist, doesn't check it.
func CheckMagicByte ¶
CheckMagicByte checks for the Bitcoin magic bytes. returns false if it didn't read the Bitcoin magic bytes. Checks only for testnet3 and mainnet
func DedupeBlock ¶
DedupeBlock takes a bitcoin block, and returns two int slices: the indexes of inputs, and idexes of outputs which can be removed. These are indexes within the block as a whole, even the coinbase tx. So the coinbase tx in & output numbers affect the skip lists even though the coinbase ins/outs can never be deduped. it's simpler that way.
func GetBitcoinDataDir ¶
func GetBitcoinDataDir() (dir string)
GetBitcoinDataDir grabs the user's Bitcoin DataDir. Doesn't support Windows or BSDs
func GetUDataBytesFromFile ¶
GetUDataBytesFromFile reads the proof data from proof.dat and proofoffset.dat and gives the proof & utxo data back. Don't ask for block 0, there is no proof of that.
func HasAccess ¶
HasAccess reports whether we have access to the named file. Returns true if HasAccess, false if it doesn't. Does NOT tell us if the file exists or not. File might exist but may not be available to us
func IsUnspendable ¶
IsUnspendable determines whether a tx is spendable or not. returns true if spendable, false if unspendable.
func PrefixLen16 ¶
PrefixLen16 puts a 2 byte length prefix in front of a byte slice
func UblockNetworkReader ¶
UblockNetworkReader gets Ublocks from the remote host and puts em in the channel. It'll try to fill the channel buffer.
Types ¶
type Hash ¶
type Hash [32]byte
func GenHashForNet ¶
For a given BitcoinNet, yields the genesis hash If the BitcoinNet is not supported, an error is returned.
func HashFromString ¶
HashFromString hashes the given string with sha256
type LeafData ¶
type LeafData struct { BlockHash [32]byte Outpoint wire.OutPoint Height int32 Coinbase bool Amt int64 PkScript []byte }
LeafData is all the data that goes into a leaf in the utreexo accumulator
func LeafDataFromBytes ¶
func LeafDataFromCompactBytes ¶
LeafDataFromCompactBytes doesn't fill in blockhash, outpoint, and in most cases PkScript, so something else has to fill those in later.
func (*LeafData) ToCompactBytes ¶
ToCompactBytes turns a LeafData into bytes (compact, for sending in blockProof) - don't hash this, it doesn't commit to everything
type PatriciaProof ¶
type PatriciaProof struct {
// contains filtered or unexported fields
}
PatriciaProof is a potential replacement structure for UData in the trie - Bolton
type ProofAndHeight ¶
type UBlock ¶
UBlock is a regular block, with Udata stuck on
func (*UBlock) CheckBlock ¶
CheckBlock does all internal block checks for a UBlock right now checks the signatures
func (*UBlock) Deserialize ¶
network serialization for UBlocks (regular block with udata) Firstjust a wire.MsgBlock with the regular serialization. Then there's 4 bytes is (big endian) length of the udata. So basically a block then udata, that's it. Looks like "height" doesn't get sent over this way, but maybe that's OK.
func (*UBlock) ProofsProveBlock ¶
ProofsProveBlock checks the consistency of a UBlock. Does the proof prove all the inputs in the block?
type UData ¶
type UData struct { AccProof accumulator.BatchProof UtxoData []LeafData LeafTTLs []uint32 }
func UDataFromBytes ¶
UDataFromBytes deserializes into UData from bytes.
func UDataFromCompactBytes ¶
func (*UData) ToBytes ¶
ToBytes serializes UData into bytes. There's a bunch of variable length things (the batchProof.hashes, and the LeafDatas) so we prefix lengths for those. Ordering is: batch proof length (4 bytes) batch proof Bunch of LeafDatas, prefixed with 2-byte lengths leaf ttls 4 bytes each
func (*UData) ToCompactBytes ¶
func (*UData) ToUtxoView ¶
func (ud *UData) ToUtxoView() *blockchain.UtxoViewpoint
ToUtxoView converts a UData into a btcd blockchain.UtxoViewpoint all the data is there, just a bit different format. Note that this needs blockchain.NewUtxoEntry() in btcd