[bisq-network/bisq] Provide ASIC resistant PoW scheme for BSQ swaps (PR #5858)

Steven Barclay notifications at github.com
Tue Dec 7 04:23:07 CET 2021


@stejbac commented on this pull request.



> +        });
+    }
+
+    @Override
+    public byte[] getChallenge(String itemId, String ownerId) {
+        checkArgument(!StringUtils.contains(itemId, '\0'));
+        checkArgument(!StringUtils.contains(ownerId, '\0'));
+        return Hash.getSha256Hash(checkNotNull(itemId) + "\0" + checkNotNull(ownerId));
+    }
+
+    @Override
+    boolean verify(ProofOfWork proofOfWork) {
+        double difficulty = adjustedDifficulty(proofOfWork.getNumLeadingZeros());
+
+        var puzzle = new Equihash(90, 5, difficulty).puzzle(proofOfWork.getChallenge());
+        return puzzle.deserializeSolution(proofOfWork.getPayload()).verify();

I've just added a commit (db6025a) to address this. It adds a `ProofOfWork.solution` field to hold the Equihash puzzle solution bytes.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/bisq-network/bisq/pull/5858#discussion_r763598762
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bisq.network/pipermail/bisq-github/attachments/20211206/3db5d889/attachment.htm>


More information about the bisq-github mailing list