title: ValueError: not enough values to unpack (expected 3, got 2) while implementing a blockchain
body: <p>I'm using python 3.8.2 to implement a blockchain and getting a valueError while running my wallet.py</p>
  
  <pre class="lang-none prettyprint-override"><code>Traceback (most recent call last):
    File "/data/user/0/ru.iiec.pydroid3/files/accomp_files/iiec_run/iiec_run.py", line 31, in &lt;module&gt;
      start(fakepyfile,mainpyfile)
    File "/data/user/0/ru.iiec.pydroid3/files/accomp_files/iiec_run/iiec_run.py", line 30, in start
      exec(open(mainpyfile).read(),  __main__.__dict__)
    File "&lt;string&gt;", line 137, in &lt;module&gt;
    File "&lt;string&gt;", line 98, in get_balance
    File "/storage/emulated/0/Blockchain/transaction_block.py", line 159, in get_balance
      for addr, amt, inx in txn.inputs:
  ValueError: not enough values to unpack (expected 3, got 2)
  </code></pre>
  
  <p>The error, I think to my understanding, is specifically is in the transaction_block module's get_balance() function and transactions module's add_input() method.</p>
  
  <p>transactions module:</p>
  
  <pre><code>class txn:
      inputs = None
      outputs = None
      signatures = None
      required = None 
  
      def __init__(self):
          self.inputs = []
          self.outputs = []
          self.signatures = []
          self.required = []
  
      def add_input(self, from_address, amount, index):
          self.inputs.append((from_address, amount, index))
  
      def add_output(self, to_address, amount):
          self.outputs.append((to_address, amount))
  </code></pre>
  
  <p>transaction_block module:</p>
  
  <pre><code>def get_balance (pu_key, last_block):
      this_block = last_block
      bal = 0.0
      while this_block != None:
          for txn in this_block.data:
              for addr, amt, inx in txn.inputs:
                  if addr == pu_key:
                      bal = bal - amt
              for addr, amt in txn.outputs:
                  if addr == pu_key:
                      bal = bal + amt
          this_block = this_block.previous_block
      return bal
  </code></pre>
  
  <p>While I tried searching for this error online and found some solutions ( <a href="https://stackoverflow.com/questions/42259166/python-3-valueerror-not-enough-values-to-unpack-expected-3-got-2?newreg=00ab49f97aae43bbbb23c950ca5ad579">Python 3 - ValueError: not enough values to unpack (expected 3, got 2)</a>) but they did not work for me completely. So please can anyone help me fix this?</p>
  
  <p>P.S.: I'm new to posting on stackoverflow so if you have any suggestions to improve my question please do give them! Also I do not know if I should put the entire modules here for this question for understanding purposes but if you need that as well feel free to ask for it! I've not added them to make the question a little clutter free.</p>