Blockchain Node API | Bloq Documentation

Category: Seguridad

bitcoin nodes ip

conwaytransport.com.au › library › view › mastering-bitcoin. Although the torrent protocol requires a central server, you don't necessarily need a central server for a p2p network. The client only needs the IP address of at. Bitcoin Full Node¶ · Prerequisites Storage Space IP Addresses DNS Records Firewall Rules Tor Hidden Service Bitcoin Daemon User. bitcoin nodes ip

How to set up a home server and use it as a Bitcoin node

Prerequisites

Download essentials before commencing the installation.

Run the command:
Make sure Git is installed. If not, install it with

Download lnd

To install lnd, download the code

Install lnd

Move into the directory of lnd with the command:

It’s generally recommended to stick with the latest release, rather than updating to the latest code on master. Check what the latest release of lnd is here. In our case it’s version vbeta. We will “check out” this version with the command

Finally, install lnd with the command:

Now navigate back to the home folder with

Check if lnd is properly installed

You should now be able to see if lnd is installed by typing and

It should read

Configure lnd

Create a configuration file for lnd. Make the directory with

Edit it right away using

Don’t forget to fill in the blue fields with your own information! You can freely choose a name and color for your node.

Find your IP address in the dashboard of Lunanode (if that is what you are using for your server).

You’ll need a username and password for the next step. For simplicity, it might be a good idea to avoid special characters.










Configure Bitcoind

We’ll need to make some amendments to Bitcoind. We’ll open the config file with

We will need to add the following lines:



Save and close the config file with Ctrl+O and Ctrl+X and restart Bitcoind with sudo service bitcoind restart

b) Launch lnd and create a wallet

Prerequisites

To begin this step, make sure Bitcoind is fully synced and ready. Test this by running the command: and compare the value of blocks with a block explorer, for example, conwaytransport.com.au

The block height displayed by the block explorer should be the same as the “blocks” output of our command. If the number shown by the block explorer is larger, the node is not yet synced.

Use to see the logs. This will also show when the last block was created and the sync progress. Our node will be synced up to this date.

Launch lnd

Launch lnd by typing into your terminal. Alternatively, you can also try

Does it look like the output below? Great, everything is going according to plan. If you see an error message, make sure Bitcoin is running or go back to the step that the error message suggests is wrong. Are all the configuration files correct?

When your output looks like the one above, close lnd again by pressing the keys

Permanently run lnd in the background with the command:

Type to make sure the task is still running, even if logged out or the terminal is closed.

Optional: Observe lnd through the debug logs

Open a new terminal, SSH back into the server and open the lnd logs to get a good idea of what is going on in the background.

It’s quite interesting, but will also alert you if anything is going wrong. In the new terminal window, type:

Leave this view anytime by pressing

Create a wallet

While lnd is running in the background, run the command:

Enter a wallet password, then confirm it.

Next, we are asked whether we have an existing cipher seed mnemonic. As this is a new Lightning node (as opposed to one that is being restored), we will use

You can optionally encrypt your cipher seed—a good idea if you are storing the seed in a location accessible to others (under your mattress)—but you must remember the encryption key.

We choose not to encrypt the seed in this example. Below, the cipher seed is blacked out.

Unlock your wallet

If you created a new wallet, it should have unlocked automatically. If something went wrong or you are restarting lnd, you need to unlock your wallet with the command:

Sync lnd

Since this is the first time starting lnd, we will need to sync it.

c) Open a channel

If you prefer to leave the command line at this point, jump to the next step and connect Zap Desktop or Zap iOS to your node. You can then open channels and make payments inside of a neat user interface.

Make sure lnd is running and synced

Do this with the command: . It should read synced to chain: true.

If it’s not synced, we need to make sure Bitcoind is running and synced, for example, by running and comparing the current block height of our node with that of a block explorer.

Check the logs that Bitcoind () and lnd () are running.

Deposit coins into your node

Generate a new address with the command:

The output should be something like bc1…

You can now send Bitcoin to this address by copy/pasting the address into your Bitcoin wallet. If your wallet somehow cannot send to an address in the format bc1…, you can also generate a legacy address starting with ‘3’ using the command:

Check the balance anytime by using the command:

It will show both the confirmed and unconfirmed balance in Satoshi. 1 Bitcoin is million Satoshi.

Connect to a node

In the next step, we will connect to a node. Maybe you already have a node to connect to or know a friend running a Lightning node. You can also pick one of the popular nodes listed on conwaytransport.com.au

A Lightning node’s URI looks like this: ffbdf8dcbba2eace23c7c@

It contains the public key of the node before the @, then its IP or domain name and the port.

Connect to this node using the command:

When successfully connected, the output should simply be an open and a close bracket without an error message.

Open a channel

Once the deposit has been confirmed on the Bitcoin Blockchain, open a channel. You can open the channel with the node connected with the above, but it is highly recommended that you connect to a diverse group of nodes. You are also welcome to open channels with multiple nodes.

We will open a channel with the command: , where the long string starting with is the other node’s public key and the number represents the amount of funds we want to put into this channel, denominated in Satoshi.

Once your channel is successfully open, you will get the funding transaction. When this transaction is confirmed on the Blockchain, your channel will be open and active. Until then it will be shown under pending channels.

Generally, it will take three confirmations for your channel to become active.

Make a payment

To make a payment, you will need outgoing liquidity (have funds in channels with other nodes). To do this, all you need is to deposit Bitcoin into your node and open channels with the network.

Ideally, these channels are directly linked to the counterparties you transact with or well-connected nodes in the network.

You can always check your node with the command:

Your node should always be synced to the chain, and you should have at least one active channel.

A Lightning invoice looks like this: lnbc10u1pwfxg42ppwyha3ag66tn40zls69eeaeq0cyluj6ja54sygp7vh50gcy0rnsdqlxycrqvpqwdshgueqvfjhggr0dcsry7qcqzysyrmxjvrg4ej2we83m8n7rxj94s8c5a8rwjud07ptc6dw7j2hr42sxt7lnazglku3pfe9jkl8f0gupkuz7jly5xnq35qrjwwqqy8qs9a

Decode it with the command:

This will show the amount, where the payment is going, and when the invoice expires.

To make a payment we will use the command:

After confirming the amount and destination, the node will attempt to make the payment. Once the payment has been successful, information about the payment, such as the hops and fees, will be received.

Receive a payment

To receive payments, you will need incoming liquidity. Encourage others to open channels with you (over time, as your node stays online, this will happen automatically).

Every time you make a payment through your channels, you will also automatically free up incoming liquidity. For example, if you deposit 10 USD into your node, open a channel, and make a payment over 2 USD, you will immediately have 2 USD in incoming capacity.

To receive a payment, generate an invoice. The invoice follows the format

For example, we can run for a 90, Satoshi invoice that is valid for one hour.

The result will include a r_hash, a pay_req and an add_index. The pay_req is our invoice that we can pass on.

Check payments

See the invoices issued and their status with the command: . Below, we can see that the invoice we issued above has not yet been paid, as “settled” is set to false.

d) Update lnd

The Lightning network and software, like lnd, is under constant active development. New features are regularly added and bugs fixed whenever they are reported. You can report a bug yourself and check for new releases here.

To upgrade lnd, first close the application with the command

Now navigate to your source folder, in our case:

Download the latest source code with git pull and navigate to the latest release with git checkout [latest release]. In our case that is

To upgrade to this release, we used the command

After restarting lnd with and unlocking our wallet, we can check if everything is properly updated with . If it shows the version number of the latest release, we did everything right!

e) Useful commands with lnd

By far the most useful command in lnd is . It lists all the available commands. Get additional information on each command by adding the word “help.” For example, will show you the available options when creating an invoice.

  • shows you basic information about your node
  • shows you the channels you currently have open and their status
  • shows you the scope of the Lightning network from your point of view
  • shows you how much your node has earned from routing payments
  • If a payment channel is offline or inactive, you may try to connect to the peer to revive it manually
  • shows you how many Satoshis you own on-chain
  • shows you how many Satoshis you own in channels

4. Optional: Connect Zap Desktop

Zap is a user interface for Lightning node that can run on your computer. If you are running Lightning on your local machine, it’s trivial to connect. But if your node is in the cloud, you’ll need to do a few more steps.

For this step to work, both your Bitcoind and your lnd node need to be fully synced. Check whether lnd is synced with the command: . It should read “synced to chain: true.”

If they’re not synced, make sure Bitcoind is running and synced, either by checking the log with or by running and comparing the block height with another node, or by checking block explorer.

Download Zap

Download Zap for desktop here. We downloaded the latest release, which in our example is v beta. Make sure you get the right version for your operating system! For Windows, that is

Amend conwaytransport.com.au

Open our configuration file with

Amend the following lines:



Save and close the file with and

Stop lnd

To make changes go into effect, restart lnd. To stop lnd, run
Wait for a few seconds before starting it again. If you have the logs open, you can see when lnd has shut down. You can also check with

Delete tls key and certificate

If you made changes to the configuration file that affect the tls key and certificate, you’ll need to delete them. Do so with the command: and

To start again, run and

Open the firewall

To use Zap, make incoming connections to our Lightning node. Open the firewall with the command:

Copy over the macaroon and TLS certificate

To authenticate the app and the server, you’ll need to copy two files (shown below).

Zap will check if the TLS key is correct to make sure it is always connected to the correct server (and not one impersonating it). To know which TLS key is right, we will need to tell Zap the TLS certificate.

Windows:

Open a new PowerShell with the command: to copy the tls certificate to your desktop.

Use the command: to copy the macaroon. If you want, you may copy it into any folder using the explorer.

Mac or Linux:

Open a new terminal and use the command: to copy the tls certificate.

Use the command: to copy the macaroon. You can also copy it into any folder using Finder or Files.

Configure Zap

Open Zap either by clicking on the file downloaded earlier or by finding it in applications. Choose the option Connect your own node in the startup screen.

Next, enter your IP address and the path to the certificate.

Windows:

This may look like this:


Mac or Linux:

This may look like this:


Login

After clicking on Next and confirming your selection, you should be logged into your node. You can see your balance as well as your recent payments.

5. Optional: Connect Zap iOS

Zap is a user interface for your Lightning node that is still in alpha, but you can sign up to be a tester here. You can use it to connect remotely, check your funds, open channels, or make and receive payments.

Download Zap for iOS

Once you have joined as a tester, download and install the app through Testflight, Apple’s tool for downloading testing software. It will then show up as a regular app on your home screen.

Download lndconnect

To authenticate the app and the server, we’ll need to pass data from our server to the phone. When connecting Zap on the desktop, two files are copied over to our machine, but that’s not possible on a phone. Instead, use a tool called lndconnect that will generate a QR code for us.

Download lndconnect with the command:

Install lndconnect

To install lndconnect, move into the directory with the command:

Install the program with

Run lndconnect

Type in your terminal to make the QR code appear. You may have to zoom out a bit and enlarge the window with (Keep control pressed and additionally press the plus or minus sign to zoom in or out)

Connect Zap

Open the Zap app in your phone and click Scan when given the option. Scan the QR code generated with lndconnect.

You can now see your balance, make and receive payments, and manage your channels with the app.

6. Optional: Configure Bitcoind over Tor

Privacy is great. Our Bitcoin business is solely our business, and no Internet Service Provider or government should be able to see how we use it.

But privacy is also great for security. If we can hide our Bitcoin activity, we can’t easily be targeted by criminal organizations. And, if our node can’t be found, it cannot be easily corrupted or fed false information.

Install tor

Quickly install tor with the command:

Configure tor

First, route all Bitcoin transactions through the Tor network. Then allow incoming transactions only over a hidden service.

To do this, we will need to create a password and its hash. To create a password, use your password manager (or use ours) to generate a 30+ character random password with uppercase letters, lowercase letters, and numbers.

Paste it for now in a notepad, but do not save it.

Create its hash using tor with the command:

Paste the output in a notepad for now.

Now edit the tor configuration file. Open it with the command:

The configuration file is already prewritten, but everything is commented out (as indicated by the lines starting with # signs. Towards the bottom of the first section, find the phrase

Remove the # sign, so it reads

Also, remove the # signs from these two lines


Replace the existing HashedControlPassword with the hash obtained in the step above. Now delete the hash from the notepad.

Save and close the new config file with and

Restart tor with the command:

Configure Bitcoind

Enter Bitcoin configuration file with

Amend the file with the following configuration:

  • (points the Bitcoin node to the Tor Socks Proxy, so that all data goes through tor)
  • (will listen to incoming connections)
  • (to only connect through tor)
  • (will listen for incoming connections through an onion address)
  • (so our IP address is not broadcast)
  • (shows the bitcoin node how to control Tor, for example, to create a hidden service)
  • (how the Bitcoin node will authenticate itself to the Tor node)

Paste the password created earlier, then close the notepad.

Close the editor with the commands: and
Restart Bitcoind with the command:

Close the port

Bitcoin port no longer needs to be open. Close it with the command: sudo ufw deny /tcp

Test your onion setup

You can now connect to onion nodes. You should find a list of such nodes in the Bitcoin wiki.

For example, connecting to BlueMatt’s node requires the command:

Your Bitcoin node can connect to regular IP addresses still, but only accept incoming connections via the Tor network. Your onion address will show up in your logs at startup in case you want to connect to it specifically from another node you control. You can also find it at the very bottom with the command

7. Set up Electrum Private Server over Tor

If you are using the lightweight Electrum wallet, this tool will massively improve your privacy. While fast and handy, Electrum sends your Bitcoin addresses to a remote server, which will inform you about your balance. Anybody can set up such a server, and while you can send your queries via the Tor Network, there is no guarantee or protection that these servers aren’t quietly setting up profiles about you. With your own Electrum Private Server, you do not have to worry about this.

Install Electrum on your personal computer

You can find the Electrum client here. It is recommended that you verify the PGP signatures before installing the software. Installing Electrum on your computer is not different to any other software on your personal machine.

a. Create a wallet

It is possible to set up Electrum Personal Server with your existing Electrum wallet. This will require you to resync your Bitcoin node and take considerable time, so we will first set it up with a new wallet. When you open Electrum for the first time, it will prompt you to create a wallet. We recommend to create a ‘standard wallet’ with the ‘segwit’ option. You will be given a ‘seed phrase.’ It’s important to store this seed securely, either on a piece of paper in a safe location, or in your password manager. Anybody with access to this seed can take your Bitcoin. Under no circumstances store it somewhere online, such as a note-taking app like Google Keep or your email drafts.

b. Get your Master Public Key

In the menu under “Wallet, ”click “Information” to retrieve your Master Public Key. Anybody with this access to this key can see what transactions you are making and how many Bitcoin you have, but they cannot take your Bitcoin. We will need this Master Public Key later. For now we can save it in a text editor or keep the window open.

c. Configure bitcoind

Enter your bitcoin configuration file

Amend the file with the following configuration:

If you have been following the guide above, you already have an RPC username and password set. You can always find it again in your bitcoind configuration file, which you can open with the command and save with and close with . Alternatively you can set any username and password in your configuration file. It will look like this:

Save and close the config file with and and restart bitcoind with

d. Set up a dedicated wallet

Create a dedicated wallet for electrum-personal-server with the command

e. Download electrum-personal-server

We can find all the latest releases here. Use the source code packaged with conwaytransport.com.au In our case, the latest version is v Download this software to our server with the command

Download the signature with

f. Verify electrum-personal-server

First, download the PGP key of the developer, which is found here and here. Download it with the command

Import it with the command

Verify whether the software is appropriately signed with the command

g. Create a SSL key and certificate

To keep things organized, create a dedicated folder for all things related to electrum-personal-server with the command . Navigate into that folder with

Create the private key with

Now create a certificate with

The command will ask a series of questions, such as ‘Country Name’ or ‘Email Address.’ As we will not have this certificate signed by a certificate authority, we can ignore all pressing each time.

Sign the certificate with the command

It is valid for five years. You can adjust the validity by changing the number of days in the command above.

h. Install dependencies

Unless it is already installed, install python with

i. Install electrum-personal-server

Unpack the conwaytransport.com.au file with the command

Enter the directory with

Now copy the configuration file with the command

You can open and edit the file with

  • In the first section, under “master-public-keys,” enter the public key obtained above.
  • If you have multiple wallets, you may add each wallet in a new line.
  • In the second section, under “bitcoin-rpc,” remove the #-sign before “rpc_user” and “rpc_password” and add the details in the conwaytransport.com.au file.
  • In the section “electrum-server,” adjust the location of the key and certificate.
  • Optionally, dedicate a permanent log file under “logging”, such as
    Exit the editor with and

To install the software, go into the folder with

The folder name will depend on your version. We will install the software with

Don’t forget the dot at the end of the command!

Источник: conwaytransport.com.au

By -

2 thoughts on “Bitcoin nodes ip”

Leave a Reply

Your email address will not be published. Required fields are marked *