回复:比特币 API
首次公开证据
打开首次公开证据查看 1 个交叉存档
来源说明
Published on GitHub in February 2024 as part of Martti Malmi's testimony in the COPA v. Wright trial
很好,那就不需要考虑 d-bus 了。Windows 上有没有类似 IPC 套接字的东西?我想我们可以看看 wx 是怎么做的,或许 XML-RPC 库已经知道该怎么处理。Windows 有命名管道,也许那是最接近的对应物。
我不想发明自己的 RPC 协议,而是想使用现有标准。PHP、Java、Python 或其他任何语言都能像命令行命令那样,直接与服务器通信。
我准备开始阅读 XML-RPC 方面的资料。搜索结果显示,它是应用最广、支持也最广泛的协议。PHP 的标准库中就包含它。
能否开启一个只能在本地访问的套接字?
可以,你可以使用仅限本地的 IPC 套接字(“Unix 域套接字”)。wx-api 是通过用文件名代替端口号来实现的。我提交了一个 wxServer-Client 通信的使用示例,如果你愿意,可以还原。现在有了 -blockamount 命令行选项,它会向正在运行的实例查询区块链长度。
我想这种命令行方法应该已经可以从 PHP 使用了,但如果 php 本身能直接调用套接字服务器,可能会更轻量。wx 的 IPC 概览提到 wxSocketEvent、wxSocketBase、wxSocketClient 和 wxSocketServer 是“用于底层 TCP/IP API 的类”,从 php 使用它们可能比我现在使用的方式(wxServer、wxClient、wxConnection)更容易。我会进一步研究。
英文原文
展开英文原文
Good, then no need to consider d-bus. Is there something like IPC sockets on Windows? I guess we could look how wx does it, or maybe the XML-RPC library will already know what to do. Windows has named pipes, maybe that's the best analogue.
I don't think I want to invent my own RPC protocol, I want to use an existing standard. PHP, Java, Python or anything will be able to talk to the server directly the same way the command line commands do.
I'm going to start reading on XML-RPC. It's coming up in searches as the most widely used protocol and widely supported. PHP includes it in its standard libraries.
Is it possible to open a socket that can only be accessed locally?
Yes, you can use IPC sockets ("Unix domain sockets") which are local only. That's done in the wx-api by using a filename in place of a port number. I committed an example of how the wxServer-Client communication is used, you can revert if you want to. Now there's the -blockamount command line option which asks the running instance for the block chain length.
I think this command line method could already be used from PHP, but it might be lighter if php itself could call the socket server directly. The wx's IPC overview mentions wxSocketEvent, wxSocketBase, wxSocketClient and wxSocketServer as being "Classes for the low-level TCP/IP API", which might be easier to use from php than what I used now (wxServer, wxClient, wxConnection). I'll look more into it.