2018-01-31 07:23:17 -07:00
|
|
|
package bchain
|
2017-08-28 09:50:57 -06:00
|
|
|
|
|
|
|
type ScriptSig struct {
|
2018-03-02 08:07:45 -07:00
|
|
|
// Asm string `json:"asm"`
|
2017-08-28 09:50:57 -06:00
|
|
|
Hex string `json:"hex"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type Vin struct {
|
|
|
|
Coinbase string `json:"coinbase"`
|
|
|
|
Txid string `json:"txid"`
|
|
|
|
Vout uint32 `json:"vout"`
|
|
|
|
ScriptSig ScriptSig `json:"scriptSig"`
|
|
|
|
Sequence uint32 `json:"sequence"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type ScriptPubKey struct {
|
|
|
|
Asm string `json:"asm"`
|
|
|
|
Hex string `json:"hex,omitempty"`
|
|
|
|
Type string `json:"type"`
|
|
|
|
Addresses []string `json:"addresses,omitempty"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type Vout struct {
|
|
|
|
Value float64 `json:"value"`
|
|
|
|
N uint32 `json:"n"`
|
|
|
|
ScriptPubKey ScriptPubKey `json:"scriptPubKey"`
|
|
|
|
}
|
|
|
|
|
2018-03-02 05:45:39 -07:00
|
|
|
// Tx is blockchain transaction
|
|
|
|
// unnecessary fields are commented out to avoid overhead
|
2017-08-28 09:50:57 -06:00
|
|
|
type Tx struct {
|
2018-03-02 08:07:45 -07:00
|
|
|
Hex string `json:"hex"`
|
|
|
|
Txid string `json:"txid"`
|
|
|
|
// Version int32 `json:"version"`
|
2018-03-02 05:45:39 -07:00
|
|
|
LockTime uint32 `json:"locktime"`
|
|
|
|
Vin []Vin `json:"vin"`
|
|
|
|
Vout []Vout `json:"vout"`
|
|
|
|
// BlockHash string `json:"blockhash,omitempty"`
|
2017-08-28 09:50:57 -06:00
|
|
|
Confirmations uint32 `json:"confirmations,omitempty"`
|
|
|
|
Time int64 `json:"time,omitempty"`
|
|
|
|
Blocktime int64 `json:"blocktime,omitempty"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type Block struct {
|
2017-09-12 16:36:08 -06:00
|
|
|
BlockHeader
|
|
|
|
Txs []Tx `json:"tx"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type ThinBlock struct {
|
2017-09-11 04:19:41 -06:00
|
|
|
BlockHeader
|
|
|
|
Txids []string `json:"tx"`
|
2017-08-28 09:50:57 -06:00
|
|
|
}
|
2017-09-06 02:59:40 -06:00
|
|
|
|
|
|
|
type BlockHeader struct {
|
2017-09-11 04:19:41 -06:00
|
|
|
Hash string `json:"hash"`
|
2017-09-11 05:03:08 -06:00
|
|
|
Prev string `json:"previousblockhash"`
|
2017-09-11 04:19:41 -06:00
|
|
|
Next string `json:"nextblockhash"`
|
|
|
|
Height uint32 `json:"height"`
|
|
|
|
Confirmations int `json:"confirmations"`
|
2017-09-06 02:59:40 -06:00
|
|
|
}
|