-
Notifications
You must be signed in to change notification settings - Fork 0
/
common.go
executable file
·151 lines (133 loc) · 4.79 KB
/
common.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
package servers
import (
. "github.com/ioeXNetwork/ioeX.MainChain/core"
"github.com/ioeXNetwork/ioeX.Utility/common"
)
const TlsPort = 443
type AttributeInfo struct {
Usage AttributeUsage `json:"usage"`
Data string `json:"data"`
}
type InputInfo struct {
TxID string `json:"txid"`
VOut uint16 `json:"vout"`
Sequence uint32 `json:"sequence"`
}
type OutputInfo struct {
Value string `json:"value"`
Index uint32 `json:"n"`
Address string `json:"address"`
AssetID string `json:"assetid"`
OutputLock uint32 `json:"outputlock"`
}
type ProgramInfo struct {
Code string `json:"code"`
Parameter string `json:"parameter"`
}
type TransactionInfo struct {
TxID string `json:"txid"`
Hash string `json:"hash"`
Size uint32 `json:"size"`
VSize uint32 `json:"vsize"`
Version uint32 `json:"version"`
LockTime uint32 `json:"locktime"`
Inputs []InputInfo `json:"vin"`
Outputs []OutputInfo `json:"vout"`
BlockHash string `json:"blockhash"`
Confirmations uint32 `json:"confirmations"`
Time uint32 `json:"time"`
BlockTime uint32 `json:"blocktime"`
TxType TransactionType `json:"type"`
PayloadVersion byte `json:"payloadversion"`
Payload PayloadInfo `json:"payload"`
Attributes []AttributeInfo `json:"attributes"`
Programs []ProgramInfo `json:"programs"`
}
type BlockInfo struct {
Hash string `json:"hash"`
Confirmations uint32 `json:"confirmations"`
StrippedSize uint32 `json:"strippedsize"`
Size uint32 `json:"size"`
Weight uint32 `json:"weight"`
Height uint32 `json:"height"`
Version uint32 `json:"version"`
VersionHex string `json:"versionhex"`
MerkleRoot string `json:"merkleroot"`
Tx []interface{} `json:"tx"`
Time uint32 `json:"time"`
MedianTime uint32 `json:"mediantime"`
Nonce uint32 `json:"nonce"`
Bits uint32 `json:"bits"`
Difficulty string `json:"difficulty"`
ChainWork string `json:"chainwork"`
PreviousBlockHash string `json:"previousblockhash"`
NextBlockHash string `json:"nextblockhash"`
AuxPow string `json:"auxpow"`
MinerInfo string `json:"minerinfo"`
}
type NodeState struct {
Compile string // The compile version of this server node
ID uint64 // The nodes's id
HexID string // The nodes's id in hex format
Height uint64 // The ServerNode latest block height
Version uint32 // The network protocol the ServerNode used
Services uint64 // The services the local node supplied
Relay bool // The relay capability of the ServerNode (merge into capbility flag)
TxnCnt uint64 // The transactions be transmit by
RxTxnCnt uint64 // The transaction received by this ServerNode
Port uint16 // The nodes's port
PRCPort uint16 // The RPC service prot
RestPort uint16 // The RESTful service port
WSPort uint16 // The webservcie port
OpenPort uint16 // The open service port
OpenService bool // If open service is enabled
Neighbors []Neighbor
}
type Neighbor struct {
ID uint64 // The neighbor ID
HexID string // The neighbor ID in hex format
Height uint64 // The neighbor height
Services uint64 // The services the neighbor node supplied
Relay bool // If this neighbor relay block and transactions
External bool // If this neighbor is an external node
State string // The state of this neighbor node
NetAddress string // The tcp address of this neighbor node
}
type ArbitratorGroupInfo struct {
OnDutyArbitratorIndex int
Arbitrators []string
}
type PayloadInfo interface{}
type CoinbaseInfo struct {
CoinbaseData string
}
type RegisterAssetInfo struct {
Asset Asset
Amount string
Controller string
}
type SideChainPowInfo struct {
BlockHeight uint32
SideBlockHash string
SideGenesisHash string
SignedData string
}
type TransferCrossChainAssetInfo struct {
CrossChainAddresses []string
OutputIndexes []uint64
CrossChainAmounts []common.Fixed64
}
type WithdrawFromSideChainInfo struct {
BlockHeight uint32
GenesisBlockAddress string
SideChainTransactionHashes []string
}
type UTXOInfo struct {
AssetID string `json:"assetid"`
TxID string `json:"txid"`
VOut uint32 `json:"vout"`
Address string `json:"address"`
Amount string `json:"amount"`
Confirmations uint32 `json:"confirmations"`
OutputLock uint32 `json:"outputlock"`
}