Litecoin

Litecoin

Litecoin can be accessed with the following coin types:

EnvironmentCoin TypeFaucet
Litecoin Productionltc
Litecoin Testnettltchttp://testnet.litecointools.com/

Generating wallets

1 2 3 4 5 6 7 8 9 10 11 bitgo .coin('tltc') .wallets() .generateWallet({ label: 'My Test Wallet', passphrase: 'secretpassphrase1a5df8380e0e30', }) .then(function (wallet) { // print the new wallet console.dir(wallet); });
1 2 3 4 5 6 7 8 LABEL="My Test Wallet" PASSPHRASE="secretpassphrase1a5df8380e0e30" curl -X POST \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $ACCESS_TOKEN" \ -d "{ \"label\": \"$LABEL\", \"passphrase\": \"$PASSPHRASE\" }" \ http://$BITGO_EXPRESS_HOST:3080/api/v2/tltc/wallet/generate

For Litecoin, BitGo uses the same 2-of-3 multisig P2SH scheme as for Bitcoin, with the keys in the order of User, Backup and BitGo respectively.

Creating addresses

1 2 3 4 5 6 7 8 9 10 11 bitgo .coin('tltc') .wallets() .getWallet({ id: '585c51a5df8380e0e3082e46' }) .then(function (wallet) { return wallet.createAddress(); }) .then(function (newAddress) { // print new address details console.dir(newAddress); });
1 2 3 4 5 WALLET=585c51a5df8380e0e3082e46 curl -X POST \ -H "Authorization: Bearer $ACCESS_TOKEN" \ https://app.bitgo-test.com/api/v2/tltc/wallet/$WALLET/address

You can view address types and their Chain Codes. Litecoin defaults to chain code 0.

Converting addresses

1 2 3 4 5 6 bitgo.coin('ltc').canonicalAddress('3GBygsGPvTdfKMbq4AKZZRu1sPMWPEsBfd', 2); // MNQ7zkgMsaV67rsjA3JuP59RC5wxRXpwgE bitgo.coin('ltc').canonicalAddress('3GBygsGPvTdfKMbq4AKZZRu1sPMWPEsBfd', 1); bitgo.coin('ltc').canonicalAddress('MNQ7zkgMsaV67rsjA3JuP59RC5wxRXpwgE', 1); // 3GBygsGPvTdfKMbq4AKZZRu1sPMWPEsBfd
1 2 3 4 5 curl -X POST \ -H "Content-Type: application/json" \ -d "{ \"address\": \"3GBygsGPvTdfKMbq4AKZZRu1sPMWPEsBfd\", \"scriptHashVersion\": 2 }" \ http://$BITGO_EXPRESS_HOST:3080/api/v2/ltc/canonicaladdress # MNQ7zkgMsaV67rsjA3JuP59RC5wxRXpwgE

Litecoin used to support the same P2SH address format as Bitcoin, but switched to other version identifiers. This is why some Litecoin addresses start with 3 and some with M. Both addresses are the same.

For incoming transactions, BitGo converts each address that start with 3 to one that starts with M. For outgoing transactions, BitGo only accepts the new address format.

In testnet, the new P2SH addresses start with Q, so the corresponding conversion could be between 2MsFGJvxH1kCoRp3XEYvKduAjY6eYz9PJHz and QLc2RwpX2rFtZzoZrexLibcAgV6Nsg74Jn.

Method

bitgo.coin('ltc').canonicalAddress(address, scriptHashVersion)

bitgo.coin('tltc').canonicalAddress(address, scriptHashVersion)

HTTP Request

POST /api/v2/:coin/canonicaladdress

Function Arguments

ParameterTypeRequiredDescription
addressStringYesThe address string to convert
scriptHashVersionIntegerNo1 for old address format, 2 for new. Defaults to 2.

Balances

Litecoin (LTC) is the native asset of the Litecoin blockchain. The base unit of Litecoin is microlitecoin:

  • 1 microlitecoin is (10-8) or 0.00000001 Litecoin.
  • 1 Litecoin is (108) or 100000000 microlitecoins (100 million).

Balances are supported in string and number format but string is recommended to ensure values do not exceed the programmable number limit: balanceString, confirmedBalanceString, and spendableBalanceString.