create account

[piston] Howto use it for coldstorage by xeroc

View this thread on: hive.blogpeakd.comecency.com
· @xeroc · (edited)
$524.07
[piston] Howto use it for coldstorage
With release 0.3.2, piston now supports **offline signing** for coldstorage. The procedure consists of three basic steps.

1. **preparation of the (unsigned) transaction**
2. **offline signing of the transaction**
3. **broadcasting of the signed transaction**

Let's go through the details real quick:

## preparation of the (unsigned) transaction

Any transaction that piston can do (post, reply, edit, upvote, downvote, transfer, powerup, powerdown, powerdownroute, convert, allow, disallow, newaccount, updatememokey, etc.) can be generated **without** actually signing them using the `-x` flag. The command will return a couple lines (JSON format) and all you need to do is store those in a file and carry them over to your offline computer.

**Important remark**: The default expiration time for transaction is **30 seconds**. Apparently, nobody will be able to carry the transaction to an offline computer, sign them and move them back to the online computer within 30 seconds, you can increase the expiration to 5 minutes by adding `-e 300` (300 seconds = 5 minutes)!

```
$ piston -e 300 -x transfer fabian 0.1 SBD > unsigned-transaction.json
```

This gives you 5 minutes for your procedure. If you can't make it in 5 minutes, increase the `300` and try again.

### Technical details

A simple example looks like this:

```
$ piston -x -e 300 transfer fabian 0.1 SBD
{'expiration': '2016-09-07T08:17:19',
 'extensions': [],
 'operations': [['transfer',
                 {'amount': '0.100 SBD',
                  'from': 'xeroc',
                  'memo': '',
                  'to': 'fabian'}]],
 'ref_block_num': 38340,
 'ref_block_prefix': 336529008,
 'signatures': [],
 [...]
}
```

That is the **basic** transaction and you see that the `signatures` are empty. In order to make it easier for the offline machine to sign your transaction, there are a few more informations returned, namely:

```
{
 [...]
 'missing_signatures': ['STM6quoHiVnmiDEXyz4fAsrNd28G6q7qBCitWbZGo4pTfQn8SwkzD',
                        'STM8HCf7QLUexogEviN8x1SpKRhFwg2sc8LrWuJqv7QsmWrua6ZyR'],
 'required_authorities': {'fabian': {'account_auths': [],
                                     'key_auths': [['STM8HCf7QLUexogEviN8x1SpKRhFwg2sc8LrWuJqv7QsmWrua6ZyR',
                                                    1]],
                                     'weight_threshold': 1},
                          'xeroc': {'account_auths': [['fabian', 1]],
                                    'key_auths': [['STM6quoHiVnmiDEXyz4fAsrNd28G6q7qBCitWbZGo4pTfQn8SwkzD',
                                                   1]],
                                    'weight_threshold': 2}},
}
```

This data allows to identify the required keys without the need for an internet connection (e.g. on you offline computer).

## offline signing of the transaction

With the unsigned transaction, you can go to your offline computer and have it signed using your key there by using:
```
piston sign --file unsigned-transaction.json > signed-transaction.json
```
The command will return the signed transaction which will look like this:
```
{'expiration': '2016-09-07T08:25:48',
 'extensions': [],
 'operations': [['transfer',
                 {'amount': '0.001 SBD',
                  'from': 'xeroc',
                  'memo': '',
                  'to': 'fabian'}]],
 'ref_block_num': 38510,
 'ref_block_prefix': 3441950962,
 'signatures': ['2071716bc5655d5327524004e33d340757cae067fcd30728484c21c605e26e3d0b548ca8b433af3037246084e67addbb726f45ef8d3fdb6e6b3e81415899bd762c']}
```

Carry this transaction to an internet connected computer and go to the next step.

## broadcasting of the signed transaction

The signed transaction can easily be broadcast to the network/blockchain by using
```
piston broadcast --file signed-transaction.json
```
Unless you obtain an error, your transaction was transmitted to the network and will shortly after be added to a block.

Congratulations!
👍  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and 175 others
👎  
properties (23)
authorxeroc
permlinkpiston-howto-use-it-for-coldstorage
categorypiston
json_metadata{"tags":["piston","coldstorage","security"]}
created2016-09-07 08:27:33
last_update2016-09-07 08:39:12
depth0
children9
last_payout2016-10-08 16:02:54
cashout_time1969-12-31 23:59:59
total_payout_value493.454 HBD
curator_payout_value30.618 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length3,948
author_reputation118,819,064,085,695
root_title"[piston] Howto use it for coldstorage"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id1,156,585
net_rshares75,473,693,560,663
author_curate_reward""
vote details (240)
@cryptomental ·
Thank you for providing the technical details on how it works under the hood. Much appreciated.
properties (22)
authorcryptomental
permlinkre-xeroc-piston-howto-use-it-for-coldstorage-20160907t082934530z
categorypiston
json_metadata{"tags":["piston"]}
created2016-09-07 08:29:36
last_update2016-09-07 08:29:36
depth1
children0
last_payout2016-10-08 16:02:54
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length95
author_reputation6,756,831,217,523
root_title"[piston] Howto use it for coldstorage"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id1,156,600
net_rshares0
@cryptomental · (edited)
A question: what is the  maximum expiration time for a transaction? Can it be set e.g. to 24 hours? Or is it just 5 minutes?
properties (22)
authorcryptomental
permlinkre-xeroc-piston-howto-use-it-for-coldstorage-20160907t083155176z
categorypiston
json_metadata{"tags":["piston"]}
created2016-09-07 08:31:57
last_update2016-09-07 08:33:30
depth1
children2
last_payout2016-10-08 16:02:54
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length124
author_reputation6,756,831,217,523
root_title"[piston] Howto use it for coldstorage"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id1,156,622
net_rshares0
@xeroc ·
$0.16
That is actually an EXCELLENT question! This is what the code says:

