我一直在尝试在potcoind守护程序上从CLI构建简单事务。我已经遵循了很多教程和示例,我觉得我错过了一些简单的东西。所以,我转向SO社区寻求帮助。
我尝试了很多方法。理想情况下,我希望能够使用非本机密钥签署事务(这最终将在浏览器中没有守护程序的情况下完成)。但是,我尝试使用本机密钥执行相同的步骤。
// This creating a transaction from an unspent transaction in the change for the address: P9Cwfbuai1ESkbAntFFqMdnQ5oC9BGJzWi
// http://potchain.net/api/addr/P9Cwfbuai1ESkbAntFFqMdnQ5oC9BGJzWi/utxo
// There are 15 POT that is unspent in the account and thus can be used in any transaction to be spent
./potcoind createrawtransaction '[{"txid":"ed267f274fab18f88a5c011c721569dc6c6434ce5f04584935b39c7017e5bed6","vout":0}]' '{"P9WQFHsLPjxMF1k3oSesZQPjnUjHZ2YUy9":2}'
// This createrawtransaction produces the hex below
0300000001d6bee517709cb3354958045fce34646cdc6915721c015c8af818ab4f277f26ed0000000000ffffffff0100c2eb0b000000001976a9140a10f9709a5e48b76bc75f01dcb7f71b592196e188ac00000000
// Now taking this hex (the transaction) you can decoderawtransaction on it.
//This response is below.
{
"txid" : "9961a9147e21780e883d522d768eede1e017b0bc80cb388acf9104736d7c8b80",
"version" : 3,
"locktime" : 0,
"time" : 0,
"vin" : [
{
"txid" : "ed267f274fab18f88a5c011c721569dc6c6434ce5f04584935b39c7017e5bed6",
"vout" : 0,
"scriptSig" : {
"asm" : "",
"hex" : ""
},
"sequence" : 4294967295
}
],
"vout" : [
{
"value" : 2.00000000,
"n" : 0,
"scriptPubKey" : {
"asm" : "OP_DUP OP_HASH160 0a10f9709a5e48b76bc75f01dcb7f71b592196e1 OP_EQUALVERIFY OP_CHECKSIG",
"hex" : "76a9140a10f9709a5e48b76bc75f01dcb7f71b592196e188ac",
"reqSigs" : 1,
"type" : "pubkeyhash",
"addresses" : [
"P9WQFHsLPjxMF1k3oSesZQPjnUjHZ2YUy9"
]
}
}
]
}
// Using this information we sign the transaction
./potcoind signrawtransaction '0300000001d6bee517709cb3354958045fce34646cdc6915721c015c8af818ab4f277f26ed0000000000ffffffff0100c2eb0b000000001976a9140a10f9709a5e48b76bc75f01dcb7f71b592196e188ac00000000' '[{"txid":"ed267f274fab18f88a5c011c721569dc6c6434ce5f04584935b39c7017e5bed6","vout":0,"scriptPubKey":"76a9140a10f9709a5e48b76bc75f01dcb7f71b592196e188ac"}]' '["U5ot..."]'
// This produces
{
"hex" : "0300000001d6bee517709cb3354958045fce34646cdc6915721c015c8af818ab4f277f26ed0000000000ffffffff0100c2eb0b000000001976a9140a10f9709a5e48b76bc75f01dcb7f71b592196e188ac00000000",
"complete" : false
}
// Complete: false means it is not signed
我不知道从哪里开始。我尝试过不同的地址。我尝试在一个新的守护进程上创建一个新的地址/帐户,为它提供资金,并尝试使用signrawtransaction从中花费,它仍然提供完整的:false。任何帮助深表感谢。谢谢。
更新
好的,我能够让交易开始签名:)。我觉得很有成就感但是,我不能把它们推到网络上。
./potcoind sendrawtransaction 0300000001d2abc13ecf7675d9e9b4a2da4d271dde7cb19d6917043771cf3d07dea29d8093010000006c4930460221008d0868777f73b6c15dd756b55199d870a5e3a6cf80993414749d47dd1078c9a6022100e7aa1e52f2c9734c940556808bc023dfc1f6af90a9f387fa88c2e84ae77e4f5f01210231b292d08addf749145a522ec0b42dfa607254314e519f247db81c30b7c5ea68ffffffff0100c2eb0b000000001976a9140a10f9709a5e48b76bc75f01dcb7f71b592196e188ac00000000
制作:error: {"code":-22,"message":"TX rejected"}
./potcoind decoderawtransaction 0300000001d2abc13ecf7675d9e9b4a2da4d271dde7cb19d6917043771cf3d07dea29d8093010000006c4930460221008d0868777f73b6c15dd756b55199d870a5e3a6cf80993414749d47dd1078c9a6022100e7aa1e52f2c9734c940556808bc023dfc1f6af90a9f387fa88c2e84ae77e4f5f01210231b292d08addf749145a522ec0b42dfa607254314e519f247db81c30b7c5ea68ffffffff0100c2eb0b000000001976a9140a10f9709a5e48b76bc75f01dcb7f71b592196e188ac00000000
产地:
{
"txid" : "b87f70becc1ca5df9d510a8e0effc70008f0b4b584dfb8dda6aedafafe88e290",
"version" : 3,
"locktime" : 0,
"time" : 0,
"vin" : [
{
"txid" : "93809da2de073dcf71370417699db17cde1d274ddaa2b4e9d97576cf3ec1abd2",
"vout" : 1,
"scriptSig" : {
"asm" : "30460221008d0868777f73b6c15dd756b55199d870a5e3a6cf80993414749d47dd1078c9a6022100e7aa1e52f2c9734c940556808bc023dfc1f6af90a9f387fa88c2e84ae77e4f5f01 0231b292d08addf749145a522ec0b42dfa607254314e519f247db81c30b7c5ea68",
"hex" : "4930460221008d0868777f73b6c15dd756b55199d870a5e3a6cf80993414749d47dd1078c9a6022100e7aa1e52f2c9734c940556808bc023dfc1f6af90a9f387fa88c2e84ae77e4f5f01210231b292d08addf749145a522ec0b42dfa607254314e519f247db81c30b7c5ea68"
},
"sequence" : 4294967295
}
],
"vout" : [
{
"value" : 2.00000000,
"n" : 0,
"scriptPubKey" : {
"asm" : "OP_DUP OP_HASH160 0a10f9709a5e48b76bc75f01dcb7f71b592196e1 OP_EQUALVERIFY OP_CHECKSIG",
"hex" : "76a9140a10f9709a5e48b76bc75f01dcb7f71b592196e188ac",
"reqSigs" : 1,
"type" : "pubkeyhash",
"addresses" : [
"P9WQFHsLPjxMF1k3oSesZQPjnUjHZ2YUy9"
]
}
}
]
}
再一次,非常感谢任何帮助。谢谢。
更新2
我在网上发现的东西让我进入硬币的尘埃门槛。但软限制设置为1POT,硬限制设置为.001POT。我试图发送10.我已经尝试了2,5和10。
更新3
好的,所以我退后一步看看我可能会失踪的东西。这是我正在做的事情(重建的步骤),希望有人能看到我做错了什么:
创建交易:
./potcoind createrawtransaction '[{"txid":"7ee9eeb1641049c75d5c44433ff919b87004056a95008dbb2d81d0bfef55edc6","vout":0}]' '{"P9WQFHsLPjxMF1k3oSesZQPjnUjHZ2YUy9":100,"PNy6SLjgTsLggrsyP6KN6wjeNU3ThRzcSw":19.999}'
产地:
0300000001c6ed55efbfd0812dbb8d00956a050470b819f93f43445c5dc7491064b1eee97e0000000000ffffffff0200e40b54020000001976a9140a10f9709a5e48b76bc75f01dcb7f71b592196e188ac600d3477000000001976a9149db6f95295b18b8c44cb008ab5e512970a76aa4988ac00000000
使用非本机(对守护程序/钱包)私钥对事务进行签名:
./potcoind signrawtransaction '0300000001c6ed55efbfd0812dbb8d00956a050470b819f93f43445c5dc7491064b1eee97e0000000000ffffffff0200e40b54020000001976a9140a10f9709a5e48b76bc75f01dcb7f71b592196e188ac600d3477000000001976a9149db6f95295b18b8c44cb008ab5e512970a76aa4988ac00000000' '[{"txid":"7ee9eeb1641049c75d5c44433ff919b87004056a95008dbb2d81d0bfef55edc6","vout":0,"scriptPubKey":"76a9149db6f95295b18b8c44cb008ab5e512970a76aa4988ac"}]' '["U8SLDvX4m9qAEWSERab5xxXzd5TUycwTb...."]'
产地:
{
"hex" : "0300000001c6ed55efbfd0812dbb8d00956a050470b819f93f43445c5dc7491064b1eee97e000000006b48304502203fe346d47234edc2db6ccc84f5235289e637687722960b65b55b35eb0cb2199f022100f3b5c7b09f66974d0a5e146203c18fe392b9cf310324c636d61d5204e854b55201210231b292d08addf749145a522ec0b42dfa607254314e519f247db81c30b7c5ea68ffffffff0200e40b54020000001976a9140a10f9709a5e48b76bc75f01dcb7f71b592196e188ac600d3477000000001976a9149db6f95295b18b8c44cb008ab5e512970a76aa4988ac00000000",
"complete" : true
}
解码交易:
./potcoind decoderawtransaction 0300000001c6ed55efbfd0812dbb8d00956a050470b819f93f43445c5dc7491064b1eee97e000000006b48304502203fe346d47234edc2db6ccc84f5235289e637687722960b65b55b35eb0cb2199f022100f3b5c7b09f66974d0a5e146203c18fe392b9cf310324c636d61d5204e854b55201210231b292d08addf749145a522ec0b42dfa607254314e519f247db81c30b7c5ea68ffffffff0200e40b54020000001976a9140a10f9709a5e48b76bc75f01dcb7f71b592196e188ac600d3477000000001976a9149db6f95295b18b8c44cb008ab5e512970a76aa4988ac00000000
产地:
{
"txid" : "5f56562b46e303eefb5f861ffa0f6679cbe039c4c84fea61552cf2503d3a5132",
"version" : 3,
"locktime" : 0,
"time" : 0,
"vin" : [
{
"txid" : "7ee9eeb1641049c75d5c44433ff919b87004056a95008dbb2d81d0bfef55edc6",
"vout" : 0,
"scriptSig" : {
"asm" : "304502203fe346d47234edc2db6ccc84f5235289e637687722960b65b55b35eb0cb2199f022100f3b5c7b09f66974d0a5e146203c18fe392b9cf310324c636d61d5204e854b55201 0231b292d08addf749145a522ec0b42dfa607254314e519f247db81c30b7c5ea68",
"hex" : "48304502203fe346d47234edc2db6ccc84f5235289e637687722960b65b55b35eb0cb2199f022100f3b5c7b09f66974d0a5e146203c18fe392b9cf310324c636d61d5204e854b55201210231b292d08addf749145a522ec0b42dfa607254314e519f247db81c30b7c5ea68"
},
"sequence" : 4294967295
}
],
"vout" : [
{
"value" : 100.00000000,
"n" : 0,
"scriptPubKey" : {
"asm" : "OP_DUP OP_HASH160 0a10f9709a5e48b76bc75f01dcb7f71b592196e1 OP_EQUALVERIFY OP_CHECKSIG",
"hex" : "76a9140a10f9709a5e48b76bc75f01dcb7f71b592196e188ac",
"reqSigs" : 1,
"type" : "pubkeyhash",
"addresses" : [
"P9WQFHsLPjxMF1k3oSesZQPjnUjHZ2YUy9"
]
}
},
{
"value" : 19.99900000,
"n" : 1,
"scriptPubKey" : {
"asm" : "OP_DUP OP_HASH160 9db6f95295b18b8c44cb008ab5e512970a76aa49 OP_EQUALVERIFY OP_CHECKSIG",
"hex" : "76a9149db6f95295b18b8c44cb008ab5e512970a76aa4988ac",
"reqSigs" : 1,
"type" : "pubkeyhash",
"addresses" : [
"PNy6SLjgTsLggrsyP6KN6wjeNU3ThRzcSw"
]
}
}
]
}
广播交易:
./potcoind sendrawtransaction 0300000001c6ed55efbfd0812dbb8d00956a050470b819f93f43445c5dc7491064b1eee97e000000006b48304502203fe346d47234edc2db6ccc84f5235289e637687722960b65b55b35eb0cb2199f022100f3b5c7b09f66974d0a5e146203c18fe392b9cf310324c636d61d5204e854b55201210231b292d08addf749145a522ec0b42dfa607254314e519f247db81c30b7c5ea68ffffffff0200e40b54020000001976a9140a10f9709a5e48b76bc75f01dcb7f71b592196e188ac600d3477000000001976a9149db6f95295b18b8c44cb008ab5e512970a76aa4988ac00000000
产地:
error: {"code":-22,"message":"TX rejected"}
我完全不知道为什么我正在制作的交易不会广播。
./potcoind getrawtransaction 0300000001c6ed55efbfd0812dbb8d00956a050470b819f93f43445c5dc7491064b1eee97e000000006b48304502203fe346d47234edc2db6ccc84f5235289e637687722960b65b55b35eb0cb2199f022100f3b5c7b09f66974d0a5e146203c18fe392b9cf310324c636d61d5204e854b55201210231b292d08addf749145a522ec0b42dfa607254314e519f247db81c30b7c5ea68ffffffff0200e40b54020000001976a9140a10f9709a5e48b76bc75f01dcb7f71b592196e188ac600d3477000000001976a9149db6f95295b18b8c44cb008ab5e512970a76aa4988ac00000000
产地:
error: {"code":-5,"message":"No information available about transaction"}