Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

After funding dogecoin multisig address unable to spend from that wallet address getting spendable false. #3405

Open
SamirBitzees opened this issue Feb 8, 2024 · 17 comments

Comments

@SamirBitzees
Copy link

SamirBitzees commented Feb 8, 2024

@patricklodder @alamshafil
I created multisig address using 3 differant signer wallet addresses and after i send some fausets on that multisig address.
Import address using import method but when i am doing listunspent then i am getting spendable false. why dont know. Here are the steps which i perform.

ubuntu@ip-172-31-35-31:~/dogecoin$ sudo /home/ubuntu/dogecoin/src/dogecoin-cli importaddress 2MupaczJX6DgQkPVC8PLDkBGDp3VbAXjGqX "sameb" false

ubuntu@ip-172-31-35-31:/dogecoin$ sudo /home/ubuntu/dogecoin/src/dogecoin-cli listunspent 0 9999999 '["2MupaczJX6DgQkPVC8PLDkBGDp3VbAXjGqX"]'
[
{
"txid": "d407b89fd72efb3528a1b0b9f551765856e140c8050d296adc57de8ba1d57859",
"vout": 0,
"address": "2MupaczJX6DgQkPVC8PLDkBGDp3VbAXjGqX",
"account": "sameb",
"scriptPubKey": "a9141c3f33a4f2c1385c0306a50df3cf67d96245d77287",
"amount": 3.00000000,
"confirmations": 18,
"spendable": false,
"solvable": false
}
]
ubuntu@ip-172-31-35-31:
/dogecoin$ sudo /home/ubuntu/dogecoin/src/dogecoin-cli sendfrom sameb neU1Ha9cuhbGWmT7xFTLntjWizxnoZskw3 1
error code: -6
error message:
Account has insufficient funds

I tried to resolve this error using rescan but not solved.
ubuntu@ip-172-31-35-31:~/dogecoin$ sudo /home/ubuntu/dogecoin/src/dogecoind -rescan

@SamirBitzees
Copy link
Author

Below is my debug.log.file

~/.dogecoin$ sudo tail -n 100 /mnt/dogedrive/.dogecoin/testnet3/debug.log
2024-02-07 06:38:15 Dogecoin version v1.14.6.0-862619ea8
2024-02-07 06:38:15 InitParameterInteraction: parameter interaction: -whitelistforcerelay=1 -> setting -whitelistrelay=1
2024-02-07 06:38:15 Assuming ancestors of block af23c3e750bb4f2ce091235f006e7e4e2af453d4c866282e7870471dcfeb4382 have valid signatures.
2024-02-07 06:38:15 Default data directory /root/.dogecoin
2024-02-07 06:38:15 Using data directory /mnt/dogedrive/.dogecoin/testnet3
2024-02-07 06:38:15 Set backupdir "/mnt/dogedrive/.dogecoin/testnet3/backups"
2024-02-07 06:38:15 Using backup directory /mnt/dogedrive/.dogecoin/testnet3/backups
2024-02-07 06:38:15 Using config file /mnt/dogedrive/.dogecoin/dogecoin.conf
2024-02-07 06:38:15 Using at most 125 automatic connections (1024 file descriptors available)
2024-02-07 06:38:15 Using 32 MiB out of 32 requested for signature cache, able to store 1048576 elements
2024-02-07 06:38:15 Using 2 threads for script verification
2024-02-07 06:38:15 HTTP: creating work queue of depth 16
2024-02-07 06:38:15 Config options rpcuser and rpcpassword will soon be deprecated. Locally-run instances may remove rpcuser to use cookie-based auth, or may be replaced with rpcauth. Please see share/rpcuser for rpcauth auth generation.
2024-02-07 06:38:15 HTTP: starting 4 worker threads
2024-02-07 06:38:15 scheduler thread start
2024-02-07 06:38:15 Using BerkeleyDB version Berkeley DB 5.3.28: (September 9, 2013)
2024-02-07 06:38:15 Using wallet wallet.dat
2024-02-07 06:38:15 init message: Verifying wallet...
2024-02-07 06:38:15 CDBEnv::Open: LogDir=/mnt/dogedrive/.dogecoin/testnet3/database ErrorFile=/mnt/dogedrive/.dogecoin/testnet3/db.log
2024-02-07 06:38:15 Bound to [::]:44556
2024-02-07 06:38:15 Bound to 0.0.0.0:44556
2024-02-07 06:38:15 Cache configuration:
2024-02-07 06:38:15 * Using 56.2MiB for block index database
2024-02-07 06:38:15 * Using 8.0MiB for chain state database
2024-02-07 06:38:15 * Using 385.8MiB for in-memory UTXO set (plus up to 286.1MiB of unused mempool space)2024-02-07 06:38:15 init message: Loading block index...
2024-02-07 06:38:15 Opening LevelDB in /mnt/dogedrive/.dogecoin/testnet3/blocks/index
2024-02-07 06:38:15 Opened LevelDB successfully
2024-02-07 06:38:15 Using obfuscation key for /mnt/dogedrive/.dogecoin/testnet3/blocks/index: 0000000000000000
2024-02-07 06:38:15 Opening LevelDB in /mnt/dogedrive/.dogecoin/testnet3/chainstate
2024-02-07 06:38:15 Opened LevelDB successfully
2024-02-07 06:38:15 Using obfuscation key for /mnt/dogedrive/.dogecoin/testnet3/chainstate: 55eaad247d125e73
2024-02-07 06:38:49 LoadBlockIndexDB: last block file = 23
2024-02-07 06:38:49 LoadBlockIndexDB: last block file info: CBlockFileInfo(blocks=12898, size=6946606, heights=5933473...5946456, time=2024-01-28...2024-02-07)
2024-02-07 06:38:49 Checking all blk files are present...
2024-02-07 06:38:49 LoadBlockIndexDB: transaction index enabled
2024-02-07 06:38:52 LoadBlockIndexDB: hashBestChain=458b8424c2fe94e4f072e2d41a02bae86a6fe98db2244916f0bae4646d3e4f01 height=5946456 date=2024-02-07 06:32:55 progress=0.999999
2024-02-07 06:38:52 init message: Rewinding blocks...
2024-02-07 06:39:16 init message: Verifying blocks...
2024-02-07 06:39:16 Verifying last 6 blocks at level 3
2024-02-07 06:39:16 [0%]...[16%]...[33%]...[50%]...[66%]...[83%]...[99%]...[DONE].
2024-02-07 06:39:16 No coin database inconsistencies in last 7 blocks (11 transactions)
2024-02-07 06:39:16 block index 61006ms
2024-02-07 06:39:16 init message: Loading wallet...
2024-02-07 06:39:16 nFileVersion = 1140600
2024-02-07 06:39:16 Keys: 240 plaintext, 0 encrypted, 253 w/ metadata, 240 total
2024-02-07 06:39:16 wallet 11ms
2024-02-07 06:39:16 setKeyPool.size() = 100
2024-02-07 06:39:16 mapWallet.size() = 57
2024-02-07 06:39:16 mapAddressBook.size() = 89
2024-02-07 06:39:16 mapBlockIndex.size() = 5946464
2024-02-07 06:39:16 nBestHeight = 5946456
2024-02-07 06:39:16 torcontrol thread start
2024-02-07 06:39:16 init message: Loading addresses...
2024-02-07 06:39:16 Imported mempool transactions from disk: 0 successes, 0 failed, 0 expired
2024-02-07 06:39:16 Loaded 2266 addresses from peers.dat 10ms
2024-02-07 06:39:16 init message: Loading banlist...
2024-02-07 06:39:16 init message: Starting network threads...
2024-02-07 06:39:16 net thread start
2024-02-07 06:39:16 dnsseed thread start
2024-02-07 06:39:16 addcon thread start
2024-02-07 06:39:16 opencon thread start
2024-02-07 06:39:16 init message: Done loading
2024-02-07 06:39:16 msghand thread start
2024-02-07 06:39:17 receive version message: /Shibetoshi:1.14.6/: version 70015, blocks=5946457, us=18.60.230.27:49662, peer=0
2024-02-07 06:39:17 connect() to [2600:1702:b10:3e60:9084:f0f4:d140:6ab0]:44556 failed: Network is unreachable (101)
2024-02-07 06:39:27 Loading addresses from DNS seeds (could take a while)
2024-02-07 06:39:28 33 addresses found from DNS seeds
2024-02-07 06:39:28 dnsseed thread exit
2024-02-07 06:39:45 UpdateTip: new best=498248962f5cc9ca525b86cfbf5f3f6b73b7a498ecd72785a08420ce4fe9a0cf height=5946457 version=0x00620004 log2_work=54.397679 tx=7443022 date='2024-02-07 06:39:11' progress=1.000000 cache=0.0MiB(1tx)
2024-02-07 06:39:45 receive version message: /Shibetoshi:1.14.6/: version 70015, blocks=5946457, us=18.60.230.27:59902, peer=1
2024-02-07 06:39:46 connect() to [2001:b011:2003:fe48:3509:29af:3b70:883f]:44556 failed: Network is unreachable (101)
2024-02-07 06:39:47 receive version message: /Shibetoshi:1.14.6/: version 70015, blocks=5946457, us=18.60.230.27:56132, peer=2
2024-02-07 06:39:47 receive version message: /Shibetoshi:1.14.6/: version 70015, blocks=5946457, us=18.60.230.27:56862, peer=3
2024-02-07 06:39:48 receive version message: /Shibetoshi:1.14.6/: version 70015, blocks=5946457, us=18.60.230.27:43998, peer=4
2024-02-07 06:39:54 receive version message: /Shibetoshi:1.14.6/: version 70015, blocks=5946457, us=18.60.230.27:41346, peer=5
2024-02-07 06:39:55 receive version message: /Shibetoshi:1.14.3/: version 70015, blocks=5946457, us=18.60.230.27:39928, peer=6
2024-02-07 06:39:55 receive version message: /Shibetoshi:1.14.6/: version 70015, blocks=5946457, us=18.60.230.27:56044, peer=7
2024-02-07 06:43:14 UpdateTip: new best=df37c8b428ed671b975dce35d4cb08b6d3984e7b59af065d446198c6cc71f1e7 height=5946458 version=0x00620004 log2_work=54.397679 tx=7443023 date='2024-02-07 06:43:11' progress=1.000000 cache=0.0MiB(2tx)
2024-02-07 06:43:53 connect() to 38.242.144.77:44556 failed after select(): Connection refused (111)
2024-02-07 06:43:53 connect() to [2601:601:1400:48d0:997d:d67b:3332:2f2f]:44556 failed: Network is unreachable (101)
2024-02-07 06:43:54 connect() to [2600:1700:8e41:94f:749d:b0f6:385b:26a5]:44556 failed: Network is unreachable (101)
2024-02-07 06:43:55 receive version message: /Shibetoshi:1.14.6(inevitable360 4ca7f6f79c7396c07ce9c4f3208c3647dbe52ede0e22c4b9f37b53086771dd7c)/: version 70015, blocks=5946458, us=18.60.230.27:53574, peer=8
2024-02-07 06:44:06 connect() to [2600:1702:b10:3e60:48a3:e0ea:f5c9:a160]:44556 failed: Network is unreachable (101)
2024-02-07 06:46:28 connect() to [2600:8800:8891:eb00::ff65]:44556 failed: Network is unreachable (101)
2024-02-07 06:48:18 UpdateTip: new best=207eb3f61ef254493a6b3430666659995e633ea676a1629af41ba8bf108492d0 height=5946459 version=0x00620004 log2_work=54.397679 tx=7443024 date='2024-02-07 06:48:01' progress=1.000000 cache=0.0MiB(3tx)

