I had a multi-sig address M (starting with 3) that I was trying to send a small amount of coins to. I was playing around with BCCAPI and the coins got sent to an "ordinary" address A (starting with 1)

I had supplied M to the library but somehow the signed tx had the address A

I know who controls M but no one seems to control A. I am trying to see if the funds can be recovered by someone controlling M.

Is there any relation between the two addresses? I'd prefer not to post the actual addresses yet. However, the fact that I used BCCAPI might give some clue.

Here is the code (in Scala) that I used:

val M = "3..." // multi-sig address
val receiver = com.bccapi.bitlib.model.Address.fromString(M, netParams)
val so = new com.bccapi.bitlib.model.ScriptOutputStandard(receiver.getTypeSpecificBytes())

1 Answer 1


The call to receiver.getTypeSpecificBytes() strips off the version byte (the '3'), and ScriptOutputStandard() always creates a P2PKH script from this raw (with no version byte) 20-byte hash. The bitcoin that was sent to the P2PKH address is probably irretrievable.

You probably meant to do this to create a P2SH script:

val so = new com.bccapi.bitlib.model.ScriptOutputMultisig(receiver.getTypeSpecificBytes())

Also, just FYI I don't think BCCAPI is being supported any longer. I don't see any updates to it since late 2012, and the then maintainer has since moved on to create Mycelium. You may want to consider an alternative Java Bitcoin library such as bitcoinj.

  • The bitcoin that was sent to the P2PKH address is probably irretrievable is the part I'm interested in confirming. Its a small amount so if its futile, I won't waste my time. I used this exact method to create ordinary transactions without problems. It only happened with multi-sig. I'm hoping that the public key in the output might be one of the public keys of the multi-sig.. But thats probably not true.
    – Jus12
    Jun 19, 2015 at 3:16
  • 1
    If your "3..." M address is in fact a valid P2SH address created by a working wallet or library, then there is no way to recover any funds sent to the A address created by your code above. The private keys for the A address cannot be determined even if you have the keys for the M address. Sorry.... :( Jun 19, 2015 at 4:44
  • 1
    In that case I should consider myself lucky that the amount lost is small. A lessen well learnt.
    – Jus12
    Jun 19, 2015 at 5:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.