Bitcoin Forum
May 06, 2024, 04:27:25 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Access testnet not possible  (Read 170 times)
uxBLN01 (OP)
Newbie
*
Offline Offline

Activity: 14
Merit: 3


View Profile
September 13, 2022, 12:40:56 PM
Merited by NotATether (1)
 #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,
1715012845
Hero Member
*
Offline Offline

Posts: 1715012845

View Profile Personal Message (Offline)

Ignore
1715012845
Reply with quote  #2

1715012845
Report to moderator
1715012845
Hero Member
*
Offline Offline

Posts: 1715012845

View Profile Personal Message (Offline)

Ignore
1715012845
Reply with quote  #2

1715012845
Report to moderator
Activity + Trust + Earned Merit == The Most Recognized Users on Bitcointalk
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1715012845
Hero Member
*
Offline Offline

Posts: 1715012845

View Profile Personal Message (Offline)

Ignore
1715012845
Reply with quote  #2

1715012845
Report to moderator
mocacinno
Legendary
*
Offline Offline

Activity: 3388
Merit: 4919


https://merel.mobi => buy facemasks with BTC/LTC


View Profile WWW
September 13, 2022, 12:51:46 PM
 #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...

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
uxBLN01 (OP)
Newbie
*
Offline Offline

Activity: 14
Merit: 3


View Profile
September 13, 2022, 12:57:31 PM
 #3

Yeah, I know but it does not happening anything
Code:
bitcoin-cli -testnet
Output:
Quote
error: too few parameters (need at least command)
mocacinno
Legendary
*
Offline Offline

Activity: 3388
Merit: 4919


https://merel.mobi => buy facemasks with BTC/LTC


View Profile WWW
September 13, 2022, 12:59:09 PM
Merited by ABCbits (1)
 #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

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
uxBLN01 (OP)
Newbie
*
Offline Offline

Activity: 14
Merit: 3


View Profile
September 13, 2022, 01:22:32 PM
 #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.
mocacinno
Legendary
*
Offline Offline

Activity: 3388
Merit: 4919


https://merel.mobi => buy facemasks with BTC/LTC


View Profile WWW
September 13, 2022, 01:26:51 PM
Merited by xandry (4)
 #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

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
uxBLN01 (OP)
Newbie
*
Offline Offline

Activity: 14
Merit: 3


View Profile
September 13, 2022, 01:33:16 PM
 #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.
NeuroticFish
Legendary
*
Offline Offline

Activity: 3668
Merit: 6379


Looking for campaign manager? Contact icopress!


View Profile
September 13, 2022, 01:37:47 PM
 #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.

.
.HUGE.
▄██████████▄▄
▄█████████████████▄
▄█████████████████████▄
▄███████████████████████▄
▄█████████████████████████▄
███████▌██▌▐██▐██▐████▄███
████▐██▐████▌██▌██▌██▌██
█████▀███▀███▀▐██▐██▐█████

▀█████████████████████████▀

▀███████████████████████▀

▀█████████████████████▀

▀█████████████████▀

▀██████████▀▀
█▀▀▀▀











█▄▄▄▄
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
.
CASINSPORTSBOOK
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀▀█











▄▄▄▄█
mocacinno
Legendary
*
Offline Offline

Activity: 3388
Merit: 4919


https://merel.mobi => buy facemasks with BTC/LTC


View Profile WWW
September 13, 2022, 01:40:14 PM
 #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.

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
uxBLN01 (OP)
Newbie
*
Offline Offline

Activity: 14
Merit: 3


View Profile
September 13, 2022, 01:50:21 PM
 #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.
NotATether
Legendary
*
Online Online

Activity: 1596
Merit: 6728


bitcoincleanup.com / bitmixlist.org


View Profile WWW
September 13, 2022, 01:58:26 PM
Last edit: September 13, 2022, 02:59:17 PM by NotATether
Merited by NeuroticFish (2)
 #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.

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
uxBLN01 (OP)
Newbie
*
Offline Offline

Activity: 14
Merit: 3


View Profile
September 13, 2022, 02:43:18 PM
Last edit: September 13, 2022, 02:58:56 PM by uxBLN01
 #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.


NotATether
Legendary
*
Online Online

Activity: 1596
Merit: 6728


bitcoincleanup.com / bitmixlist.org


View Profile WWW
September 13, 2022, 03:01:54 PM
Merited by ABCbits (1)
 #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/<you>/.bitcoin

or even set it to /tmp/<something> if you want - it doesn't really matter because regtest coins are worthless.

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
uxBLN01 (OP)
Newbie
*
Offline Offline

Activity: 14
Merit: 3


View Profile
September 13, 2022, 03:56:47 PM
 #14

hm, I do not get it. Is it maybe not possible cause the initial blockchain synchronization is still on-going?
NotATether
Legendary
*
Online Online

Activity: 1596
Merit: 6728


bitcoincleanup.com / bitmixlist.org


View Profile WWW
September 14, 2022, 01:32:20 AM
 #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.

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
mocacinno
Legendary
*
Offline Offline

Activity: 3388
Merit: 4919


https://merel.mobi => buy facemasks with BTC/LTC


View Profile WWW
September 14, 2022, 06:17:49 AM
Merited by ABCbits (1)
 #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.

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
uxBLN01 (OP)
Newbie
*
Offline Offline

Activity: 14
Merit: 3


View Profile
September 18, 2022, 12:30:24 PM
 #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.


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!