Bitcoin
The D'CENT Android SDK provides functions for signing transaction of coins.
This function for :
BITCOIN
(BTC) - bitcoinBITCOIN_SV
(BSV) - bitcoin svBTC_SEGWIT
(BTC) - bitcoin segwitMONACOIN
(MONA) - monacoinLITECOIN
(LTC) - litecoinLTC_SEGWIT
(LTC) - litecoin segwitZCASH
(ZEC) - zcashHORIZEN
(ZEN) - horizenBITCOINCASH
(BCH) - bitcoin cashDOGECOIN
(DOGE) - dogecoinBITCOINABC
(BCHA) - bitcoin cash abcECASH
(XEC) - ecashDASH
(DASH) - dashBITCOIN_GOLD
(BTG) - bitcoin goldDIGIBYTE
(DGB) - digibyteDGB_SEGWIT
(DGB)- digibyte segwitRAVENCOIN
(RVN) - ravencoinBITCOIN_TESTNET
(BTCt) - bitcoin testnsetBTC_SEGWIT_TESTNET
(BTCt) - bitcoin segwit testnetMONACOIN_TESTNET
(MONAt) - monacoin testnetLITE_TESTNET
(tLTC) - litecoin testnetLTC_SEGWIT_TESTNET
(tLTC) - litecoin segwit testnetZCASH_TESTNET
(TAZ) - zcash testnetBCH_TESTNET
(tBCH)- bitocin cash testnetDASH_TESTENET
(tDASH) - dash testnetBTG_TESTNET
(tBTG) - bitcoin gold testnetDIGIBYTE_TESTNET
(tDGB) - digibyte testnetDGB_SEGWIT_TESTNET
(tDGB) - digibyte segwit testnetRVN_TESTNET
(tRVN) - ravencoin testnet
Parameter | Type | Description |
---|---|---|
coinType | CoinType | bitcoin coin type. |
transaction | bitcoin transaction parameters. |
This class to be used for bitcoin transaction.
Name | Type | Description |
---|---|---|
version | int | version of bitcoin transaction. Currently 1
- BCH / Dash /BTG -> 2
- ZCASH -> 4 |
input | previous transaction output information to be used | |
output | coin spending information | |
locktime | int | locktime for this transaction |
optionParam | String | (optional)option parameter |
The class for previous transaction output information to be used for bitcoin network transaction.
Name | Type | Description |
---|---|---|
prev_tx | String | full of previous transaction data |
utxo_idx | int | index of previous transaction output to be sent |
type | String | bitcoin transaction type for this UTXO |
key | Bip44KeyPath | BIP44 key path for unlocking UTXO |
The class for coin spending information of Bitcoin network Transaction
Name | Type | Description |
---|---|---|
value | long | amount of coin to spend. Satoshi unit. |
to | List<String> | if type is p2pkh or p2sh , Base58Check encoded address of the receiver.
The value of the field may follow the rule of version prefix.(BITCOIN_BASE58CHECK )
if the type is p2pk , Base58Check encoded non-compressed public key without version prefix.
if the type is multisig , Base58Check encoded non-compressed public key (without version prefix) list.
if the type is change , BIP44 formatted PATH to get change address. In this case, the transaction type is assumed as p2pkh |
type | String | bitcoin network transaction type or this field can indicate output as a change |
String
- signed transaction.j- Refer to D`CENT Firmware Update History to determine which D'CENT Biometric Wallet versions are supported on each network.
Example
UnspentTransactionOutput utxo = new UnspentTransactionOutput("01000000012b09bd990adc6792588225486c336fb2090890341fcbc6ae92c440c3bd266b98010000006a47304402201df6bd2294f9d51496c1be7ea09431fcfee4b0ca9359712c2c381aff9b2d6f070220595a5bb4e9f0f0d1f5fb9a800224c01ac99058d9b491cd7e6a60145bbd26ddca0121028cbb73e589f81937784eaf728cd14ad27984e5415766c04408211af8d9e30ee7ffffffff0127810000000000001976a9141c7254fac600ef7371664a613f0323c6c641cbd288ac00000000", 0, BitCoinTransaction.TxType.p2pkh, Bip44KeyPath.valueOf("m/44'/0'/0'/0/0")) ;
List<UnspentTransactionOutput> input = new ArrayList<>();
input.add(utxo) ;
TransactionOutput txo = new TransactionOutput(10000, Arrays.asList(new String[]{"1Ckii7MpiquSxcmo2ch1UTfQMConz31rpB"}), BitCoinTransaction.TxType.p2pkh ) ;
List<TransactionOutput> output = new ArrayList<>();
output.add(txo) ;
BitCoinTransaction bitCoinTransaction = new BitCoinTransaction.Builder()
.version(1)
.input(input)
.output(output)
.locktime(0)
.build();
String response = mDcentManager.getBitcoinSignedTransaction(CoinType.BITCOIN, bitCoinTransaction);
Last modified 2mo ago