-
Notifications
You must be signed in to change notification settings - Fork 0
Setup lightning in pipeline and local dev script #56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -293,12 +293,6 @@ start_lnd() { | |
echo " RPC Port: 10009" | ||
echo " P2P Port: 9735" | ||
echo "" | ||
echo "Note: Update the placeholder flags in the script:" | ||
echo " - <BITCOIND_RPC_PORT>" | ||
echo " - <BITCOIND_RPC_USER>" | ||
echo " - <BITCOIND_RPC_PASS>" | ||
echo " - <ZMQ_RAWBLOCK_PORT>" | ||
echo " - <ZMQ_RAWTX_PORT>" | ||
} | ||
|
||
# Stops and removes the LND container | ||
|
@@ -312,6 +306,64 @@ stop_lnd() { | |
fi | ||
} | ||
|
||
# Sets up Lightning Network channels between LND and CLN | ||
setup_lightning_channels() { | ||
echo "⚡ Setting up Lightning Network channels..." | ||
|
||
if ! command -v jq &> /dev/null; then | ||
echo "Error: 'jq' is not installed. Please install it to continue." >&2 | ||
exit 1 | ||
fi | ||
|
||
echo "" | ||
echo "⏳ Waiting for LND to fully start..." | ||
sleep 10 | ||
|
||
echo "" | ||
echo "🔍 Getting LND node pubkey..." | ||
local lnd_pubkey | ||
lnd_pubkey=$(docker exec "$LND_CONTAINER" lncli --network=regtest getinfo | jq -r '.identity_pubkey') | ||
echo " LND pubkey: $lnd_pubkey" | ||
|
||
echo "" | ||
echo "🔍 Getting CLN node pubkey..." | ||
local cln_pubkey | ||
cln_pubkey=$(dcr exec "$CLN_SERVICE" lightning-cli --regtest getinfo | jq -r '.id') | ||
echo " CLN pubkey: $cln_pubkey" | ||
|
||
echo "" | ||
echo "💰 Generating new address on LND node..." | ||
local lnd_address | ||
lnd_address=$(docker exec "$LND_CONTAINER" lncli --network=regtest newaddress p2tr | jq -r '.address') | ||
echo " Address: $lnd_address" | ||
|
||
echo "" | ||
echo "💸 Sending 0.1 BTC to LND address..." | ||
send_to_address "$lnd_address" "0.1" | ||
|
||
echo "" | ||
echo "⛏️ Generating 10 blocks..." | ||
generate_blocks 10 | ||
|
||
echo "" | ||
echo "⏳ Waiting for LND to sync to chain..." | ||
sleep 10 | ||
niteshbalusu11 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
echo "" | ||
echo "🔗 Connecting LND to CLN..." | ||
dcr exec "$CLN_SERVICE" lightning-cli --regtest connect "[email protected]:9735" || echo " (Already connected or connection failed, continuing...)" | ||
niteshbalusu11 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
echo "" | ||
echo "⚡ Opening channel from LND to CLN (1,000,000 sats with 900,000 push amount)..." | ||
docker exec "$LND_CONTAINER" lncli --network=regtest openchannel "$cln_pubkey" 1000000 900000 | ||
|
||
echo "" | ||
echo "⛏️ Generating 10 more blocks to confirm channel..." | ||
generate_blocks 10 | ||
|
||
echo "✅ Lightning Network channels setup complete!" | ||
} | ||
|
||
# Runs the complete setup sequence | ||
setup_everything() { | ||
echo "🚀 Running complete setup sequence..." | ||
|
@@ -344,6 +396,9 @@ setup_everything() { | |
echo "" | ||
start_lnd | ||
|
||
echo "" | ||
setup_lightning_channels | ||
|
||
echo "" | ||
echo "🎉 Complete setup finished successfully!" | ||
echo "Your Ark dev environment is ready to use." | ||
|
@@ -354,6 +409,7 @@ setup_everything() { | |
echo " - Noah Server: http://localhost:3000" | ||
echo " - Noah Server Health: http://localhost:3099/health" | ||
echo " - LND (Lightning): RPC at localhost:10009, P2P at localhost:9735" | ||
echo " - CLN (Lightning): Connected to LND with open channel" | ||
} | ||
|
||
# --- Main Logic --- | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.