@SamirBitzees
Copy link
Author

SamirBitzees commented Feb 8, 2024

Below I once again tried with 3 fresh signer wallet and generate new address on that wallet and tried to create multisig address and funded it and imported its redeemscript and address by using import method but still getting spedable = false solvable = false .

ubuntu@ip-172-31-35-31:~/dogecoin$ sudo /home/ubuntu/dogecoin/src/dogecoin-cli getnewaddress SINAC798FF0CnUsNYFBZXtKzjFpPaF5gLKwzuKkMYbcKsd
ubuntu@ip-172-31-35-31:~/dogecoin$ sudo /home/ubuntu/dogecoin/src/dogecoin-cli getnewaddress SINBFC94C70CncRiNeKt5kyCFyx7xPa8XQfeaWxK1eAxAE
ubuntu@ip-172-31-35-31:~/dogecoin$ sudo /home/ubuntu/dogecoin/src/dogecoin-cli getnewaddress SIN6EA95D70CnW4ac3dY21R58R9wVQWUWezkWdPULruoVq
ubuntu@ip-172-31-35-31:~/dogecoin$  sudo /home/ubuntu/dogecoin/src/dogecoin-cli createmultisig 3 '["nUsNYFBZXtKzjFpPaF5gLKwzuKkMYbcKsd","ncRiNeKt5kyCFyx7xPa8XQfeaWxK1eAxAE","nW4ac3dY21R58R9wVQWUWezkWdPULruoVq"]'
{
  "address": "2N9LcDezM8QD3EZ5DZQhxk9T6MLQFTRcTq9",
  "redeemScript": "5321039f0b5d474f082e0ba6a60248ea903dc65b6535bc142d5e7359a2f979cf5055e7210318bb70a17ff8d85a8dab210e038bb02ac7b9c11b0a0faeda656c4df16cafa0222103356efa507756281e0a544a4913705f4a2e633da9b8ed4ebebce2aacd1d6261fc53ae"
}
ubuntu@ip-172-31-35-31:~/dogecoin$ sudo /home/ubuntu/dogecoin/src/dogecoin-cli sendtoaddress 2N9LcDezM8QD3EZ5DZQhxk9T6MLQFTRcTq9 2
f10f1a3b1e6fcf4ac8977a93ccb72339cd7e676c64e548272f6bd018e17cb96b
ubuntu@ip-172-31-35-31:~/dogecoin$ sudo /home/ubuntu/dogecoin/src/dogecoin-cli importaddress  5321039f0b5d474f082e0ba6a60248ea903dc65b6535bc142d5e7359a2f979cf5055e7210318bb70a17ff8d85a8dab210e038bb02ac7b9c11b0a0faeda656c4df16cafa0222103356efa507756281e0a544a4913705f4a2e633da9b8ed4ebebce2aacd1d6261fc53ae "new" false
error code: -4
error message:
The wallet already contains the private key for this address or script

ubuntu@ip-172-31-35-31:~/dogecoin$ sudo /home/ubuntu/dogecoin/src/dogecoin-cli listunspent 0 9999999 '["2N9LcDezM8QD3EZ5DZQhxk9T6MLQFTRcTq9"]'
[
]
ubuntu@ip-172-31-35-31:~/dogecoin$ sudo /home/ubuntu/dogecoin/src/dogecoin-cli importaddress  2N9LcDezM8QD3EZ5DZQhxk9T6MLQFTRcTq9 "new" false
ubuntu@ip-172-31-35-31:~/dogecoin$ sudo /home/ubuntu/dogecoin/src/dogecoin-cli listunspent 0 9999999 '["2N9LcDezM8QD3EZ5DZQhxk9T6MLQFTRcTq9"]'
[
  {
    "txid": "f10f1a3b1e6fcf4ac8977a93ccb72339cd7e676c64e548272f6bd018e17cb96b",
    "vout": 1,
    "address": "2N9LcDezM8QD3EZ5DZQhxk9T6MLQFTRcTq9",
    "account": "new",
    "scriptPubKey": "a914b086a64422cff6b4c8655c7b9ffa9a050765b53d87",
    "amount": 2.00000000,
    "confirmations": 1,
    "spendable": false,
    "solvable": false
  }
]

@patricklodder
Copy link
Member

importaddress

ubuntu@ip-172-31-35-31:~/dogecoin$ sudo /home/ubuntu/dogecoin/src/dogecoin-cli importaddress  5321039f0b5d474f082e0ba6a60248ea903dc65b6535bc142d5e7359a2f979cf5055e7210318bb70a17ff8d85a8dab210e038bb02ac7b9c11b0a0faeda656c4df16cafa0222103356efa507756281e0a544a4913705f4a2e633da9b8ed4ebebce2aacd1d6261fc53ae "new" false
error code: -4
error message:
The wallet already contains the private key for this address or script

Since you're doing p2sh, you will want to set the p2sh (4th) parameter to true:

importaddress <script> <label> <rescan> <p2sh>

This prevents you having to import the p2sh address after, and make it solvable (and spendable). It will still say the keys already exist, but that's fine

spending it

You can manually spend it using the listunspent output for the input section, and with the above p2sh flag enabled, you don't have to specify any keys for signing. eg. to send to yourself:

$ dogecoin-cli createrawtransaction \
   '[{"txid": "f10f1a3b1e6fcf4ac8977a93ccb72339cd7e676c64e548272f6bd018e17cb96b", "vout": 1}]' \
   '{"2N9LcDezM8QD3EZ5DZQhxk9T6MLQFTRcTq9": 1.9}'
<unsigned_tx>

$ dogecoin-cli signrawtransaction <unsigned_tx>
{ "hex": "<signed_tx>", "complete": true }

$ dogecoin-cli sendrawtransaction <signed_tx>
<txid>

@SamirBitzees
Copy link
Author

Basically I want to sign manually 3 signer should sign the transaction one by one.

@SamirBitzees
Copy link
Author

SamirBitzees commented Feb 8, 2024

This time i made changes and create fresh signer wallet but when i am doing fundraw transaction that time i unable sign getting error. here u can see complete transaction details. Previously to resolve this error I used "sudo /home/ubuntu/dogecoin/src/dogecoind -rescan" so then the wallet fund were reflecting but this process takes too much time. Give me correct solution. Because i want to sign transaction manually each time.

