You can see the test code 
here: 
https://github.com/bitcoinj/bitcoinj/blob/master/core/src/test/java/org/bitcoinj/core/AddressTest.java#L178



On Friday, 28 August 2015 18:07:51 UTC+2, Chris Stewart wrote:
>
> Hi, 
>
> I'm trying to create a p2sh address with bitcoinj. Here is my first crack 
> at it. 
>
>     //example coming from here:
>     //
> http://www.soroushjp.com/2014/12/20/bitcoin-multisig-the-hard-way-understanding-raw-multisignature-bitcoin-transactions/
>     val pubKey1 = 
> "04a882d414e478039cd5b52a92ffb13dd5e6bd4515497439dffd691a0f12af9575fa349b5694ed3155b136f09e63975a1700c9f4d4df849323dac06cf3bd6458cd"
>     val pubKey2 = 
> "046ce31db9bdd543e72fe3039a1f1c047dab87037c36a669ff90e28da1848f640de68c2fe913d363a51154a0c62d7adea1b822d05035077418267b1a1379790187"
>     val pubKey3 = 
> "0411ffd36c70776538d079fbae117dc38effafb33304af83ce4894589747aee1ef992f63280567f52f5ba870678b4ab4ff6c8ea600bd217870a8b4f1f09f3a8e83"
>     val expectedAddress = "347N1Thc213QqfYCz3PZkjoJpNv5b14kBd"
>     val key1 = ECKey.fromPublicOnly(decodeHex(pubKey1))
>     val key2 = ECKey.fromPublicOnly(decodeHex(pubKey2))
>     val key3 = ECKey.fromPublicOnly(decodeHex(pubKey3))
>     val keyList = ImmutableList.of(key1,key2,key3)
>     val script : Script = ScriptBuilder.createP2SHOutputScript(2,keyList)
>     val p2shAddress : String = Address.fromP2SHScript(walletUtil.network, 
> script).toString()
>     val actualAddress = p2shAddress
>     actualAddress must be (expectedAddress)
>
> and the result of this test is:
>
> [info] - must correct a p2sh address *** FAILED ***
> [info]   "3[Jdaaix9j8sc1YbTzLSvrqTmm5jmTeMC47]" was not equal to 
> "3[47N1Thc213QqfYCz3PZkjoJpNv5b14kBd]" (WalletUtilTest.scala:171)
>
> I'm not really sure what can be going wrong here, as it seems very 
> straightforward. I've tried different examples across the web and the 
> result has been incorrect. It is very possible that I have a simple error 
> that is causing this issue. 
>
> Thanks,
>
> -Chris
>

-- 
You received this message because you are subscribed to the Google Groups 
"bitcoinj" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to