使用steempy生成交易(transaction)、签名交易以及广播交易

in #cn6 years ago

假设我们这样一种复杂的需求,一个多重签名账户,需要进行一笔交易,比如转账给别人。

那么我们需要对这个操作进行签名的权重超过阈值,这样说可能有些复杂,举个例子:
一个账户由三个账户控制,进行某项操作时,必须两个以上账户同意。

好了,今天要说的不是多重签名账户咋玩,而是假设我们有上述需求,那么如何对操作进行签名呢?STEEMIT官方网站肯定不行啦,没有这个接口。所以今天我要介绍使用steempy来进行这些操作。


生成交易(transaction)

首先,我们要生成交易数据:
假设oflyhigh.test是一个多重签名账户(实则它不是,但不影响我们讲解),我们要从这个账户转出一笔巨款给oflyhigh

我们可以使用如下指令生成交易数据
steempy --expires 600 -d -x transfer --account oflyhigh.test oflyhigh 0.001 SBD > t1.txt

  • -d 表示不广播
  • -e 表示不签名
  • --expires 600 表示交易超级时间为600秒

打开文件,可见交易数据如下:

签名交易(transaction)

接下来我们对交易进行签名。

steempy sign --file t1.txt > s1.txt

签名成功后的数据如下:

我们这里oflyhigh.test并不是多重签名账户,如果是多重签名账户,那么操作流程如下:

  • 用户1 执行 steempy sign --file t1.txt > s1.txt
  • 用户2 执行 steempy sign --file s1.txt > s2.txt
  • 用户3执行 steempy sign --file s2.txt > s3.txt

依次类推,就是把前一个用户的输出作为输入,继续签名。

广播交易(transaction)

最后这个步骤简单多了,执行以下指令即可:
steempy broadcast --file s1.txt
s1.txt是最终签名生成的文件,因为我们实际上只签了一次,所以是s1.


查看steemd.com,得知我们的操作很成功。

总结

使用steempy,可以很轻易的生成交易,并对其进行签名以及广播。这个可以用于多重签名账户,让每个账户分别签名。

Sort:  

I like cn post i m pakistani but like chines post & foods

Nice post. U also see my blogs and upvote my post.

done my post vote me and reply msg

The Vote For Your Awesome Post Has Just Arrived!


This post has been voted with the use of SteemiTag. Feel free to upvote this comment if you’d like to express your support for our cause. Conversely, if you don’t want to receive any more votes from SteemiTag, please respond to this comment by writing NOVOTES.

SteemiTag is an innovative program that helps users increase their gains in the curation rewards by voting on posts that are likely to get high payouts. It maximizes the chance of a user to be rewarded through an accurate selection algorithm that works 24/7 and eliminates "no rewards" problem for users with low Steem Power. You can participate in our program by clicking on this link and confirming your delegation. Your rewards will be sent to you in the form of weekly dividends. Thank you and keep up with your great work!

English please @oflyhigh 😂😂😂

Thanks for your great post I appreciate your post but sir writing language I don't understood if you write English post really I am learn easily and am I also happy for your post @oflyhigh ✌✌

O哥,请教一个问题:我昨天通过blocktrades往p网充值,结果到现在还没到账,p网让我提供transaction ID,可是我现在只记得给blocktrades转账时的memo,怎样才能找回我的transaction ID呢?找不回来的话我往p网充值的bts就泡汤了,求助o哥!非常感谢

呃,你是通过bt转p网
那p网要的应该是bt转给它的txid
你联系一下bt吧

谢谢O哥的指教!

我找到了一串字符 Tx 0e4d940769ee213a2453c3fd6a9a1fd5f7fa59db@22270914 不知道这是不是所谓的transaction id?

good instructions for better transaction. upvote @oflyhigh

muzakirpb upvote, posting is perfect

Coin Marketplace

STEEM 0.29
TRX 0.12
JST 0.032
BTC 63724.53
ETH 3071.11
USDT 1.00
SBD 3.98