Created
June 7, 2019 12:16
-
-
Save hal0x2328/0eefd313df100291a03707029b6ee7b0 to your computer and use it in GitHub Desktop.
deserialize raw Neo transaction
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
from neocore.IO.BinaryReader import BinaryReader | |
from neo.IO.MemoryStream import StreamManager | |
from neo.Core.TX.InvocationTransaction import InvocationTransaction | |
from neo.Core.TX.Transaction import Transaction | |
import binascii | |
import json | |
import io | |
tx = "d1012200c10a6d696e74546f6b656e73672723c89fa24b31b843a1a6ce5107537002cf4537000000000000000001202723c89fa24b31b843a1a6ce5107537002cf45370193cd3306b4ad6144fcec91b5f6772f51c844ae1b1ecfee8969e03f3f9e1872b2000001e72d286979ee6cb1b7e65dfddfb2e384100b8d148e7758de42e4168b71792c6000e1f505000000002723c89fa24b31b843a1a6ce5107537002cf453702020000004140d4d4004a87a60119406bf7f5acb5d715b780005efa98257a3a62301f0373ab73c89682e8c7f00d2fb124057df73a822ea858eaf3dec7c9091f563b165a4f79ec232103dfb8520394226e2039bc1592b3af2f9a0d485cf04158d8f5cd09e18628ce8231ac" | |
stream = StreamManager.GetStream(data=binascii.unhexlify(tx)) | |
reader = BinaryReader(stream) | |
tx = Transaction.DeserializeFrom(reader) | |
print(json.dumps(tx.ToJson(), indent=4)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment