Skip to content

Conversation

@tynes
Copy link
Collaborator

@tynes tynes commented Jan 7, 2019

  • create watch only wallets with trezor
  • create multisig wallets with trezor
  • multisig functionality
  • broadcast transactions after enough cosigners
  • remove debugger statements
  • sign transactions with trezor

This requires https://github.com/trezor/trezord-go to be running
you can also download it here https://trezor.io/start/
They bundle the program as a mac app as well as it being available as a go program

To test, pull this into a bpanel instance and

  1. create a watch only wallet using ledger
  2. create a watch only wallet using trezor
  3. mine a bunch of blocks and send transactions to the ledger/trezor wallets
  4. create transactions using the ledger/trezor wallets and send them
  5. create a 2/2 multisig wallet
  6. join using ledger and trezor
  7. send bitcoin to the address
  8. create proposal
  9. approve proposal with both ledger and trezor
  10. broadcast proposal on wallet info page

@tynes tynes requested review from bucko13 and pinheadmz January 7, 2019 20:29
@tynes
Copy link
Collaborator Author

tynes commented Jan 11, 2019

bmultisig backend Invalid Signature but trezor is signing the transaction

amount,
};

segwit = false;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think there is a bug in here regarding a tx with both segwit and non segwit inputs. We need segwit value to determine the output address toBase58 or toBech32. To have segwit be in scope for the outputs loop, its declared above and out of the loops. Its set to false each iteration and then set to true if the input isProgram. If the last input is legacy, then segwit will be false for the outputs loop. The last input will determine the value for the output loop

return mtx;
}
case 'trezor': {
// TrezorConnect uses their backend to fetch
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ledger has two different methods for signing and returning tx vs just fetching signature while Trezor has one method that returns both the raw tx and the signature. This causes the API to be a bit redundant in Trezor's case, as Ledger was the first client added to this codebase

prev_index: input.prevout.index,
sequence: input.sequence,
// default to normal spend
script_type: 'SPENDADDRESS',
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

const proposals = await multisig.getProposals(walletId, true);

// fetch both pending and non pending proposals
// and combine the two lists
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

TODO: this will query the same proposals twice, filter out the ones that appear twice

proposalInfo =
proposals[selectedWallet].find(p => p.name === selectedProposal) || {};
proposalInfo = proposals.find(p => p.name === selectedProposal) || {};
} catch (e) {}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

TODO: remove this useless try/catch

type: hardwareType,
network,
chain,
logLevel: 'debug',
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

TODO: remove hardcoding of logLevel

const path = parsePath(paths[i], true);
let ti = {
address_n: path,
prev_hash: input.prevout.hash.toString('hex'),
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 is a bug here, should use txid() method instead of toString('hex')


return mtx;
// alter if its multisig
if (input.script.isMultisig()) {
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 method is only used for p2sh and p2wsh - remove multisig stuff, add a comment around it saying that

@bucko13

This comment has been minimized.

@tynes
Copy link
Collaborator Author

tynes commented Jan 15, 2019

Rebase ontop https://github.com/bpanel-org/bwallet/pull/56/files complete

@tynes

This comment has been minimized.

@tynes

This comment has been minimized.

@tynes tynes removed the request for review from bucko13 January 23, 2019 01:31
@pinheadmz pinheadmz removed their request for review September 6, 2020 02:43
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.

3 participants