ubuntu@ip-172-31-35-31:~/dogecoin$ sudo /home/ubuntu/dogecoin/src/dogecoin-cli getnewaddress krish1
noQnSLVwYjNsqu1dTiuvuz5L9UX6oz26Cu
ubuntu@ip-172-31-35-31:~/dogecoin$ sudo /home/ubuntu/dogecoin/src/dogecoin-cli dumpprivkey noQnSLVwYjNsqu1dTiuvuz5L9UX6oz26Cu
cg73kiK7XjoFsHzRAP5hov5fqd78kkgycMgAKoJ3JTmqMnKVEiBY
ubuntu@ip-172-31-35-31:~/dogecoin$ sudo /home/ubuntu/dogecoin/src/dogecoin-cli getnewaddress krish2
nV5kaFE3PE7HExF53M92X71sZadVjVgRq2
ubuntu@ip-172-31-35-31:~/dogecoin$ sudo /home/ubuntu/dogecoin/src/dogecoin-cli dumpprivkey nV5kaFE3PE7HExF53M92X71sZadVjVgRq2
cjK6S2iz9AbZTEbmSKCMfk2fthYCnXy412VWFTqZ3Jin6i8tf8Rg
ubuntu@ip-172-31-35-31:~/dogecoin$ sudo /home/ubuntu/dogecoin/src/dogecoin-cli getnewaddress krish3
nUgeHQWuptUANXv21h5PF9xZ23JS44aUq5
ubuntu@ip-172-31-35-31:~/dogecoin$ sudo /home/ubuntu/dogecoin/src/dogecoin-cli dumpprivkey nUgeHQWuptUANXv21h5PF9xZ23JS44aUq5
cjezHyTNow5ybHuzAmoE2nurDyVHk9H2sKLVyJbsMErmFD5o2c1k
ubuntu@ip-172-31-35-31:~/dogecoin$  sudo /home/ubuntu/dogecoin/src/dogecoin-cli createmultisig 3 '["noQnSLVwYjNsqu1dTiuvuz5L9UX6oz26Cu","nV5kaFE3PE7HExF53M92X71sZadVjVgRq2","nUgeHQWuptUANXv21h5PF9xZ23JS44aUq5"]'
{
  "address": "2N5kNgvKswTTdsvVBuKQRnRh21865c96cFZ",
  "redeemScript": "532102324c886c67e43b7cb38493182f093e4f8d725e0cc316c690c4cb27db80da77d021032fbea33ba3b8aabde800649a753b36c84ba6e67b1fc14891f6e289c06d89bca121034518a1d55b5e07cfab0969da5be36d55c2bb5a84c0c63e2be5d283a2475c801353ae"
}
ubuntu@ip-172-31-35-31:~/dogecoin$ sudo /home/ubuntu/dogecoin/src/dogecoin-cli importaddress 2N5kNgvKswTTdsvVBuKQRnRh21865c96cFZ "krishna" false
ubuntu@ip-172-31-35-31:~/dogecoin$ sudo /home/ubuntu/dogecoin/src/dogecoin-cli importaddress 532102324c886c67e43b7cb38493182f093e4f8d725e0cc316c690c4cb27db80da77d021032fbea33ba3b8aabde800649a753b36c84ba6e67b1fc14891f6e289c06d89bca121034518a1d55b5e07cfab0969da5be36d55c2bb5a84c0c63e2be5d283a2475c801353ae "krishna_redeem" true 
error code: -4
error message:
The wallet already contains the private key for this address or script
ubuntu@ip-172-31-35-31:~/dogecoin$ sudo /home/ubuntu/dogecoin/src/dogecoin-cli sendtoaddress 2N5kNgvKswTTdsvVBuKQRnRh21865c96cFZ 2 
a1aeb21908c83a2aae5bc7869f5b09445bdc568f26beb6c282caff60d06f0e63
ubuntu@ip-172-31-35-31:~/dogecoin$ sudo /home/ubuntu/dogecoin/src/dogecoin-cli listunspent 0 9999999 '["2N5kNgvKswTTdsvVBuKQRnRh21865c96cFZ"]'
[
  {
    "txid": "a1aeb21908c83a2aae5bc7869f5b09445bdc568f26beb6c282caff60d06f0e63",
    "vout": 1,
    "address": "2N5kNgvKswTTdsvVBuKQRnRh21865c96cFZ",
    "account": "krishna",
    "scriptPubKey": "a9148924d5d08d21dd49ef3a5e811d60720512a4dbd887",
    "amount": 2.00000000,
    "confirmations": 12,
    "spendable": false,
    "solvable": false
  }
]
ubuntu@ip-172-31-35-31:~/dogecoin$   sudo /home/ubuntu/dogecoin/src/dogecoin-cli createrawtransaction \
'[{"txid":"a1aeb21908c83a2aae5bc7869f5b09445bdc568f26beb6c282caff60d06f0e63","vout":1}]' \
'{"nbCDSaEbcGwthBR9vjYceA57qEaJHs41oG":1}' 
0100000001630e6fd060ffca82c2b6be268f56dc5b44095b9f86c75bae2a3ac80819b2aea10100000000ffffffff0100e1f505000000001976a9144ccb8875496955e9ffdc6049b3f9a14b3aec182388ac00000000
ubuntu@ip-172-31-35-31:~/dogecoin$ sudo /home/ubuntu/dogecoin/src/dogecoin-cli fundrawtransaction 0100000001630e6fd060ffca82c2b6be268f56dc5b44095b9f86c75bae2a3ac80819b2aea10100000000ffffffff0100e1f505000000001976a9144ccb8875496955e9ffdc6049b3f9a14b3aec182388ac00000000
error code: -4
error message:
Signing transaction failed

