Skip to main content
added 533 characters in body
Source Link
Zombie
  • 548
  • 3
  • 19

I am working with watching wallet and Offline wallet using bitcoinj, I created Watching Wallet using tpub key of Offline Wallet

I am receiving payment on watching wallet Fine, now I want to spend coins from watching wallet after Signing my transaction from offline wallet

But my wallet balance is 60.00123389 BTC , its not spendable balance as my watching wallet shows

Wallet containing 0.23389 BTC (spendable: 0.00 BTC)

This is not spendable because we cannot spend coins from watching wallet unless you sign it with the corresponding private key

Below is my code: As i am trying to sign transaction from my offline wallet, so i can spend coins from watching wallet

private void bla()
{
    Coin coin = Coin.parseCoin("0.01");
    Address address = Address.fromBase58(params, "n4oLPFUGvohSdDxvJS3amXvfE1GEdZBddd");
    Transaction tx = new Transaction(params);
    System.out.println("Raw TX: " + tx.toString());
    byte[] bytes = Script.createInputScript("5ff01d61e67c706cb79653aa1e7ad2c7254b841167e0a34055504c35c7240469".getBytes()); // tx hash 
 
    TransactionInput input = newnull;
 TransactionInput   List<Transaction> list = kit.wallet(params,).getTransactionsByTime();
 null, bytes  for(Transaction t: list)
    {
        input = t.getInput(0);
    }

    //Creates a scriptPubKey that encodes payment to the given address.
    Script scriptPubKey = ScriptBuilder.createOutputScript(address);
    // Signature Script
    Script scriptSig = input.getScriptSig();

    // Adding output that involves Amount and Script
    tx.addOutput(coin, scriptPubKey);
    System.out.println("Script pub key: " + scriptPubKey);

    //Adding input to the raw transaction
    tx.addInput(Sha256Hash.wrap(tx.getHashAsString()), 0, scriptSiginput);
    System.out.println("After adding inputs: " + tx.toString());
}

I am working with watching wallet and Offline wallet using bitcoinj,

I am receiving payment on watching wallet Fine, now I want to spend coins from watching wallet

But my wallet balance is 6.001 BTC

Below is my code:

private void bla()
{
    Coin coin = Coin.parseCoin("0.01");
    Address address = Address.fromBase58(params, "n4oLPFUGvohSdDxvJS3amXvfE1GEdZBddd");
    Transaction tx = new Transaction(params);
    System.out.println("Raw TX: " + tx.toString());
    byte[] bytes = Script.createInputScript("5ff01d61e67c706cb79653aa1e7ad2c7254b841167e0a34055504c35c7240469".getBytes()); // tx hash 
 
    TransactionInput input = new TransactionInput(params, null, bytes);

    //Creates a scriptPubKey that encodes payment to the given address.
    Script scriptPubKey = ScriptBuilder.createOutputScript(address);
    // Signature Script
    Script scriptSig = input.getScriptSig();

    // Adding output that involves Amount and Script
    tx.addOutput(coin, scriptPubKey);
    System.out.println("Script pub key: " + scriptPubKey);

    //Adding input to the raw transaction
    tx.addInput(Sha256Hash.wrap(tx.getHashAsString()), 0, scriptSig);
    System.out.println("After adding inputs: " + tx.toString());
}

I am working with watching wallet and Offline wallet using bitcoinj, I created Watching Wallet using tpub key of Offline Wallet

I am receiving payment on watching wallet Fine, now I want to spend coins from watching wallet after Signing my transaction from offline wallet

But my wallet balance is 0.23389 BTC , its not spendable balance as my watching wallet shows

Wallet containing 0.23389 BTC (spendable: 0.00 BTC)

This is not spendable because we cannot spend coins from watching wallet unless you sign it with the corresponding private key

Below is my code: As i am trying to sign transaction from my offline wallet, so i can spend coins from watching wallet

private void bla()
{
    Coin coin = Coin.parseCoin("0.01");
    Address address = Address.fromBase58(params, "n4oLPFUGvohSdDxvJS3amXvfE1GEdZBddd");
    Transaction tx = new Transaction(params);
    System.out.println("Raw TX: " + tx.toString());
    byte[] bytes = Script.createInputScript("5ff01d61e67c706cb79653aa1e7ad2c7254b841167e0a34055504c35c7240469".getBytes()); // tx hash 
    TransactionInput input = null;
    List<Transaction> list = kit.wallet().getTransactionsByTime();
    for(Transaction t: list)
    {
        input = t.getInput(0);
    }

    //Creates a scriptPubKey that encodes payment to the given address.
    Script scriptPubKey = ScriptBuilder.createOutputScript(address);
    // Signature Script
    Script scriptSig = input.getScriptSig();

    // Adding output that involves Amount and Script
    tx.addOutput(coin, scriptPubKey);
    System.out.println("Script pub key: " + scriptPubKey);

    //Adding input to the raw transaction
    tx.addInput(input);
    System.out.println("After adding inputs: " + tx.toString());
}
deleted 63 characters in body
Source Link
Ava Chow
  • 72.2k
  • 5
  • 84
  • 162

what I am doing is creating rawTx from Watching Wallet then sign it
with private key from Offline Wallet

but when I broadcast it, it throws an exception
InsufficientMoneyException. my wallet balance is 6.001 BTC

What I am doing is creating rawTx from the Watching Wallet and then signing it with the private key from Offline Wallet but when I broadcast it, it throws an exception:

InsufficientMoneyException

My code snippetBut my wallet balance is 6.001 BTC

Below is my code:

For creating Raw Transaction from Watching Wallet

and I am getting an exception here InsufficientMoneyException but my wallet balance is 6 BTC

I am getting the exception here.

what I am doing is creating rawTx from Watching Wallet then sign it
with private key from Offline Wallet

but when I broadcast it, it throws an exception
InsufficientMoneyException. my wallet balance is 6.001 BTC

My code snippet is

For creating Raw Transaction from Watching Wallet

and I am getting an exception here InsufficientMoneyException but my wallet balance is 6 BTC

What I am doing is creating rawTx from the Watching Wallet and then signing it with the private key from Offline Wallet but when I broadcast it, it throws an exception:

InsufficientMoneyException

But my wallet balance is 6.001 BTC

Below is my code:

For creating Raw Transaction from Watching Wallet

I am getting the exception here.

iI am working with watching wallet and Offline wallet using bitcoinj,

iI am receiving payment on watching wallet Fine, now iI want to spend coins from watching wallet

what iI am doing is creating rawTx from Watching Wallet then sign it
with private key from Offline Wallet

but when iI broadcast it, its throwit throws an exception
InsufficientMoneyException. my wallet balance is 6.001 BTC

Then iI have added one more input in raw transaction

and iI am getting an exception here InsufficientMoneyException but my wallet balance is 6 BTC

iI don't know what i anI am doing wrong here, as iI think my tx hash is just fine, all i all I have to do is broadcast the transaction into the network fromfrom watching wallet, which iI am also doing but can notcannot succeed. i willI would really appreciate if someone helps me to find my mistake and broadcasting the signed transaction from watching wallet.

i am working with watching wallet and Offline wallet using bitcoinj,

i am receiving payment on watching wallet Fine, now i want to spend coins from watching wallet

what i am doing is creating rawTx from Watching Wallet then sign it
with private key from Offline Wallet

but when i broadcast it, its throw an exception
InsufficientMoneyException. my wallet balance is 6.001 BTC

Then i have added one more input in raw transaction

and i am getting an exception here InsufficientMoneyException but my wallet balance is 6 BTC

i don't know what i an doing wrong here, as i think my tx hash is just fine, all i have to do is broadcast the transaction into the network from watching wallet, which i am also doing but can not succeed. i will really appreciate if someone helps me to find my mistake and broadcasting the signed transaction from watching wallet.

I am working with watching wallet and Offline wallet using bitcoinj,

I am receiving payment on watching wallet Fine, now I want to spend coins from watching wallet

what I am doing is creating rawTx from Watching Wallet then sign it
with private key from Offline Wallet

but when I broadcast it, it throws an exception
InsufficientMoneyException. my wallet balance is 6.001 BTC

Then I have added one more input in raw transaction

and I am getting an exception here InsufficientMoneyException but my wallet balance is 6 BTC

I don't know what I am doing wrong here, as I think my tx hash is just fine, all I have to do is broadcast the transaction into the network from watching wallet, which I am also doing but cannot succeed. I would really appreciate if someone helps me to find my mistake and broadcasting the signed transaction from watching wallet.

Source Link
Zombie
  • 548
  • 3
  • 19
Loading