forked from wangnan31415926/bip39-BIP32-BIP44
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTransaction.h
51 lines (42 loc) · 1.9 KB
/
Transaction.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/** \file transaction.h
*
* \brief Describes functions and types exported by transaction.c.
*
* This file is licensed as described by the file LICENCE.
*/
#ifndef TRANSACTION_H_INCLUDED
#define TRANSACTION_H_INCLUDED
#include "common.h"
#include "bignum256.h"
/** Maximum size (in number of bytes) of the DER format ECDSA signature which
* signTransaction() generates. */
#define MAX_SIGNATURE_LENGTH 73
/** Return values for parseTransaction(). */
typedef enum TransactionErrorsEnum
{
/** No error actually occurred. */
TRANSACTION_NO_ERROR = 0,
/** Format of transaction is unknown or invalid. */
TRANSACTION_INVALID_FORMAT = 1,
/** Too many inputs in transaction. */
TRANSACTION_TOO_MANY_INPUTS = 2,
/** Too many outputs in transaction. */
TRANSACTION_TOO_MANY_OUTPUTS = 3,
/** Transaction's size (in bytes) is too large. */
TRANSACTION_TOO_LARGE = 4,
/** Transaction not recognised (i.e. non-standard). */
TRANSACTION_NON_STANDARD = 5,
/** Output amount too high in transaction. This can also be returned if
* the calculated transaction fee is negative. */
TRANSACTION_INVALID_AMOUNT = 7,
/** Reference to an inner transaction is invalid. */
TRANSACTION_INVALID_REFERENCE = 8
} TransactionErrors;
extern unsigned char master_node[NODE_LENGTH];
//extern const uint8_t good_main_transaction[];
//extern TransactionErrors parseTransaction(BigNum256 sig_hash, BigNum256 transaction_hash, uint32_t length);
extern void signTransaction(uint8_t *signature, uint8_t *out_length, BigNum256 sig_hash, BigNum256 private_key);
extern void HextoBase58check(unsigned char* buf,unsigned char* base58check,unsigned short* outlength);
bool b58enc(unsigned char *b58, unsigned short *b58sz, unsigned char *data, unsigned short binsz);
void base58Decode(uint8_t *out, const char *in, const unsigned int len);
#endif // #ifndef TRANSACTION_H_INCLUDED