10000 feat(coinjoin): support encrypted wallets by HashEngineering · Pull Request #196 · dashpay/dashj · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

feat(coinjoin): support encrypted wallets #196

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

Merged

Conversation

HashEngineering
Copy link
Collaborator

Issue being fixed or feature implemented

What was done?

How Has This Been Tested?

Breaking Changes

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have made corresponding changes to the documentation

For repository code-owners and collaborators only

  • I have assigned this pull request to a milestone

@HashEngineering HashEngineering self-assigned this Feb 21, 2023
Comment on lines +17 to +23
package org.bitcoinj.coinjoin.callbacks;

import org.bitcoinj.core.ECKey;

public interface RequestDecryptedKey {
ECKey requestDecryptedKey(ECKey encryptedKey);
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This call will decrypt a single key.

Comment on lines +17 to +24
package org.bitcoinj.coinjoin.callbacks;

import org.bitcoinj.wallet.Wallet;
import org.bouncycastle.crypto.params.KeyParameter;

public interface RequestKeyParameter {
KeyParameter requestKeyParameter(Wallet wallet);
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This call back will obtain the key parameter (encryption key) for the wallet. used with SendRequests.

Comment on lines +328 to +343

public void setRequestKeyParameter(RequestKeyParameter requestKeyParameter) {
this.requestKeyParameter = requestKeyParameter;
}

public void setRequestDecryptedKey(RequestDecryptedKey requestDecryptedKey) {
this.requestDecryptedKey = requestDecryptedKey;
}

public @Nullable KeyParameter requestKeyParameter(WalletEx mixingWallet) {
return requestKeyParameter != null ? requestKeyParameter.requestKeyParameter(mixingWallet) : null;
}

public @Nullable ECKey requestDecryptKey(ECKey key) {
return requestDecryptedKey != null ? requestDecryptedKey.requestDecryptedKey(key) : null;
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CoinJoinManager will keep track of the callbacks.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In DashPay, we will use these functions like this:

interface CoinJoinService {
    fun configureMixing(
        amount: Coin,
        requestKeyParameter: RequestKeyParameter,
        requestDecryptedKey: RequestDecryptedKey
    )
}
        if (blockchainIdentityData.creationState <= CreationState.MIXING_FUNDS) {
            platformRepo.updateIdentityCreationState(blockchainIdentityData, CreationState.MIXING_FUNDS)
            coinJoinService.configureMixing(
                Constants.DASH_PAY_FEE,
                { encryptionKey },
                { it.decrypt(encryptionKey) })

            coinJoinService.prepareAndStartMixing()

            coinJoinService.waitForMixing();
        }

@HashEngineering
Copy link
Collaborator Author

There is a problem with one of the tests due to a Context mismatch on Linux and not Mac.

Copy link
Member
@Syn-McJ Syn-McJ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great

@HashEngineering HashEngineering merged commit 29e7459 into feature-coinjoin Mar 6, 2023
@HashEngineering HashEngineering deleted the feature-coinjoin-encrypted-wallet-support branch May 22, 2023 05:51
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 this pull request may close these issues.

2 participants
0