```
#define STEEMIT_MAX_TIME_UNTIL_EXPIRATION       (60*60) // seconds,  aka: 1 hour
```
👍  
properties (23)
authorxeroc
permlinkre-cryptomental-re-xeroc-piston-howto-use-it-for-coldstorage-20160907t084113484z
categorypiston
json_metadata{"tags":["piston"]}
created2016-09-07 08:41:12
last_update2016-09-07 08:41:12
depth2
children1
last_payout2016-10-08 16:02:54
cashout_time1969-12-31 23:59:59
total_payout_value0.162 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length157
author_reputation118,819,064,085,695
root_title"[piston] Howto use it for coldstorage"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id1,156,676
net_rshares404,776,631,366
author_curate_reward""
vote details (1)
@cryptomental ·
Ok, thanks!
properties (22)
authorcryptomental
permlinkre-xeroc-re-cryptomental-re-xeroc-piston-howto-use-it-for-coldstorage-20160907t084248399z
categorypiston
json_metadata{"tags":["piston"]}
created2016-09-07 08:42:51
last_update2016-09-07 08:42:51
depth3
children0
last_payout2016-10-08 16:02:54
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length11
author_reputation6,756,831,217,523
root_title"[piston] Howto use it for coldstorage"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id1,156,683
net_rshares0
@cynetyc ·
Interesting!
I dunno much about the subject but  I am curious to know more  so I followed you @xeroc
👍  
properties (23)
authorcynetyc
permlinkre-xeroc-piston-howto-use-it-for-coldstorage-20160907t082951893z
categorypiston
json_metadata{"tags":["piston"],"users":["xeroc"]}
created2016-09-07 08:29:54
last_update2016-09-07 08:29:54
depth1
children0
last_payout2016-10-08 16:02:54
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length100
author_reputation108,708,138,206,157
root_title"[piston] Howto use it for coldstorage"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id1,156,604
net_rshares108,908,119
author_curate_reward""
vote details (1)
@doitvoluntarily ·
lol read it and thought it said prison..
properties (22)
authordoitvoluntarily
permlinkre-xeroc-piston-howto-use-it-for-coldstorage-20160907t083026432z
categorypiston
json_metadata{"tags":["piston"]}
created2016-09-07 08:30:27
last_update2016-09-07 08:30:27
depth1
children0
last_payout2016-10-08 16:02:54
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length40
author_reputation1,412,689,148,080,496
root_title"[piston] Howto use it for coldstorage"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id1,156,607
net_rshares0
@gekko ·
this keeps getting more interesting @xeroc 8]
👍  
properties (23)
authorgekko
permlinkre-xeroc-piston-howto-use-it-for-coldstorage-20160907t084331996z
categorypiston
json_metadata{"tags":["piston"],"users":["xeroc"]}
created2016-09-07 08:43:33
last_update2016-09-07 08:43:33
depth1
children0
last_payout2016-10-08 16:02:54
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length45
author_reputation1,185,517,433,922
root_title"[piston] Howto use it for coldstorage"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id1,156,692
net_rshares2,062,724,006
author_curate_reward""
vote details (1)
@l0k1 ·
Nice feature. A friend of mine is always talking about offline signing for bitcoin transactions. If someone is running a service like an exchange or other trusted third party, cold storage and offline signing are essential for reducing the chances of a network breach.
properties (22)
authorl0k1
permlinkre-xeroc-piston-howto-use-it-for-coldstorage-20160907t083605225z
categorypiston
json_metadata{"tags":["piston"]}
created2016-09-07 08:36:06
last_update2016-09-07 08:36:06
depth1
children1
last_payout2016-10-08 16:02:54
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length268
author_reputation94,800,257,230,993
root_title"[piston] Howto use it for coldstorage"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id1,156,644
net_rshares0
@xeroc ·
$0.16
you may want to also read the other post that came after this one:
[[piston] How to use it for multisignature accounts](/piston/@xeroc/piston-how-to-use-it-for-multisignature-accounts)
👍  ,
properties (23)
authorxeroc
permlinkre-l0k1-re-xeroc-piston-howto-use-it-for-coldstorage-20160907t094632731z
categorypiston
json_metadata{"tags":["piston"],"links":["/piston/@xeroc/piston-how-to-use-it-for-multisignature-accounts"]}
created2016-09-07 09:46:33
last_update2016-09-07 09:46:33
depth2
children0
last_payout2016-10-08 16:02:54
cashout_time1969-12-31 23:59:59
total_payout_value0.162 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length184
author_reputation118,819,064,085,695
root_title"[piston] Howto use it for coldstorage"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id1,157,034
net_rshares404,778,141,591
author_curate_reward""
vote details (2)