Peer Server. Copyright (c) 2013 Alexander Færøy
Behaviours: gen_server
, ranch_protocol
.
Authors: Alexander Færøy (ahf@0x90.dk
).
This module contains a gen_server
for representing a peer in the Bitcoin
peer-to-peer network.
We are using a single server to represent both incoming and outgoing peers.
block_locator() = peculium_core_types:block_locator()
hash() = peculium_core_types:hash()
inv() = peculium_core_types:inv()
peer() = pid()
transaction() = peculium_core_types:transaction()
uint32_t() = peculium_core_types:uint32_t()
block/8 | Send block message to the given Peer. |
code_change/3 | |
getaddr/1 | Send getaddr message to the given Peer. |
getblocks/3 | Send getblocks message to the given Peer. |
getdata/2 | Send getdata message to the given Peer. |
getheaders/3 | Send getheaders message to the given Peer. |
handle_call/3 | |
handle_cast/2 | |
handle_info/2 | |
init/1 | |
ping/1 | Send ping message to the given Peer. |
start_link/2 | Start Peer server. |
stop/1 | Stop the given Peer. |
terminate/2 | |
verack/1 | Send verack message to the given Peer. |
version/2 | Send version message to the given Peer. |
block(Peer::peer(), Version::uint32_t(), PreviousBlock::hash(), MerkleRoot::hash(), Timestamp::non_neg_integer(), Bits::binary(), Nonce::binary(), Transactions::[transaction()]) -> ok
Send block message to the given Peer.
code_change(OldVersion, State, Extra) -> any()
getaddr(Peer::peer()) -> ok
Send getaddr message to the given Peer.
getblocks(Peer::peer(), BlockLocator::block_locator(), BlockStop::hash()) -> ok
Send getblocks message to the given Peer.
Send getdata message to the given Peer.
getheaders(Peer::peer(), BlockLocator::block_locator(), BlockStop::hash()) -> ok
Send getheaders message to the given Peer.
handle_call(Request, From, State) -> any()
handle_cast(Message, State) -> any()
handle_info(Info, State) -> any()
init(Arguments::[term()]) -> {ok, term()} | {ok, term(), non_neg_integer() | infinity} | {ok, term(), hibernate} | {stop, any()} | ignore
ping(Peer::peer()) -> ok
Send ping message to the given Peer.
start_link(Address::inet:ip_address(), Port::inet:port_number()) -> {ok, peer()} | ignore | {error, any()}
stop(Peer::peer()) -> ok
terminate(Reason, State) -> any()
verack(Peer::peer()) -> ok
Send verack message to the given Peer.
version(Peer::peer(), Nonce::binary()) -> ok
Send version message to the given Peer.