Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions bitcart/coins/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from .bch import BCH
from .bnb import BNB
from .btc import BTC
from .btclnd import BTCLND
from .eth import ETH
from .grs import GRS
from .ltc import LTC
Expand All @@ -11,6 +12,7 @@

COINS = {
"BTC": BTC,
"BTCLND": BTCLND,
"BCH": BCH,
"XMR": XMR,
"ETH": ETH,
Expand Down
3 changes: 2 additions & 1 deletion bitcart/coins/btc.py
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ async def validate_key(self, key: str, *args: Any, **kwargs: Any) -> bool:
### Lightning apis ###

@lightning
async def open_channel(self, node_id: str, amount: AmountType) -> str:
async def open_channel(self, node_id: str, amount: AmountType, private: bool = False) -> str:
"""Open lightning channel

Open channel with node, returns string of format
Expand All @@ -463,6 +463,7 @@ async def open_channel(self, node_id: str, amount: AmountType) -> str:
self (BTC): self
node_id (str): id of node to open channel with
amount (AmountType): amount to open channel
private (bool): if True, open an unannounced (private) channel

Returns:
str: string of format txid:output_index
Expand Down
31 changes: 31 additions & 0 deletions bitcart/coins/btclnd.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
"""BitcoinLND SDK coin class.

Provides the same interface as BTC but connects to the BTCLND daemon
(LND-backed) instead of Electrum.
"""

from .btc import BTC


class BTCLND(BTC):
coin_name = "BTCLND"
friendly_name = "Bitcoin (LND)"
display_symbol = "BTC" # Show "BTC" to customers on checkout, not "BTCLND"
xpub_name = "Seed"
RPC_URL = "http://localhost:5012"
RPC_USER = "electrum"
RPC_PASS = "electrumz" # noqa
# LND only supports hot wallets (seed-based), not watch-only
hot_wallet_only = True
# Lightning is always enabled with LND
lightning_default = True
# LND supports Tor hybrid mode
supports_tor = True
supports_zero_conf = True
# Rate rules: define fixed SATS conversion (1 BTC = 100,000,000 SATS)
# Uses BTCLND prefix (internal currency name) matching how the rate engine looks up rules
rate_rules = "BTCLND_SATS = 100000000\nBTCLND_BTC = 1"

async def open_channel(self, node_id: str, amount, private: bool = False) -> str:
"""Open lightning channel with announced/unannounced support."""
return await self.server.open_channel(node_id, amount, private=private)