Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Addressed Envelope endpoint #4713

Closed
nugaon opened this issue Jun 26, 2024 · 1 comment · Fixed by #4723
Closed

Addressed Envelope endpoint #4713

nugaon opened this issue Jun 26, 2024 · 1 comment · Fixed by #4723

Comments

@nugaon
Copy link
Member

nugaon commented Jun 26, 2024

Summary

Single Owner Chunk can be pre-signed by Postage Batch before its content would be known. It allows that the Issuer who owns the postage batch attached to the SOC be a separate entity from the Poster who owns the Single Owner Chunk and posts arbitrary content. New endpoint could support this feature so that addressed envelopes can be signed with postage stamp of the node. Other details are in Book of Swarm 4.4.3 Addressed Envelops

Motivation

Cross-Chain Postage Batch Purchase workflow uses this Swarm feature which is in the design but not in implementation yet.

Implementation

The Postage Batch utilization should be updated by calling this endpoint
POST /envelope/{chunkAddress}
where chunkAddress is a hexString // chunk address against which the Postage Stamp will be signed

The used postage would be the one defined in the Swarm-Postage-Batch-Id header as usual.

The endpoint must return back with an application/json response

{
  issuer: hexString // Ethereum address of the postage batch owner
  index: uint64 // used index of the Postage Batch
  timestamp: uint64 // timestamp of the postage stamp
  signature: hexString // postage stamp signature
}

that gives back all required properties for postage stamp signature verification.

@nugaon
Copy link
Member Author

nugaon commented Oct 18, 2024

batchID.copy(buffer, 0)
index.copy(buffer, 32)
buffer.writeBigUInt64BE(BigInt(timestamp), 40)
signature.copy(buffer, 48)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant