Skip to content

Instantly share code, notes, and snippets.

@xeroc
Created August 21, 2018 08:43
Show Gist options
  • Save xeroc/ffd50faf75b45d5ef8cba356864329a7 to your computer and use it in GitHub Desktop.
Save xeroc/ffd50faf75b45d5ef8cba356864329a7 to your computer and use it in GitHub Desktop.
import requests
from pprint import pprint
url = "http://206.189.110.191:9880"
x = {
"method": "call",
"params": [0,
"get_transaction_hex",
[{"ref_block_num": 34294,
"ref_block_prefix": 3707022213,
"expiration": "2016-04-06T08:29:27",
"operations": [[7,
{"fee": {"amount": 0,
"asset_id": "1.3.0"},
"authorizing_account": "1.2.0",
"account_to_list": "1.2.1",
"new_listing": 1,
"extensions": []}]],
"extensions": [],
"signatures": ["1f12f0e62577a646a1d0309b3ad083073780462821a364e8205fab19458e9d27b30707052a0ed9ab6d9477da59427ce6c005ca51dff9744431e3e8ec39547e2b10"]}]],
"jsonrpc": "2.0",
"id": 6
}
# let's obtain the transaction hex from the ledger node
ret = requests.post(url, json=x).json()
original = ret["result"]
# Let's change the transactions and re-obtain the transaction hex
x["params"][2][0]["operations"][0][1]["account_to_list"] = "1.2.3"
x["params"][2][0]["operations"][0][1]["new_listing"] = 2
ret = requests.post(url, json=x).json()
changed = ret["result"]
print("Original: {}".format(original))
print("Changed: {}".format(changed))
print("Only Transaction (orig): {}".format(original[:-130]))
print("Only Transaction (chan): {}".format(changed[:-130]))
print("Are they equal? {}".format("Yes!" if (original == changed) else "No!"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment