比特币-红宝石宝石每次都会生成相同的地址? [英] Bitcoin-ruby gem generating same address every time?
问题描述
我正在尝试使用bitcoin-ruby
gem从我的公开比特币地址创建一个用于付款交易的新地址.
我可以使用pubkey_to_address
方法执行此操作.但是,每次我运行该方法时,结果地址payment_address
都是相同的.每次诸如blockchain.info之类的服务都会返回一个不同的地址,这与我的要求更加一致.
Bitcoin-ruby github参考
https://github.com/lian/bitcoin-ruby/blob/master/lib/bitcoin.rb#L128
我的代码在下面
require 'bitcoin'
ORIGIN_ADDRESS = "1BjxMfaBpsXu8AnAA44TTgopWuE6QamvCQ"
payment_address = Bitcoin::pubkey_to_address(ORIGIN_ADDRESS)
puts payment_address
# => "171GYkox1rWqNf8skyK2Aw9EAnVJ1wPwKf"
有了@Thilo的反馈,我现在明白了.我一直在使用的服务正在抽象一个事实,即正在使用新的私钥生成新的接收者"地址,该私钥会在区块链上确认交易时自动转发回我提供给他们的比特币地址.
正如Thilo所指出的,我应该为每个事务使用新的pub/priv键,并尽可能使私钥处于脱机状态.然后,可以将该私钥用于将来的比特币交易,并使用支付给公共地址的资金进行支付.
我要去那里..谢谢
I am trying to use the bitcoin-ruby
gem to create a new address for payment transactions from my public Bitcoin Address.
I am able to use the pubkey_to_address
method to do this. However, each time I run the method the resulting address, payment_address
, is the same. Services such as blockchain.info return a different address each time which is more consistent with my requirement.
Bitcoin-ruby github reference
https://github.com/lian/bitcoin-ruby/blob/master/lib/bitcoin.rb#L128
My Code is below
require 'bitcoin'
ORIGIN_ADDRESS = "1BjxMfaBpsXu8AnAA44TTgopWuE6QamvCQ"
payment_address = Bitcoin::pubkey_to_address(ORIGIN_ADDRESS)
puts payment_address
# => "171GYkox1rWqNf8skyK2Aw9EAnVJ1wPwKf"
With @Thilo's feedback I now understand this. The services that I had been using were abstracting the fact that the were generating new "receiver" address with new private key that automatically forwards back to the Bitcoin address I provided them when a transaction was confirmed on block chain.
As Thilo points out, I should use new pub/priv key for each transaction and keep the priv key offline if at all possible. This priv key can then be used for future Bitcoin transactions against funds paid to the public address.
I'm getting there.. thanks
这篇关于比特币-红宝石宝石每次都会生成相同的地址?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!