@patricklodder
Copy link
Member

If you don't generate the keys inside your wallet, but have the redeemscript imported as above, you can simply use the privatekey argument when testing:

signrawtransaction "hexstring" ( [{"txid":"id","vout":n,"scriptPubKey":"hex","redeemScript":"hex"},...] ["privatekey1",...] sighashtype )

Sign inputs for raw transaction (serialized, hex-encoded).
The second optional argument (may be null) is an array of previous transaction outputs that
this transaction depends on but may not yet be in the block chain.
The third optional argument (may be null) is an array of base58-encoded private
keys that, if given, will be the only keys used to sign the transaction.


Arguments:
1. "hexstring"     (string, required) The transaction hex string
2. "prevtxs"       (string, optional) An json array of previous dependent transaction outputs
     [               (json array of json objects, or 'null' if none provided)
       {
         "txid":"id",             (string, required) The transaction id
         "vout":n,                  (numeric, required) The output number
         "scriptPubKey": "hex",   (string, required) script key
         "redeemScript": "hex",   (string, required for P2SH or P2WSH) redeem script
         "amount": value            (numeric, required) The amount spent
       }
       ,...
    ]
3. "privkeys"     (string, optional) A json array of base58-encoded private keys for signing
    [                  (json array of strings, or 'null' if none provided)
      "privatekey"   (string) private key in base58-encoding
      ,...
    ]
4. "sighashtype"     (string, optional, default=ALL) The signature hash type. Must be one of
       "ALL"
       "NONE"
       "SINGLE"
       "ALL|ANYONECANPAY"
       "NONE|ANYONECANPAY"
       "SINGLE|ANYONECANPAY"

So you'd do something like:

$ dogecoin-cli signrawtransaction <unsigned_tx> '[]' '["<wif>"]'
{ "hex": "<partially_signed_tx>", "complete": false }

and iterate that over partially_signed_tx.

@SamirBitzees
Copy link
Author

This time i made changes and create fresh signer wallet but when i am doing fundraw transaction that time i unable sign getting error. here u can see complete transaction details. Previously to resolve this error I used "sudo /home/ubuntu/dogecoin/src/dogecoind -rescan" so then the wallet fund were reflecting but this process takes too much time. Give me correct solution. Because i want to sign transaction manually each time.

ubuntu@ip-172-31-35-31:~/dogecoin$ sudo /home/ubuntu/dogecoin/src/dogecoin-cli getnewaddress krish1
noQnSLVwYjNsqu1dTiuvuz5L9UX6oz26Cu
ubuntu@ip-172-31-35-31:~/dogecoin$ sudo /home/ubuntu/dogecoin/src/dogecoin-cli dumpprivkey noQnSLVwYjNsqu1dTiuvuz5L9UX6oz26Cu
cg73kiK7XjoFsHzRAP5hov5fqd78kkgycMgAKoJ3JTmqMnKVEiBY
ubuntu@ip-172-31-35-31:~/dogecoin$ sudo /home/ubuntu/dogecoin/src/dogecoin-cli getnewaddress krish2
nV5kaFE3PE7HExF53M92X71sZadVjVgRq2
ubuntu@ip-172-31-35-31:~/dogecoin$ sudo /home/ubuntu/dogecoin/src/dogecoin-cli dumpprivkey nV5kaFE3PE7HExF53M92X71sZadVjVgRq2
cjK6S2iz9AbZTEbmSKCMfk2fthYCnXy412VWFTqZ3Jin6i8tf8Rg
ubuntu@ip-172-31-35-31:~/dogecoin$ sudo /home/ubuntu/dogecoin/src/dogecoin-cli getnewaddress krish3
nUgeHQWuptUANXv21h5PF9xZ23JS44aUq5
ubuntu@ip-172-31-35-31:~/dogecoin$ sudo /home/ubuntu/dogecoin/src/dogecoin-cli dumpprivkey nUgeHQWuptUANXv21h5PF9xZ23JS44aUq5
cjezHyTNow5ybHuzAmoE2nurDyVHk9H2sKLVyJbsMErmFD5o2c1k
ubuntu@ip-172-31-35-31:~/dogecoin$  sudo /home/ubuntu/dogecoin/src/dogecoin-cli createmultisig 3 '["noQnSLVwYjNsqu1dTiuvuz5L9UX6oz26Cu","nV5kaFE3PE7HExF53M92X71sZadVjVgRq2","nUgeHQWuptUANXv21h5PF9xZ23JS44aUq5"]'
{
  "address": "2N5kNgvKswTTdsvVBuKQRnRh21865c96cFZ",
  "redeemScript": "532102324c886c67e43b7cb38493182f093e4f8d725e0cc316c690c4cb27db80da77d021032fbea33ba3b8aabde800649a753b36c84ba6e67b1fc14891f6e289c06d89bca121034518a1d55b5e07cfab0969da5be36d55c2bb5a84c0c63e2be5d283a2475c801353ae"
}
ubuntu@ip-172-31-35-31:~/dogecoin$ sudo /home/ubuntu/dogecoin/src/dogecoin-cli importaddress 2N5kNgvKswTTdsvVBuKQRnRh21865c96cFZ "krishna" false
ubuntu@ip-172-31-35-31:~/dogecoin$ sudo /home/ubuntu/dogecoin/src/dogecoin-cli importaddress 532102324c886c67e43b7cb38493182f093e4f8d725e0cc316c690c4cb27db80da77d021032fbea33ba3b8aabde800649a753b36c84ba6e67b1fc14891f6e289c06d89bca121034518a1d55b5e07cfab0969da5be36d55c2bb5a84c0c63e2be5d283a2475c801353ae "krishna_redeem" true 
error code: -4
error message:
The wallet already contains the private key for this address or script
ubuntu@ip-172-31-35-31:~/dogecoin$ sudo /home/ubuntu/dogecoin/src/dogecoin-cli sendtoaddress 2N5kNgvKswTTdsvVBuKQRnRh21865c96cFZ 2 
a1aeb21908c83a2aae5bc7869f5b09445bdc568f26beb6c282caff60d06f0e63
ubuntu@ip-172-31-35-31:~/dogecoin$ sudo /home/ubuntu/dogecoin/src/dogecoin-cli listunspent 0 9999999 '["2N5kNgvKswTTdsvVBuKQRnRh21865c96cFZ"]'
[
  {
    "txid": "a1aeb21908c83a2aae5bc7869f5b09445bdc568f26beb6c282caff60d06f0e63",
    "vout": 1,
    "address": "2N5kNgvKswTTdsvVBuKQRnRh21865c96cFZ",
    "account": "krishna",
    "scriptPubKey": "a9148924d5d08d21dd49ef3a5e811d60720512a4dbd887",
    "amount": 2.00000000,
    "confirmations": 12,
    "spendable": false,
    "solvable": false
  }
]
ubuntu@ip-172-31-35-31:~/dogecoin$   sudo /home/ubuntu/dogecoin/src/dogecoin-cli createrawtransaction \
'[{"txid":"a1aeb21908c83a2aae5bc7869f5b09445bdc568f26beb6c282caff60d06f0e63","vout":1}]' \
'{"nbCDSaEbcGwthBR9vjYceA57qEaJHs41oG":1}' 
0100000001630e6fd060ffca82c2b6be268f56dc5b44095b9f86c75bae2a3ac80819b2aea10100000000ffffffff0100e1f505000000001976a9144ccb8875496955e9ffdc6049b3f9a14b3aec182388ac00000000
ubuntu@ip-172-31-35-31:~/dogecoin$ sudo /home/ubuntu/dogecoin/src/dogecoin-cli fundrawtransaction 0100000001630e6fd060ffca82c2b6be268f56dc5b44095b9f86c75bae2a3ac80819b2aea10100000000ffffffff0100e1f505000000001976a9144ccb8875496955e9ffdc6049b3f9a14b3aec182388ac00000000
error code: -4
error message:
Signing transaction failed

Please check here i unable to do fundrawransaction getting error

@patricklodder
Copy link
Member

  1. You don't need to fundrawtransaction if you already create the transaction with the inputs you want to spend
  2. You didn't use p2sh flag on importaddress as I just outlined

Give me correct solution.

🤣

@SamirBitzees
Copy link
Author

SamirBitzees commented Feb 8, 2024

  1. You don't need to fundrawtransaction if you already create the transaction with the inputs you want to spend
  2. You didn't use p2sh flag on importaddress as I just outlined

Give me correct solution.

