Bitcoin Forum

Bitcoin => Bitcoin Technical Support => Topic started by: Kylepr on May 22, 2018, 04:21:03 AM



Title: Error sweeping wallet
Post by: Kylepr on May 22, 2018, 04:21:03 AM
I am getting a cannot build transaction error when I try sweeping a paper wallet with copay. Any idea what could be happening?


Title: Re: Error sweeping wallet
Post by: Heisenberg_Hunter on May 22, 2018, 06:01:45 AM
Are you having enough funds in your wallet to pay for the transaction fee?

Cannot build transaction error occurs most probably when the Total amount present in the wallet is less than amount you specified to sweep+fee. When you sweep a paper wallet, your wallet must have enough funds to provide the transaction fees and complete the sweep. For instance, if your wallet has a balance of 0.00001 btc in the paper wallet you can never sweep the wallet as the funds would go for the transaction fees itself and cannot transfer the funds.


Title: Re: Error sweeping wallet
Post by: bob123 on May 22, 2018, 07:51:43 AM
Are you having enough funds in your wallet to pay for the transaction fee?

Cannot build transaction error occurs most probably when the Total amount present in the wallet is less than amount you specified to sweep+fee. When you sweep a paper wallet, your wallet must have enough funds to provide the transaction fees and complete the sweep.

I am not familiar with copay. But does the fee always get paid by the 'copay wallet addresses'?
Because this should not be the case. 'Sweeping' simply means to import private keys + send them to an address generated by this wallet.
So as long the paper wallet isn't 'empty', a wallet should always be able to make a transaction, using the imported private key as the only input of a transaction.

Either copay is coded realy realy bad or this is not the reason for the error OP gets.



For instance, if your wallet has a balance of 0.00001 btc in the paper wallet you can never sweep the wallet as the funds would go for the transaction fees itself and cannot transfer the funds.


A paper wallet should always contain more than just a transaction fee.


@OP:
You might try to use a different wallet. Simply import the private key into (any) [1] wallet and send the funds to your copay wallet.

[1] e.g. for mobile: mycelium (https://play.google.com/store/apps/details?id=com.mycelium.wallet) / electrum (https://play.google.com/store/apps/details?id=org.electrum.electrum)  -  and for desktop: electrum (https://electrum.org/#home)


Title: Re: Error sweeping wallet
Post by: Heisenberg_Hunter on May 22, 2018, 03:26:02 PM
'Sweeping' simply means to import private keys + send them to an address generated by this wallet.
Isn't "Sweeping a paper wallet" and "Importing private keys of a paper wallet" different? 

Importing private key of a paper wallet is just adding the "private key of paper wallet" to the list of private keys already present in the software wallet (for instance electrum). By this way we can have access to both the funds of the wallet and also the paper wallet and the wallet balance increases. Importing a private key is literally dangerous when compared to sweeping of paper wallet. If the paper wallet receives any funds, they are shown in the software wallet too.

Whereas "Sweeping a paper wallet" is similar to sending btc from one address to another. Sweeping makes the balance of the paper wallet to 0 and all the funds present in the paper wallet has been transferred to the software wallet. In order to perform a sweep, its literally a blockchain transaction and requires a fee to be paid to the miner for the transfer.

Either copay is coded realy realy bad or this is not the reason for the error OP gets.
Copay doesn't support importing of private keys. It only supports sweeping of paper wallets. Hence we need to have enough funds in the wallet to pay for a transaction

A paper wallet should always contain more than just a transaction fee.
Yes. But what about btc dust? There was a time before segwit where we need to spend around 20-25$ per transaction and the amount present in the paper wallet is 10$. During such times, we cannot perform a sweep!

You might try to use a different wallet. Simply import the private key into (any) [1] wallet and send the funds to your copay wallet.
This is the only solution if the OP has less funds in a paper wallet!


Title: Re: Error sweeping wallet
Post by: bob123 on May 23, 2018, 08:00:12 AM
'Sweeping' simply means to import private keys + send them to an address generated by this wallet.
Isn't "Sweeping a paper wallet" and "Importing private keys of a paper wallet" different? 

Importing private key of a paper wallet is just adding the "private key of paper wallet" to the list of private keys already present in the software wallet (for instance electrum). By this way we can have access to both the funds of the wallet and also the paper wallet and the wallet balance increases. Importing a private key is literally dangerous when compared to sweeping of paper wallet. If the paper wallet receives any funds, they are shown in the software wallet too.

Whereas "Sweeping a paper wallet" is similar to sending btc from one address to another. Sweeping makes the balance of the paper wallet to 0 and all the funds present in the paper wallet has been transferred to the software wallet. In order to perform a sweep, its literally a blockchain transaction and requires a fee to be paid to the miner for the transfer.

To be able to 'send from an address to another' you need the corresponding private key.
Whenever you are going to 'sweep' a wallet, the software you are using is importing the private key AND creating/broadcasting a transaction to an address generated by the wallet itself.
This does not mean that the private key will be stored inside the wallet. But it still had to be imported to make this transaction.



Either copay is coded realy realy bad or this is not the reason for the error OP gets.
Copay doesn't support importing of private keys. It only supports sweeping of paper wallets. Hence we need to have enough funds in the wallet to pay for a transaction

This doesn't make any sense at all.
The moment the wallet scans the private key (containing more than just dust) there are funds available to create a transaction and pay a fee.
You don't need to have a balance BEFORE tryin to sweep. The UTXO's assigned to the public key which corresponds to the scanned private key will be the input of the transaction.



A paper wallet should always contain more than just a transaction fee.
Yes. But what about btc dust? There was a time before segwit where we need to spend around 20-25$ per transaction and the amount present in the paper wallet is 10$. During such times, we cannot perform a sweep!

OP is facing this problem now and not back in december where fees were at their ATH (what you probably mean with 'time before segwit').
Note that segwit has been activated 01.08.2017. Followed by a transaction spam attack on the network (see here: https://jochen-hoenicke.de/queue/#1,all (https://jochen-hoenicke.de/queue/#1,all)).
Still, the highest fees occured 5 months later. Segwit was already there. It just hasn't been used.

And currently fees are as low as 3-4 sat/B to get confirmed within the next block. Can't get much lower. If you are having dust now which is less than a transaction fee, then you won't ever be able to use it efficiently again..


Title: Re: Error sweeping wallet
Post by: Heisenberg_Hunter on May 23, 2018, 03:13:06 PM
Thanks for correcting me and the explanation you have given for justifying it. Maybe I would have not read completely about sweeping of paper wallets.


Title: Re: Error sweeping wallet
Post by: Kylepr on May 24, 2018, 01:26:54 AM
I only have the option of sweeping all the funds. It won't let me choose the amount. If there is a fee I know I have enough to cover the transaction cost.


Title: Re: Error sweeping wallet
Post by: HCP on May 24, 2018, 02:11:20 AM
Just out of curiosity, does the private key you are trying to sweep start with a "5" or does it start with a "K" or "L"?

It's possible that the wallet is having issues with uncompressed vs. compressed keys and is not finding the appropriate available inputs etc.

Have you tried sweeping with another wallet? Personally, I'd recommend Electrum (The desktop version).


Title: Re: Error sweeping wallet
Post by: Kylepr on May 24, 2018, 04:36:25 PM
I'll give another wallet a try if that's my only option I guess


Title: Re: Error sweeping wallet
Post by: jackg on May 24, 2018, 05:07:47 PM
I'll give another wallet a try if that's my only option I guess


Could you look at HCP's question.

What does the private key begin with?
an "L" or a "K" means the key is wif compressed.
a "5" means the key is wif format (but not compressed).
a "U" means it's encrypted (usually)
anything else might mean the key is in a different format.

I'd suggest trying electrum (http://electrum.org/#download) for importing the keys to check it's not the problem of copay if you want a secondary wallet to try it with. [EDIT: as hcp suggested].

If the link doesn't load: http://electrum.org/#download - copy/paste this.


Title: Re: Error sweeping wallet
Post by: LoyceV on May 24, 2018, 06:26:38 PM
I only have the option of sweeping all the funds. It won't let me choose the amount.
When sweeping a paper wallet, you should always use the entire balance! Making a partial payment means the change will be send to another address, and if you're not sure what you're doing, you risk losing it.

This has nothing to do with Copay, it's the way Bitcoin transactions work. If you only want to send a part of your funds to Copay, you'll have to sweep your Bitcoins into your own wallet first. See bob123's post (https://bitcointalk.org/index.php?topic=4113956.msg38134137#msg38134137) for wallet suggestions.


Title: Re: Error sweeping wallet
Post by: Searing on May 24, 2018, 06:28:18 PM
I only have the option of sweeping all the funds. It won't let me choose the amount. If there is a fee I know I have enough to cover the transaction cost.


If this is a paper wallet I did this online via blockchain.info or coinbase....I can't remember which..think maybe it was coinbase in that

it stripped out the BCH..which I found amusing...

others? clarity?



Title: Re: Error sweeping wallet
Post by: Kylepr on May 25, 2018, 03:27:49 AM
My private key starts with 6. Idk if that helps


Title: Re: Error sweeping wallet
Post by: HCP on May 25, 2018, 03:53:53 AM
My private key starts with 6. Idk if that helps
Ahhhh OK. It sounds like you actually have a BIP38 ENCRYPTED private key (https://bitcoinpaperwallet.com/bip38-password-encrypted-wallets/)... it will start "6P". You need to know the encryption passphrase that was used to be able to decrypt and then sweep this wallet. NOTE: If you don't know this passphrase, you will be unable to decrypt the private key and recover the funds!

If CoPay does not support BIP38 encrypted paperwallets... you'll need to decrypt it first (using the "Wallet Details" tab at bitaddress.org (https://www.bitaddress.org/) or the "Validate or Decrypt" tab at bitcoinpaperwallet.com (https://bitcoinpaperwallet.com/bitcoinpaperwallet/generate-wallet.html#)), and then sweep the WIF format key that you get after decrypting it. (NOTE: remember to download bitaddress.org or bitcoinpaperwallet.com and run them offline to minimise risk of exposing your private key before you sweep it!)


Title: Re: Error sweeping wallet
Post by: jackg on May 25, 2018, 04:26:46 PM
My private key starts with 6. Idk if that helps
Ahhhh OK. It sounds like you actually have a BIP38 ENCRYPTED private key (https://bitcoinpaperwallet.com/bip38-password-encrypted-wallets/)... it will start "6P". You need to know the encryption passphrase that was used to be able to decrypt and then sweep this wallet. NOTE: If you don't know this passphrase, you will be unable to decrypt the private key and recover the funds!

If CoPay does not support BIP38 encrypted paperwallets... you'll need to decrypt it first (using the "Wallet Details" tab at bitaddress.org (https://www.bitaddress.org/) or the "Validate or Decrypt" tab at bitcoinpaperwallet.com (https://bitcoinpaperwallet.com/bitcoinpaperwallet/generate-wallet.html#)), and then sweep the WIF format key that you get after decrypting it. (NOTE: remember to download bitaddress.org or bitcoinpaperwallet.com and run them offline to minimise risk of exposing your private key before you sweep it!)

Disconnect the internet before using bitaddress.org once you have downloaded the site and clicked on the right options (just before entering the private key).
Reconnect only once your session is complete (the browser is closed and the private key is stored on your clipboard or on a file just to increase the security a little bit).


Title: Re: Error sweeping wallet
Post by: TheGameBall on June 08, 2018, 05:32:31 AM
It's possible that the wallet is having issues with uncompressed vs. compressed keys and is not finding the appropriate available inputs etc. :-\