chainsvrresults.go raw
1 package btcjson
2
3 import (
4 "encoding/json"
5 )
6
7 // Bip9SoftForkDescription describes the current state of a defined BIP0009 version bits soft-fork.
8 type Bip9SoftForkDescription struct {
9 Status string `json:"status"`
10 Bit uint8 `json:"bit"`
11 StartTime int64 `json:"startTime"`
12 Timeout int64 `json:"timeout"`
13 Since int32 `json:"since"`
14 }
15
16 // CreateMultiSigResult models the data returned from the createmultisig command.
17 type CreateMultiSigResult struct {
18 Address string `json:"address"`
19 RedeemScript string `json:"redeemScript"`
20 }
21
22 // DecodeScriptResult models the data returned from the decodescript command.
23 type DecodeScriptResult struct {
24 Asm string `json:"asm"`
25 ReqSigs int32 `json:"reqSigs,omitempty"`
26 Type string `json:"type"`
27 Addresses []string `json:"addresses,omitempty"`
28 P2sh string `json:"p2sh,omitempty"`
29 }
30
31 // GetAddedNodeInfoResult models the data from the getaddednodeinfo command.
32 type GetAddedNodeInfoResult struct {
33 AddedNode string `json:"addednode"`
34 Connected *bool `json:"connected,omitempty"`
35 Addresses *[]GetAddedNodeInfoResultAddr `json:"addresses,omitempty"`
36 }
37
38 // GetAddedNodeInfoResultAddr models the data of the addresses portion of the getaddednodeinfo command.
39 type GetAddedNodeInfoResultAddr struct {
40 Address string `json:"address"`
41 Connected string `json:"connected"`
42 }
43
44 // GetBlockChainInfoResult models the data returned from the getblockchaininfo command.
45 type GetBlockChainInfoResult struct {
46 Chain string `json:"chain"`
47 Blocks int32 `json:"blocks"`
48 Headers int32 `json:"headers"`
49 BestBlockHash string `json:"bestblockhash"`
50 Difficulty float64 `json:"difficulty"`
51 MedianTime int64 `json:"mediantime"`
52 VerificationProgress float64 `json:"verificationprogress,omitempty"`
53 Pruned bool `json:"pruned"`
54 PruneHeight int32 `json:"pruneheight,omitempty"`
55 ChainWork string `json:"chainwork,omitempty"`
56 // SoftForks []*SoftForkDescription `json:"softforks"`
57 // Bip9SoftForks map[string]*Bip9SoftForkDescription `json:"bip9_softforks"`
58 }
59
60 // GetBlockHeaderVerboseResult models the data from the getblockheader command when the verbose flag is set. When the
61 // verbose flag is not set, getblockheader returns a hex-encoded string.
62 type GetBlockHeaderVerboseResult struct {
63 Hash string `json:"hash"`
64 Confirmations int64 `json:"confirmations"`
65 Height int32 `json:"height"`
66 Version int32 `json:"version"`
67 VersionHex string `json:"versionHex"`
68 MerkleRoot string `json:"merkleroot"`
69 Time int64 `json:"time"`
70 Nonce uint64 `json:"nonce"`
71 Bits string `json:"bits"`
72 Difficulty float64 `json:"difficulty"`
73 PreviousHash string `json:"previousblockhash,omitempty"`
74 NextHash string `json:"nextblockhash,omitempty"`
75 }
76
77 // GetBlockTemplateResult models the data returned from the getblocktemplate command.
78 type GetBlockTemplateResult struct {
79 // Base fields from BIP 0022. CoinbaseAux is optional.
80 //
81 // One of CoinbaseTxn or CoinbaseValue must be specified, but not both.
82 Bits string `json:"bits"`
83 CurTime int64 `json:"curtime"`
84 Height int64 `json:"height"`
85 PreviousHash string `json:"previousblockhash"`
86 SigOpLimit int64 `json:"sigoplimit,omitempty"`
87 SizeLimit int64 `json:"sizelimit,omitempty"`
88 WeightLimit int64 `json:"weightlimit,omitempty"`
89 Transactions []GetBlockTemplateResultTx `json:"transactions"`
90 Version int32 `json:"version"`
91 CoinbaseAux *GetBlockTemplateResultAux `json:"coinbaseaux,omitempty"`
92 CoinbaseTxn *GetBlockTemplateResultTx `json:"coinbasetxn,omitempty"`
93 CoinbaseValue *int64 `json:"coinbasevalue,omitempty"`
94 WorkID string `json:"workid,omitempty"`
95 // // Witness commitment defined in BIP 0141.
96 // DefaultWitnessCommitment string `json:"default_witness_commitment,omitempty"`
97 // Optional long polling from BIP 0022.
98 LongPollID string `json:"longpollid,omitempty"`
99 LongPollURI string `json:"longpolluri,omitempty"`
100 SubmitOld *bool `json:"submitold,omitempty"`
101 // Basic pool extension from BIP 0023.
102 Target string `json:"target,omitempty"`
103 Expires int64 `json:"expires,omitempty"`
104 // Mutations from BIP 0023.
105 MaxTime int64 `json:"maxtime,omitempty"`
106 MinTime int64 `json:"mintime,omitempty"`
107 Mutable []string `json:"mutable,omitempty"`
108 NonceRange string `json:"noncerange,omitempty"`
109 // Block proposal from BIP 0023.
110 Capabilities []string `json:"capabilities,omitempty"`
111 RejectReasion string `json:"reject-reason,omitempty"`
112 }
113
114 // GetBlockTemplateResultAux models the coinbaseaux field of the getblocktemplate command.
115 type GetBlockTemplateResultAux struct {
116 Flags string `json:"flags"`
117 }
118
119 // GetBlockTemplateResultTx models the transactions field of the getblocktemplate command.
120 type GetBlockTemplateResultTx struct {
121 Data string `json:"data"`
122 Hash string `json:"hash"`
123 Depends []int64 `json:"depends"`
124 Fee int64 `json:"fee"`
125 SigOps int64 `json:"sigops"`
126 Weight int64 `json:"weight"`
127 }
128
129 // GetBlockVerboseResult models the data from the getblock command when the verbose flag is set. When the verbose flag
130 // is not set, getblock returns a hex-encoded string.
131 type GetBlockVerboseResult struct {
132 Hash string `json:"hash"`
133 Confirmations int64 `json:"confirmations"`
134 StrippedSize int32 `json:"strippedsize"`
135 Size int32 `json:"size"`
136 Weight int32 `json:"weight"`
137 Height int64 `json:"height"`
138 Version int32 `json:"version"`
139 VersionHex string `json:"versionHex"`
140 PowAlgoID uint32 `json:"pow_algo_id"`
141 PowAlgo string `json:"pow_algo"`
142 PowHash string `json:"pow_hash"`
143 MerkleRoot string `json:"merkleroot"`
144 TxNum int `json:"txnum,omitempty"`
145 Tx []string `json:"tx,omitempty"`
146 RawTx []TxRawResult `json:"rawtx,omitempty"`
147 Time int64 `json:"time"`
148 Nonce uint32 `json:"nonce"`
149 Bits string `json:"bits"`
150 Difficulty float64 `json:"difficulty"`
151 PreviousHash string `json:"previousblockhash"`
152 NextHash string `json:"nextblockhash,omitempty"`
153 }
154
155 // GetMempoolEntryResult models the data returned from the getmempoolentry command.
156 type GetMempoolEntryResult struct {
157 Size int32 `json:"size"`
158 Fee float64 `json:"fee"`
159 ModifiedFee float64 `json:"modifiedfee"`
160 Time int64 `json:"time"`
161 Height int64 `json:"height"`
162 StartingPriority float64 `json:"startingpriority"`
163 CurrentPriority float64 `json:"currentpriority"`
164 DescendantCount int64 `json:"descendantcount"`
165 DescendantSize int64 `json:"descendantsize"`
166 DescendantFees float64 `json:"descendantfees"`
167 AncestorCount int64 `json:"ancestorcount"`
168 AncestorSize int64 `json:"ancestorsize"`
169 AncestorFees float64 `json:"ancestorfees"`
170 Depends []string `json:"depends"`
171 }
172
173 // GetMempoolInfoResult models the data returned from the getmempoolinfo command.
174 type GetMempoolInfoResult struct {
175 Size int64 `json:"size"`
176 Bytes int64 `json:"bytes"`
177 }
178
179 // GetMiningInfoResult models the data from the getmininginfo command.
180 // TODO: this needs to be updated
181 type GetMiningInfoResult struct {
182 Blocks int64 `json:"blocks"`
183 CurrentBlockSize uint64 `json:"currentblocksize"`
184 CurrentBlockWeight uint64 `json:"currentblockweight"`
185 CurrentBlockTx uint64 `json:"currentblocktx"`
186 PowAlgoID uint32 `json:"pow_algo_id"`
187 PowAlgo string `json:"pow_algo"`
188 Difficulty float64 `json:"difficulty"`
189 DifficultyArgon2i float64 `json:"difficulty_argon2i"`
190 DifficultyBlake2b float64 `json:"difficulty_blake2b"`
191 DifficultyKeccak float64 `json:"difficulty_keccak"`
192 DifficultyLyra2rev2 float64 `json:"difficulty_lyra2rev2"`
193 DifficultyScrypt float64 `json:"difficulty_scrypt"`
194 DifficultySHA256D float64 `json:"difficulty_sha256d"`
195 DifficultySkein float64 `json:"difficulty_skein"`
196 DifficultyStribog float64 `json:"difficulty_stribog"`
197 Errors string `json:"errors"`
198 Generate bool `json:"generate"`
199 GenAlgo string `json:"genalgo"`
200 GenProcLimit int32 `json:"genproclimit"`
201 HashesPerSec int64 `json:"hashespersec"`
202 NetworkHashPS int64 `json:"networkhashps"`
203 PooledTx uint64 `json:"pooledtx"`
204 TestNet bool `json:"testnet"`
205 }
206
207 // GetMiningInfoResult0 is the pre-hardfork mining info response
208 type GetMiningInfoResult0 struct {
209 Blocks int64 `json:"blocks"`
210 CurrentBlockSize uint64 `json:"currentblocksize"`
211 CurrentBlockWeight uint64 `json:"currentblockweight"`
212 CurrentBlockTx uint64 `json:"currentblocktx"`
213 PowAlgoID uint32 `json:"pow_algo_id"`
214 PowAlgo string `json:"pow_algo"`
215 Difficulty float64 `json:"difficulty"`
216 DifficultySHA256D float64 `json:"difficulty_sha256d"`
217 DifficultyScrypt float64 `json:"difficulty_scrypt"`
218 Errors string `json:"errors"`
219 Generate bool `json:"generate"`
220 GenProcLimit int32 `json:"genproclimit"`
221 HashesPerSec int64 `json:"hashespersec"`
222 NetworkHashPS int64 `json:"networkhashps"`
223 PooledTx uint64 `json:"pooledtx"`
224 TestNet bool `json:"testnet"`
225 }
226
227 // GetNetTotalsResult models the data returned from the getnettotals command.
228 type GetNetTotalsResult struct {
229 TotalBytesRecv uint64 `json:"totalbytesrecv"`
230 TotalBytesSent uint64 `json:"totalbytessent"`
231 TimeMillis int64 `json:"timemillis"`
232 }
233
234 // GetNetworkInfoResult models the data returned from the getnetworkinfo command.
235 type GetNetworkInfoResult struct {
236 Version int32 `json:"version"`
237 SubVersion string `json:"subversion"`
238 ProtocolVersion int32 `json:"protocolversion"`
239 LocalServices string `json:"localservices"`
240 LocalRelay bool `json:"localrelay"`
241 TimeOffset int64 `json:"timeoffset"`
242 Connections int32 `json:"connections"`
243 NetworkActive bool `json:"networkactive"`
244 Networks []NetworksResult `json:"networks"`
245 RelayFee float64 `json:"relayfee"`
246 IncrementalFee float64 `json:"incrementalfee"`
247 LocalAddresses []LocalAddressesResult `json:"localaddresses"`
248 Warnings string `json:"warnings"`
249 }
250
251 // GetPeerInfoResult models the data returned from the getpeerinfo command.
252 type GetPeerInfoResult struct {
253 ID int32 `json:"id"`
254 Addr string `json:"addr"`
255 AddrLocal string `json:"addrlocal,omitempty"`
256 Services string `json:"services"`
257 RelayTxes bool `json:"relaytxes"`
258 LastSend int64 `json:"lastsend"`
259 LastRecv int64 `json:"lastrecv"`
260 BytesSent uint64 `json:"bytessent"`
261 BytesRecv uint64 `json:"bytesrecv"`
262 ConnTime int64 `json:"conntime"`
263 TimeOffset int64 `json:"timeoffset"`
264 PingTime float64 `json:"pingtime"`
265 PingWait float64 `json:"pingwait,omitempty"`
266 Version uint32 `json:"version"`
267 SubVer string `json:"subver"`
268 Inbound bool `json:"inbound"`
269 StartingHeight int32 `json:"startingheight"`
270 CurrentHeight int32 `json:"currentheight,omitempty"`
271 BanScore int32 `json:"banscore"`
272 FeeFilter int64 `json:"feefilter"`
273 SyncNode bool `json:"syncnode"`
274 }
275
276 // GetRawMempoolVerboseResult models the data returned from the getrawmempool command when the verbose flag is set. When
277 // the verbose flag is not set, getrawmempool returns an array of transaction hashes.
278 type GetRawMempoolVerboseResult struct {
279 Size int32 `json:"size"`
280 VSize int32 `json:"vsize"`
281 Fee float64 `json:"fee"`
282 Time int64 `json:"time"`
283 Height int64 `json:"height"`
284 StartingPriority float64 `json:"startingpriority"`
285 CurrentPriority float64 `json:"currentpriority"`
286 Depends []string `json:"depends"`
287 }
288
289 // GetTxOutResult models the data from the gettxout command.
290 type GetTxOutResult struct {
291 BestBlock string `json:"bestblock"`
292 Confirmations int64 `json:"confirmations"`
293 Value float64 `json:"value"`
294 ScriptPubKey ScriptPubKeyResult `json:"scriptPubKey"`
295 Coinbase bool `json:"coinbase"`
296 }
297
298 // GetWorkResult models the data from the getwork command.
299 type GetWorkResult struct {
300 Data string `json:"data"`
301 Hash1 string `json:"hash1"`
302 Midstate string `json:"midstate"`
303 Target string `json:"target"`
304 }
305 type (
306 // InfoChainResult models the data returned by the chain server getinfo command.
307 InfoChainResult struct {
308 Version int32 `json:"version"`
309 ProtocolVersion int32 `json:"protocolversion"`
310 Blocks int32 `json:"blocks"`
311 TimeOffset int64 `json:"timeoffset"`
312 Connections int32 `json:"connections"`
313 Proxy string `json:"proxy"`
314 PowAlgoID uint32 `json:"pow_algo_id"`
315 PowAlgo string `json:"pow_algo"`
316 Difficulty float64 `json:"difficulty"`
317 DifficultyBlake2b float64 `json:"difficulty_blake2b"`
318 DifficultyBlake14lr float64 `json:"difficulty_blake14lr"`
319 DifficultyBlake2s float64 `json:"difficulty_blake2s"`
320 DifficultyKeccak float64 `json:"difficulty_keccak"`
321 DifficultyScrypt float64 `json:"difficulty_scrypt"`
322 DifficultySHA256D float64 `json:"difficulty_sha256d"`
323 DifficultySkein float64 `json:"difficulty_skein"`
324 DifficultyStribog float64 `json:"difficulty_stribog"`
325 DifficultyX11 float64 `json:"difficulty_x11"`
326 TestNet bool `json:"testnet"`
327 RelayFee float64 `json:"relayfee"`
328 Errors string `json:"errors"`
329 }
330 // InfoChainResult0 is pre-hardfork getinfo response
331 InfoChainResult0 struct {
332 Version int32 `json:"version"`
333 ProtocolVersion int32 `json:"protocolversion"`
334 Blocks int32 `json:"blocks"`
335 TimeOffset int64 `json:"timeoffset"`
336 Connections int32 `json:"connections"`
337 Proxy string `json:"proxy"`
338 PowAlgoID uint32 `json:"pow_algo_id"`
339 PowAlgo string `json:"pow_algo"`
340 Difficulty float64 `json:"difficulty"`
341 DifficultySHA256D float64 `json:"difficulty_sha256d"`
342 DifficultyScrypt float64 `json:"difficulty_scrypt"`
343 TestNet bool `json:"testnet"`
344 RelayFee float64 `json:"relayfee"`
345 Errors string `json:"errors"`
346 }
347 // LocalAddressesResult models the localaddresses data from the getnetworkinfo command.
348 LocalAddressesResult struct {
349 Address string `json:"address"`
350 Port uint16 `json:"port"`
351 Score int32 `json:"score"`
352 }
353 // NetworksResult models the networks data from the getnetworkinfo command.
354 NetworksResult struct {
355 Name string `json:"name"`
356 Limited bool `json:"limited"`
357 Reachable bool `json:"reachable"`
358 Proxy string `json:"proxy"`
359 ProxyRandomizeCredentials bool `json:"proxy_randomize_credentials"`
360 }
361 // PrevOut represents previous output for an input Vin.
362 PrevOut struct {
363 Addresses []string `json:"addresses,omitempty"`
364 Value float64 `json:"value"`
365 }
366 // ScriptPubKeyResult models the scriptPubKey data of a tx script. It is defined separately since it is used by
367 // multiple commands.
368 ScriptPubKeyResult struct {
369 Asm string `json:"asm"`
370 Hex string `json:"hex,omitempty"`
371 ReqSigs int32 `json:"reqSigs,omitempty"`
372 Type string `json:"type"`
373 Addresses []string `json:"addresses,omitempty"`
374 }
375 // ScriptSig models a signature script. It is defined separately since it only applies to non-coinbase. Therefore
376 // the field in the Vin structure needs to be a pointer.
377 ScriptSig struct {
378 Asm string `json:"asm"`
379 Hex string `json:"hex"`
380 }
381 // SearchRawTransactionsResult models the data from the searchrawtransaction command.
382 SearchRawTransactionsResult struct {
383 Hex string `json:"hex,omitempty"`
384 TxID string `json:"txid"`
385 Hash string `json:"hash"`
386 Size string `json:"size"`
387 Vsize string `json:"vsize"`
388 Version int32 `json:"version"`
389 LockTime uint32 `json:"locktime"`
390 Vin []VinPrevOut `json:"vin"`
391 VOut []Vout `json:"vout"`
392 BlockHash string `json:"blockhash,omitempty"`
393 Confirmations uint64 `json:"confirmations,omitempty"`
394 Time int64 `json:"time,omitempty"`
395 Blocktime int64 `json:"blocktime,omitempty"`
396 }
397 // // SoftForkDescription describes the current state of a soft-fork which was deployed using a super-majority block signalling.
398 // SoftForkDescription struct {
399 // ID string `json:"id"`
400 // Version uint32 `json:"version"`
401 // Reject struct {
402 // Status bool `json:"status"`
403 // } `json:"reject"`
404 // }
405
406 // TxRawDecodeResult models the data from the decoderawtransaction command.
407 TxRawDecodeResult struct {
408 Txid string `json:"txid"`
409 Version int32 `json:"version"`
410 Locktime uint32 `json:"locktime"`
411 Vin []Vin `json:"vin"`
412 Vout []Vout `json:"vout"`
413 }
414 // TxRawResult models the data from the getrawtransaction command.
415 TxRawResult struct {
416 Hex string `json:"hex"`
417 Txid string `json:"txid"`
418 Hash string `json:"hash,omitempty"`
419 Size int32 `json:"size,omitempty"`
420 Vsize int32 `json:"vsize,omitempty"`
421 Version int32 `json:"version"`
422 LockTime uint32 `json:"locktime"`
423 Vin []Vin `json:"vin"`
424 Vout []Vout `json:"vout"`
425 BlockHash string `json:"blockhash,omitempty"`
426 Confirmations uint64 `json:"confirmations,omitempty"`
427 Time int64 `json:"time,omitempty"`
428 Blocktime int64 `json:"blocktime,omitempty"`
429 }
430 // ValidateAddressChainResult models the data returned by the chain server validateaddress command.
431 ValidateAddressChainResult struct {
432 IsValid bool `json:"isvalid"`
433 Address string `json:"address,omitempty"`
434 }
435 // Vin models parts of the tx data. It is defined separately since getrawtransaction, decoderawtransaction, and
436 // searchrawtransaction use the same structure.
437 Vin struct {
438 Coinbase string `json:"coinbase"`
439 Txid string `json:"txid"`
440 Vout uint32 `json:"vout"`
441 ScriptSig *ScriptSig `json:"scriptSig"`
442 Sequence uint32 `json:"sequence"`
443 // Witness []string `json:"txinwitness"`
444 }
445 // VinPrevOut is like Vin except it includes PrevOut. It is used by searchrawtransaction
446 VinPrevOut struct {
447 Coinbase string `json:"coinbase"`
448 Txid string `json:"txid"`
449 Vout uint32 `json:"vout"`
450 ScriptSig *ScriptSig `json:"scriptSig"`
451 // Witness []string `json:"txinwitness"`
452 PrevOut *PrevOut `json:"prevOut"`
453 Sequence uint32 `json:"sequence"`
454 }
455 // Vout models parts of the tx data. It is defined separately since both getrawtransaction and decoderawtransaction
456 // use the same structure.
457 Vout struct {
458 Value float64 `json:"value"`
459 N uint32 `json:"n"`
460 ScriptPubKey ScriptPubKeyResult `json:"scriptPubKey"`
461 }
462 )
463
464 // // HasWitness returns a bool to show if a Vin has any witness data associated
465 // // with it or not.
466 // func (v *Vin) HasWitness() bool {
467 // return len(v.Witness) > 0
468 // }
469
470 // IsCoinBase returns a bool to show if a Vin is a Coinbase one or not.
471 func (v *Vin) IsCoinBase() bool {
472 return len(v.Coinbase) > 0
473 }
474
475 // MarshalJSON provides a custom Marshal method for Vin.
476 func (v *Vin) MarshalJSON() ([]byte, error) {
477 if v.IsCoinBase() {
478 coinbaseStruct := struct {
479 Coinbase string `json:"coinbase"`
480 Sequence uint32 `json:"sequence"`
481 // Witness []string `json:"witness,omitempty"`
482 }{
483 Coinbase: v.Coinbase,
484 Sequence: v.Sequence,
485 // Witness: v.Witness,
486 }
487 return json.Marshal(coinbaseStruct)
488 }
489 // if v.HasWitness() {
490 // txStruct := struct {
491 // Txid string `json:"txid"`
492 // Vout uint32 `json:"vout"`
493 // ScriptSig *ScriptSig `json:"scriptSig"`
494 // Witness []string `json:"txinwitness"`
495 // Sequence uint32 `json:"sequence"`
496 // }{
497 // Txid: v.Txid,
498 // Vout: v.Vout,
499 // ScriptSig: v.ScriptSig,
500 // Witness: v.Witness,
501 // Sequence: v.Sequence,
502 // }
503 // return json.Marshal(txStruct)
504 // }
505 txStruct := struct {
506 Txid string `json:"txid"`
507 Vout uint32 `json:"vout"`
508 ScriptSig *ScriptSig `json:"scriptSig"`
509 Sequence uint32 `json:"sequence"`
510 }{
511 Txid: v.Txid,
512 Vout: v.Vout,
513 ScriptSig: v.ScriptSig,
514 Sequence: v.Sequence,
515 }
516 return json.Marshal(txStruct)
517 }
518
519 // // HasWitness returns a bool to show if a Vin has any witness data associated
520 // // with it or not.
521 // func (v *VinPrevOut) HasWitness() bool {
522 // return len(v.Witness) > 0
523 // }
524
525 // IsCoinBase returns a bool to show if a Vin is a Coinbase one or not.
526 func (v *VinPrevOut) IsCoinBase() bool {
527 return len(v.Coinbase) > 0
528 }
529
530 // MarshalJSON provides a custom Marshal method for VinPrevOut.
531 func (v *VinPrevOut) MarshalJSON() ([]byte, error) {
532 if v.IsCoinBase() {
533 coinbaseStruct := struct {
534 Coinbase string `json:"coinbase"`
535 Sequence uint32 `json:"sequence"`
536 }{
537 Coinbase: v.Coinbase,
538 Sequence: v.Sequence,
539 }
540 return json.Marshal(coinbaseStruct)
541 }
542 // if v.HasWitness() {
543 // txStruct := struct {
544 // Txid string `json:"txid"`
545 // Vout uint32 `json:"vout"`
546 // ScriptSig *ScriptSig `json:"scriptSig"`
547 // Witness []string `json:"txinwitness"`
548 // PrevOut *PrevOut `json:"prevOut,omitempty"`
549 // Sequence uint32 `json:"sequence"`
550 // }{
551 // Txid: v.Txid,
552 // Vout: v.Vout,
553 // ScriptSig: v.ScriptSig,
554 // Witness: v.Witness,
555 // PrevOut: v.PrevOut,
556 // Sequence: v.Sequence,
557 // }
558 // return json.Marshal(txStruct)
559 // }
560 txStruct := struct {
561 Txid string `json:"txid"`
562 Vout uint32 `json:"vout"`
563 ScriptSig *ScriptSig `json:"scriptSig"`
564 PrevOut *PrevOut `json:"prevOut,omitempty"`
565 Sequence uint32 `json:"sequence"`
566 }{
567 Txid: v.Txid,
568 Vout: v.Vout,
569 ScriptSig: v.ScriptSig,
570 PrevOut: v.PrevOut,
571 Sequence: v.Sequence,
572 }
573 return json.Marshal(txStruct)
574 }
575