Author

Topic: Access testnet not possible (Read 199 times)

newbie
Activity: 14
Merit: 3
September 18, 2022, 07:30:24 AM
#17
Thank you for your response and the following may help you to understand my core problem.
My task was the following:

1. Compile Bitcoin Core (https://github.com/bitcoin/bitcoin). You can see doc/build-*.md for instructions on building the various elements.

2. Run the unit and functional tests. Instructions on how to do that can be found here: (https://github.com/bitcoin/bitcoin/blob/master/test/README.md).

3. Look at example_test.py in the functional test directory and try getting node 1 to mine another block, send it to node 2, and check that node 2 received it. In your response to this email, please include a link to a gist or code snippet that you used to complete this step.

Then I thought, I do not want to extra compile cause I had in mind that I am setting up already a Raspiblitz. Therefore I had my thoughts on doing this task on my raspiblitz but like you said it is not possible. Just compiling was a bit difficult for me so I downloaded the pre compiled version on my mac so I am able to access the regtest mode. Nevertheless I do not want to have the initial blockchain download started if I am unpack the bitcoin application because of the much required data space. The remaining problem still exist: Solving this task via regtest mode without cluttering up my laptop with data and slowing down the performance of my device.


legendary
Activity: 3612
Merit: 5297
https://merel.mobi => buy facemasks with BTC/LTC
September 14, 2022, 01:17:49 AM
#16
Last night i started thinking about this topic, and i realized we didn't start from the beginning and jumped right into trying to fix the problem you were posting.

The initial question in this topic should have been: "what are you trying to do?".
Why do you need to mine a block, are you going to setup a solo mining operation or do you just want to test out your setup on the testnet, or maybe your goal is something else?

If it's the first case (you wanting to solo mine), do realize this is a difficult setup... I've set up solo mining operations on the testnet in the past, and it's quite hard to get things up and running, and keep them running over a longer time. There are solo mining pools that ask a very moderate mining fee, it might be a good first step to use them instead. Oh yeah, you'll need a recent ASIC, basic knowledge and dirt cheap electricity to pull this off...

If it's the second case (you wanting to test your setup), you don't need to mine a block, you can just claim some tBTC from a couple tBTC faucets...

If your goal is something else, i wonder if you'd be willing to share said goal...

It's just that in numerous occasions, i've seen people coming to the forum asking a bunch of questions, but when they finally say what they want to accomplish, we immediately tell him he/she was taking the completely "wrong" approach to solving the problem in the first place.
legendary
Activity: 1568
Merit: 6660
bitcoincleanup.com / bitmixlist.org
September 13, 2022, 08:32:20 PM
#15
hm, I do not get it. Is it maybe not possible cause the initial blockchain synchronization is still on-going?

No, there is no synchronization in regtest because it has no blockchain to sync - it starts completely empty.

What you have, is a permissions error with your data folder - Bitcoin Core tried to open it to put some stuff inside, but your OS is blocking it with an "Access denied"-type error.
newbie
Activity: 14
Merit: 3
September 13, 2022, 10:56:47 AM
#14
hm, I do not get it. Is it maybe not possible cause the initial blockchain synchronization is still on-going?
legendary
Activity: 1568
Merit: 6660
bitcoincleanup.com / bitmixlist.org
September 13, 2022, 10:01:54 AM
#13
I created a bitcoin.conf file as well. The file looks like:
Quote
[regtest]
txindex=1
server=1
rpcport=18444
rpcuser=bitcoin
rpcpassword=talk
connect=127.0.0.1:18444

And if I try it with:
Code:
bitcoind --chain=regtest

I got the error:
Quote
************************
EXCEPTION: NSt10filesystem7__cxx1116filesystem_errorE       
filesystem error: cannot create directories: Permission denied [/mnt/hdd/bitcoin/regtest/wallets]       
bitcoin in AppInit()     

What is wrong? I just want to run a regtest node while my full node is still syncing the original blockchain.

Change the data directory to a folder that is not on a removable disk, because these usually have messed up permissions.

Since you are using regtest there will be no monstorous network or disk usage, so you can add to the config file (the regtest part):

Code:
datadir=/home//.bitcoin

or even set it to /tmp/ if you want - it doesn't really matter because regtest coins are worthless.
newbie
Activity: 14
Merit: 3
September 13, 2022, 09:43:18 AM
#12
Thanks. I am trying it with regtest. But I got this error:

Code:
bitcoin-cli -regtest getnewaddress

Output:

Quote
error: timeout on transient error: Could not connect to the server 127.0.0.1:18443

Make sure the bitcoind server is running and that you are connecting to the correct RPC port.

I created a bitcoin.conf file as well. The file looks like:
Quote
[regtest]
txindex=1
server=1
rpcport=18444
rpcuser=bitcoin
rpcpassword=talk
connect=127.0.0.1:18444

And if I try it with:
Code:
bitcoind --chain=regtest

I got the error:
Quote
************************
EXCEPTION: NSt10filesystem7__cxx1116filesystem_errorE       
filesystem error: cannot create directories: Permission denied [/mnt/hdd/bitcoin/regtest/wallets]       
bitcoin in AppInit()     

What is wrong? I just want to run a regtest node while my full node is still syncing the original blockchain.


legendary
Activity: 1568
Merit: 6660
bitcoincleanup.com / bitmixlist.org
September 13, 2022, 08:58:26 AM
#11
okay, I was getting this task from someone and they said  to me do it with a test framework. Look for hints at https://github.com/bitcoin/bitcoin/blob/master/test/functional/example_test.py. To be honest I do know what to do. So I was thinking of doing something with the testnet. But they said also it is not necessary. All you need is in bitcoin repository on Github.

You have to run Bitcoin Core in regtest mode if you want to mine bitcoins yourself. Regtest coins are only visible to you.

Simply add the --chain=regtest option to bitcoind and bitcoin-cli to start them both in regtest mode. This uses port 28332 (my bad, it is 18444), so you can run this alongside mainnet and testnet if you want.

To mine a block, run bitcoin-cli --chain=regtest generate 1, that'll generate one block. Replace 1 with any number you want to mine that many blocks.
newbie
Activity: 14
Merit: 3
September 13, 2022, 08:50:21 AM
#10
okay, I was getting this task from someone and they said  to me do it with a test framework. Look for hints at https://github.com/bitcoin/bitcoin/blob/master/test/functional/example_test.py. To be honest I do know what to do. So I was thinking of doing something with the testnet. But they said also it is not necessary. All you need is in bitcoin repository on Github.
legendary
Activity: 3612
Merit: 5297
https://merel.mobi => buy facemasks with BTC/LTC
September 13, 2022, 08:40:14 AM
#9
--snip--
"Switching to testnet mode" means to work with the testnet blockchain. That one has to be downloaded and so on. You need a node.
Even more, I certainly hope you have an ASIC for mining the block you want, the diff is afaik far too big for RasPi to mine.

correct, and IIRC, the block reward is really low nowadays aswell...

But, just FYI, you could follow a tutorial like this one:
https://number1.co.za/running-a-mainnet-and-testnet-on-the-same-bitcoin-node/
to run 2 nodes under the same linux account.

You could also add a new user and run your testnet node under this second user... That's how i do it... 2 users each running a full node: one user running a node on the main net, the other on the testnet.

But still, yeah, you'll need an ASIC to mine on the testnet...

If you want tBTC, you can use a tBTC faucet.
legendary
Activity: 3668
Merit: 6382
Looking for campaign manager? Contact icopress!
September 13, 2022, 08:37:47 AM
#8
ah okay, no I am not running a testnode. I was just thinking that bitcoin-cli -testnet is automatically  switching to a testnet mode then. But my main goal remains. Getting from my full/Lightning Node of Raspiblitz to a testnet node cause I have to execute this task: Getting node 1 to mine a block, send it to node 2 and check if node 2 received it.
all the stuff is running on a raspberry pi. Just working with the terminal on mac via ssh connection.

"Switching to testnet mode" means to work with the testnet blockchain. That one has to be downloaded and so on. You need a node.
Even more, I certainly hope you have an ASIC for mining the block you want, the diff is afaik far too big for RasPi to mine.
newbie
Activity: 14
Merit: 3
September 13, 2022, 08:33:16 AM
#7
ah okay, no I am not running a testnode. I was just thinking that bitcoin-cli -testnet is automatically  switching to a testnet mode then. But my main goal remains. Getting from my full/Lightning Node of Raspiblitz to a testnet node cause I have to execute this task: Getting node 1 to mine a block, send it to node 2 and check if node 2 received it.
all the stuff is running on a raspberry pi. Just working with the terminal on mac via ssh connection.
legendary
Activity: 3612
Merit: 5297
https://merel.mobi => buy facemasks with BTC/LTC
September 13, 2022, 08:26:51 AM
#6
ah okay. But now this problem occurs:
Code:
bitcoin-cli -testnet listunspent

Output:
Quote
error: timeout on transient error: Could not connect to the server 127.0.0.1:18332

Make sure the bitcoind server is running and that you are connecting to the correct RPC port.

Then the initial question remains: ARE you running a node on the testnet? You cannot run a node on the main net, and just expect bitcoin-cli -testnet to work...

could you execute
Code:
lsof -i :18332

At least, i'm assuming you're working on linux, right? I have no idear how to check if you're listening on a port on windows...
EDIT: you're talking about Raspiblitz, that's linux Wink
newbie
Activity: 14
Merit: 3
September 13, 2022, 08:22:32 AM
#5
ah okay. But now this problem occurs:
Code:
bitcoin-cli -testnet listunspent

Output:
Quote
error: timeout on transient error: Could not connect to the server 127.0.0.1:18332

Make sure the bitcoind server is running and that you are connecting to the correct RPC port.
legendary
Activity: 3612
Merit: 5297
https://merel.mobi => buy facemasks with BTC/LTC
September 13, 2022, 07:59:09 AM
#4
Yeah, I know but it does not happening anything
Code:
bitcoin-cli -testnet
Output:
Quote
error: too few parameters (need at least command)

bitcoin-cli need options... For example
Code:
bitcoin-cli -testnet listunspent
bitcoin-cli by itself does nothing... you need to tell it what you want to do Smiley
newbie
Activity: 14
Merit: 3
September 13, 2022, 07:57:31 AM
#3
Yeah, I know but it does not happening anything
Code:
bitcoin-cli -testnet
Output:
Quote
error: too few parameters (need at least command)
legendary
Activity: 3612
Merit: 5297
https://merel.mobi => buy facemasks with BTC/LTC
September 13, 2022, 07:51:46 AM
#2
Code:
bitcoin-cli --help

output:
Code:
  -testnet
       Use the test chain. Equivalent to -chain=test.


But, if you only have one instance running, and you run bitcoin-cli as the same user you're running bitcoind, you shouldn't need the -testnet option. You just add
"testnet=1" to "~/.bitcoin/bitcoin.conf", start your node, and then use bitcoin-cli without the "-testnet" option.
You ARE running a testnet node, right? You can't run your node on the main net, and magically use the bitcoin-cli on the testnet...
newbie
Activity: 14
Merit: 3
September 13, 2022, 07:40:56 AM
#1
Hi,

I am setting up a Bitcoin/Lightning node on Raspiblitz. The blockchain is currently syncing. Now I want to get access to the testnet cause I want to mine a block and send it to another node. But if I type
Code:
bitcoin-cli testnet
in the terminal I am getting the message:
Quote
error code: -32601
error message:
Method not found
. What do I wrong?
Best,
Jump to: