dart-bitcoin/bitcoin_flutter

Transaction Builder Example

Opened this issue · 0 comments

i5hi commented

The following example:

      txb.addInput(
          '53676626f5042d42e15313492ab7e708b87559dc0a8c74b7140057af51a2ed5b',
          0,
          null,
          p2wpkh
              .output); // Alice's previous transaction output, has 200000 satoshis
      txb.addOutput('tb1qchsmnkk5c8wsjg8vxecmsntynpmkxme0yvh2yt', 1000000);
      txb.addOutput('tb1qn40fftdp6z2lvzmsz4s0gyks3gq86y2e8svgap', 8995000);

      txb.sign(vin: 0, keyPair: alice, witnessValue: 10000000);

the comment says Alice is prev output is 200_000 and the outputs are 1_000_000 and 8_995_000 and witnessValue is 10_000_000.

This does not seem right.

As I understand, 1. witnessValue = total amount inputs and 2. inputs >outputs. In this example both cases fail.