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

chimp1984 notifications at github.com
Fri Dec 3 20:31:16 CET 2021


@chimp1984 commented on this pull request.



> +        return CompletableFuture.supplyAsync(() -> {
+            long ts = System.currentTimeMillis();
+            byte[] solution = new Equihash(90, 5, difficulty).puzzle(challenge).findSolution().serialize();
+            long counter = Longs.fromByteArray(Arrays.copyOf(solution, 8));
+            var proofOfWork = new ProofOfWork(solution, counter, challenge, log2Difficulty,
+                    System.currentTimeMillis() - ts, getVersion());
+            log.info("Completed minting proofOfWork: {}", proofOfWork);
+            return proofOfWork;
+        });
+    }
+
+    @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));

Ah ok.

-- 
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_r762192671
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bisq.network/pipermail/bisq-github/attachments/20211203/ad5ee0c3/attachment-0001.htm>


More information about the bisq-github mailing list