Bitcoin Stack Exchange is a question and answer site for Bitcoin crypto-currency enthusiasts. It only takes a minute to sign up.
Sign up to join this communityAnybody can ask a question
Anybody can answer
The best answers are voted up and rise to the top
I've created a Doge transaction in android using kotlin and am trying to push it via BlockCyphers facility at:https://%20https://live.blockcypher.com/btc-testnet/pushtx/
Then I got the following error:
Error validating transaction: Error running script for input 0 referencing 126c8c1312cf5dbcd7fe7154b645884c029e732460368cb21d050eb9b980a5bf at 0: Script was NOT verified successfully..
I am attaching my code sample here :
val wallet = HDWallet(seedPhrase, "") val bitcoin = CoinType.DOGECOIN val privateKey: PrivateKey =wallet.getKeyForCoin(CoinType.DOGECOIN); val toAddress = "DNGFS97bTyoxUUZKwemSiv3WhNHjbfaXTA" val fromAddress=wallet.getAddressForCoin(CoinType.DOGECOIN) val script = BitcoinScript.lockScriptForAddress(fromAddress, bitcoin) val txid=Numeric.hexStringToByteArray("126c8c1312cf5dbcd7fe7154b645884c029e732460368cb21d050eb9b980a5bf") val outPoint = OutPoint.newBuilder() .setHash(ByteString.copyFrom(txid.reversedArray())) .setIndex(0) .build() val utxoArrayList = UnspentTransaction.newBuilder() .setAmount(200000000) .setOutPoint(outPoint) .setScript(ByteString.copyFrom(script.data())) .build() val input = Bitcoin.SigningInput.newBuilder() .setAmount(100000000) .setHashType(BitcoinSigHashType.ALL.value()) .setToAddress(toAddress) .setChangeAddress(fromAddress) .setByteFee(1) .setCoinType(bitcoin.value()) .addUtxo(utxoArrayList) .addPrivateKey(ByteString.copyFrom(privateKey.data())) val plan = AnySigner.plan(input.build(), bitcoin, Bitcoin.TransactionPlan.parser()) input.plan = plan input.amount = plan.amount val output = AnySigner.sign(input.build(), bitcoin, Bitcoin.SigningOutput.parser()) val signedTransaction = output.encoded.toByteArray() val xy=signedTransaction.toHexString() signedTransaction?.toHexString()?.let { Log.d(TAG, it) }
**Is there any other issue with my code? Please help me **
You can get bonuses upto $100 FREE BONUS when you:
π° Install these recommended apps:
π² SocialGood - 100% Crypto Back on Everyday Shopping
π² xPortal - The DeFi For The Next Billion
π² CryptoTab Browser - Lightweight, fast, and ready to mine!
π° Register on these recommended exchanges:
π‘ Binanceπ‘ Bitfinexπ‘ Bitmartπ‘ Bittrexπ‘ Bitget
π‘ CoinExπ‘ Crypto.comπ‘ Gate.ioπ‘ Huobiπ‘ Kucoin.
Comments