Replies: 3 comments
-
Sorry, no idea about that error. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Hello |
Beta Was this translation helpful? Give feedback.
0 replies
-
You can dm me with put you through to resolve the issues you facing |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, following is my code to new regtest transation, but I try sendrawtransaction the signed tx with bitcoin-cli, bitcoin-cli retrun a errror:
error code: -3
error message:
Amount is not a number or string
my code:
in coininfodata.cpp, I modified the bitcoin's p2pkhPrefix = 0 to 0x6f, like:
const CoinInfo getCoinInfo(TWCoinType coin) {
// switch is preferred instead of a data structure, due to initialization issues
switch (coin) {
case TWCoinTypeBitcoin:
return CoinInfo {
"bitcoin",
"Bitcoin",
TWBlockchainBitcoin,
TWPurposeBIP84,
TWCurveSECP256k1,
TWHDVersionZPUB,
TWHDVersionZPRV,
"m/84'/0'/0'/0/0",
TWPublicKeyTypeSECP256k1,
0,
0x6f,
5,
TWHRPBitcoin,
Hash::sha256ripemd,
Hash::sha256d,
"BTC",
8,
"https://blockchair.com/bitcoin/transaction/",
"https://blockchair.com/bitcoin/address/",
0,
};
in TWHRP.h, Modified HRP_BITCOIN = "bc"; to HRP_BITCOIN = "bcrt";
static const char *_Nonnull HRP_BITCOIN = "bcrt";
int main(void)
{
auto hash0 = TW::parse_hex("65624703015c46ee5cf3cae9c79e4f4f1f96c149ef3a9f3383c72e4dd6e645e6");
std::reverse(hash0.begin(), hash0.end());
}
run it ,print out the signed tx:
0100000001e645e6d64d2ec783339f3aef49c1961f4f4f9ec7e9caf35cee465c0103476265010000006a4730440220629f91945a5658cea6bf266cbb5724fed349e9ae027a3262d26dbcbb512cf6b702203fd0af77a3307e8f0e100de32586d94095dedb214d79f4c8510ff4aa3485deab012102aa2c3f3f8a7834d98ebc3e6febcd1cf7bae49ceabaf584628a6014f1777f8d55ffffffff02b0bf031400000000160014068d2ab7e480219bf4cc8df6c151670582c79f0be24ba6270000000016001402fcc7ba72c60fc6d161405a77dc3b4e8d28bd5000000000
then, decode rawtransaction,
[root@localhost BTC]# ./bitcoin-cli -regtest -rpcuser=zhangwenge -rpcport=8332 -rpcpassword=123456 decoderawtransaction 0100000001e645e6d64d2ec783339f3aef49c1961f4f4f9ec7e9caf35cee465c0103476265010000006a4730440220629f91945a5658cea6bf266cbb5724fed349e9ae027a3262d26dbcbb512cf6b702203fd0af77a3307e8f0e100de32586d94095dedb214d79f4c8510ff4aa3485deab012102aa2c3f3f8a7834d98ebc3e6febcd1cf7bae49ceabaf584628a6014f1777f8d55ffffffff02b0bf031400000000160014068d2ab7e480219bf4cc8df6c151670582c79f0be24ba6270000000016001402fcc7ba72c60fc6d161405a77dc3b4e8d28bd5000000000
{
"txid": "7ff433c837207b2b499c77ab59a60ff79aaa630ea98ef2130a6ff462bc248f5c",
"hash": "7ff433c837207b2b499c77ab59a60ff79aaa630ea98ef2130a6ff462bc248f5c",
"version": 1,
"size": 219,
"vsize": 219,
"weight": 876,
"locktime": 0,
"vin": [
{
"txid": "65624703015c46ee5cf3cae9c79e4f4f1f96c149ef3a9f3383c72e4dd6e645e6",
"vout": 1,
"scriptSig": {
"asm": "30440220629f91945a5658cea6bf266cbb5724fed349e9ae027a3262d26dbcbb512cf6b702203fd0af77a3307e8f0e100de32586d94095dedb214d79f4c8510ff4aa3485deab[ALL] 02aa2c3f3f8a7834d98ebc3e6febcd1cf7bae49ceabaf584628a6014f1777f8d55",
"hex": "4730440220629f91945a5658cea6bf266cbb5724fed349e9ae027a3262d26dbcbb512cf6b702203fd0af77a3307e8f0e100de32586d94095dedb214d79f4c8510ff4aa3485deab012102aa2c3f3f8a7834d98ebc3e6febcd1cf7bae49ceabaf584628a6014f1777f8d55"
},
"sequence": 4294967295
}
],
"vout": [
{
"value": 3.35790000,
"n": 0,
"scriptPubKey": {
"asm": "0 068d2ab7e480219bf4cc8df6c151670582c79f0b",
"hex": "0014068d2ab7e480219bf4cc8df6c151670582c79f0b",
"reqSigs": 1,
"type": "witness_v0_keyhash",
"addresses": [
"bcrt1qq6xj4dlysqsehaxv3hmvz5t8qkpv08ctjlhkvp"
]
}
},
{
"value": 6.65209826,
"n": 1,
"scriptPubKey": {
"asm": "0 02fcc7ba72c60fc6d161405a77dc3b4e8d28bd50",
"hex": "001402fcc7ba72c60fc6d161405a77dc3b4e8d28bd50",
"reqSigs": 1,
"type": "witness_v0_keyhash",
"addresses": [
"bcrt1qqt7v0wnjcc8ud5tpgpd80hpmf6xj302s98vgm4"
]
}
}
]
}
lastest, sendrawtransaction
[root@localhost BTC]# ./bitcoin-cli -regtest -rpcuser=zhangwenge -rpcport=8332 -rpcpassword=123456 sendrawtransaction 0100000001e645e6d64d2ec783339f3aef49c1961f4f4f9ec7e9caf35cee465c0103476265010000006a4730440220629f91945a5658cea6bf266cbb5724fed349e9ae027a3262d26dbcbb512cf6b702203fd0af77a3307e8f0e100de32586d94095dedb214d79f4c8510ff4aa3485deab012102aa2c3f3f8a7834d98ebc3e6febcd1cf7bae49ceabaf584628a6014f1777f8d55ffffffff02b0bf031400000000160014068d2ab7e480219bf4cc8df6c151670582c79f0be24ba6270000000016001402fcc7ba72c60fc6d161405a77dc3b4e8d28bd5000000000 false
error code: -3
error message:
Amount is not a number or string
[root@localhost BTC]#
[root@localhost BTC]#
---------------------->
Beta Was this translation helpful? Give feedback.
All reactions