package
0.0.0-20201029031353-9742f5acb6e0
Repository: https://github.com/cachecashproject/go-cachecash.git
Documentation: pkg.go.dev

# README

ledger

Notes

  • We support only native P2WPKH transactions (as described in BIP-0142), not P2PKH transactions, P2WPKH-in-P2SH, or other variants. P2SH transactions are not currently supported but will be in a future iteration, in order to support cross-chain atomic swaps.

P2WPKH transactions

A P2WPKH output script looks like

OP_0 [20-byte public key hash]

0x00 0x14 [20 bytes]

The constant 0 is the witness program version. It is followed by a push of the public key hash. The output address includes an address version, which identifies the address as a P2WPKH address on a particular network (testnet, goodnet, or mainnet).

An input spending a P2WPKH output must have a two witness values attached ([signature] [public key]) and an empty input script. The empty input sript is replaced with

OP_DUP OP_HASH160 [20-byte public key hash] OP_EQUALVERIFY OP_CHECKSIG

0x76 0xa9 0x14 [20 bytes] 0x88 0xac

After the output script is evaluated, the stack will look like

[20-byte public key hash]
0

The address version indicates that witnesses are in use, so the 0 is consumed (indicating the witness program version); because this is version 0, the VM checks

  • that the input script is empty;
  • that there is a single value left on the stack; and
  • that there are two witness values

and then

  • replaces the empty input script with the template above, consuming the stack; and
  • pushes the two witness values onto the stack.

After this, script execution proceeds as normal. If the public key in the witness data matches the hash embedded in the address and the signature in the witness data is valid, execution succeeds and the output may be spent.

# Packages

No description provided by the author
No description provided by the author
No description provided by the author
Package txscript implements a limited subset of the Bitcoin script language.

# Functions

No description provided by the author
No description provided by the author
No description provided by the author
MustDecodeBlocKID provides convenient glue for making block ID instances in code.
No description provided by the author
NewBlock creates a new block containing the given transactions and sign it.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
GlobalConfigSchemaYAML returns the NewGlobalConfigPatch for content provided.
NewGlobalConfigSchemaFromFile parses a GlobalConfigPatch file.
NewGlobalConfigSchemaFromFile parses a GlobalConfigSchemaYAML file into a GlobalConfigSchema.
No description provided by the author
NewGlobalConfigStateYAML creates new YAML-friendly version of the GlobalConfigState.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
WriteVarInt serializes val to w using a variable number of bytes depending on its value.

# Constants

No description provided by the author
These values are Cachecash-specific and do not line up with Bitcoin address version assignments.
These values are Cachecash-specific and do not line up with Bitcoin address version assignments.
These values are Cachecash-specific and do not line up with Bitcoin address version assignments.
No description provided by the author
XXX: this is an arbitrary value.
No description provided by the author
this limit is identical with bitcoin.
XXX: this is an arbitrary limit to prevent a panic in make().
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Not valid in serialized transactions.

# Variables

No description provided by the author
No description provided by the author
No description provided by the author

# Structs

No description provided by the author
BlockHeader of a block containing metadata and a signature.
No description provided by the author
No description provided by the author
ChainStorageMemory implmenets an in-memory block storage backend.
ChainStoragePostgres implements a block storage backend for postgres.
ChainStorageSQL implements a block storage backend for SQL.
ChainStorageSqlite implements a block storage backend for sqlite.
Database describes an interface to query blockchain data.
An EscrowOpenTransaction ..
A GenesisTransaction creates coins from thin air.
A GlobalConfigListInsertion describes an insertion into a list global configuration parameter (GCP).
A GlobalConfigListUpdate describes changes to the list global configuration parameter (GCP) Key.
GlobalConfigPatch is the human supplied patch converted into GlobalConfigTransactions by cachecash-gcp merge.
A GlobalConfigScalarUpdate indicates that the scalar gloal configuration parameter (GCP) Key has been set to Value.
A GlobalConfigSchema defines the available global configuration parameters in an in-memory convenient fashion.
No description provided by the author
GlobalConfigStateYAML is derived from GlobalConfigState by converting the typed configuration keys into their known types.
A GlobalConfigTransaction creates coins from thin air.
No description provided by the author
XXX: This is a bad name, because we use this struct to describe both inpoints and outpoints.
No description provided by the author
Position is the location of a transaction: the Nth transaction in a specific block.
SpendingState is a temporary state when crafting a new TransferTransaction Transaction in the mempool may conflict with each other, like spending the same UTXO twice.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Transactions wraps a slice of *Transaction.
No description provided by the author
In Bitcoin, this is serialized as a data stack.
A TransferTransaction is very similar to a Bitcoin transaction.
No description provided by the author
No description provided by the author
No description provided by the author

# Interfaces

No description provided by the author
No description provided by the author
No description provided by the author
NewBlockSubscriber describes the in-transaction callback made by Database for new blocks.
Persistence descibes the storage backend that is used to store blocks and transactions.
No description provided by the author
No description provided by the author

# Type aliases

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author