|
|
11 năm trước cách đây | |
|---|---|---|
| .. | ||
| .gitignore | 11 năm trước cách đây | |
| README.md | 11 năm trước cách đây | |
| client_identity.go | 11 năm trước cách đây | |
| client_identity_test.go | 11 năm trước cách đây | |
| messages2.go | 11 năm trước cách đây | |
| messaging.go | 11 năm trước cách đây | |
The ethwire package contains the ethereum wire protocol. The ethwire package is required to write and read from the ethereum network.
go get github.com/ethereum/ethwire-go
The Ethereum Wire protocol defines the communication between the nodes running Ethereum. Further reader reading can be done on the Wiki.
// Read and validate the next eth message from the provided connection.
// returns a error message with the details.
msg, err := ethwire.ReadMessage(conn)
if err != nil {
// Handle error
}
// Constructs a message which can be interpreted by the eth network.
// Write the inventory to network
err := ethwire.WriteMessage(conn, &Msg{
Type: ethwire.MsgInvTy,
Data : []interface{}{...},
})