Bitcoin Forum
May 01, 2024, 05:02:47 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Creating a bitcoin transaction using Trust Wallet wallet-core  (Read 37 times)
NotATether (OP)
Legendary
*
Offline Offline

Activity: 1582
Merit: 6717


bitcoincleanup.com / bitmixlist.org


View Profile WWW
March 12, 2023, 05:32:54 AM
 #1

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:

Code:
              // 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?

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!