🤣
Note: - I set flag "true" while importing redeemScript.
==> ubuntu@ip-172-31-35-31:~/dogecoin$ sudo /home/ubuntu/dogecoin/src/dogecoin-cli importaddress 532102324c886c67e43b7cb38493182f093e4f8d725e0cc316c690c4cb27db80da77d021032fbea33ba3b8aabde800649a753b36c84ba6e67b1fc14891f6e289c06d89bca121034518a1d55b5e07cfab0969da5be36d55c2bb5a84c0c63e2be5d283a2475c801353ae "krishna_redeem" true

If i don,t use fundrawtransaction then it will not send change to change address. remaining will get as Total Fee i checked that condition. You can see on this transaction hash which i perform multisig transaction.
Transaction hash :-- b06b0ba091a8d3bdb43df2977d6c0354d8a7f5eef62e08eedacfa065d036e16c

@SamirBitzees
Copy link
Author

SamirBitzees commented Feb 8, 2024

When I am using p2sh flag on importaddress getting error.

ubuntu@ip-172-31-35-31:~/dogecoin$ sudo /home/ubuntu/dogecoin/src/dogecoin-cli importaddress 532102324c886c67e43b7cb38493182f093e4f8d725e0cc316c690c4cb27db80da77d021032fbea33ba3b8aabde800649a753b36c84ba6e67b1fc14891f6e289c06d89bca121034518a1d55b5e07cfab0969da5be36d55c2bb5a84c0c63e2be5d283a2475c801353ae "krishna_redeem" true p2sh
error: Error parsing JSON:p2sh

@patricklodder
Copy link
Member

error: Error parsing JSON:p2sh

the value you need to give is true

@SamirBitzees
Copy link
Author

After setting value "true" and importing redeemScript still issue has not been resolved getting error when i am doing listunspent getting spendable false.

And one more thing if i sign transactions without fundraw transaction then it is taking remainig amount as an fee. you can see in this transaction.
Transaction Hash:- e983745fc4cc1c428c167e76032acb6ecf9a1d6eee5e9ad52af8aeaa244d2253

@SamirBitzees
Copy link
Author

> After setting value "true" and importing redeemScript still issue has not been resolved getting error when i am doing listunspent getting spendable false.

And one more thing if i sign transactions without fundraw transaction then it is taking remainig amount as an fee. you can see in this transaction. Transaction Hash:- e983745fc4cc1c428c167e76032acb6ecf9a1d6eee5e9ad52af8aeaa244d2253

@patricklodder Please reply for this i am facing big issue due it.

@SamirBitzees
Copy link
Author

Hi @patricklodder Please help me for this matter.

After setting value "true" and importing redeemScript still issue has not been resolved getting error when i am doing listunspent getting spendable false.

And one more thing if i sign transactions without fundraw transaction then it is taking remainig amount as an fee. you can see in this transaction. Transaction Hash:- e983745fc4cc1c428c167e76032acb6ecf9a1d6eee5e9ad52af8aeaa244d2253

@patricklodder
Copy link
Member

After setting value "true" and importing redeemScript still issue has not been resolved getting error when i am doing listunspent getting spendable false.

The only way how I can reproduce this is by importing the p2sh before importaddress. You'll want to strictly use this sequence, not doing anything in-between:

  1. createmultisig
  2. importaddress <script> <label> false true
  3. sendtoaddress
  4. wait for it to get mined - on testnet can generate 1 while you wait
  5. listunspent

@SamirBitzees
Copy link
Author

And one more thing if i sign transactions without fundraw transaction then it is taking remainig amount as an fee. you can see in this transaction. Transaction Hash:- e983745fc4cc1c428c167e76032acb6ecf9a1d6eee5e9ad52af8aeaa244d2253

What About this how we can calculate fee without fundraw transaction method, because if i am not wrong it calculate transaction fee and set default address as change address,

@patricklodder
Copy link
Member

patricklodder commented Feb 19, 2024

how we can calculate fee without fundraw transaction method

with estimatesmartfee and estimating the signed transaction size. for 3-of-3 multisig:

tx overhead: 10 bytes

for each input:

- outpoint: 36 bytes
- size: 2 bytes
- redeemscript: 254 bytes
- sequence: 4 bytes
- 3 signatures: 3 * 73 bytes = 219 bytes
total: 515 bytes

for each p2sh output: 24+8 = 32 bytes

for each p2pkh output: 28+8 = 36 bytes

For example, if you have a tx with 2 inputs, 1 p2pkh output and 1 p2sh output for change:

estimated size: 10 + (2 * 515) +  32 + 36 = 1108 bytes

Say the feerate given by estimatesmartfee is 0.05 DOGE/kB:

total fee: 1.108 * 0.05 = 0.0554
<total amount over inputs> - <amount sent> - <total fee> = change

you then assign that change back to your p2sh address (or a change address) by adding an additional output.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
@patricklodder @SamirBitzees and others