 |
Ethereum
PoC-8
The C++ Implementation of Ethereum
|
Go to the documentation of this file.
28 #include <boost/asio.hpp>
29 #include <boost/utility.hpp>
34 #include <libp2p/Host.h>
48 namespace eth {
class Interface; }
49 namespace shh {
class Interface; }
50 namespace bzz {
class Interface;
class Client; }
61 virtual std::vector<p2p::PeerSessionInfo>
peers() = 0;
67 virtual void addPeer(p2p::NodeSpec
const& _node, p2p::PeerType _t) = 0;
94 virtual std::string
enode()
const = 0;
113 WebThreeDirect(std::string
const& _clientVersion, boost::filesystem::path
const& _dbPath,
114 boost::filesystem::path
const& _snapshotPath,
eth::ChainParams const& _params,
127 return m_ethereum.get();
138 std::vector<p2p::PeerSessionInfo>
peers()
override;
144 virtual void addPeer(p2p::NodeSpec
const& _node, p2p::PeerType _t)
override;
147 virtual void addNode(
p2p::NodeID const& _node, bi::tcp::endpoint
const& _hostEndpoint)
override;
173 p2p::NodeInfo
nodeInfo()
const override {
return m_net.nodeInfo(); }
177 std::string
enode()
const override {
return m_net.enode(); }
189 std::string m_clientVersion;
191 std::unique_ptr<eth::Client> m_ethereum;
virtual void stopNetwork()=0
Stop the network subsystem.
void setIdealPeerCount(size_t _n) override
Sets the ideal number of peers.
virtual void requirePeer(p2p::NodeID const &_node, bi::tcp::endpoint const &_endpoint)=0
Require connection to peer.
~WebThreeDirect() override
Destructor.
static std::string composeClientVersion(std::string const &_client)
u256 networkId() const override
Get network id.
eth::Client * ethereum() const
virtual u256 networkId() const =0
Get network id.
void setPeerStretch(size_t _n)
Experimental. Sets ceiling for incoming connections to multiple of ideal peer count.
std::string enode() const override
Get enode string.
virtual std::string enode() const =0
Get enode string.
size_t peerCount() const override
Same as peers().size(), but more efficient.
Main API hub for interfacing with Web 3 components. This doesn't do any local multiplexing,...
void addNode(bi::tcp::endpoint const &_endpoint)
Add node to connect to.
WebThreeDirect(std::string const &_clientVersion, boost::filesystem::path const &_dbPath, boost::filesystem::path const &_snapshotPath, eth::ChainParams const &_params, WithExisting _we=WithExisting::Trust, p2p::NetworkConfig const &_n=p2p::NetworkConfig{}, bytesConstRef _network=bytesConstRef(), bool _testing=false)
void addNode(std::string const &_hostString)
Add node to connect to.
Main API hub for interfacing with Ethereum.
void stopNetwork() override
Stop the network subsystem.
std::vector< byte > bytes
virtual p2p::NodeInfo nodeInfo() const =0
Get information concerning this node.
vector_ref< byte const > bytesConstRef
void requirePeer(p2p::NodeID const &_node, bi::tcp::endpoint const &_endpoint) override
Require connection to peer.
virtual void setIdealPeerCount(size_t _n)=0
Sets the ideal number of peers.
virtual dev::bytes saveNetwork()=0
Save peers.
virtual void addNode(p2p::NodeID const &_node, bi::tcp::endpoint const &_hostEndpoint)=0
Add node to connect to.
virtual void addNode(p2p::NodeID const &_node, bi::tcp::endpoint const &_hostEndpoint) override
Add node to connect to.
virtual std::vector< p2p::PeerSessionInfo > peers()=0
Get information on the current peer set.
virtual ~NetworkFace()=default
boost::multiprecision::number< boost::multiprecision::cpp_int_backend< 256, 256, boost::multiprecision::unsigned_magnitude, boost::multiprecision::unchecked, void > > u256
std::vector< p2p::PeerSessionInfo > peers() override
Get information on the current peer set.
virtual void addPeer(p2p::NodeSpec const &_node, p2p::PeerType _t)=0
Generalised peer addition.
bool isNetworkStarted() const override
Is network working? there may not be any peers yet.
virtual void addPeer(p2p::NodeSpec const &_node, p2p::PeerType _t) override
Generalised peer addition.
virtual bool isNetworkStarted() const =0
Is network working? there may not be any peers yet.
void requirePeer(p2p::NodeID const &_node, std::string const &_hostString)
Require connection to peer.
void startNetwork() override
Start the network subsystem.
boost::error_info< struct tag_interface, std::string > errinfo_interface
dev::bytes saveNetwork() override
Save peers.
void addNode(p2p::NodeID const &_node, std::string const &_hostString)
Add node to connect to.
std::string const & clientVersion() const
virtual void startNetwork()=0
Start the network subsystem.
p2p::NodeInfo nodeInfo() const override
Get information concerning this node.
virtual size_t peerCount() const =0
Same as peers().size(), but more efficient.