Skip to content

utility rchash passes full overlay address as anchor instead of prefix — causes BeeResponseError / ECONNRESET #673

@crtahlin

Description

@crtahlin

Bug Report

Command

swarm-cli utility rchash

Error

BeeResponseError: socket hang up
  method: 'get',
  url: 'rchash/9/db4de188507aaf43ba79147344ef5373743e4a7490aab2c4c0b0677b50655f1d/db4de188507aaf43ba79147344ef5373743e4a7490aab2c4c0b0677b50655f1d',
  statusText: 'ECONNRESET'

Description

The utility rchash command constructs its API call using the full 64-character overlay address for both anchor_01 and anchor_02 parameters. According to the Bee API documentation, the anchor parameters should only contain the first 4 hex digits of the overlay address (sufficient to cover the storage depth prefix bits). Bee appears to reject the oversized anchor values with a connection reset.

The correct URL for depth 9 and overlay starting with db4d should be something like:

rchash/9/db4d/db4d

Instead, the CLI is constructing:

rchash/9/db4de188507aaf43ba79147344ef5373743e4a7490aab2c4c0b0677b50655f1d/db4de188507aaf43ba79147344ef5373743e4a7490aab2c4c0b0677b50655f1d

Expected Behavior

The command should:

  1. Fetch the node's overlay address from /addresses
  2. Truncate it to the appropriate prefix length (first 4 hex digits / enough to cover depth bits)
  3. Pass the truncated value as both anchor parameters

Environment

  • swarm-cli: installed via npm -g @ethersphere/swarm-cli
  • bee-js: bundled version (from error trace: @ethersphere/bee-js/dist/cjs/modules/rchash.js)
  • Node.js: v24.7.0
  • OS: macOS (Homebrew install)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions