Author

Topic: analyze TRX via CLI/Unix Shell (trx2txt) - now with SegWit (Read 1799 times)

sr. member
Activity: 257
Merit: 343
and some more update: the idea of smart contracts become more and more important... people seem to believe, smart contracts are a unique element of Ethereum or other altcoins, this is simply not true. Bitcoin and it's scripting language has these capabilities for a long time, and I thought I update my tx analyzer (tcls_tx2txt.sh) in a way, that the sig scripts display more than a block of some op_codes. The corresponding testcase file (tcls_testcases_tx2txt.sh) has testcase14 for latest SegWit tx, testcase16 and 17 for CLTV and CSV smart contracts, with examples from the forum here (and the links). Have fun, as usual the shell scripts are here:
https://github.com/pebwindkraft/trx_cl_suite
hero member
Activity: 692
Merit: 569
Good Job ! You may also want to have a look at this https://github.com/shivaenigma/bitcointools
sr. member
Activity: 257
Merit: 343
just another short update: as it is time to play with segwit, I have extended the tx analyzer (tcls_tx2txt.sh) with capabilities for SegWit. The decomposition would show now the details of any SegWit tx.
(as usual testcases are also included). 
sr. member
Activity: 257
Merit: 343
just modified title, as old tool (trx2txt) is discontinued.

Shell scripts for Linux, MacOS and OpenBSD are here:
https://github.com/pebwindkraft/trx_cl_suite

last added functionality was DER sig check, creation of transaction with multiple inputs, and calculation of fees. Here is a transaction with 53 TX Inputs:
https://blockchain.info/de/tx/a9895d9891c21e515a449245e60a97054716f68bd023622a69db80ed44c1e5e4?show_adv=true

Those who forked, may want to update.

Final help came from stackexchange (a very valuable ressource!), thx to the team running this environment:
http://bitcoin.stackexchange.com/questions/49661/signing-tx-with-openssl-but-fails-when-sending-with-bitcoin-qt-how-to-debug/49953#49953

thx.
sr. member
Activity: 420
Merit: 252
+1 good job Volker !
sr. member
Activity: 257
Merit: 343
Hi team(s)  Wink

I further improved the scripts, to include possibility for creating/signing transactions (cold storage!).
With some help (from here: https://bitcointalksearch.org/topic/re-coldstorage-and-manually-signing-a-trx-from-cli-using-openssl-solved-1535855) I did several fixes and updates, to also have improved portability.

Here is my last transaction with the tools, which I created on Mac OSX, put it on USB to my Cold Storage OpenBSD system, signed it, and brought it back to MAC OSX. Via blockchain.info's "pushtx" I sent it into the network.

https://blockchain.info/de/rawtx/4fc62561c97c15599831e13dbdbc2afc65d9526d116ed664036c147e55162d05

I am currently limited to one previous trx, and one output, for a P2PKH trx.

Code as usual here:
https://github.com/pebwindkraft/trx2txt

enjoy :-)
Volker
hero member
Activity: 521
Merit: 522
Developer - EthicHacker - BTC enthusiast
removed old link to zipped file, everything on github now.
Added a cool feature to directly load trx from network (blockchain.info):

./trx2txt.sh -vv -t 7264f8ba4a85a4780c549bf04a98e8de4c9cb1120cb1dfe8ab85ff6832eff864

have fun :-)

Volker




+1 - very good Volker. github and basically any versioning capable hosting for sources is the best you can do.. i will look at this the coming weekend. now saw its couple of files. will be great when you add little info in the readme about each script so we can have fast look/review.
sr. member
Activity: 257
Merit: 343
removed old link to zipped file, everything on github now.
Added a cool feature to directly load trx from network (blockchain.info):

./trx2txt.sh -vv -t 7264f8ba4a85a4780c549bf04a98e8de4c9cb1120cb1dfe8ab85ff6832eff864

have fun :-)

Volker


sr. member
Activity: 257
Merit: 343
sure, didn't get the security implications of a zipped file...
Here we go:

https://github.com/pebwindkraft/trx2txt

hero member
Activity: 521
Merit: 522
Developer - EthicHacker - BTC enthusiast
Hi,

thought I share my command line tool with the audience.
I wrote the script to better understand the transaction details.
I wanted to start with the python tools and perl tools, but had several issues on versions, links, required subtools, dependencies - after a day I got tired. I wanted to be able to analyze my trx on OpenBSD, MAC OS X and SuSE Linux. No tool could provide this, so I thought I'd give it a try. Need some POSIX compliance here...

- the script (trx2txt.sh) produces a transaction output similiar to the JSON outputs that can be found on blockchain.info.
- it shows the OpCodes of the TRX_IN sig scripts and TRX_OUT public key scripts (hex values)
- shows type of transaction script (P2PKH, P2SH, MULTISIG, ...)
- it shows the corresponding bitcoin address (hash).
- there is a detailed README with the file, supporting doc and state machine picture (and each script is heavily commented)
- there are test cases included

The link is here:

link removed from OP

The code is not (yet?) beautified, nor made for performance reasons...
And yes, there is room for improvement  Grin

enjoy!

you could provide the script on a gist or on github. Why on earth you zip a simple shell script?

@all readers - as always: BE CAUTIOS when downloading any files from untrusted sources. They can contain VIRUS and WALLETSTEALING software. Never trust nobody!
sr. member
Activity: 257
Merit: 343
Hi,

thought I share my command line tool with the audience.
I wrote the script to better understand the transaction details.
I wanted to start with the python tools and perl tools, but had several issues on versions, links, required subtools, dependencies - after a day I got tired. I wanted to be able to analyze my trx on OpenBSD, MAC OS X and SuSE Linux. No tool could provide this, so I thought I'd give it a try. Need some POSIX compliance here...

- the script (trx2txt.sh) produces a transaction output similiar to the JSON outputs that can be found on blockchain.info.
- it shows the OpCodes of the TRX_IN sig scripts and TRX_OUT public key scripts (hex values)
- shows type of transaction script (P2PKH, P2SH, MULTISIG, ...)
- it shows the corresponding bitcoin address (hash).
- there is a detailed README with the file, supporting doc and state machine picture (and each script is heavily commented)
- there are test cases included

The link is here:

nowarra.ch/Volker/160610_TRX2TXT.zip (removed 15June2016)

The code is not (yet?) beautified, nor made for performance reasons...
And yes, there is room for improvement  Grin

enjoy!
Jump to: