replication between shared public/private keypair
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 748
- Forks
- 56
- PR merge metrics
- No merged PRs in 30d
Description
I'm curious to implement a hyperdb where the public/private keypair are treated as a "capability" code, where anyone who has them can write to the same hyperdb. Is replication between the same keypair something which should (theoretically) work with hyperdb/hypercore?
I tried something like the following, but the replication doesn't seem to work (totally possible I'm doing this the wrong way):
```javascript
var db1 = hyperdb('./db1.db', {valueEncoding: 'utf-8'})
// cp -r db1.db -> db2.db (manually in the shell), which copies the keypairs
db1.on('ready', function(err, node) {
var db2 = hyperdb('./db2.db', {valueEncoding: 'utf-8'})
db2.on('ready', function(err, node) {
db1.put('/hello', 'world', function (err, node) {
var stream = db1.replicate()
stream.pipe(db2.replicate()).pipe(stream).on('end', function() {
db2.get('/hello', function (err, nodes) {
if (err) throw err;
console.log('/hello --> ' + nodes)
})
})
})
})
});
```
I was looking into the `hypercore-protocol` code, which has a hook for specifying a stream id to ["to detect if you connect to yourself"](https://github.com/mafintosh/hypercore-protocol#var-stream--protocoloptions). I'd be happy to dig in further (while admitting that I'm a little out of my depth here!) unless there's some fundamental architectural reason why replicating between identical keypairs *shouldn't* be supported?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the hyperdb replication call in the example and the hypercore-protocol stream-id hook mentioned in the issue. Determine whether copying the keypairs should permit replication between db1 and db2, or whether self-connection detection prevents it. Done means establishing the architectural answer and, if support is appropriate, identifying the required changes and a reproducible test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- database, distributed-systems
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100