#!/usr/bin/env bash ## When in doubt just write a shell script ## new registration request ## should fail because foobar is not a student curl --request POST \ --header 'Content-Type: application/json' \ --data '{ "student_id": "foobar", "public_key": "not_implemented_yet" }' \ http://localhost:8080/register ## new registration request ## this student can hold a gradecoin account curl --request POST \ --header 'Content-Type: application/json' \ --data '{ "student_id": "e254275", "public_key": "not_implemented_yet" }' \ http://localhost:8080/register ## new transaction curl --request POST \ --header 'Content-Type: application/json' \ --data '{ "by": "old_transaction_hash_1", "source": "old_transaction_hash_1", "target": "target_account", "amount": 20, "timestamp": "2021-04-09T01:30:30" }' \ http://localhost:8080/transaction ## new transaction curl --request POST \ --header 'Content-Length: 36864' \ --data '{ "source": "old_transaction_hash_2", "target": "target_account", "amount": 20, "timestamp": "2021-04-09T01:31:30" }' \ http://localhost:8080/transaction ## new transaction curl --request POST \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer arstarst.arstarst.arstarst' \ --data '{ "by": "e254275", "source": "old_transaction_hash_3", "target": "target_account", "amount": 20, "timestamp": "2021-04-09T01:32:30" }' \ http://localhost:8080/transaction printf "\n\nList of current transactions\n\n" ## list transactions curl localhost:8080/transaction curl --header "Content-Type: application/json" \ --header "Authorization: aaa.bbb.ccc" \ --request POST \ --data '{ "transaction_list": [ "old_transaction_hash_1", "old_transaction_hash_2", "old_transaction_hash_3" ], "nonce": 0, "timestamp": "2021-04-08T12:30:30", "hash": "not_a_thing_yet" }' \ http://localhost:8080/block printf "\n\nShould be scooped up by the block\n\n" ## list transactions curl localhost:8080/transaction curl --request POST \ --header 'Content-Type: application/json' \ --data '{ "source": "source_account", "target": "target_account", "amount": 20, "timestamp": "2021-04-09T01:30:30" }' \ http://localhost:8080/transaction printf "\n\nShould have only one transaction\n\n" curl localhost:8080/transaction printf "\n\nShould have only one block\n\n" curl localhost:8080/block ## new registration request ## this student can hold a gradecoin account curl --request POST \ --header 'Content-Type: application/json' \ --data '{ "student_id": "e254275", "public_key": "not_implemented_yet" }' \ http://localhost:8080/register curl --request POST \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0aGEiOiIyYjY0OGZmYWI1ZDlhZjFkNWQ1ZmMwNTJmYzllNTFiODgyZmM0ZmIwYzk5ODYwOGM5OTIzMmY5MjgyMDAwMDAwIiwiaWF0IjoxNjE4MzYwNjQxLCJleHAiOjE3MTgyNjA2NDF9.P5L_uZ9lOhRZCbsG9GDXn_rmZat3dP9Y2lbk8GY4Kg4pOxJIklBUxot-TtJzB0vEJFcjnxVnT2lFLCgfdQLHTJvURiW0KRHi94e1Kj8aDXxJ0qjlq4-c1JCZnAIbDpvkFtHNKz04yfyeSR2htJ6kOjlqVpeUhLVokHhi1x-ZUZZSpeGnlIXgi-AcmkEoyOypZGSZgQ1hjID2f18zgfbshgPK4Dr0hiN36wYMB0y0YiikRbvDuGgDzRLN2nitih46-CXTGZMqIRz3eAfM2wuUSH1yhdKi5_vavz8L3EPVCGMO-CKlPUDkYA-duQZf_q3tG2fkdaFlTAcCik_kVMprdw' \ --data '{ "transaction_list": [ "e254275" ], "nonce": 2151653522, "timestamp": "2021-04-13T23:38:00", "hash": "000000a996ab57b3aff1ad1d009767278f819895b28ef860a8ec3b6560d6ed0e" }' \ http://localhost:8080/block curl --request POST \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0aGEiOiIyYjY0OGZmYWI1ZDlhZjFkNWQ1ZmMwNTJmYzllNTFiODgyZmM0ZmIwYzk5ODYwOGM5OTIzMmY5MjgyMDAwMDAwIiwiaWF0IjoxNjE4MzYwNjQxLCJleHAiOjE3MTgyNjA2NDF9.P5L_uZ9lOhRZCbsG9GDXn_rmZat3dP9Y2lbk8GY4Kg4pOxJIklBUxot-TtJzB0vEJFcjnxVnT2lFLCgfdQLHTJvURiW0KRHi94e1Kj8aDXxJ0qjlq4-c1JCZnAIbDpvkFtHNKz04yfyeSR2htJ6kOjlqVpeUhLVokHhi1x-ZUZZSpeGnlIXgi-AcmkEoyOypZGSZgQ1hjID2f18zgfbshgPK4Dr0hiN36wYMB0y0YiikRbvDuGgDzRLN2nitih46-CXTGZMqIRz3eAfM2wuUSH1yhdKi5_vavz8L3EPVCGMO-CKlPUDkYA-duQZf_q3tG2fkdaFlTAcCik_kVMprdw' \ --data '{ "transaction_list": [], "nonce": 2151653522, "timestamp": "2021-04-13T23:38:00", "hash": "000000a996ab57b3aff1ad1d009767278f819895b28ef860a8ec3b6560d6ed0e" }' \ http://localhost:8080/block