Restyled.io f8d4108d44 Restyled by prettier-markdown 3 years ago
..
constants 4a41dd0b5e Moved wire/constants into it's own package 4 years ago
protocol d31209cd03 Moved wire/protocol.go to it's own package 4 years ago
ruleerror 283823059a mainline/decred: apply code style best practices 3 years ago
testdata 27c0f9f8d1 wire: Add large tx deserialize benchmark. (#678) 8 years ago
README.md f8d4108d44 Restyled by prettier-markdown 3 years ago
bench_test.go 283823059a mainline/decred: apply code style best practices 3 years ago
blockheader.go adf2ac5e47 for merge optimization: mainline btcd/decred style 3 years ago
blockheader_test.go d31209cd03 Moved wire/protocol.go to it's own package 4 years ago
common.go adf2ac5e47 for merge optimization: mainline btcd/decred style 3 years ago
common_test.go 283823059a mainline/decred: apply code style best practices 3 years ago
doc.go a0a29f9570 multi: Appease linters, update documentation, etc. 3 years ago
error.go adf2ac5e47 for merge optimization: mainline btcd/decred style 3 years ago
fakemessage_test.go 441f34016b Tests all fixed up except for the wallet 4 years ago
fixedIO_test.go 25ec88c9bb Optimization: Eliminate most use of slices 3 years ago
invvect.go 952c6ec469 Split off txscript error to it's own package 4 years ago
invvect_test.go 283823059a mainline/decred: apply code style best practices 3 years ago
message.go 283823059a mainline/decred: apply code style best practices 3 years ago
message_test.go adf2ac5e47 for merge optimization: mainline btcd/decred style 3 years ago
msgaddr.go d31209cd03 Moved wire/protocol.go to it's own package 4 years ago
msgaddr_test.go d31209cd03 Moved wire/protocol.go to it's own package 4 years ago
msgblock.go 283823059a mainline/decred: apply code style best practices 3 years ago
msgblock_test.go d31209cd03 Moved wire/protocol.go to it's own package 4 years ago
msgcfcheckpt.go e1a0413a76 Removed pktwallet websocket based rpc server which is unused, second round of dead code elimination 4 years ago
msgcfheaders.go 952c6ec469 Split off txscript error to it's own package 4 years ago
msgcfilter.go 952c6ec469 Split off txscript error to it's own package 4 years ago
msgfeefilter.go d31209cd03 Moved wire/protocol.go to it's own package 4 years ago
msgfeefilter_test.go d31209cd03 Moved wire/protocol.go to it's own package 4 years ago
msgfilteradd.go d31209cd03 Moved wire/protocol.go to it's own package 4 years ago
msgfilteradd_test.go 283823059a mainline/decred: apply code style best practices 3 years ago
msgfilterclear.go d31209cd03 Moved wire/protocol.go to it's own package 4 years ago
msgfilterclear_test.go d31209cd03 Moved wire/protocol.go to it's own package 4 years ago
msgfilterload.go adf2ac5e47 for merge optimization: mainline btcd/decred style 3 years ago
msgfilterload_test.go d31209cd03 Moved wire/protocol.go to it's own package 4 years ago
msggetaddr.go 952c6ec469 Split off txscript error to it's own package 4 years ago
msggetaddr_test.go d31209cd03 Moved wire/protocol.go to it's own package 4 years ago
msggetblocks.go d31209cd03 Moved wire/protocol.go to it's own package 4 years ago
msggetblocks_test.go d31209cd03 Moved wire/protocol.go to it's own package 4 years ago
msggetcfcheckpt.go 952c6ec469 Split off txscript error to it's own package 4 years ago
msggetcfheaders.go 952c6ec469 Split off txscript error to it's own package 4 years ago
msggetcfilters.go 952c6ec469 Split off txscript error to it's own package 4 years ago
msggetdata.go 952c6ec469 Split off txscript error to it's own package 4 years ago
msggetdata_test.go d31209cd03 Moved wire/protocol.go to it's own package 4 years ago
msggetheaders.go 952c6ec469 Split off txscript error to it's own package 4 years ago
msggetheaders_test.go d31209cd03 Moved wire/protocol.go to it's own package 4 years ago
msgheaders.go 952c6ec469 Split off txscript error to it's own package 4 years ago
msgheaders_test.go d31209cd03 Moved wire/protocol.go to it's own package 4 years ago
msginv.go 952c6ec469 Split off txscript error to it's own package 4 years ago
msginv_test.go d31209cd03 Moved wire/protocol.go to it's own package 4 years ago
msgmempool.go d31209cd03 Moved wire/protocol.go to it's own package 4 years ago
msgmempool_test.go d31209cd03 Moved wire/protocol.go to it's own package 4 years ago
msgmerkleblock.go d31209cd03 Moved wire/protocol.go to it's own package 4 years ago
msgmerkleblock_test.go d31209cd03 Moved wire/protocol.go to it's own package 4 years ago
msgnotfound.go 952c6ec469 Split off txscript error to it's own package 4 years ago
msgnotfound_test.go d31209cd03 Moved wire/protocol.go to it's own package 4 years ago
msgping.go d31209cd03 Moved wire/protocol.go to it's own package 4 years ago
msgping_test.go 3d9a0899e7 Fixed buggy test 3 years ago
msgpong.go d31209cd03 Moved wire/protocol.go to it's own package 4 years ago
msgpong_test.go d31209cd03 Moved wire/protocol.go to it's own package 4 years ago
msgreject.go d31209cd03 Moved wire/protocol.go to it's own package 4 years ago
msgreject_test.go 283823059a mainline/decred: apply code style best practices 3 years ago
msgsendheaders.go d31209cd03 Moved wire/protocol.go to it's own package 4 years ago
msgsendheaders_test.go d31209cd03 Moved wire/protocol.go to it's own package 4 years ago
msgtx.go adf2ac5e47 for merge optimization: mainline btcd/decred style 3 years ago
msgtx_test.go 283823059a mainline/decred: apply code style best practices 3 years ago
msgverack.go 952c6ec469 Split off txscript error to it's own package 4 years ago
msgverack_test.go d31209cd03 Moved wire/protocol.go to it's own package 4 years ago
msgversion.go adf2ac5e47 for merge optimization: mainline btcd/decred style 3 years ago
msgversion_test.go 283823059a mainline/decred: apply code style best practices 3 years ago
netaddress.go d31209cd03 Moved wire/protocol.go to it's own package 4 years ago
netaddress_test.go d31209cd03 Moved wire/protocol.go to it's own package 4 years ago
packetcryptann.go e1a0413a76 Removed pktwallet websocket based rpc server which is unused, second round of dead code elimination 4 years ago
packetcryptproof.go 283823059a mainline/decred: apply code style best practices 3 years ago
test_test.go 441f34016b Tests all fixed up except for the wallet 4 years ago

README.md

wire

ISC License

Package wire implements the wire protocol. A comprehensive suite of tests with 100% test coverage is provided to ensure proper functionality.

This package has intentionally been designed so it can be used as a standalone package for any projects needing to interface with bitcoin-like peers at the wire protocol level.

Message Overview

The protocol consists of exchanging messages between peers. Each message is preceded by a header which identifies information about it such as which network it is a part of, its type, how big it is, and a checksum to verify validity. All encoding and decoding of message headers is handled by this package.

To accomplish this, there is a generic interface for bitcoin messages named Message which allows messages of any type to be read, written, or passed around through channels, functions, etc. In addition, concrete implementations of most of the currently supported bitcoin messages are provided. For these supported messages, all of the details of marshaling and unmarshaling to and from the wire using bitcoin encoding are handled so the caller doesn't have to concern themselves with the specifics.

Reading Messages Example

In order to unmarshal bitcoin messages from the wire, use the ReadMessage function. It accepts any io.Reader, but typically this will be a net.Conn to a remote node running a bitcoin peer.

Messages

In order to marshal bitcoin messages to the wire, use the WriteMessage function. It accepts any io.Writer, but typically this will be a net.Conn to a remote node running a bitcoin peer.

License

Package wire is licensed under the Copyfree ISC License.