Next: Introduction, Previous: (dir), Up: (dir) [Contents][Index]
This is the bp Reference Manual, version 0.0.3, generated automatically by Declt version 3.0 "Montgomery Scott" on Sun May 15 03:25:40 2022 GMT+0.
• Introduction | What bp is all about | |
• Systems | The systems documentation | |
• Files | The files documentation | |
• Packages | The packages documentation | |
• Definitions | The symbols documentation | |
• Indexes | Concepts, functions, variables and data types |
This is a Common Lisp implementation of the various components of the Bitcoin Protocol. The serialization and deserialization utils may be used for reading the block data both from peers and from local database on disk. EC-based cryptographic operations are implemented as FFI bindings to the secp256k1 using cffi, while hash-functions are taken from ironclad. Low-level networking is implemented using usocket, HTTP client code uses aserve and JSON handling is done with jsown.
THIS BITCOIN CONSENSUS RULES IMPLEMENTATION IS NOT, AND WILL PROBABLY NEVER BE FULLY COMPLIANT WITH BITCOIN CORE IMPLEMENTATION. DO NOT RELY ON IT FOR VALIDATING YOUR MAINNET TRANSACTIONS, AS IT MAY EASILY PUT YOU OUT OF SYNC WITH THE NETWORK IN A LOT OF CORNER CASES.
Elliptic curve cryptography utilities (transaction signing and
verification) use a secp256k1 library, so it must be installed
before building the bp
system (either manually, or using the system
package manager if available):
# Ubuntu
$ apt install libsecp256k1 libsecp256k1-dev
# Arch Linux
$ pacman -Syu libsecp256k1
# macOS
$ brew tap cuber/homebrew-libsecp256k1
$ brew install libsecp256k1
Once secp256k1 is ready, bp
can be installed via quicklisp tool:
CL-USER> (ql:quickload "bp")
Alternatively, bp
system can be loaded from sources, assuming the
following Common Lisp packages are available locally:
In order to load bp
from sources, evaluate the following form (this
assumes that ASDF is able to find the system definition; more on that
here):
CL-USER> (asdf:load-system "bp")
Currently this library only provides utilities for stateless interaction with Bitcoin from REPL. Storage, wallet and full node capabilities are somewhere in a distant future.
Note that at this point only the symbols exported from the package
bp/core/all
(nicknamed bp
) can be considered an API - changes to
these functions and classes will be kept to a minimum. Everything else
will likely be changing a lot.
Functions bp:get-block-hash
, bp:get-block
and bp:get-transaction
allow to pull chain data from any external supplier specified with the
bp:with-chain-supplier
macro:
CL-USER> (bp:with-chain-supplier (bprpc:node-rpc-connection
:url "http://localhost:8332"
:username "btcuser"
:password "btcpassword")
(bp:get-transaction "0e3e2357e806b6cdb1f70b54c3a3a17b6714ee1f0e68bebb44a74b1efd512098"))
#<BP/CORE/TRANSACTION:TX 0e3e2357e806b6cdb1f70b54c3a3a17b6714ee1f0e68bebb44a74b1efd512098>
Non-nil
keyword argument :encoded
can be used with bp:get-block
and bp:get-transaction
to return serialized transaction hex-encoded
in a string:
CL-USER> (bp:get-transaction "14...c3" :encoded t)
"010000000...ae00000000"
Under the hood, these operations call corresponding generic functions
bp:chain-get-{block-hash,block,transaction}
which take the supplier
object as an explicit first argument.
Bitcoin data entities are represented by the following structures:
bp:block-header
,bp:cblock
,bp:tx
,bp:txin
,bp:txout
,bp:script
.Functions named bp:block-*
(both for bp:block-header
and
bp:cblock
), bp:tx-*
, bp:txin-*
and bp:txout-*
provide access
to the components of the corresponding entities.
Functions bp:parse
and bp:serialize
can be used to read and write
any Bitcoin entity from and to any octet stream respectively:
CL-USER> (ironclad:with-octet-input-stream (stream #(1 0 ... 0 0))
(bp:parse 'bp:tx in-stream))
#<BP/CORE/TRANSACTION:TX 17e590f116d3deeb9b121bbb1c37b7916e6b7859461a3af7edf74e2348a9b347>
CL-USER> (ironclad:with-octet-output-stream (stream)
(bp:parse 'tx out-stream))
#(1 0 ... 0 0)
Note that while bp:serialize
function take an entity as its first
argument, bp:parse
takes the symbol naming the class of the entity,
behaving as class method.
Functions bp:decode
and bp:encode
wrap above functions to decode
and encode Bitcoin entities from and to hex-encoded strings:
CL-USER> (bp:decode 'bp:tx "0100000002f8615378...e097a988ac00000000")
#<BP/CORE/TRANSACTION:TX 17e590f116d3deeb9b121bbb1c37b7916e6b7859461a3af7edf74e2348a9b347>
CL-USER> (bp:encode *)
"0100000002f8615378...e097a988ac00000000"
Functions bp:validate
and bp:validp
take an entity as well as the
optional context parameters, and validate it according to an
approximation of Bitcoin consensus rules.
Both functions return t
if the entity is valid, but the
bp:validate
function signals an error otherwise, while the
bp:validp
function simply returns nil
.
Both functions assume the chain supplier context (i.e. they are called
within the body of bp:with-chain-supplier
).
Dynamic variable bp:*trace-script-execution*
can be used to enable
printing the steps of script execution (chain supplier macro omitted):
CL-USER> (setf bp:*trace-script-execution* t)
T
CL-USER> (bp:validate
(bp:get-transaction "17e590f116d3deeb9b121bbb1c37b7916e6b7859461a3af7edf74e2348a9b347"))
op: OP_PUSH22
payload: #(0 14 a4 b4 ca 48 de b 3f ff c1 54 4 a1 ac dc 8d ba ae 22 69 55)
commands: <>
stack: ()
op: OP_HASH160
payload: -
commands: <OP_PUSH20 OP_EQUAL>
stack: (#(0 14 a4 b4 ca 48 de b 3f ff c1 54 4 a1 ac dc 8d ba ae 22 69 55))
op: OP_PUSH20
payload: #(29 28 f4 3a f1 8d 2d 60 e8 a8 43 54 d 80 86 b3 5 34 13 39)
commands: <OP_EQUAL>
stack: (#(29 28 f4 3a f1 8d 2d 60 e8 a8 43 54 d 80 86 b3 5 34 13 39))
op: OP_EQUAL
payload: -
commands: <>
stack: (#(29 28 f4 3a f1 8d 2d 60 e8 a8 43 54 d 80 86 b3 5 34 13 39)
#(29 28 f4 3a f1 8d 2d 60 e8 a8 43 54 d 80 86 b3 5 34 13 39))
op: OP_FALSE
payload: -
commands: <OP_PUSH20>
stack: ()
op: OP_PUSH20
payload: #(a4 b4 ca 48 de b 3f ff c1 54 4 a1 ac dc 8d ba ae 22 69 55)
commands: <>
stack: (#())
T
Validating certain entities requires additional information (block
height, transactions index, block/transaction itself, etc), which can
be packed into an instance of bp:validation-context
class. For
example, validating a coinbase transaction will fail, because the only
transaction input it contains will have its previous-tx-id
set to 0,
which is invalid for regular transactions. For example, to be
considered valid, a coinbase transaction must be the first transaction
of its block, while the block itself is required for amount
verification (to calculate the collected fees) and block height may be
needed to perform the BIP-0034 check, so such a
transaction can be validated using the following form:
CL-USER> (let* ((block
(bp:get-block "00000000000000d0dfd4c9d588d325dce4f32c1b31b7c0064cba7025a9b9adcc"))
(context
(make-instance 'bp:validation-context :tx-index 0 :height 227836 :block block))
(bp:validate
(bp:get-transaction "0f3601a5da2f516fa9d3f80c9bf6e530f1afb0c90da73e8f8ad0630c5483afe5")
:context context)))
T
BP provides simple utilities for interacting with Bitcoin network - a subset of network messages and functions for establishing connections with other network nodes as well as requesting blocks and transactions.
In order to demontrate interaction with Bitcoin network, we can start
a regtest
Bitcoin node:
# Start Bitcoin daemon:
$ bitcoind --daemon --regtest --datadir=$HOME/.bitcoin
# Generate a few blocks:
$ bitcoin-cli --regtest generatetoaddress 5 $(bitcoin-cli --regtest getnewaddress)
# Enable net logging:
$ bitcoin-cli --regtest logging "[\"net\"]"
# Tail log file to see the incoming messages:
$ tail -f ~/.bitcoin/regtest/debug.log
Executing the following forms from Lisp REPL will perform a handshake with Bitcoin node:
CL-USER> (defvar *node* (make-instance 'bpnet:simple-node :network :regtest))
...
CL-USER> (bpnet:connect-peer *node* :host "127.0.0.1" :port 18444)
...
bpnet:simple-node
is a very simple network node implementation that
maintains a single peer connection and provides bpnet:send-message
and bpnet:receive-message
functions for sending and receiving
messages, respectively.
Alternatively, bpnet:simple-node
can be asked to discover a peer
using a hardcoded DNS seed, but this is currently only supported on
mainnet. The following form will select a random peer and shake hands
with it:
CL-USER> (setf *node* (make-instance 'bpnet:simple-node :peer :discover))
...
Objects of bpnet:simple-node
partially implement chain supplier
interface - bp:chain-get-block-hash
is currently not supported,
bp:chain-get-transaction
only returns transactions that are
currently in the mempool or in relay set (this is an intentional
limitation of the Bitcoin gossip protocol to prevent
clients from assuming all nodes keep full transaction indexes).
bp:chain-get-block
works as expected. In the example below
<block-hash>
must be a hash of one of the blocks generated by the
generatetoaddress
command above:
CL-USER> (bp:chain-get-block *node* <block-hash>)
...
bprpc
package provides that bprpc:node-rpc-connection
class which
is is an RPC client to the bitcoind
RPC server. It was mentioned
above as one of the implementations of the chain supplier interface,
but it also supports the following RPC operations that correspond to
the bitcoind
RPC methods (and bitcoin-cli
commands) with the same
name:
bprpc:getblockhash
;bprpc:getblock
;bprpc:getrawtransaction
;bprpc:getchaintxstats
.Note that results of RPC operations are jsown
JSON structures, so
specific parts of these structures have to be extracted manually:
cl-user> (let* ((node-connection (make-instance 'bprpc:node-rpc-connection :url <url>))
(chain-stats (bprpc:getchaintxstats node-connection))
(chain-blocks (jsown:val chain-stats "window_final_block_height"))
(chain-txs (jsown:val chain-stats "txcount")))
(format t "Blocks: ~a, transactions: ~a~%" chain-blocks chain-txs))
See CHANGELOG.md.
Copyright (c) 2019-2021 Seibart Nedor <rodentrabies@protonmail.com>
Licensed under MIT License. See LICENSE.
Next: Files, Previous: Introduction, Up: Top [Contents][Index]
The main system appears first, followed by any subsystem dependency.
Next: The bp/net/all system, Previous: Systems, Up: Systems [Contents][Index]
Seibart Nedor <rodentrabies@protonmail.com>
MIT
Bitcoin Protocol components in Common Lisp
0.0.3
bp.asd (file)
Next: The bp/net/node system, Previous: The bp system, Up: Systems [Contents][Index]
Seibart Nedor <rodentrabies@protonmail.com>
MIT
bp.asd (file)
file-type.lisp (file)
Next: The bp/crypto/all system, Previous: The bp/net/all system, Up: Systems [Contents][Index]
Seibart Nedor <rodentrabies@protonmail.com>
MIT
bp.asd (file)
file-type.lisp (file)
Next: The bp/net/parameters system, Previous: The bp/net/node system, Up: Systems [Contents][Index]
Seibart Nedor <rodentrabies@protonmail.com>
MIT
bp.asd (file)
file-type.lisp (file)
Next: The bp/net/message system, Previous: The bp/crypto/all system, Up: Systems [Contents][Index]
Seibart Nedor <rodentrabies@protonmail.com>
MIT
bp/core/all (system)
bp.asd (file)
file-type.lisp (file)
Next: The bp/net/address system, Previous: The bp/net/parameters system, Up: Systems [Contents][Index]
Seibart Nedor <rodentrabies@protonmail.com>
MIT
bp.asd (file)
file-type.lisp (file)
Next: The bp/rpc/all system, Previous: The bp/net/message system, Up: Systems [Contents][Index]
Seibart Nedor <rodentrabies@protonmail.com>
MIT
bp.asd (file)
file-type.lisp (file)
Next: The bp/core/all system, Previous: The bp/net/address system, Up: Systems [Contents][Index]
Seibart Nedor <rodentrabies@protonmail.com>
MIT
bp.asd (file)
file-type.lisp (file)
Next: The bp/core/consensus system, Previous: The bp/rpc/all system, Up: Systems [Contents][Index]
Seibart Nedor <rodentrabies@protonmail.com>
MIT
bp.asd (file)
file-type.lisp (file)
Next: The bp/core/chain system, Previous: The bp/core/all system, Up: Systems [Contents][Index]
Seibart Nedor <rodentrabies@protonmail.com>
MIT
bp.asd (file)
file-type.lisp (file)
Next: The bp/core/merkletree system, Previous: The bp/core/consensus system, Up: Systems [Contents][Index]
Seibart Nedor <rodentrabies@protonmail.com>
MIT
bp.asd (file)
file-type.lisp (file)
Next: The bp/core/block system, Previous: The bp/core/chain system, Up: Systems [Contents][Index]
Seibart Nedor <rodentrabies@protonmail.com>
MIT
bp.asd (file)
file-type.lisp (file)
Next: The bp/core/transaction system, Previous: The bp/core/merkletree system, Up: Systems [Contents][Index]
Seibart Nedor <rodentrabies@protonmail.com>
MIT
bp.asd (file)
file-type.lisp (file)
Next: The bp/core/script system, Previous: The bp/core/block system, Up: Systems [Contents][Index]
Seibart Nedor <rodentrabies@protonmail.com>
MIT
bp.asd (file)
file-type.lisp (file)
Next: The bp/core/encoding system, Previous: The bp/core/transaction system, Up: Systems [Contents][Index]
Seibart Nedor <rodentrabies@protonmail.com>
MIT
bp.asd (file)
file-type.lisp (file)
Next: The bp/crypto/secp256k1 system, Previous: The bp/core/script system, Up: Systems [Contents][Index]
Seibart Nedor <rodentrabies@protonmail.com>
MIT
bp.asd (file)
file-type.lisp (file)
Next: The bp/crypto/random system, Previous: The bp/core/encoding system, Up: Systems [Contents][Index]
Seibart Nedor <rodentrabies@protonmail.com>
MIT
bp.asd (file)
file-type.lisp (file)
Next: The bp/core/parameters system, Previous: The bp/crypto/secp256k1 system, Up: Systems [Contents][Index]
Seibart Nedor <rodentrabies@protonmail.com>
MIT
bp.asd (file)
file-type.lisp (file)
Next: The bp/crypto/hash system, Previous: The bp/crypto/random system, Up: Systems [Contents][Index]
Seibart Nedor <rodentrabies@protonmail.com>
MIT
bp.asd (file)
file-type.lisp (file)
Previous: The bp/core/parameters system, Up: Systems [Contents][Index]
Seibart Nedor <rodentrabies@protonmail.com>
MIT
ironclad
bp.asd (file)
file-type.lisp (file)
Files are sorted by type and then listed depth-first from the systems components trees.
• Lisp files |
Next: The bp/net/all/file-type․lisp file, Previous: Lisp files, Up: Lisp files [Contents][Index]
bp.asd
Next: The bp/net/node/file-type․lisp file, Previous: The bp․asd file, Up: Lisp files [Contents][Index]
bp/net/all (system)
net/all.lisp
Next: The bp/crypto/all/file-type․lisp file, Previous: The bp/net/all/file-type․lisp file, Up: Lisp files [Contents][Index]
bp/net/node (system)
net/node.lisp
Next: The bp/net/parameters/file-type․lisp file, Previous: The bp/net/node/file-type․lisp file, Up: Lisp files [Contents][Index]
bp/crypto/all (system)
crypto/all.lisp
Next: The bp/net/message/file-type․lisp file, Previous: The bp/crypto/all/file-type․lisp file, Up: Lisp files [Contents][Index]
bp/net/parameters (system)
net/parameters.lisp
Next: The bp/net/address/file-type․lisp file, Previous: The bp/net/parameters/file-type․lisp file, Up: Lisp files [Contents][Index]
bp/net/message (system)
net/message.lisp
Next: The bp/rpc/all/file-type․lisp file, Previous: The bp/net/message/file-type․lisp file, Up: Lisp files [Contents][Index]
bp/net/address (system)
net/address.lisp
*dns-seed* (special variable)
Next: The bp/core/all/file-type․lisp file, Previous: The bp/net/address/file-type․lisp file, Up: Lisp files [Contents][Index]
bp/rpc/all (system)
rpc/all.lisp
Next: The bp/core/consensus/file-type․lisp file, Previous: The bp/rpc/all/file-type․lisp file, Up: Lisp files [Contents][Index]
bp/core/all (system)
core/all.lisp
Next: The bp/core/chain/file-type․lisp file, Previous: The bp/core/all/file-type․lisp file, Up: Lisp files [Contents][Index]
bp/core/consensus (system)
core/consensus.lisp
Next: The bp/core/merkletree/file-type․lisp file, Previous: The bp/core/consensus/file-type․lisp file, Up: Lisp files [Contents][Index]
bp/core/chain (system)
core/chain.lisp
Next: The bp/core/block/file-type․lisp file, Previous: The bp/core/chain/file-type․lisp file, Up: Lisp files [Contents][Index]
bp/core/merkletree (system)
core/merkletree.lisp
Next: The bp/core/transaction/file-type․lisp file, Previous: The bp/core/merkletree/file-type․lisp file, Up: Lisp files [Contents][Index]
bp/core/block (system)
core/block.lisp
Next: The bp/core/script/file-type․lisp file, Previous: The bp/core/block/file-type․lisp file, Up: Lisp files [Contents][Index]
bp/core/transaction (system)
core/transaction.lisp
Next: The bp/core/encoding/file-type․lisp file, Previous: The bp/core/transaction/file-type․lisp file, Up: Lisp files [Contents][Index]
bp/core/script (system)
core/script.lisp
Next: The bp/crypto/secp256k1/file-type․lisp file, Previous: The bp/core/script/file-type․lisp file, Up: Lisp files [Contents][Index]
bp/core/encoding (system)
core/encoding.lisp
Next: The bp/crypto/random/file-type․lisp file, Previous: The bp/core/encoding/file-type․lisp file, Up: Lisp files [Contents][Index]
bp/crypto/secp256k1 (system)
crypto/secp256k1.lisp
Next: The bp/core/parameters/file-type․lisp file, Previous: The bp/crypto/secp256k1/file-type․lisp file, Up: Lisp files [Contents][Index]
bp/crypto/random (system)
crypto/random.lisp
random-bytes (function)
Next: The bp/crypto/hash/file-type․lisp file, Previous: The bp/crypto/random/file-type․lisp file, Up: Lisp files [Contents][Index]
bp/core/parameters (system)
core/parameters.lisp
Previous: The bp/core/parameters/file-type․lisp file, Up: Lisp files [Contents][Index]
bp/crypto/hash (system)
crypto/hash.lisp
Next: Definitions, Previous: Files, Up: Top [Contents][Index]
Packages are listed by definition order.
Next: The bp/net/node package, Previous: Packages, Up: Packages [Contents][Index]
file-type.lisp (file)
bpnet
Next: The bp/crypto/all package, Previous: The bp/net/all package, Up: Packages [Contents][Index]
file-type.lisp (file)
Next: The bp/net/parameters package, Previous: The bp/net/node package, Up: Packages [Contents][Index]
file-type.lisp (file)
bpcrypto
Next: The bp/net/message package, Previous: The bp/crypto/all package, Up: Packages [Contents][Index]
file-type.lisp (file)
Next: The bp/net/address package, Previous: The bp/net/parameters package, Up: Packages [Contents][Index]
file-type.lisp (file)
Next: The bp/rpc/all package, Previous: The bp/net/message package, Up: Packages [Contents][Index]
file-type.lisp (file)
*dns-seed* (special variable)
Next: The bp/core/all package, Previous: The bp/net/address package, Up: Packages [Contents][Index]
file-type.lisp (file)
bprpc
Next: The bp/core/consensus package, Previous: The bp/rpc/all package, Up: Packages [Contents][Index]
file-type.lisp (file)
bp
node-connection (class)
Next: The bp/core/chain package, Previous: The bp/core/all package, Up: Packages [Contents][Index]
file-type.lisp (file)
Next: The bp/core/merkletree package, Previous: The bp/core/consensus package, Up: Packages [Contents][Index]
file-type.lisp (file)
Next: The bp/core/block package, Previous: The bp/core/chain package, Up: Packages [Contents][Index]
file-type.lisp (file)
Next: The bp/core/transaction package, Previous: The bp/core/merkletree package, Up: Packages [Contents][Index]
file-type.lisp (file)
Next: The bp/core/script package, Previous: The bp/core/block package, Up: Packages [Contents][Index]
file-type.lisp (file)
Next: The bp/core/encoding package, Previous: The bp/core/transaction package, Up: Packages [Contents][Index]
file-type.lisp (file)
Next: The bp/crypto/secp256k1 package, Previous: The bp/core/script package, Up: Packages [Contents][Index]
file-type.lisp (file)
Next: The bp/crypto/random package, Previous: The bp/core/encoding package, Up: Packages [Contents][Index]
file-type.lisp (file)
secp256k1
Next: The bp/core/parameters package, Previous: The bp/crypto/secp256k1 package, Up: Packages [Contents][Index]
file-type.lisp (file)
common-lisp
random-bytes (function)
Next: The bp/crypto/hash package, Previous: The bp/crypto/random package, Up: Packages [Contents][Index]
file-type.lisp (file)
common-lisp
Previous: The bp/core/parameters package, Up: Packages [Contents][Index]
file-type.lisp (file)
Definitions are sorted by export status, category, package, and then by lexicographic order.
• Exported definitions | ||
• Internal definitions |
Next: Internal definitions, Previous: Definitions, Up: Definitions [Contents][Index]
• Exported constants | ||
• Exported special variables | ||
• Exported macros | ||
• Exported functions | ||
• Exported generic functions | ||
• Exported conditions | ||
• Exported structures | ||
• Exported classes |
Next: Exported special variables, Previous: Exported definitions, Up: Exported definitions [Contents][Index]
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
Number of blocks in between halving events - each 210000 blocks, the block reward is reduced by half, eventually getting to 0 and providing the limited supply property of Bitcoin.
file-type.lisp (file)
Initial reward included in newly mined blocks.
file-type.lisp (file)
Any data of with this number may be ignored.
file-type.lisp (file)
Hash is related to a data block.
file-type.lisp (file)
Hash of a block header; identical to MSG_BLOCK. Only to be used in getdata message. Indicates the reply should be a cmpctblock message. See BIP-0152 for more info.
file-type.lisp (file)
Hash of a block header; identical to MSG_BLOCK. Only to be used in getdata message. Indicates the reply should be a merkleblock message rather than a block message; this only works if a bloom filter has been set.
file-type.lisp (file)
Hash is related to a transaction.
file-type.lisp (file)
Block timestamp at which BIP-0016 was adopted by the mainnet.
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
See BIP-0111.
file-type.lisp (file)
See BIP-0064.
file-type.lisp (file)
This service flag means that given node can serve full blocks instead of just headers.
file-type.lisp (file)
See BIP-0159.
file-type.lisp (file)
See BIP-0111.
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
Block timestamp at which BIP-0016 was adopted by the testnet.
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
Next: Exported macros, Previous: Exported constants, Up: Exported definitions [Contents][Index]
Pay to Script Hash https://github.com/bitcoin/bips/blob/master/bip-0016.mediawiki.
file-type.lisp (file)
Segregated Witness (Consensus layer) https://github.com/bitcoin/bips/blob/master/bip-0141.mediawiki.
file-type.lisp (file)
Version of the BP package.
file-type.lisp (file)
Global chain supplier bound by the WITH-CHAIN-SUPPLIER context manager.
file-type.lisp (file)
file-type.lisp (file)
Dynamic variable to control printing the steps of script execution. If its value is not NIL, it will be used as a first argument to the FORMAT function for logging script steps (i.e. setting it to T will print the trace to *STANDARD-OUTPUT*, while setting it to a stream value will write the trace to that stream).
file-type.lisp (file)
file-type.lisp (file)
Next: Exported functions, Previous: Exported special variables, Up: Exported definitions [Contents][Index]
file-type.lisp (file)
Helper macro for generating the normalization if the entity
identifier (block height, block hash and transaction id) and
post-processing (encoding, decoding and error signalling) for the
chain supplier API implementations.
ID-VAR is an entity identifier variable, which will be normalized to a
hex-string, byte array or left unchanged if the value of ID-TYPE is
:ENCODED, :DECODED or :AS-IS respectively.
ENCODED-VAR corresponds to ENCODED chain supplier parameter - it will
be used in combination with BODY-TYPE argument to determine if the
result of the BODY should be encoded, decoded (as an ENTITY-TYPE
entity in the latter case) or left as-is.
ERROPR-VAR corresponds to the ERRORP chain supplier parameter - it will be used to either return NIL or signal a corresponding error if the body returns NIL. If ERROR-TYPE is non-NIL, it will be used instead of the default error type.
file-type.lisp (file)
Next: Exported generic functions, Previous: Exported macros, Up: Exported definitions [Contents][Index]
file-type.lisp (file)
file-type.lisp (file)
Decode a BASE58-encoded string and return a byte array.
file-type.lisp (file)
Encode a byte array with BASE58 and return a resulting string.
file-type.lisp (file)
Decode a BASE58-encoded string STRING, verify that the last 4 bytes (checksum part) match the first 4 bytes of the double-SHA256 hash of all but the last 4 bytes of the original sequence (payload part) and return the payload part.
file-type.lisp (file)
BASE58-encode a byte array BYTES (payload) followed by the checksum computed as first 4 bytes of the double-SHA256 hash of the payload.
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
Build merkle tree from the list of transactions LEAVES by taking a current tree level (starting from LEAVES), completing it to the even number of elements, grouping it into pairs and constructing the next level until it has length 1. Return a resulting root node.
file-type.lisp (file)
Return a string command for a given message struct.
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
Decode Bitcoin Protocol entity given by its class name ENTITY-CLASS from hex STRING.
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
Create an ECDSA signature.
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
Verify an ECDSA signature.
file-type.lisp (file)
Encode Bitcoin Protocol ENTITY into a hex string.
file-type.lisp (file)
file-type.lisp (file)
Execute a script using a state that can be provided externally.
file-type.lisp (file)
Execute SCRIPT-SIG and SCRIPT-PUBKEY in succession, preserving the stack and performing the special rule detection (P2SH, SegWit).
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
Shortcut to avoid using long symbol IRONCLAD:HEX-STRING-TO-BYTE-ARRAY.
file-type.lisp (file)
Shortcut to avoid using long symbol IRONCLAD:BYTE-ARRAY-TO-HEX-STRING.
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
Return a message type symbol for a given string command.
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
Construct a SCRIPT object from a sequence of Lisp objects, doing the best effort to detect/convert the provided values.
file-type.lisp (file)
file-type.lisp (file)
If given script is standard, return a common name for the script type (:P2SH, :P2PKH, :P2WSH, etc) or T, otherwise return NIL. Additionally, if the address format is defined for that type of script, return a Bitcoin address for a given script as a second value.
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
Raw transaction ID is a double SHA256 of its binary serialization.
file-type.lisp (file)
Return hex-encoded txid - little-endian hash of the transaction serialization without witness structures.
file-type.lisp (file)
Return INDEXth input of the given transaction.
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
Return INDEXth output of the given transaction.
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
Return hex-encoded wtxid - little-endian hash of the transaction serialization including witness structures.
file-type.lisp (file)
Return INDEXth witness of the given transaction if it is a SegWit transaction, otherwise return NIL.
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
Return T if the ENTITY is valid, NIL otherwise.
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
Next: Exported conditions, Previous: Exported functions, Up: Exported definitions [Contents][Index]
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
Get raw block data from SUPPLIER by its HASH. HASH
can be either a hex-encoded string or a byte array. If ENCODED is
non-NIL, returns a hex-encoded string, otherwise returns CBLOCK
object. If there is no block with the given HASH, return NIL or signal
an UNKNOWN-BLOCK-ERROR error, depending on the ERRORP value.
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
Get the hash of the block from SUPPLIER by its
HEIGHT in the chain. HEIGHT must be an integer. If ENCODED is non-NIL,
returns a hex-encoded string, otherwise returns a raw id represented
as byte array. If there is no known block at the given HEIGHT, return
NIL or signal an UNKNOWN-BLOCK-HASH-ERROR error, depending on the
ERRORP value.
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
Get raw transaction data from SUPPLIER by its
ID. ID can be either a hex-encoded string or a byte array. If ENCODED
is non-NIL, returns a hex-encoded string, otherwise returns TX
object. If there is no transaction with a given ID, return NIL or
signal an UNKNOWN-TRANSACTION-ERROR error, depending on the ERRORP
value.
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
Return NIL if SUPPLIER’s network is :MAINNET and T otherwise.
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
automatically generated reader method
file-type.lisp (file)
automatically generated writer method
file-type.lisp (file)
automatically generated reader method
file-type.lisp (file)
automatically generated writer method
file-type.lisp (file)
automatically generated reader method
file-type.lisp (file)
automatically generated writer method
file-type.lisp (file)
Parse bytes from the STREAM into an instance of the class named ENTITY-CLASS.
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
Serialize ENTITY into the stream.
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
Validate entity according to the Bitcoin Protocol
consensus rules, throw an error if an entity is invalid for any reason.
file-type.lisp (file)
Next: Exported structures, Previous: Exported generic functions, Up: Exported definitions [Contents][Index]
file-type.lisp (file)
base58check-checksum-error (condition)
file-type.lisp (file)
checksum-error (condition)
file-type.lisp (file)
base58check-checksum-error (condition)
file-type.lisp (file)
bech32-checksum-error (condition)
file-type.lisp (file)
file-type.lisp (file)
bech32-error (condition)
:character
file-type.lisp (file)
bech32-error (condition)
file-type.lisp (file)
bech32-checksum-error (condition)
file-type.lisp (file)
bech32-error (condition)
file-type.lisp (file)
bech32-error (condition)
file-type.lisp (file)
error (condition)
file-type.lisp (file)
http-error (condition)
(quote "rpc connection error: rpc code ~a (~a)")
file-type.lisp (file)
unknown-entity-error (condition)
:hash
unknown-block-hash (generic function)
(setf unknown-block-hash) (generic function)
file-type.lisp (file)
unknown-entity-error (condition)
:height
unknown-block-height (generic function)
(setf unknown-block-height) (generic function)
file-type.lisp (file)
simple-error (condition)
file-type.lisp (file)
unknown-entity-error (condition)
transaction-not-available-error (condition)
:id
unknown-transaction-id (generic function)
(setf unknown-transaction-id) (generic function)
Next: Exported classes, Previous: Exported conditions, Up: Exported definitions [Contents][Index]
file-type.lisp (file)
structure-object (structure)
serialize (method)
file-type.lisp (file)
structure-object (structure)
serialize (method)
file-type.lisp (file)
structure-object (structure)
block-header-version (function)
(setf block-header-version) (function)
block-header-previous-block-hash (function)
(setf block-header-previous-block-hash) (function)
block-header-merkle-root (function)
(setf block-header-merkle-root) (function)
block-header-timestamp (function)
(setf block-header-timestamp) (function)
block-header-bits (function)
(setf block-header-bits) (function)
block-header-nonce (function)
(setf block-header-nonce) (function)
file-type.lisp (file)
structure-object (structure)
serialize (method)
block-message-block (function)
(setf block-message-block) (function)
file-type.lisp (file)
structure-object (structure)
serialize (method)
file-type.lisp (file)
structure-object (structure)
block-header (function)
(setf block-header) (function)
block-transactions (function)
(setf block-transactions) (function)
file-type.lisp (file)
structure-object (structure)
serialize (method)
file-type.lisp (file)
structure-object (structure)
serialize (method)
file-type.lisp (file)
structure-object (structure)
serialize (method)
file-type.lisp (file)
structure-object (structure)
serialize (method)
file-type.lisp (file)
structure-object (structure)
serialize (method)
file-type.lisp (file)
structure-object (structure)
serialize (method)
file-type.lisp (file)
structure-object (structure)
serialize (method)
file-type.lisp (file)
structure-object (structure)
serialize (method)
file-type.lisp (file)
structure-object (structure)
serialize (method)
file-type.lisp (file)
structure-object (structure)
serialize (method)
getdata-message-inventory (function)
(setf getdata-message-inventory) (function)
file-type.lisp (file)
structure-object (structure)
serialize (method)
file-type.lisp (file)
structure-object (structure)
serialize (method)
file-type.lisp (file)
structure-object (structure)
serialize (method)
inv-message-inventory (function)
(setf inv-message-inventory) (function)
file-type.lisp (file)
structure-object (structure)
serialize (method)
inventory-vector-type (function)
(setf inventory-vector-type) (function)
inventory-vector-hash (function)
(setf inventory-vector-hash) (function)
file-type.lisp (file)
structure-object (structure)
key-bytes (function)
(setf key-bytes) (function)
file-type.lisp (file)
structure-object (structure)
serialize (method)
file-type.lisp (file)
structure-object (structure)
merkle-tree-node-hash (function)
(setf merkle-tree-node-hash) (function)
merkle-tree-node-left (function)
(setf merkle-tree-node-left) (function)
merkle-tree-node-right (function)
(setf merkle-tree-node-right) (function)
file-type.lisp (file)
structure-object (structure)
serialize (method)
file-type.lisp (file)
structure-object (structure)
serialize (method)
network-address-timestamp (function)
(setf network-address-timestamp) (function)
network-address-services (function)
(setf network-address-services) (function)
network-address-address (function)
(setf network-address-address) (function)
network-address-port (function)
(setf network-address-port) (function)
file-type.lisp (file)
structure-object (structure)
serialize (method)
notfound-message-inventory (function)
(setf notfound-message-inventory) (function)
file-type.lisp (file)
structure-object (structure)
serialize (method)
packet-magic (function)
(setf packet-magic) (function)
packet-command (function)
(setf packet-command) (function)
packet-length (function)
(setf packet-length) (function)
packet-checksum (function)
(setf packet-checksum) (function)
packet-payload (function)
(setf packet-payload) (function)
file-type.lisp (file)
structure-object (structure)
ping-message-nonce (function)
(setf ping-message-nonce) (function)
file-type.lisp (file)
structure-object (structure)
serialize (method)
pong-message-nonce (function)
(setf pong-message-nonce) (function)
file-type.lisp (file)
structure-object (structure)
pubkey-bytes (function)
(setf pubkey-bytes) (function)
file-type.lisp (file)
structure-object (structure)
serialize (method)
file-type.lisp (file)
structure-object (structure)
serialize (method)
file-type.lisp (file)
structure-object (structure)
script-commands (function)
(setf script-commands) (function)
file-type.lisp (file)
structure-object (structure)
serialize (method)
file-type.lisp (file)
structure-object (structure)
serialize (method)
file-type.lisp (file)
structure-object (structure)
signature-bytes (function)
(setf signature-bytes) (function)
file-type.lisp (file)
structure-object (structure)
serialize (method)
file-type.lisp (file)
structure-object (structure)
tx-version (function)
(setf tx-version) (function)
tx-inputs (function)
(setf tx-inputs) (function)
tx-outputs (function)
(setf tx-outputs) (function)
tx-witnesses (function)
(setf tx-witnesses) (function)
tx-locktime (function)
(setf tx-locktime) (function)
file-type.lisp (file)
structure-object (structure)
serialize (method)
tx-message-tx (function)
(setf tx-message-tx) (function)
file-type.lisp (file)
structure-object (structure)
txin-previous-tx-id (function)
(setf txin-previous-tx-id) (function)
txin-previous-tx-index (function)
(setf txin-previous-tx-index) (function)
txin-script-sig (function)
(setf txin-script-sig) (function)
txin-sequence (function)
(setf txin-sequence) (function)
file-type.lisp (file)
structure-object (structure)
txout-amount (function)
(setf txout-amount) (function)
txout-script-pubkey (function)
(setf txout-script-pubkey) (function)
file-type.lisp (file)
structure-object (structure)
serialize (method)
file-type.lisp (file)
structure-object (structure)
serialize (method)
version-message-version (function)
(setf version-message-version) (function)
version-message-services (function)
(setf version-message-services) (function)
version-message-timestamp (function)
(setf version-message-timestamp) (function)
version-message-receiver-address (function)
(setf version-message-receiver-address) (function)
version-message-sender-address (function)
(setf version-message-sender-address) (function)
version-message-nonce (function)
(setf version-message-nonce) (function)
version-message-user-agent (function)
(setf version-message-user-agent) (function)
version-message-height (function)
(setf version-message-height) (function)
version-message-relayp (function)
(setf version-message-relayp) (function)
file-type.lisp (file)
structure-object (structure)
witness-items (function)
(setf witness-items) (function)
Previous: Exported structures, Up: Exported definitions [Contents][Index]
file-type.lisp (file)
standard-object (class)
node-rpc-connection (class)
Network marker (one of :MAINNET, :TESTNET, :REGTEST).
:network
:mainnet
chain-supplier-network (generic function)
(setf chain-supplier-network) (generic function)
file-type.lisp (file)
standard-object (class)
simple-node (class)
:network
:mainnet
node-network (generic function)
(setf node-network) (generic function)
file-type.lisp (file)
node-rpc-connection (class)
initialize-instance (method)
file-type.lisp (file)
node-connection (class)
Simple Bitcoin network node communicating with a single peer via peer-2-peer gossip protocol.
file-type.lisp (file)
node (class)
:host
node-host (generic function)
(setf node-host) (generic function)
:port
bp/net/parameters:+bp-network-port+
node-port (generic function)
(setf node-port) (generic function)
node-peer (generic function)
(setf node-peer) (generic function)
Structure for storing additional information needed during entity validation.
file-type.lisp (file)
standard-object (class)
:height
@height (generic function)
(setf @height) (generic function)
:block
@block (generic function)
(setf @block) (generic function)
:tx
@tx (generic function)
(setf @tx) (generic function)
:tx-index
@tx-index (generic function)
(setf @tx-index) (generic function)
:txin
@txin (generic function)
(setf @txin) (generic function)
:txin-index
@txin-index (generic function)
(setf @txin-index) (generic function)
:txout
@txout (generic function)
(setf @txout) (generic function)
:txout-index
@txout-index (generic function)
(setf @txout-index) (generic function)
Previous: Exported definitions, Up: Definitions [Contents][Index]
• Internal constants | ||
• Internal special variables | ||
• Internal macros | ||
• Internal functions | ||
• Internal generic functions | ||
• Internal conditions | ||
• Internal structures | ||
• Internal classes |
Next: Internal special variables, Previous: Internal definitions, Up: Internal definitions [Contents][Index]
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
Next: Internal macros, Previous: Internal constants, Up: Internal definitions [Contents][Index]
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
DNS seed is a list of hardcoded host names for Bitcoin nodes that can accept new connections when bootstrapping new nodes.
file-type.lisp (file)
Mapping from message types (symbols) to message commands (strings).
file-type.lisp (file)
Mapping from commands (strings) to message types (symbols).
file-type.lisp (file)
Table mapping opcodes to pairs (<list of opcode-names> . <function>).
file-type.lisp (file)
Table mapping opcode names to pairs (<code> . <function>).
file-type.lisp (file)
If non-NIL, the script will be printed without Lisp object wrapping.
file-type.lisp (file)
Next: Internal functions, Previous: Internal special variables, Up: Internal definitions [Contents][Index]
file-type.lisp (file)
file-type.lisp (file)
Define two functions for encoding/decoding digits of a given encoding scheme named <NAME>-ENCODE-DIGIT and <NAME>-DECODE-DIGIT respective.
file-type.lisp (file)
file-type.lisp (file)
Define opcode function named OP-NAME for a given OP-CODE. OP-HEX-CODE is ignored and used only for documentation purposes.
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
Ensure CONTEXT-SYM is bound to the VALIDATION-CONTEXT object before executing the BODY.
file-type.lisp (file)
file-type.lisp (file)
Next: Internal generic functions, Previous: Internal macros, Up: Internal definitions [Contents][Index]
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
A command is considered executable if current branch is an
executable one (i.e. the current code path does not contain false
conditions), or it is a branching command.
For this purpose, OP_IF pushes its condition to CONDITIONS stack in
script state (OP_NOTIF pushes an inverted condition), OP_ELSE inverts
the top condition in CONDITIONS, while OP_ENDIF simply pops the top
condition. For OP_ELSE/OP_ENDIF commands, empty CONDITIONS stack means
that the branching construction is unbalanced.
This follows the implementation of script interpreter in Bitcoin Core.
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
Verify checksum using the both Bech32 and Bech32m constants. Return the detected encoding or NIL if neither match.
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
Convert from one power-of-2 number base to another. Feed each digit to the function OUTPUT-FN. We only need this to work for octets for now. A direct translation from Bitcoin Core’s ‘ConvertBits‘ function in ‘util/strencoding.h‘.
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
This function is taken from the libsecp256k1 distribution and implements DER parsing for ECDSA signatures, while supporting an arbitrary subset of format violations (see Bitcoin’s pubkey.cpp).
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
Create a new VALIDATION-CONTEXT object from the given one and extend it with additional data if supplied.
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
Get txout described by its transaction ID and output index. Will signal an error if the transaction is unknown or does not have the output with given index. Assumes chain supplier context.
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
file-type.lisp (file)
Check if given SCRIPT-PUBKEY is a NULL DATA script.
file-type.lisp (file)
An empty array of bytes is pushed onto the stack. (This is not a no-op: an item is added to the stack.)
file-type.lisp (file)
Returns 0 if the input is 0. 1 otherwise.
file-type.lisp (file)
The number 1 is pushed onto the stack.
file-type.lisp (file)
The number in the word name (2-16) is pushed onto the stack.
file-type.lisp (file)
The number in the word name (2-16) is pushed onto the stack.
file-type.lisp (file)
The number in the word name (2-16) is pushed onto the stack.
file-type.lisp (file)
The number in the word name (2-16) is pushed onto the stack.
file-type.lisp (file)
The number in the word name (2-16) is pushed onto the stack.
file-type.lisp (file)
The number in the word name (2-16) is pushed onto the stack.
file-type.lisp (file)
The number in the word name (2-16) is pushed onto the stack.
file-type.lisp (file)
1 is added to the input.
file-type.lisp (file)
The number -1 is pushed onto the stack.
file-type.lisp (file)
1 is subtracted from the input.
file-type.lisp (file)
The number in the word name (2-16) is pushed onto the stack.
file-type.lisp (file)
The input is divided by 2.
file-type.lisp (file)
Removes the top two stack items.
file-type.lisp (file)
Duplicates the top two stack items.
file-type.lisp (file)
The input is multiplied by 2.
file-type.lisp (file)
Copies the pair of items two spaces back in the stack to the front.
file-type.lisp (file)
The fifth and sixth items back are moved to the top of the stack.
file-type.lisp (file)
Swaps the top two pairs of items.
file-type.lisp (file)
The number in the word name (2-16) is pushed onto the stack.
file-type.lisp (file)
Duplicates the top three stack items.
file-type.lisp (file)
The number in the word name (2-16) is pushed onto the stack.
file-type.lisp (file)
The number in the word name (2-16) is pushed onto the stack.
file-type.lisp (file)
The number in the word name (2-16) is pushed onto the stack.
file-type.lisp (file)
The number in the word name (2-16) is pushed onto the stack.
file-type.lisp (file)
The number in the word name (2-16) is pushed onto the stack.
file-type.lisp (file)
The number in the word name (2-16) is pushed onto the stack.
file-type.lisp (file)
The input is made positive.
file-type.lisp (file)
a is added to b.
file-type.lisp (file)
Boolean and between each bit in the inputs.
file-type.lisp (file)
If both a and b are not 0, the output is 1. Otherwise 0.
file-type.lisp (file)
If a or b is not 0, the output is 1. Otherwise 0.
file-type.lisp (file)
Concatenates two strings.
file-type.lisp (file)
Marks transaction as invalid if the top stack item is greater than the transaction’s nLockTime field, otherwise script evaluation continues as though an OP_NOP was executed. Transaction is also invalid if 1. the stack is empty; or 2. the top stack item is negative; or 3. the top stack item is greater than or equal to 500000000 while the transaction’s nLockTime field is less than 500000000, or vice versa; or 4. the input’s nSequence field is equal to #xffffffff. The precise semantics are described in BIP 0065.
file-type.lisp (file)
Compares the first signature against each public key until it finds an ECDSA match. Starting with the subsequent public key, it compares the second signature against each remaining public key until it finds an ECDSA match. The process is repeated until all signatures have been checked or not enough public keys remain to produce a successful result. All signatures need to match a public key. Because public keys are not checked again if they fail any signature comparison, signatures must be placed in the scriptSig using the same order as their corresponding public keys were placed in the scriptPubKey or redeemScript. If all signatures are valid, 1 is returned, 0 otherwise. Due to a bug, one extra unused value is removed from the stack.
file-type.lisp (file)
Same as OP_CHECKMULTISIG, but OP_VERIFY is executed afterward.
file-type.lisp (file)
Marks transaction as invalid if the relative lock time of the input (enforced by BIP 0068 with nSequence) is not equal to or longer than the value of the top stack item. The precise semantics are described in BIP 0112.
file-type.lisp (file)
The entire transaction’s outputs, inputs, and script (from the most recently-executed OP_CODESEPARATOR to the end) are hashed. The signature used by OP_CHECKSIG must be a valid signature for this hash and public key. If it is, 1 is returned, 0 otherwise.
file-type.lisp (file)
Same as OP_CHECKSIG, but OP_VERIFY is executed afterward.
file-type.lisp (file)
All of the signature checking words will only match signatures to the data after the most recently-executed OP_CODESEPARATOR.
file-type.lisp (file)
Puts the number of stack items onto the stack.
file-type.lisp (file)
a is divided by b.
file-type.lisp (file)
Removes the top stack item.
file-type.lisp (file)
Duplicates the top stack item.
file-type.lisp (file)
If the preceding OP_IF or OP_NOTIF or OP_ELSE was not executed then these statements are and if the preceding OP_IF or OP_NOTIF or OP_ELSE was executed then these statements are not. See @EXECP for more details on how branching works.
file-type.lisp (file)
Ends an if/else block. All blocks must end, or the transaction is invalid. An OP_ENDIF without OP_IF earlier is also invalid. See @EXECP for more details on how branching works.
file-type.lisp (file)
Returns 1 if the inputs are exactly equal, 0 otherwise.
file-type.lisp (file)
Same as OP_EQUAL, but runs OP_VERIFY afterward.
file-type.lisp (file)
Puts the input onto the top of the main stack. Removes it from the alt stack.
file-type.lisp (file)
Returns 1 if a is greater than b, 0 otherwise.
file-type.lisp (file)
Returns 1 if a is greater than or equal to b, 0 otherwise.
file-type.lisp (file)
The input is hashed twice: first with SHA-256 and then with RIPEMD-160.
file-type.lisp (file)
The input is hashed two times with SHA-256.
file-type.lisp (file)
If the top stack value is not False, the statements are
executed. The top stack value is removed. See @EXECP for more details
on how branching works.
file-type.lisp (file)
If the top stack value is not 0, duplicate it.
file-type.lisp (file)
Matches any opcode that is not yet assigned.
file-type.lisp (file)
Flips all of the bits in the input.
file-type.lisp (file)
Keeps only characters left of the specified point in a string.
file-type.lisp (file)
Returns 1 if a is less than b, 0 otherwise.
file-type.lisp (file)
Returns 1 if a is less than or equal to b, 0 otherwise.
file-type.lisp (file)
Shifts a left b bits, preserving sign.
file-type.lisp (file)
Returns the larger of a and b.
file-type.lisp (file)
Returns the smaller of a and b.
file-type.lisp (file)
Returns the remainder after dividing a by b.
file-type.lisp (file)
a is multiplied by b.
file-type.lisp (file)
The sign of the input is flipped.
file-type.lisp (file)
Removes the second-to-top stack item.
file-type.lisp (file)
Does nothing.
file-type.lisp (file)
The word is ignored. Does not mark transaction as invalid.
file-type.lisp (file)
The word is ignored. Does not mark transaction as invalid.
file-type.lisp (file)
The word is ignored. Does not mark transaction as invalid.
file-type.lisp (file)
The word is ignored. Does not mark transaction as invalid.
file-type.lisp (file)
The word is ignored. Does not mark transaction as invalid.
file-type.lisp (file)
The word is ignored. Does not mark transaction as invalid.
file-type.lisp (file)
The word is ignored. Does not mark transaction as invalid.
file-type.lisp (file)
The word is ignored. Does not mark transaction as invalid.
file-type.lisp (file)
If the input is 0 or 1, it is flipped. Otherwise the output will be 0.
file-type.lisp (file)
If the top stack value is False, the statements are executed. The top stack value is removed. See @EXECP for more details on how branching works.
file-type.lisp (file)
Returns 1 if the numbers are equal, 0 otherwise.
file-type.lisp (file)
Same as OP_NUMEQUAL, but runs OP_VERIFY afterward.
file-type.lisp (file)
Returns 1 if the numbers are not equal, 0 otherwise.
file-type.lisp (file)
Boolean or between each bit in the inputs.
file-type.lisp (file)
Copies the second-to-top stack item to the top.
file-type.lisp (file)
The item n back in the stack is copied to the top.
file-type.lisp (file)
Represents a public key compatible with OP_CHECKSIG.
file-type.lisp (file)
Represents a public key hashed with OP_HASH160.
file-type.lisp (file)
The next opcode bytes is data to be pushed onto the stack.
file-type.lisp (file)
The next opcode bytes is data to be pushed onto the stack.
file-type.lisp (file)
The next opcode bytes is data to be pushed onto the stack.
file-type.lisp (file)
The next opcode bytes is data to be pushed onto the stack.
file-type.lisp (file)
The next opcode bytes is data to be pushed onto the stack.
file-type.lisp (file)
The next opcode bytes is data to be pushed onto the stack.
file-type.lisp (file)
The next opcode bytes is data to be pushed onto the stack.
file-type.lisp (file)
The next opcode bytes is data to be pushed onto the stack.
file-type.lisp (file)
The next opcode bytes is data to be pushed onto the stack.
file-type.lisp (file)
The next opcode bytes is data to be pushed onto the stack.
file-type.lisp (file)
The next opcode bytes is data to be pushed onto the stack.
file-type.lisp (file)
The next opcode bytes is data to be pushed onto the stack.
file-type.lisp (file)
The next opcode bytes is data to be pushed onto the stack.
file-type.lisp (file)
The next opcode bytes is data to be pushed onto the stack.
file-type.lisp (file)
The next opcode bytes is data to be pushed onto the stack.
file-type.lisp (file)
The next opcode bytes is data to be pushed onto the stack.
file-type.lisp (file)
The next opcode bytes is data to be pushed onto the stack.
file-type.lisp (file)
The next opcode bytes is data to be pushed onto the stack.
file-type.lisp (file)
The next opcode bytes is data to be pushed onto the stack.
file-type.lisp (file)
The next opcode bytes is data to be pushed onto the stack.
file-type.lisp (file)
The next opcode bytes is data to be pushed onto the stack.
file-type.lisp (file)
The next opcode bytes is data to be pushed onto the stack.
file-type.lisp (file)
The next opcode bytes is data to be pushed onto the stack.
file-type.lisp (file)
The next opcode bytes is data to be pushed onto the stack.
file-type.lisp (file)
The next opcode bytes is data to be pushed onto the stack.
file-type.lisp (file)
The next opcode bytes is data to be pushed onto the stack.
file-type.lisp (file)
The next opcode bytes is data to be pushed onto the stack.
file-type.lisp (file)
The next opcode bytes is data to be pushed onto the stack.
file-type.lisp (file)
The next opcode bytes is data to be pushed onto the stack.
file-type.lisp (file)
The next opcode bytes is data to be pushed onto the stack.
file-type.lisp (file)
The next opcode bytes is data to be pushed onto the stack.
file-type.lisp (file)
The next opcode bytes is data to be pushed onto the stack.
file-type.lisp (file)
The next opcode bytes is data to be pushed onto the stack.
file-type.lisp (file)
The next opcode bytes is data to be pushed onto the stack.
file-type.lisp (file)
The next opcode bytes is data to be pushed onto the stack.
file-type.lisp (file)
The next opcode bytes is data to be pushed onto the stack.
file-type.lisp (file)
The next opcode bytes is data to be pushed onto the stack.
file-type.lisp (file)
The next opcode bytes is data to be pushed onto the stack.
file-type.lisp (file)
The next opcode bytes is data to be pushed onto the stack.
file-type.lisp (file)
The next opcode bytes is data to be pushed onto the stack.
file-type.lisp (file)
The next opcode bytes is data to be pushed onto the stack.
file-type.lisp (file)
The next opcode bytes is data to be pushed onto the stack.
file-type.lisp (file)
The next opcode bytes is data to be pushed onto the stack.
file-type.lisp (file)
The next opcode bytes is data to be pushed onto the stack.
file-type.lisp (file)
The next opcode bytes is data to be pushed onto the stack.
file-type.lisp (file)
The next opcode bytes is data to be pushed onto the stack.
file-type.lisp (file)
The next opcode bytes is data to be pushed onto the stack.
file-type.lisp (file)
The next opcode bytes is data to be pushed onto the stack.
file-type.lisp (file)
The next opcode bytes is data to be pushed onto the stack.
file-type.lisp (file)
The next opcode bytes is data to be pushed onto the stack.
file-type.lisp (file)
The next opcode bytes is data to be pushed onto the stack.
file-type.lisp (file)
The next opcode bytes is data to be pushed onto the stack.
file-type.lisp (file)
The next opcode bytes is data to be pushed onto the stack.
file-type.lisp (file)
The next opcode bytes is data to be pushed onto the stack.
file-type.lisp (file)
The next opcode bytes is data to be pushed onto the stack.
file-type.lisp (file)
The next opcode bytes is data to be pushed onto the stack.
file-type.lisp (file)
The next opcode bytes is data to be pushed onto the stack.
file-type.lisp (file)
The next opcode bytes is data to be pushed onto the stack.
file-type.lisp (file)
The next opcode bytes is data to be pushed onto the stack.
file-type.lisp (file)
The next opcode bytes is data to be pushed onto the stack.
file-type.lisp (file)
The next opcode bytes is data to be pushed onto the stack.
file-type.lisp (file)
The next opcode bytes is data to be pushed onto the stack.
file-type.lisp (file)
The next opcode bytes is data to be pushed onto the stack.
file-type.lisp (file)
The next opcode bytes is data to be pushed onto the stack.
file-type.lisp (file)
The next opcode bytes is data to be pushed onto the stack.
file-type.lisp (file)
The next opcode bytes is data to be pushed onto the stack.
file-type.lisp (file)
The next opcode bytes is data to be pushed onto the stack.
file-type.lisp (file)
The next opcode bytes is data to be pushed onto the stack.
file-type.lisp (file)
The next opcode bytes is data to be pushed onto the stack.
file-type.lisp (file)
The next opcode bytes is data to be pushed onto the stack.
file-type.lisp (file)
The next opcode bytes is data to be pushed onto the stack.
file-type.lisp (file)
The next opcode bytes is data to be pushed onto the stack.
file-type.lisp (file)
The next opcode bytes is data to be pushed onto the stack.
file-type.lisp (file)
The next opcode bytes is data to be pushed onto the stack.
file-type.lisp (file)
The next opcode bytes is data to be pushed onto the stack.
file-type.lisp (file)
The next byte contains the number of bytes to be pushed onto the stack.
file-type.lisp (file)
The next two bytes contain the number of bytes to be pushed onto the stack in little endian order.
file-type.lisp (file)
The next four bytes contain the number of bytes to be pushed onto the stack in little endian order.
file-type.lisp (file)
Transaction is invalid unless occuring in an unexecuted OP_IF branch.
file-type.lisp (file)
Transaction is invalid unless occuring in an unexecuted OP_IF branch.
file-type.lisp (file)
Transaction is invalid unless occuring in an unexecuted OP_IF branch.
file-type.lisp (file)
Marks transaction as invalid. Since bitcoin 0.9, a standard way of attaching extra data to transactions is to add a zero-value output with a scriptPubKey consisting of OP_RETURN followed by data. Such outputs are provably unspendable and specially discarded from storage in the UTXO set, reducing their cost to the network. Since 0.12, standard relay rules allow a single output with OP_RETURN, that contains any sequence of push statements (or OP_RESERVED[1]) after the OP_RETURN provided the total scriptPubKey length is at most 83 bytes.
file-type.lisp (file)
Keeps only characters right of the specified point in a string.
file-type.lisp (file)
The input is hashed using RIPEMD-160.
file-type.lisp (file)
The item n back in the stack is moved to the top.
file-type.lisp (file)
The top three items on the stack are rotated to the left.
file-type.lisp (file)
Shifts a right b bits, preserving sign.
file-type.lisp (file)
The input is hashed using SHA-1.
file-type.lisp (file)
The input is hashed using SHA-256.
file-type.lisp (file)
Pushes the string length of the top element of the stack (without popping it).
file-type.lisp (file)
b is subtracted from a.
file-type.lisp (file)
Returns a section of a string.
file-type.lisp (file)
The top two items on the stack are swapped.
file-type.lisp (file)
Puts the input onto the top of the alt stack. Removes it from the main stack.
file-type.lisp (file)
The item at the top of the stack is copied and inserted before the second-to-top item.
file-type.lisp (file)
Unknown opcode. Used for handling coinbase input scripts.
file-type.lisp (file)
Unknown opcode. Used for handling coinbase input scripts.
file-type.lisp (file)
Unknown opcode. Used for handling coinbase input scripts.
file-type.lisp (file)
Unknown opcode. Used for handling coinbase input scripts.
file-type.lisp (file)
Unknown opcode. Used for handling coinbase input scripts.
file-type.lisp (file)
Unknown opcode. Used for handling coinbase input scripts.
file-type.lisp (file)
Unknown opcode. Used for handling coinbase input scripts.
file-type.lisp (file)
Unknown opcode. Used for handling coinbase input scripts.
file-type.lisp (file)
Unknown opcode. Used for handling coinbase input scripts.
file-type.lisp (file)
Unknown opcode. Used for handling coinbase input scripts.
file-type.lisp (file)
Unknown opcode. Used for handling coinbase input scripts.
file-type.lisp (file)
Unknown opcode. Used for handling coinbase input scripts.
file-type.lisp (file)
Unknown opcode. Used for handling coinbase input scripts.
file-type.lisp (file)
Unknown opcode. Used for handling coinbase input scripts.
file-type.lisp (file)
Unknown opcode. Used for handling coinbase input scripts.
file-type.lisp (file)
Unknown opcode. Used for handling coinbase input scripts.
file-type.lisp (file)
Unknown opcode. Used for handling coinbase input scripts.
file-type.lisp (file)
Unknown opcode. Used for handling coinbase input scripts.
file-type.lisp (file)
Unknown opcode. Used for handling coinbase input scripts.
file-type.lisp (file)
Unknown opcode. Used for handling coinbase input scripts.
file-type.lisp (file)
Unknown opcode. Used for handling coinbase input scripts.
file-type.lisp (file)
Unknown opcode. Used for handling coinbase input scripts.
file-type.lisp (file)
Unknown opcode. Used for handling coinbase input scripts.
file-type.lisp (file)
Unknown opcode. Used for handling coinbase input scripts.
file-type.lisp (file)
Unknown opcode. Used for handling coinbase input scripts.
file-type.lisp (file)
Unknown opcode. Used for handling coinbase input scripts.
file-type.lisp (file)
Unknown opcode. Used for handling coinbase input scripts.
file-type.lisp (file)
Unknown opcode. Used for handling coinbase input scripts.
file-type.lisp (file)
Unknown opcode. Used for handling coinbase input scripts.
file-type.lisp (file)
Unknown opcode. Used for handling coinbase input scripts.
file-type.lisp (file)
Unknown opcode. Used for handling coinbase input scripts.
file-type.lisp (file)
Unknown opcode. Used for handling coinbase input scripts.
file-type.lisp (file)
Unknown opcode. Used for handling coinbase input scripts.
file-type.lisp (file)
Unknown opcode. Used for handling coinbase input scripts.
file-type.lisp (file)
Unknown opcode. Used for handling coinbase input scripts.
file-type.lisp (file)
Unknown opcode. Used for handling coinbase input scripts.
file-type.lisp (file)
Unknown opcode. Used for handling coinbase input scripts.
file-type.lisp (file)
Unknown opcode. Used for handling coinbase input scripts.
file-type.lisp (file)
Unknown opcode. Used for handling coinbase input scripts.
file-type.lisp (file)
Unknown opcode. Used for handling coinbase input scripts.
file-type.lisp (file)
Unknown opcode. Used for handling coinbase input scripts.
file-type.lisp (file)