**New:** - [Docs] Added Transactions docs - [Transactions] Python Processing and Signing of Transactions - [Transactions] Allow for signing of Comments **Bugs fixed:** - [Examples] Update Examples - [Account] Fixed missing prefix - [Examples] Updates - [API] Fix get_account - [API] background cleanup and 'wallet'/'node' references ## Manual Constructing and Signing of Transactions The new *transactions* feature allows to manually construct, sign and broadcast transactions using python3. That means that no `cli_wallet` is required any longer. ### Loading Transactions Class We load the class for manual transaction construction via: ```python from steembase import transactions ``` ### Construction Now we can use the predefined transaction formats, e.g. ``vote`` or ``comment`` as follows: 1. define the expiration time 2. define a JSON object that contains all data for that transaction 3. load that data into the corresponding **operations** class 4. collect multiple operations 5. get some blockchain parameters to prevent replay attack 6. Construct the actual **transaction** from the list of operations 7. sign the transaction with the corresponding private key(s) #### Example A: Vote ```python expiration = transactions.formatTimeFromNow(60) op = transactions.Vote( **{"voter": voter, "author": message["author"], "permlink": message["permlink"], "weight": int(weight)} ) ops = [transactions.Operation(op)] ref_block_num, ref_block_prefix = transactions.getBlockParams(rpc) tx = transactions.Signed_Transaction(ref_block_num=ref_block_num, ref_block_prefix=ref_block_prefix, expiration=expiration, operations=ops) tx = tx.sign([wif]) ``` #### Example A: Comment ```python # Expiration time 60 seconds in the future expiration = transactions.formatTimeFromNow(60) op = transactions.Comment( **{"parent_author": parent_author, "parent_permlink": parent_permlink, "author": author, "permlink": postPermlink, "title": postTitle, "body": postBody, "json_metadata": ""} ) ops = [transactions.Operation(op)] ref_block_num, ref_block_prefix = transactions.getBlockParams(rpc) tx = transactions.Signed_Transaction(ref_block_num=ref_block_num, ref_block_prefix=ref_block_prefix, expiration=expiration, operations=ops) tx = tx.sign([wif]) ``` ### Broadcasting For broadcasting, we first need to convert the transactions class into a JSON object. After that, we can braodcast this to the network: ```python # Convert python class to JSON tx = transactions.JsonObj(tx) # Broadcast JSON to network rpc.broadcast_transaction(tx, api="network_broadcast"): ```
author | xeroc |
---|---|
permlink | python-steem-v0-1-1 |
category | steem |
json_metadata | {} |
created | 2016-04-25 12:36:36 |
last_update | 2016-04-25 12:36:36 |
depth | 0 |
children | 3 |
last_payout | 2016-08-18 10:29:45 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 31.460 HBD |
curator_payout_value | 31.458 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 2,907 |
author_reputation | 118,819,064,085,695 |
root_title | "Python Steem Libraries 0.1.1" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 787 |
net_rshares | 26,139,251,018,212 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
barrie | 0 | 0 | 100% | ||
rainman | 0 | 16,593,109,000,000 | 100% | ||
nextgenwitness | 0 | 257,728,581,923 | 100% | ||
xeldal | 0 | 206,534,000,000 | 100% | ||
enki | 0 | 4,968,859,000,000 | 100% | ||
justin | 0 | 746,404,507,692 | 100% | ||
nextgencrypto | 0 | 1,276,729,529,516 | 100% | ||
roadscape | 0 | 551,098,735,900 | 100% | ||
xeroc | 0 | 782,125,000,000 | 100% | ||
clayop | 0 | 582,821,000,000 | 100% | ||
au1nethyb1 | 0 | 151,776,000,000 | 100% | ||
abka1 | 0 | 2,507,000,000 | 100% | ||
mineralwasser | 0 | 0 | 100% | ||
boombastic | 0 | 0 | 100% | ||
mrs.agsexplorer | 0 | 0 | 100% | ||
rnglab | 0 | 15,522,797,453 | 100% | ||
bingo-0 | 0 | 0 | 100% | ||
bingo-1 | 0 | 0 | 100% | ||
steemoholic | 0 | 653,757,854 | 100% | ||
hcf27 | 0 | 692,450,944 | 100% | ||
sir | 0 | 592,786,525 | 100% | ||
murh | 0 | 1,807,759,532 | 33.01% | ||
rubybian | 0 | 0 | 100% | ||
ripexz | 0 | 230,109,097 | 100% | ||
alex.chien | 0 | 0 | 100% | ||
luke490 | 0 | 59,001,776 | 100% |
I know it's been a long time, but what exactly is expiration? I keep getting expiration errors...
author | dercoco |
---|---|
permlink | re-xeroc-python-steem-v0-1-1-20160731t223802582z |
category | steem |
json_metadata | {"tags":["steem"]} |
created | 2016-07-31 22:39:03 |
last_update | 2016-07-31 22:39:03 |
depth | 1 |
children | 2 |
last_payout | 2016-08-18 10:29:45 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 98 |
author_reputation | 2,425,825,242,028 |
root_title | "Python Steem Libraries 0.1.1" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 521,778 |
net_rshares | 902,745,498 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
dercoco | 0 | 902,745,498 | 100% |
The expiration is meant for the network to make sure a unconfirmed transactions is not added if it is expired. I think should cannot use an expiration time larger than 30 seconds
author | xeroc |
---|---|
permlink | re-dercoco-re-xeroc-python-steem-v0-1-1-20160802t073430189z |
category | steem |
json_metadata | {"tags":["steem"]} |
created | 2016-08-02 07:34:30 |
last_update | 2016-08-02 07:34:30 |
depth | 2 |
children | 1 |
last_payout | 2016-08-18 10:29:45 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 1.312 HBD |
curator_payout_value | 0.001 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 178 |
author_reputation | 118,819,064,085,695 |
root_title | "Python Steem Libraries 0.1.1" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 554,226 |
net_rshares | 1,463,995,826,466 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
anonymous | 0 | 1,442,028,444,055 | 100% | ||
fury | 0 | 17,393,694,296 | 100% | ||
auxon | 0 | 3,603,869,663 | 100% | ||
auxonoxua | 0 | 18,037,211 | 100% | ||
dercoco | 0 | 951,781,241 | 100% |
Thank you, I have figured out the problem now. I had use my own node to be able to go back in time for more than just 30 seconds.
author | dercoco |
---|---|
permlink | re-xeroc-re-dercoco-re-xeroc-python-steem-v0-1-1-20160802t082916033z |
category | steem |
json_metadata | {"tags":["steem"]} |
created | 2016-08-02 08:30:15 |
last_update | 2016-08-02 08:30:15 |
depth | 3 |
children | 0 |
last_payout | 2016-08-18 10:29:45 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 129 |
author_reputation | 2,425,825,242,028 |
root_title | "Python Steem Libraries 0.1.1" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 554,826 |
net_rshares | 0 |