title: ValueError: not enough values to unpack (expected 3, got 2) while developing a blockchain
body: <p>I'm using python for implementing a blockchain and am getting this error.</p>
  
  <pre><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 160, in get_balance
      for addr, amt, inx in txn.inputs:
  ValueError: not enough values to unpack (expected 3, got 2)
  </code></pre>
  
  <p>I'm trying to call the <code>get_balance()</code> function which is in the transaction_block module via my wallet.py. The <code>get_balance()</code> collects data from my transactions module <code>inputs</code> array. While there are 3 arguments in my <code>inputs</code> array but I'm getting only 2 values when I call function's inputs call. So where am I going wrong here?</p>
  
  <p>transactions module:</p>
  
  <pre><code>def __init__(self):
          self.inputs = []
          self.outputs = []
          self.signatures = []
          self.required = []
  
      def add_input(self, from_address, amount, index = 0):
          self.inputs.append((from_address, amount, index))
  </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:
              print(txn.inputs)
              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>If you require the entire code, I've linked it <a href="https://github.com/niranjay30/Blockchain" rel="nofollow noreferrer">here</a> as I've tried to keep this question clutter free. If you want to run this entire code, run the wallet.py module and you'll encounter this error.</p>