{"info":{"_postman_id":"0fc7f9d1-2188-cc63-315c-cd4889f4a4b2","name":"BlockChain","description":"<html><head></head><body><h1 id=\"overview\">Overview</h1>\n<p>The BlockChain program created is meant to simulate a simple cryptocurreny blockchain. The user will run a web API in their localhost that allows them to host, create their own BlockChain, and communicate with other BlockChains.</p>\n<h1 id=\"requirements\">Requirements:</h1>\n<p>The current version of the downloadable program only runs on Mac OS X. </p>\n<p>Download the program <a href=\"https://github.com/laurenkwa/SimplePythonBlockChain/blob/master/download/blockchain.zip\">here</a></p>\n<p>The program runs the API on the user's localhost on port 5000.</p>\n<p>After the download and successful execution of the program, the user must have a way to make POST or GET requests to their API or another node's API. Something like Postman or cURL are good tools to use. </p>\n<p>The following API request codes found in this documentation will be sent to their localhost:5000 running the program. Alternatively, they can try posting the requests to a registered node created for testing purposes at <a href=\"laurenkwa.pythonanywhere.com\">laurenkwa.pythonanywhere.com</a>.</p>\n<p>Users can also communicate and sync their nodes to this sample testing node. </p>\n<p>Readme: <a href=\"https://github.com/laurenkwa/SimplePythonBlockChain/blob/master/readme.md\">Github Link</a></p>\n</body></html>","schema":"https://schema.getpostman.com/json/collection/v2.0.0/collection.json","toc":[{"content":"Overview","slug":"overview"},{"content":"Requirements:","slug":"requirements"}],"owner":"3449197","collectionId":"0fc7f9d1-2188-cc63-315c-cd4889f4a4b2","publishedId":"7LqA31d","public":true,"customColor":{"top-bar":"FFFFFF","right-sidebar":"303030","highlight":"EF5B25"},"publishDate":"2018-01-02T23:04:10.000Z"},"item":[{"name":"http://localhost:5000/mine","id":"2a0c9850-b4bf-a4f7-b503-5ecb978bea35","request":{"method":"GET","header":[],"body":{"mode":"raw","raw":""},"url":"http://localhost:5000/mine","description":"<p>Mine a new Block to be added to this node's BlockChain.</p>\n<p>The miner will be rewarded with one coin.</p>\n<p>Flask Python Code:</p>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code>    @node.route('/mine', methods=['GET'])\n    def mine():\n\n        last_block = blockchain.last_block()\n        proof = blockchain.proof_of_work(last_block[\"proof\"], last_block[\"hash\"])\n                \n        blockchain.new_transaction(sender=\"0\",recipient = node_id, amount = 1,)\n                \n        previous_hash = last_block[\"hash\"]\n        block = blockchain.new_block(proof, previous_hash)\n        \n        file_object = open(text_path, 'wb')\n        pickle.dump(blockchain.chain, file_object)\n                \n        response = {\n            'message': \"New Block Added To Chain\",\n            'index': block.index,\n            'transaction': block.transaction,\n            'proof': block.proof,\n            'previous_hash': block.previous_hash,\n        }\n        return jsonify(response), 200\n</code></pre>","urlObject":{"protocol":"http","port":"5000","path":["mine"],"host":["localhost"],"query":[],"variable":[]}},"response":[{"id":"e768005a-9b96-1b33-440b-db6a90ced5f6","name":"Sample Mine Request/Response","originalRequest":{"method":"GET","header":[],"body":{"mode":"raw","raw":""},"url":"http://localhost:5000/mine"},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"Content-Length","value":"298","name":"Content-Length","description":""},{"key":"Content-Type","value":"application/json","name":"Content-Type","description":""},{"key":"Date","value":"Tue, 02 Jan 2018 20:20:08 GMT","name":"Date","description":""},{"key":"Server","value":"Werkzeug/0.13 Python/3.6.3","name":"Server","description":""}],"cookie":[],"responseTime":"71","body":"{\n  \"index\": 8, \n  \"message\": \"New Block Added To Chain\", \n  \"previous_hash\": \"5b83cb83444f8aa03962e42028cee8ecd2835e376697f9f01a48f7a5ebab2002\", \n  \"proof\": 3464, \n  \"transaction\": [\n    {\n      \"amount\": 1, \n      \"recipient\": \"2ef6a698265f4466bedfda16dcf5eb39\", \n      \"sender\": \"0\"\n    }\n  ]\n}\n"}],"_postman_id":"2a0c9850-b4bf-a4f7-b503-5ecb978bea35"},{"name":"http://localhost:5000/nodes/resolve","id":"9ff41cf4-b1bc-ab02-3f7c-d219fcc96795","request":{"method":"GET","header":[],"body":{"mode":"raw","raw":""},"url":"http://localhost:5000/nodes/resolve","description":"<p>Check the BlockChains of other registered nodes and reach a consensus of which chain is more authoritative.</p>\n<p>The most authoritative chain is the longest BlockChain with the most Blocks.</p>\n<p>The authoritative chain is copied as the new BlockChain.</p>\n<p>Flask Python Code:</p>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code>    @node.route('/nodes/resolve', methods=['GET'])\n    def consensus():\n\n        replaced = blockchain.get_consensus()\n    \n        if replaced:\n            response = {\n                'message': 'Our chain was replaced',\n                'new_chain': blockchain.chain\n            }\n        else:\n            response = {\n                'message': 'Our chain is authoritative',\n                'chain': blockchain.chain\n            }\n    \n        return jsonify(response), 200   \n</code></pre>","urlObject":{"protocol":"http","port":"5000","path":["nodes","resolve"],"host":["localhost"],"query":[],"variable":[]}},"response":[{"id":"af522940-b134-e532-cc5a-bf567f07969d","name":"http://localhost:5000/nodes/resolve","originalRequest":{"method":"GET","header":[],"body":{"mode":"raw","raw":""},"url":"http://localhost:5000/nodes/resolve"},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"Content-Length","value":"4073","name":"Content-Length","description":""},{"key":"Content-Type","value":"application/json","name":"Content-Type","description":""},{"key":"Date","value":"Tue, 02 Jan 2018 20:25:31 GMT","name":"Date","description":""},{"key":"Server","value":"Werkzeug/0.13 Python/3.6.3","name":"Server","description":""}],"cookie":[],"responseTime":"44","body":"{\n  \"chain\": [\n    {\n      \"hash\": \"33d2e70bd8c020ef610b812004761459d7401057eaf724bed502ca7cfe47cbca\", \n      \"index\": 0, \n      \"previous_hash\": \"0\", \n      \"proof\": 28, \n      \"timestamp\": \"2018-01-01 12:43:59.046788\", \n      \"transaction\": \"Genesis Block\"\n    }, \n    {\n      \"hash\": \"f30363b2ebd68fceda861bef0137dbefad84aa1f3ffcf51167e1762987bcd3cd\", \n      \"index\": 1, \n      \"previous_hash\": \"33d2e70bd8c020ef610b812004761459d7401057eaf724bed502ca7cfe47cbca\", \n      \"proof\": 2548, \n      \"timestamp\": \"2018-01-01 12:44:15.113543\", \n      \"transaction\": [\n        {\n          \"amount\": 1, \n          \"recipient\": \"ad41b5254e024aab8eae2e061bc5c6b4\", \n          \"sender\": \"0\"\n        }\n      ]\n    }, \n    {\n      \"hash\": \"9d12f8f19fa7e7d82832af95c282a9f885641723e25fae6f500cf29085fc9a83\", \n      \"index\": 2, \n      \"previous_hash\": \"f30363b2ebd68fceda861bef0137dbefad84aa1f3ffcf51167e1762987bcd3cd\", \n      \"proof\": 2904, \n      \"timestamp\": \"2018-01-01 13:31:00.072867\", \n      \"transaction\": [\n        {\n          \"amount\": 1, \n          \"recipient\": \"0bf7decb82d3441aa7fa40c529ec3f9e\", \n          \"sender\": \"0\"\n        }\n      ]\n    }, \n    {\n      \"hash\": \"66debccdbb8a3fb50191d975574e3dccfd3f52a63f98f982c2c7f7b9bec6f790\", \n      \"index\": 3, \n      \"previous_hash\": \"9d12f8f19fa7e7d82832af95c282a9f885641723e25fae6f500cf29085fc9a83\", \n      \"proof\": 13005, \n      \"timestamp\": \"2018-01-01 18:08:36.452407\", \n      \"transaction\": [\n        {\n          \"amount\": 1, \n          \"recipient\": \"a1a98d4149774422ace13ebbfc680e38\", \n          \"sender\": \"0\"\n        }\n      ]\n    }, \n    {\n      \"hash\": \"73cc9163cefedc1d6cd5c2ebfdc7057e66c62ce609a8e0206404b94a923f4916\", \n      \"index\": 4, \n      \"previous_hash\": \"66debccdbb8a3fb50191d975574e3dccfd3f52a63f98f982c2c7f7b9bec6f790\", \n      \"proof\": 8589, \n      \"timestamp\": \"2018-01-01 20:21:52.839584\", \n      \"transaction\": [\n        {\n          \"amount\": 1, \n          \"recipient\": \"aa68d377ecc04590b1b34860125aef53\", \n          \"sender\": \"0\"\n        }\n      ]\n    }, \n    {\n      \"hash\": \"fc925765db1936baa47fd4564edfed192d09835e72a24221da78f3e91c628853\", \n      \"index\": 5, \n      \"previous_hash\": \"73cc9163cefedc1d6cd5c2ebfdc7057e66c62ce609a8e0206404b94a923f4916\", \n      \"proof\": 5285, \n      \"timestamp\": \"2018-01-01 20:21:57.039765\", \n      \"transaction\": [\n        {\n          \"amount\": 1, \n          \"recipient\": \"aa68d377ecc04590b1b34860125aef53\", \n          \"sender\": \"0\"\n        }\n      ]\n    }, \n    {\n      \"hash\": \"f54896dfb14260edb02ab5d944d91046017140a3898c7740b3ecce07d30173c4\", \n      \"index\": 6, \n      \"previous_hash\": \"fc925765db1936baa47fd4564edfed192d09835e72a24221da78f3e91c628853\", \n      \"proof\": 10614, \n      \"timestamp\": \"2018-01-02 12:18:33.856492\", \n      \"transaction\": [\n        {\n          \"amount\": 100, \n          \"recipient\": \"testrecipient\", \n          \"sender\": \"testsender\"\n        }, \n        {\n          \"amount\": 100, \n          \"recipient\": \"testrecipient\", \n          \"sender\": \"testsender\"\n        }, \n        {\n          \"amount\": 1, \n          \"recipient\": \"2ef6a698265f4466bedfda16dcf5eb39\", \n          \"sender\": \"0\"\n        }\n      ]\n    }, \n    {\n      \"hash\": \"5b83cb83444f8aa03962e42028cee8ecd2835e376697f9f01a48f7a5ebab2002\", \n      \"index\": 7, \n      \"previous_hash\": \"f54896dfb14260edb02ab5d944d91046017140a3898c7740b3ecce07d30173c4\", \n      \"proof\": 1321, \n      \"timestamp\": \"2018-01-02 12:19:11.428488\", \n      \"transaction\": [\n        {\n          \"amount\": 1, \n          \"recipient\": \"2ef6a698265f4466bedfda16dcf5eb39\", \n          \"sender\": \"0\"\n        }\n      ]\n    }, \n    {\n      \"hash\": \"72d44b9660b08d855ca78cc563f5ce2fa6bd4e5ba01c19aae7a92bb50a227a5d\", \n      \"index\": 8, \n      \"previous_hash\": \"5b83cb83444f8aa03962e42028cee8ecd2835e376697f9f01a48f7a5ebab2002\", \n      \"proof\": 3464, \n      \"timestamp\": \"2018-01-02 12:20:07.982717\", \n      \"transaction\": [\n        {\n          \"amount\": 1, \n          \"recipient\": \"2ef6a698265f4466bedfda16dcf5eb39\", \n          \"sender\": \"0\"\n        }\n      ]\n    }\n  ], \n  \"message\": \"Our chain is authoritative\"\n}\n"}],"_postman_id":"9ff41cf4-b1bc-ab02-3f7c-d219fcc96795"},{"name":"http://localhost:5000/nodes/register","id":"105c82b3-89af-871c-920f-e491204fc5bc","request":{"method":"POST","header":[{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":"{\"nodes\": \"http://localhost:8888\"}"},"url":"http://localhost:5000/nodes/register","description":"<p>Register another node computer to this BlockChain.</p>\n<p>The \"nodes\" parameter posted will be the IP address of the node you wish to add. In this example, it is \"<a href=\"http://localhost:8888\">http://localhost:8888</a>\"</p>\n<p>Flask Python Code:</p>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code>#registers new nodes that will be tracked for consensus\n@node.route('/nodes/register', methods=['POST'])\ndef register_nodes():\n    values = request.get_json(force=\"true\")\n\n    nodes = values.get('nodes')\n\n    if nodes:\n        answer = values['nodes']\n        blockchain.register_node(answer)\n        print (\"true\")\n        \n        response = {\n        'message': 'New nodes have been added',\n        'total_nodes': list(blockchain.nodes),\n        }\n        return jsonify(response), 201\n        \n    else: \n        return \"Error: Please supply a valid list of nodes\", 400\n</code></pre>","urlObject":{"protocol":"http","port":"5000","path":["nodes","register"],"host":["localhost"],"query":[],"variable":[]}},"response":[{"id":"11f074e2-c935-4441-08dc-866099e36307","name":"http://localhost:5000/nodes/register","originalRequest":{"method":"POST","header":[{"key":"Content-Type","value":"application/json","disabled":false}],"body":{"mode":"raw","raw":"{\"nodes\": \"http://localhost:8888\"}"},"url":"http://localhost:5000/nodes/register"},"status":"CREATED","code":201,"_postman_previewlanguage":"json","header":[{"key":"Content-Length","value":"91","name":"Content-Length","description":""},{"key":"Content-Type","value":"application/json","name":"Content-Type","description":""},{"key":"Date","value":"Tue, 02 Jan 2018 20:21:42 GMT","name":"Date","description":""},{"key":"Server","value":"Werkzeug/0.13 Python/3.6.3","name":"Server","description":""}],"cookie":[],"responseTime":"40","body":"{\n  \"message\": \"New nodes have been added\", \n  \"total_nodes\": [\n    \"localhost:8888\"\n  ]\n}\n"}],"_postman_id":"105c82b3-89af-871c-920f-e491204fc5bc"},{"name":"http://localhost:5000/nodes/sync","id":"3de7c508-9519-5894-362d-b1b9d7c006f9","request":{"method":"POST","header":[{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":"{\"nodes\": \"http://localhost:8888\"}"},"url":"http://localhost:5000/nodes/register","description":"<p>Copies the chain of the posted node.</p>\n<p>Flask Python Code:</p>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code>#syncs this node with another node\n#sync means we will copy the current chain of the other node\n@node.route('/nodes/sync', methods=['POST'])\ndef get_current_chain():\n\n    value = request.get_json(force=\"true\")\n    \n    nodes = value.get(\"nodes\")\n    \n    if nodes:\n        answer = value['nodes']\n        parsed_url = urlparse(answer).netloc\n        \n        response = requests.get('http://{}/chain'.format(parsed_url))\n        \n        if response.status_code == 200:\n                length = response.json()['length']\n                blockchain.chain = response.json()['chain']  \n                \n                new_chain = {\n                    \"message\": \"Sync successful.\",\n                    \"chain\": blockchain.chain,\n                    \"length\": len(blockchain.chain)\n                }\n                \n                return jsonify(new_chain), 201\n</code></pre>","urlObject":{"protocol":"http","port":"5000","path":["nodes","register"],"host":["localhost"],"query":[],"variable":[]}},"response":[{"id":"31cd8663-78a1-7ace-2855-98a6668706bb","name":"http://localhost:5000/nodes/sync","originalRequest":{"method":"POST","header":[{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":"{\"nodes\": \"http://localhost:8888\"}"},"url":"http://localhost:5000/nodes/sync"},"status":"CREATED","code":201,"_postman_previewlanguage":"json","header":[{"key":"Content-Length","value":"3832","name":"Content-Length","description":""},{"key":"Content-Type","value":"application/json","name":"Content-Type","description":""},{"key":"Date","value":"Tue, 02 Jan 2018 20:34:09 GMT","name":"Date","description":""},{"key":"Server","value":"Werkzeug/0.13 Python/3.6.3","name":"Server","description":""}],"cookie":[],"responseTime":"68","body":"{\n  \"chain\": [\n    {\n      \"hash\": \"33d2e70bd8c020ef610b812004761459d7401057eaf724bed502ca7cfe47cbca\", \n      \"index\": 0, \n      \"previous_hash\": \"0\", \n      \"proof\": 28, \n      \"timestamp\": \"2018-01-01 12:43:59.046788\", \n      \"transaction\": \"Genesis Block\"\n    }, \n    {\n      \"hash\": \"f30363b2ebd68fceda861bef0137dbefad84aa1f3ffcf51167e1762987bcd3cd\", \n      \"index\": 1, \n      \"previous_hash\": \"33d2e70bd8c020ef610b812004761459d7401057eaf724bed502ca7cfe47cbca\", \n      \"proof\": 2548, \n      \"timestamp\": \"2018-01-01 12:44:15.113543\", \n      \"transaction\": [\n        {\n          \"amount\": 1, \n          \"recipient\": \"ad41b5254e024aab8eae2e061bc5c6b4\", \n          \"sender\": \"0\"\n        }\n      ]\n    }, \n    {\n      \"hash\": \"9d12f8f19fa7e7d82832af95c282a9f885641723e25fae6f500cf29085fc9a83\", \n      \"index\": 2, \n      \"previous_hash\": \"f30363b2ebd68fceda861bef0137dbefad84aa1f3ffcf51167e1762987bcd3cd\", \n      \"proof\": 2904, \n      \"timestamp\": \"2018-01-01 13:31:00.072867\", \n      \"transaction\": [\n        {\n          \"amount\": 1, \n          \"recipient\": \"0bf7decb82d3441aa7fa40c529ec3f9e\", \n          \"sender\": \"0\"\n        }\n      ]\n    }, \n    {\n      \"hash\": \"66debccdbb8a3fb50191d975574e3dccfd3f52a63f98f982c2c7f7b9bec6f790\", \n      \"index\": 3, \n      \"previous_hash\": \"9d12f8f19fa7e7d82832af95c282a9f885641723e25fae6f500cf29085fc9a83\", \n      \"proof\": 13005, \n      \"timestamp\": \"2018-01-01 18:08:36.452407\", \n      \"transaction\": [\n        {\n          \"amount\": 1, \n          \"recipient\": \"a1a98d4149774422ace13ebbfc680e38\", \n          \"sender\": \"0\"\n        }\n      ]\n    }, \n    {\n      \"hash\": \"da21df1b0d3c787ea479e61d53f573dac88d4e94a5f70a81bc62238e7bb16f8f\", \n      \"index\": 4, \n      \"previous_hash\": \"66debccdbb8a3fb50191d975574e3dccfd3f52a63f98f982c2c7f7b9bec6f790\", \n      \"proof\": 8589, \n      \"timestamp\": \"2018-01-01 18:29:20.948239\", \n      \"transaction\": [\n        {\n          \"amount\": 1, \n          \"recipient\": \"4510407b36314964bccd00d983244bcd\", \n          \"sender\": \"0\"\n        }\n      ]\n    }, \n    {\n      \"hash\": \"18c08cc8ffba7ed571676c17008f0a7fe37b47c84228edc1d637ce8c2e8708d7\", \n      \"index\": 5, \n      \"previous_hash\": \"da21df1b0d3c787ea479e61d53f573dac88d4e94a5f70a81bc62238e7bb16f8f\", \n      \"proof\": 212, \n      \"timestamp\": \"2018-01-01 18:29:37.212287\", \n      \"transaction\": [\n        {\n          \"amount\": 1, \n          \"recipient\": \"4510407b36314964bccd00d983244bcd\", \n          \"sender\": \"0\"\n        }\n      ]\n    }, \n    {\n      \"hash\": \"4052e92fd83a786461da178ae9cfea3cd56538a2ecaf5adb8eb1ea40be409dd9\", \n      \"index\": 6, \n      \"previous_hash\": \"18c08cc8ffba7ed571676c17008f0a7fe37b47c84228edc1d637ce8c2e8708d7\", \n      \"proof\": 3374, \n      \"timestamp\": \"2018-01-01 18:29:38.400348\", \n      \"transaction\": [\n        {\n          \"amount\": 1, \n          \"recipient\": \"4510407b36314964bccd00d983244bcd\", \n          \"sender\": \"0\"\n        }\n      ]\n    }, \n    {\n      \"hash\": \"d214bde07e0d431b5148c73bbf648213f5ad309b1ab3edf145385cda28e45204\", \n      \"index\": 7, \n      \"previous_hash\": \"4052e92fd83a786461da178ae9cfea3cd56538a2ecaf5adb8eb1ea40be409dd9\", \n      \"proof\": 215, \n      \"timestamp\": \"2018-01-01 18:29:39.534199\", \n      \"transaction\": [\n        {\n          \"amount\": 1, \n          \"recipient\": \"4510407b36314964bccd00d983244bcd\", \n          \"sender\": \"0\"\n        }\n      ]\n    }, \n    {\n      \"hash\": \"3134dffb5a9ab2cad1cf86d440b418558c17f0e9eed1f5a275926f58e7061abf\", \n      \"index\": 8, \n      \"previous_hash\": \"d214bde07e0d431b5148c73bbf648213f5ad309b1ab3edf145385cda28e45204\", \n      \"proof\": 4478, \n      \"timestamp\": \"2018-01-01 18:29:40.338079\", \n      \"transaction\": [\n        {\n          \"amount\": 1, \n          \"recipient\": \"4510407b36314964bccd00d983244bcd\", \n          \"sender\": \"0\"\n        }\n      ]\n    }\n  ], \n  \"length\": 9, \n  \"message\": \"Sync successful.\"\n}\n"}],"_postman_id":"3de7c508-9519-5894-362d-b1b9d7c006f9"},{"name":"http://localhost:5000/chain","id":"17103464-856f-1ef3-c7bf-70954529e53d","request":{"method":"GET","header":[],"body":{"mode":"raw","raw":""},"url":"http://localhost:5000/chain","description":"<p>Returns the current BlockChain of this node computer. </p>\n<p>Flask python code: </p>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code>    #returns the current blockchain of this node\n    @node.route('/chain', methods=['GET'])\n    def chain():\n        \n        response = {'length': len(blockchain.chain),\n                   'chain': blockchain.chain}\n        \n        file_object = open(text_path, 'wb')\n        pickle.dump(blockchain.chain, file_object)\n                \n        return jsonify(response), 200\n</code></pre>","urlObject":{"protocol":"http","port":"5000","path":["chain"],"host":["localhost"],"query":[],"variable":[]}},"response":[{"id":"799fe155-2ee9-fcac-1a37-57a051809460","name":"Sample Chain Request/Response","originalRequest":{"method":"GET","header":[],"body":{"mode":"raw","raw":""},"url":"http://localhost:5000/mine"},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"Content-Length","value":"503","name":"Content-Length","description":""},{"key":"Content-Type","value":"application/json","name":"Content-Type","description":""},{"key":"Date","value":"Tue, 02 Jan 2018 20:18:33 GMT","name":"Date","description":""},{"key":"Server","value":"Werkzeug/0.13 Python/3.6.3","name":"Server","description":""}],"cookie":[],"responseTime":"143","body":"{\n  \"index\": 6, \n  \"message\": \"New Block Added To Chain\", \n  \"previous_hash\": \"fc925765db1936baa47fd4564edfed192d09835e72a24221da78f3e91c628853\", \n  \"proof\": 10614, \n  \"transaction\": [\n    {\n      \"amount\": 100, \n      \"recipient\": \"testrecipient\", \n      \"sender\": \"testsender\"\n    }, \n    {\n      \"amount\": 100, \n      \"recipient\": \"testrecipient\", \n      \"sender\": \"testsender\"\n    }, \n    {\n      \"amount\": 1, \n      \"recipient\": \"2ef6a698265f4466bedfda16dcf5eb39\", \n      \"sender\": \"0\"\n    }\n  ]\n}\n"}],"_postman_id":"17103464-856f-1ef3-c7bf-70954529e53d"},{"name":"http://localhost:5000/transaction","id":"45aad0d2-4762-963e-96ee-6127fb9598ea","request":{"method":"POST","header":[],"body":{"mode":"raw","raw":"{\"sender\": \"testsender\", \"recipient\": \"testrecipient\", \"amount\": 100"},"url":"http://localhost:5000/transaction","description":"<p>Create a new transaction that will be stored in the next Block created.</p>\n<p>Flask python code:</p>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code>    #create a new transaction to be stored in the blockchain\n    \n    @node.route('/transaction', methods=['POST'])\n    def transaction():\n\n        if request.method == 'POST':\n            data = request.get_json(force=\"true\")\n            required = [\"sender\", \"recipient\", \"amount\"]\n            \n            if data['sender'] and data['recipient'] and data['amount']:     \n            \n                index = blockchain.new_transaction(data[\"sender\"], data[\"recipient\"], data[\"amount\"] )\n    \n                response = {'message: Transaction will be added to Block {}'.format(index)}\n    \n                return jsonify(data), 201\n            else:\n                return 'Wrong Transaction Format', 400\n</code></pre>","urlObject":{"protocol":"http","port":"5000","path":["transaction"],"host":["localhost"],"query":[],"variable":[]}},"response":[{"id":"bb6a26d4-3e05-70ce-9583-761bc6e4bf67","name":"Create Transaction Example","originalRequest":{"method":"POST","header":[],"body":{"mode":"raw","raw":"{\"sender\": \"testsender\", \"recipient\": \"testrecipient\", \"amount\": 100}"},"url":"http://localhost:5000/transaction"},"status":"CREATED","code":201,"_postman_previewlanguage":"json","header":[{"key":"Content-Length","value":"80","name":"Content-Length","description":""},{"key":"Content-Type","value":"application/json","name":"Content-Type","description":""},{"key":"Date","value":"Tue, 02 Jan 2018 20:16:45 GMT","name":"Date","description":""},{"key":"Server","value":"Werkzeug/0.13 Python/3.6.3","name":"Server","description":""}],"cookie":[],"responseTime":"44","body":"{\n  \"amount\": 100, \n  \"recipient\": \"testrecipient\", \n  \"sender\": \"testsender\"\n}\n"}],"_postman_id":"45aad0d2-4762-963e-96ee-6127fb9598ea"}],"event":[{"listen":"prerequest","script":{"id":"f6d3aa29-8655-4f1f-9455-a53e83b22e49","type":"text/javascript","exec":[""]}},{"listen":"test","script":{"id":"86050b19-7fc8-4031-85c5-805bca7f83df","type":"text/javascript","exec":[""]}}]}