This repository has been archived by the owner on Apr 12, 2022. It is now read-only.
forked from fluidjax/segwittx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
qredoTX_test.go
55 lines (40 loc) · 2.03 KB
/
qredoTX_test.go
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
52
53
54
55
package main
//Internal Qredo requirements fullfillment & testing
//This is probably not much use to anyone else, Im just identifying which fields we have/need for a specific implementation
/* Requirements:
type SettleInput struct {
Address string // From address in string format
UnderlyingPayload protobuffer.PBUnderlying // Underlying transaction payload
Change int64 // For Bitcoin this represents wehether the underlying input is change. Ethereum it is unused (0)
State SetttlInputState // For Bitcoin this is spent or unspent
Nonce uint64 // (v1.2 or later) For Ethereum inputs this value must be tracked and increase by one each time the address is used. For Bitcoin this field is unused (0).
CurrentBalance int64 // Current Balance of the account input
}
type SettleOutput struct {
Address string
Type int
Amount int64
PublicKey string
SeedID []byte
Payload []byte // Needed for smart contract transactions (v1.5 or later)
}
UnderlyingForSigning(
inputs []*SettleInput,
extraInputs []*SettleInput,
FeeUnit int64,
outputs []*SettleOutput,
qredoFeePerc float64,
minerFeeChargable int64,
currency protobuffer.PBCryptoCurrency,
deliver bool,
amount int64,
fee int64)
(*protobuffer.PBSettlementTransaction, ichangeAmount, totalFeeToQredo, actualSettlementAmount, []*SettleInput, reuseMarker, error)
//func CreateTransaction(secret string, destination string, sendAmount int64, utxoAmount int64, utxoScript string, txHash string, chain *chaincfg.Params, expectedTransactionHash string) error {
1) Update watcher to issue segwit addresses
2) Create snapshot chain, with wallets with segwit addresses
3) Ammend underlying/bitcoin/settletransaction.go to build correct unsigned TX
4) Note txscript.CalcWitnessSigHash(script []byte, sigHashes *TxSigHashes, hType SigHashType,tx *wire.MsgTx, idx int, amt int64) ([]byte, error)
Watcher
Sign the hashes and build the witness & script
*/