I need to use
Wallet-Core to create & sign transactions for Bitcoin, which I then broadcast with blockcypher. The sample program is for Ethereum though, so I'm at a loss at what I'm supposed to do here.
From the sample:
// coin type: we use Ethereum
const TWCoinType coinType = TWCoinType::TWCoinTypeEthereum; // TWCoinTypeBitcoin, TWCoinTypeEthereum
cout << "Working with coin: " <<
TWStringUTF8Bytes(TWCoinTypeConfigurationGetName(coinType)) << " " <<
TWStringUTF8Bytes(TWCoinTypeConfigurationGetSymbol(coinType)) << endl;
// Derive default address.
cout << "Obtaining default address ... ";
string address = TWStringUTF8Bytes(TWHDWalletGetAddressForCoin(walletImp, coinType));
cout << " done." << endl;
cout << "Default address: '" << address << "'" << endl;
// ...
That's how you can get the address of any coin from the wallet.
But it appears the TWAnySignerSignJSON class, which is responsible for signing the transaction, is using data fields specific to ETH in the example code later in the file. (samples/cpp/sample.cpp). It's json, mixed with raw transaction bytes.
So how can I use this class to create a Bitcoin transaction? And by extension, coins that use the Bitcoin tx format such as LTC and doge?