Bitcoin Forum
May 06, 2024, 02:29:21 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Trying to send bitcoin to c-lightning. Getting "Invalid Bitcoin Address"  (Read 205 times)
jimbobway (OP)
Legendary
*
Offline Offline

Activity: 1304
Merit: 1014



View Profile
January 23, 2018, 01:00:18 AM
Merited by DannyHamilton (2)
 #1

I'm following these instructions at https://github.com/ElementsProject/lightning to open a channel:

Quote
First you need to transfer some funds to lightningd so that it can open a channel:

# Returns an address <address>
cli/lightning-cli newaddr

# Returns a transaction id <txid>
bitcoin-cli -testnet sendtoaddress <address> <amount>


Lightning gives me a new address that starts with a "2", 2xxxxxxxxxxxxxxxxxxxxxxx.

I try to send bitcoins to this address using sendtoaddress but it says:

error code: -5
error message:
Invalid Bitcoin address


What am I doing wrong?
Be very wary of relying on JavaScript for security on crypto sites. The site can change the JavaScript at any time unless you take unusual precautions, and browsers are not generally known for their airtight security.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714962561
Hero Member
*
Offline Offline

Posts: 1714962561

View Profile Personal Message (Offline)

Ignore
1714962561
Reply with quote  #2

1714962561
Report to moderator
achow101
Moderator
Legendary
*
Offline Offline

Activity: 3388
Merit: 6581


Just writing some code


View Profile WWW
January 23, 2018, 01:03:06 AM
 #2

You probably missed a character.

jimbobway (OP)
Legendary
*
Offline Offline

Activity: 1304
Merit: 1014



View Profile
January 23, 2018, 01:05:55 AM
 #3

I just tripled checked my copy and paste and I did not miss any characters.  Huh
jimbobway (OP)
Legendary
*
Offline Offline

Activity: 1304
Merit: 1014



View Profile
January 23, 2018, 01:17:55 AM
Last edit: December 29, 2020, 02:39:23 PM by jimbobway
Merited by DannyHamilton (2)
 #4

I figured it out.  By default c-lightning runs on testnet.  To run on mainnet you have to use:

lightningd/lightningd --network=bitcoin

The address started with a '2' because it's a testnet address.
ncsupanda
Legendary
*
Offline Offline

Activity: 1628
Merit: 1012



View Profile
February 08, 2018, 03:53:00 PM
 #5

Quote
First you need to transfer some funds to lightningd so that it can open a channel:

# Returns an address <address>
cli/lightning-cli newaddr

# Returns a transaction id <txid>
bitcoin-cli sendtoaddress <address> <amount>
-snip-
When I do bitcoin-cli listreceivedbyaddress 1 true, I'm not seeing the "newaddr" showing up in bitcoind, and can't seem to find how lightning handles its generated addresses.
-snip-

If you haven't sent any funds to the address, then isn't listreceivedbyaddress working correctly?
ncsupanda
Legendary
*
Offline Offline

Activity: 1628
Merit: 1012



View Profile
February 08, 2018, 04:31:16 PM
 #6

If you haven't sent any funds to the address, then isn't listreceivedbyaddress working correctly?

Fair point. Ok, so it's properly communicating directly with bitcoind then.

In which case, my question then becomes, "How do I see a list of address that have been generated with newaddr and are under my control ?"

Change the 1 to a 0? This would show a list of addresses in your wallet with 0 confirmations as opposed to 1.
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!