{"action":"opened","issue":{"url":"https://api.github.com/repos/SIGBlockchain/Project-Allium/issues/237","repository_url":"https://api.github.com/repos/SIGBlockchain/Project-Allium","labels_url":"https://api.github.com/repos/SIGBlockchain/Project-Allium/issues/237/labels{/name}","comments_url":"https://api.github.com/repos/SIGBlockchain/Project-Allium/issues/237/comments","events_url":"https://api.github.com/repos/SIGBlockchain/Project-Allium/issues/237/events","html_url":"https://github.com/SIGBlockchain/Project-Allium/issues/237","id":394860048,"node_id":"MDU6SXNzdWUzOTQ4NjAwNDg=","number":237,"title":"Transaction Validation","user":{"login":"kstola2","id":31855040,"node_id":"MDQ6VXNlcjMxODU1MDQw","avatar_url":"https://avatars1.githubusercontent.com/u/31855040?v=4","gravatar_id":"","url":"https://api.github.com/users/kstola2","html_url":"https://github.com/kstola2","followers_url":"https://api.github.com/users/kstola2/followers","following_url":"https://api.github.com/users/kstola2/following{/other_user}","gists_url":"https://api.github.com/users/kstola2/gists{/gist_id}","starred_url":"https://api.github.com/users/kstola2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kstola2/subscriptions","organizations_url":"https://api.github.com/users/kstola2/orgs","repos_url":"https://api.github.com/users/kstola2/repos","events_url":"https://api.github.com/users/kstola2/events{/privacy}","received_events_url":"https://api.github.com/users/kstola2/received_events","type":"User","site_admin":false},"labels":[{"id":1083763217,"node_id":"MDU6TGFiZWwxMDgzNzYzMjE3","url":"https://api.github.com/repos/SIGBlockchain/Project-Allium/labels/scale","name":"scale","color":"88d140","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-12-30T09:58:43Z","updated_at":"2018-12-30T09:58:43Z","closed_at":null,"author_association":"MEMBER","body":"**Objective:**\r\nValidating transactions is possibly the most important part of any cryptocurrency project. The security of exchanging of value is predicated upon inputs fairly consuming rightfully claimed unused transaction outputs.\r\n\r\n(In `transaction.py` and `transaction.test.py`)\r\n\r\n**Task 1: INCOMPLETE**\r\nCreate a function called `validate_input`. It takes an `input` and an `output` as parameters. Note that these should both be in the form of dictionaries that were parsed from a raw transaction.\r\n- First, create an empty list called a `stack`.\r\n- Push the input's signature onto the stack by calling `stack.append`.\r\n![image](https://user-images.githubusercontent.com/31855040/50545836-a9280f00-0be2-11e9-9f6c-22c91d57f875.png)\r\n- Push the input's public key onto the stack by calling `stack.append`.\r\n![image](https://user-images.githubusercontent.com/31855040/50545842-bba24880-0be2-11e9-8314-d93e42a90adc.png)\r\n- Duplicate the top of the stack by calling `stack.append(stack[-1])`.\r\n![image](https://user-images.githubusercontent.com/31855040/50545845-c957ce00-0be2-11e9-963f-9504c95d0551.png)\r\n- Pop the top of the stack by calling `stack.pop()` and storing the return into a variable called `pk`.\r\n![image](https://user-images.githubusercontent.com/31855040/50545874-25225700-0be3-11e9-9fec-a9b151ba9157.png)\r\n- Generate a `pk_hash` from the `pk` by calling the generate pk hash function from `keys.py`.\r\n![image](https://user-images.githubusercontent.com/31855040/50545895-9104bf80-0be3-11e9-92a5-42316adbc0d5.png)\r\n- Push the `pk_hash` onto the stack by calling `stack.append`.\r\n![image](https://user-images.githubusercontent.com/31855040/50545900-b5f93280-0be3-11e9-96d8-5df58d2d1f6f.png)\r\n- Push the `recipient` of the `output` to the `stack` by calling `stack.append`\r\n![image](https://user-images.githubusercontent.com/31855040/50545987-beeb0380-0be5-11e9-8533-fa2d27b6fc41.png)\r\n- Perform a stack match by popping off the top of the stack, then compare that popped element to the top of the stack. If they are the same, call pop once more.\r\n![image](https://user-images.githubusercontent.com/31855040/50545993-d9bd7800-0be5-11e9-8c0f-77499df66cdf.png) -----> ![image](https://user-images.githubusercontent.com/31855040/50545999-f9ed3700-0be5-11e9-82d4-9b7f6427ee46.png)\r\n- Pop off the top of the `stack` and use that element to generate a `verifying_key`\r\n![image](https://user-images.githubusercontent.com/31855040/50546007-3a4cb500-0be6-11e9-8361-eb034519b4ff.png) -----> ![image](https://user-images.githubusercontent.com/31855040/50546009-49336780-0be6-11e9-94bd-acbf69232a53.png)\r\n- Push the `verifying_key` to the stack.\r\n![image](https://user-images.githubusercontent.com/31855040/50546012-57818380-0be6-11e9-9a16-13369a321721.png)\r\n- Push the `unsigned_tx_hash` which is a result of passing the `unsigned_tx` to the `hash_SHA` function. (Note: the `cat_input_fields` by default generates unsigned transactions.)\r\n![image](https://user-images.githubusercontent.com/31855040/50546025-85ff5e80-0be6-11e9-9e34-aba2f3a2f825.png)\r\n- Perform a stack verification by first popping off the top element (which should be the `unsigned_tx_hash`), then popping off the top element once again (which should now be the `verifying_key`), and finally using the `verifying_key` to `verify` with parameters `stack[-1]` and the `unsigned_tx_hash` - **if** `verify` returns true, pop the top of the `stack` one final time \r\n![image](https://user-images.githubusercontent.com/31855040/50546030-97e10180-0be6-11e9-9fec-a677e9ff9bbb.png) ---> ![image](https://user-images.githubusercontent.com/31855040/50546036-a8917780-0be6-11e9-9a76-fe11ffc932f4.png) ---> ![image](https://user-images.githubusercontent.com/31855040/50546055-e7bfc880-0be6-11e9-8584-90d927ad249d.png)\r\n- At this point if it was a valid `input` rightfully claiming the `output`, the stack should be empty. Return the expression `len(stack) == 0`.\r\n![image](https://user-images.githubusercontent.com/31855040/50546063-12aa1c80-0be7-11e9-99d6-2e95a0321803.png)\r\n\r\n\r\n"}}
{"actor":{"display_login":"kstola2"}}