Bitcoin ABC  0.24.7
P2P Digital Currency
bitcoinconsensus.h
Go to the documentation of this file.
1 // Copyright (c) 2009-2010 Satoshi Nakamoto
2 // Copyright (c) 2009-2016 The Bitcoin Core developers
3 // Distributed under the MIT software license, see the accompanying
4 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
5 
6 #ifndef BITCOIN_SCRIPT_BITCOINCONSENSUS_H
7 #define BITCOIN_SCRIPT_BITCOINCONSENSUS_H
8 
9 #include <cstdint>
10 
11 #if defined(BUILD_BITCOIN_INTERNAL) && defined(HAVE_CONFIG_H)
12 #include <config/bitcoin-config.h>
13 #if defined(_WIN32)
14 #if defined(DLL_EXPORT)
15 #if defined(HAVE_FUNC_ATTRIBUTE_DLLEXPORT)
16 #define EXPORT_SYMBOL __declspec(dllexport)
17 #else
18 #define EXPORT_SYMBOL
19 #endif
20 #endif
21 #elif defined(HAVE_FUNC_ATTRIBUTE_VISIBILITY)
22 #define EXPORT_SYMBOL __attribute__((visibility("default")))
23 #endif
24 #elif defined(MSC_VER) && !defined(STATIC_LIBBITCOINCONSENSUS)
25 #define EXPORT_SYMBOL __declspec(dllimport)
26 #endif
27 
28 #ifndef EXPORT_SYMBOL
29 #define EXPORT_SYMBOL
30 #endif
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 
36 #define BITCOINCONSENSUS_API_VER 1
37 
46 
48 enum {
50  // evaluate P2SH (BIP16) subscripts
52  // enforce strict DER (BIP66) compliance
54  // enable CHECKLOCKTIMEVERIFY (BIP65)
56  // enable CHECKSEQUENCEVERIFY (BIP112)
58  // enable WITNESS (BIP141)
60  // enable SIGHASH_FORKID replay protection
67 };
68 
74  const uint8_t *scriptPubKey, unsigned int scriptPubKeyLen,
75  const uint8_t *txTo, unsigned int txToLen, unsigned int nIn,
76  unsigned int flags, bitcoinconsensus_error *err);
77 
79  const uint8_t *scriptPubKey, unsigned int scriptPubKeyLen, int64_t amount,
80  const uint8_t *txTo, unsigned int txToLen, unsigned int nIn,
81  unsigned int flags, bitcoinconsensus_error *err);
82 
84 
85 #ifdef __cplusplus
86 } // extern "C"
87 #endif
88 
89 #undef EXPORT_SYMBOL
90 
91 #endif // BITCOIN_SCRIPT_BITCOINCONSENSUS_H
bitcoinconsensus_verify_script_with_amount
EXPORT_SYMBOL int bitcoinconsensus_verify_script_with_amount(const uint8_t *scriptPubKey, unsigned int scriptPubKeyLen, int64_t amount, const uint8_t *txTo, unsigned int txToLen, unsigned int nIn, unsigned int flags, bitcoinconsensus_error *err)
Definition: bitcoinconsensus.cpp:113
flags
int flags
Definition: bitcoin-tx.cpp:532
bitcoinconsensus_ERR_TX_INDEX
@ bitcoinconsensus_ERR_TX_INDEX
Definition: bitcoinconsensus.h:40
bitcoinconsensus_ERR_OK
@ bitcoinconsensus_ERR_OK
Definition: bitcoinconsensus.h:39
bitcoinconsensus_SCRIPT_FLAGS_VERIFY_NONE
@ bitcoinconsensus_SCRIPT_FLAGS_VERIFY_NONE
Definition: bitcoinconsensus.h:49
bitcoinconsensus_ERR_INVALID_FLAGS
@ bitcoinconsensus_ERR_INVALID_FLAGS
Definition: bitcoinconsensus.h:44
bitcoinconsensus_SCRIPT_FLAGS_VERIFY_CHECKLOCKTIMEVERIFY
@ bitcoinconsensus_SCRIPT_FLAGS_VERIFY_CHECKLOCKTIMEVERIFY
Definition: bitcoinconsensus.h:55
bitcoinconsensus_ERR_AMOUNT_REQUIRED
@ bitcoinconsensus_ERR_AMOUNT_REQUIRED
Definition: bitcoinconsensus.h:43
bitcoinconsensus_error_t
bitcoinconsensus_error_t
Definition: bitcoinconsensus.h:38
bitcoinconsensus_SCRIPT_FLAGS_VERIFY_ALL
@ bitcoinconsensus_SCRIPT_FLAGS_VERIFY_ALL
Definition: bitcoinconsensus.h:62
bitcoinconsensus_SCRIPT_FLAGS_VERIFY_DERSIG
@ bitcoinconsensus_SCRIPT_FLAGS_VERIFY_DERSIG
Definition: bitcoinconsensus.h:53
bitcoinconsensus_ERR_TX_DESERIALIZE
@ bitcoinconsensus_ERR_TX_DESERIALIZE
Definition: bitcoinconsensus.h:42
bitcoinconsensus_ERR_TX_SIZE_MISMATCH
@ bitcoinconsensus_ERR_TX_SIZE_MISMATCH
Definition: bitcoinconsensus.h:41
bitcoinconsensus_verify_script
EXPORT_SYMBOL int bitcoinconsensus_verify_script(const uint8_t *scriptPubKey, unsigned int scriptPubKeyLen, const uint8_t *txTo, unsigned int txToLen, unsigned int nIn, unsigned int flags, bitcoinconsensus_error *err)
Returns 1 if the input nIn of the serialized transaction pointed to by txTo correctly spends the scri...
Definition: bitcoinconsensus.cpp:122
bitcoinconsensus_SCRIPT_FLAGS_VERIFY_WITNESS_DEPRECATED
@ bitcoinconsensus_SCRIPT_FLAGS_VERIFY_WITNESS_DEPRECATED
Definition: bitcoinconsensus.h:59
bitcoinconsensus_SCRIPT_FLAGS_VERIFY_P2SH
@ bitcoinconsensus_SCRIPT_FLAGS_VERIFY_P2SH
Definition: bitcoinconsensus.h:51
bitcoinconsensus_error
enum bitcoinconsensus_error_t bitcoinconsensus_error
bitcoinconsensus_version
EXPORT_SYMBOL unsigned int bitcoinconsensus_version()
Definition: bitcoinconsensus.cpp:136
bitcoinconsensus_SCRIPT_FLAGS_VERIFY_CHECKSEQUENCEVERIFY
@ bitcoinconsensus_SCRIPT_FLAGS_VERIFY_CHECKSEQUENCEVERIFY
Definition: bitcoinconsensus.h:57
bitcoinconsensus_SCRIPT_ENABLE_SIGHASH_FORKID
@ bitcoinconsensus_SCRIPT_ENABLE_SIGHASH_FORKID
Definition: bitcoinconsensus.h:61
EXPORT_SYMBOL
#define EXPORT_SYMBOL
Definition: bitcoinconsensus.h:29