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

2of2 Multisig Bug: invalid transaction #23

Open
c8e4 opened this issue Apr 26, 2024 · 0 comments
Open

2of2 Multisig Bug: invalid transaction #23

c8e4 opened this issue Apr 26, 2024 · 0 comments

Comments

@c8e4
Copy link
Contributor

c8e4 commented Apr 26, 2024

OS: latest macOS
node: v21.2.0
minotaur-wallet: latest

Expected behaviour:

A fully signed 2of2 tx passes https://gql.ergoplatform.com/ -> checkTransaction

Actual behaviour

Transaction fails to pass checkTransaction
Please note that publishing such a transaction over https://api.ergoplatform.com/api/v1/mempool/transactions/submit returns a txId, but the transaction never reaches the mempool.

Steps to reproduce

Setup Wallets
BrowserAlice: Create Alice Wallet
BrowserBob: Create Bob Wallet

BrowserAlice: Create Multisig Wallet with 2of2: Alice Wallet, Bob xpub
BrowserBob: Create Multisig Wallet with 2of2: Bob Wallet, Alice xpub

Send funds to Multisig Wallet address.

Create Multisig Spending Tx
MultisigWalletBob:

  1. Create a Tx that sends some funds to Bob.
  2. Sign Commitment
  3. Copy to Clipboard

MultisigWalletAlice:

  1. Paste in Multi-sig Communication
  2. Sign Commitment
  3. Sign Transaction
  4. Copy to Clipboard

MultisigWalletBob:

  1. DELETE Transaction <- THIS STEP TRIGGERS THE BUG
  2. Paste in Multi-sig Communication
  3. Sign Transaction
  4. Publish Transaction <- ui will show you a tx id, but the tx will never enter mempool

Reliable way of checking if tx is valid in javascript

// signedTransaction  - wasm.Transaction.to_js_eip12()
async function txHasErrors(signedTransaction: string): Promise<false |string> {
    const endpoint = "https://gql.ergoplatform.com/";
    const query = `
      mutation CheckTransaction($signedTransaction: SignedTransaction!) {
        checkTransaction(signedTransaction: $signedTransaction)
      }
    `;

    const variables = {
        signedTransaction: signedTransaction
    };

    const response = await fetch(endpoint, {
        method: "POST",
        headers: {
            "Content-Type": "application/json"
        },
        body: JSON.stringify({
            query: query,
            variables: variables
        })
    });

    if (!response.ok) {
        throw new Error("Network response was not ok: " + response.statusText);
    }

    const jsonResp =  await response.json();
    if(jsonResp.data?.checkTransaction){
        return false;
    }else{
        return jsonResp.errors
    }
}
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

No branches or pull requests

1 participant