ravencoin: expose and auto-verify Core backend - #3
Conversation
Update: official Core identity verification is now automaticCommit Cipig must not set Normal deployment: no configurationIf ElectrumX and
Official catalog entry:
Container/process isolationIf ElectrumX cannot see the host
Do not copy a different binary merely to satisfy this check: the mounted path must refer to the executable deployed for the Core service. Zero/multiple Verify all public Cipig endpointsAfter deployment: for host in electrum1.cipig.net electrum2.cipig.net electrum3.cipig.net; do
printf '%s\n' '{"jsonrpc":"2.0","id":1,"method":"server.ravencoin_backend","params":[]}' \
| timeout 15 openssl s_client -quiet -connect "$host:20051" -servername "$host" 2>/dev/null
doneEach response should report: Please attach the three live responses (including |
Summary
This adds an optional, Ravencoin-only
server.ravencoin_backendRPC so Ravencoin Electrum clients can determine which Ravencoin Core daemon is actually behind an ElectrumX server.The change is intentionally isolated and does not require a separate ElectrumX installation or process. It is designed for the existing multi-coin deployment model.
The implementation was prepared against
cipig/electrumxmaster commitc9dc2e138888da08843414b2072c40901f20032d.Why
After the recent Ravencoin consensus incident, an Electrum client should not infer backend safety merely from the fact that an ElectrumX server is reachable.
A client needs a way to inspect sanitized evidence about the configured
ravend, including the Core version. In particular, Ravencoin Core encodes 4.8.0 as numeric version4080000, which needs Ravencoin-specific parsing rather than the generic Bitcoin version-number interpretation.This RPC is the interoperability capability used by Electrum-Ravencoin. The server reports evidence; the client remains responsible for applying its own trust/safety policy.
What changes
For
COIN=Ravencoinonly, the environment installs small Ravencoin-specific subclasses:RavencoinDaemon, extending the existing daemon adapter;RavencoinElectrumX, extending the existing session class;server.ravencoin_backendreports only sanitized public information:nHeightvalidation capability;The daemon information is cached briefly to avoid creating unnecessary load on
ravend.Backward compatibility
Backward compatibility with existing and older Electrum clients is a hard requirement of this change.
This PR does not:
PROTOCOL_MIN;server.version;RavencoinElectrumX.set_request_handlers()first calls the existingElectrumX.set_request_handlers(ptuple)and only then addsserver.ravencoin_backend.Therefore an older client continues to use exactly the handlers selected by the existing Electrum protocol version negotiation. A client that does not know
server.ravencoin_backendsimply never calls it.The tests explicitly exercise representative protocol tuples
(1, 0),(1, 4, 2),(1, 6)and(1, 7)and verify that inherited handlers are preserved.Other coins are unaffected
The extension is activated only when the selected coin class has
NAME == "Ravencoin".BTC, LTC, ZEC and the other coins served by the same ElectrumX codebase continue to use their existing
DAEMON,SESSIONCLS, protocol handlers and configuration unchanged.This is important for the multi-coin architecture: no second ElectrumX install is required.
Requested deployment on all three Cipig RVN servers
Merging the code is only the first part of this request. Please also deploy the updated ElectrumX code to all three public Cipig Ravencoin endpoints:
electrum1.cipig.net— SSL20051, TCP10051electrum2.cipig.net— SSL20051, TCP10051electrum3.cipig.net— SSL20051, TCP10051The goal is for
server.ravencoin_backendto be available and return truthful live evidence from theravendactually used by each of the three servers.After deployment, each endpoint should be independently checked. The feature should not be considered operational until all three servers answer
server.ravencoin_backendsuccessfully and report their real Ravencoin Core backend.This matters because these three endpoints are already present in Electrum-Ravencoin discovery as discovery-only servers. They can only become independently verifiable by the hardened client once the capability is live on the actual public servers.
If the three servers share the same ElectrumX installation/code tree, a single code update is of course fine; the important requirement is that the updated service is restarted/reloaded for all three RVN endpoints and that the RPC is live on each of them.
Ravencoin safety evidence
The implementation includes the Ravencoin-specific evidence expected by current Electrum-Ravencoin clients:
4.8.0;4,487,775;nHeightvalidation from height4,487,776;These are evidence fields, not a replacement for client-side validation.
Automatic official Core identity
Official build identity is now automatic and fail-closed. It is not inferred from the version string and an operator cannot manually claim
BUILD_IDENTITY_VERIFIED.The verifier hashes the actual
ravendexecutable and compares it with the embedded catalog of reviewed official RavenProject binaries. The current catalog contains the official x86_64 GNU/Linux binary from RavenProject/Ravencoinv4.8.0:22549129888d02e0e08fcdb9f96f3c699167e774cb359b6a5b42e47068cd655231484fcc763d2f79eae5ea318b029c704a4dc020ravendexecutable SHA-256:885f6670c819e3a48339bbc596f1a224fe41af21ae7a0db57b2ebca700d050eax86_64-linux-gnuNormal Cipig deployment: zero configuration
When ElectrumX can see the host process table,
RAVENCOIN_AUTO_VERIFY_COREdefaults totrue. At startup it finds the single visible process whosecommisravend, opens/proc/<pid>/exe, hashes those live executable bytes, and reports verified identity only if the digest is an exact catalog match.No identity environment variables are required in this normal same-host case.
Isolated service/container fallbacks
If ElectrumX cannot see the host
/proc, select exactly one of these mechanisms:RAVENCOIN_CORE_PID_FILE=/path/to/ravend.pidwhen the live daemon PID and corresponding/proc/<pid>/exeare visible;RAVENCOIN_CORE_BINARY=/read-only/path/ravend.Manual source metadata remains available for operator attestation, but
RAVENCOIN_IDENTITY_EVIDENCE=BUILD_IDENTITY_VERIFIEDis deliberately rejected. Only executable-byte verification can emit that evidence level.Discovery fails closed: zero or multiple visible
ravendprocesses, an unreadable executable, or an unknown checksum producesVERSION_ONLY. It never guesses identity fromravend --version.Deployment verification
After restarting each RVN ElectrumX service, call
server.ravencoin_backendon all three public endpoints. For an exact official v4.8.0 build,backend.identitymust contain:{ "evidence": "BUILD_IDENTITY_VERIFIED", "sourceRepository": "RavenProject/Ravencoin", "sourceTag": "v4.8.0", "sourceCommit": "22549129888d02e0e08fcdb9f96f3c699167e774", "artifactSha256": "cb359b6a5b42e47068cd655231484fcc763d2f79eae5ea318b029c704a4dc020", "binarySha256": "885f6670c819e3a48339bbc596f1a224fe41af21ae7a0db57b2ebca700d050ea", "architecture": "x86_64-linux-gnu" }If Cipig uses another architecture or a source-built executable, the result will intentionally remain
VERSION_ONLY. A reviewed checksum entry for that exact official binary must be added to the catalog; the operator must not substitute manual verified metadata.Tests
The added tests cover:
4080000->4.8.0);nHeightenforcement;The repository's existing pull-request CI additionally runs the full pytest suite, pycodestyle and documentation build.
Acceptance criteria
server.ravencoin_backendis verified live on each of the three endpoints.ravend.Scope
The final diff is intentionally small and self-contained: one Ravencoin backend module, one RVN-only activation block in the environment, and focused tests. No generic Electrum protocol implementation has been replaced.