Bitcoin Forum

Bitcoin => Bitcoin Technical Support => Topic started by: jimbobway on January 23, 2018, 01:00:18 AM



Title: Trying to send bitcoin to c-lightning. Getting "Invalid Bitcoin Address"
Post by: jimbobway on January 23, 2018, 01:00:18 AM
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?


Title: Re: Trying to send bitcoin to c-lightning. Getting "Invalid Bitcoin Address"
Post by: achow101 on January 23, 2018, 01:03:06 AM
You probably missed a character.


Title: Re: Trying to send bitcoin to c-lightning. Getting "Invalid Bitcoin Address"
Post by: jimbobway on January 23, 2018, 01:05:55 AM
I just tripled checked my copy and paste and I did not miss any characters.  ???


Title: Re: Trying to send bitcoin to c-lightning. Getting "Invalid Bitcoin Address"
Post by: jimbobway on January 23, 2018, 01:17:55 AM
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.


Title: Re: Trying to send bitcoin to c-lightning. Getting "Invalid Bitcoin Address"
Post by: ncsupanda on February 08, 2018, 03:53:00 PM
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?


Title: Re: Trying to send bitcoin to c-lightning. Getting "Invalid Bitcoin Address"
Post by: ncsupanda on February 08, 2018, 04:31:16 PM
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.