Connecting to Testnet: Request URL not opening


#1

Hi,
So I am working to connect to the Peercoin testnet using PeerAssets. I am just trying a basic storage of a couple bytes of text. When I run the OP_RETURN.py script, I get an error when the python file tries to open the requests url. It breaks at line 458: result = urlopen(requests).read(). My config file is as follows:
testnet=1
listen=1
server=1
rpcport=9902
rpcconnect=127.0.0.1
rpcuser=<my_username>
rpcpassword=<my_password>

The actual error comes later in the python library saying: File “/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py”, line 417, in _read_status
raise BadStatusLine(line)
httplib.BadStatusLine: ‘’

Any idea what would cause this error or why the URL doesn’t seem to exist or open?
Thank you for your time!
-G

P.S. The full output when I run the script is attached.


#2

Try removing rpcport=9902 from your config file.

I believe by default the ports are

[ul][li]main-net: 9901[/li]
[li]main-net rpc: 9902[/li]
[li]test-net: 9903[/li]
[li]test-net rpc: 9904[/li][/ul]


#3

There is a vagrant setup that you could also try


#4

[quote=“peercoinops, post:3, topic:4072”]There is a vagrant setup that you could also try

https://github.com/peercoinops/vagrant-peercoind[/quote]

Nice!


#5

[quote=“peerchemist, post:4, topic:4072”][quote=“peercoinops, post:3, topic:4072”]There is a vagrant setup that you could also try

https://github.com/peercoinops/vagrant-peercoind[/quote]

Nice![/quote]

very nice!


#6

Hey thank you so much for the replies!
I am working on running it through Vagrant right now. I have Vagrant up and running (SSH’d into it) using the main Vagrant file provided on the github page provided. However, I am not exactly sure where to go from here. I apologize I am new to vagrant and Peercoin in general. I ran the curl commands but just received “connection refused” failures. Am I supposed to do something with the vagrant files in pars and parstestnet folders?
Thank you for all of your help!
I truly appreciate it!
-G


#7

After running vagrant up in the main folder, run vagrant up in either of the sub folders to start each container. For example from the ‘parstestnet’. This will start the parstestnet container.


#8

Hey!
That worked! I am up and running! Thank you.
However, I now get an error when I try writing data to the testnet. It says: “NameError: global name ‘data_len’ is not defined.” I looked in the store-OP_RETURN.py file and data_len is used 3 times but it is never defined. Am I right in assuming data_len is supposed to hold the number of bytes of data I am trying to store? If this is the case, wouldn’t I need to edit the store-OP_RETURN.py file so that it figures out how long the input data is and then store that length in bytes in data_len?
Am I on the right track?
Thank you for all of your help!
-G


#9

Which branch of peercoin-OP_RETURN are you currently using?

If you’re using the master branch and you’re trying to send an OP_RETURN transaction you can do
python send-OP_RETURN.py

so something like
python send-OP_RETURN.py mvyiYPvgnDGywEJJYLqFQTseNZQp1q3t9s 10 ‘This is awesome!’ 1
Note that the trailing one is to specify that this is on testnet.


#10

[quote=“saeveritt, post:9, topic:4072”]Which branch of peercoin-OP_RETURN are you currently using?

so something like
python send-OP_RETURN.py mvyiYPvgnDGywEJJYLqFQTseNZQp1q3t9s 10 ‘This is awesome!’ 1
Note that the trailing one is to specify that this is on testnet.[/quote]

I am trying to use the testnet.
I then tried what you suggested: python send-OP_RETURN.py mvyiYPvgnDGywEJJYLqFQTseNZQp1q3t9s 10 ‘This is awesome!’ 1 but with my own address, and it responds with, “Error” Send address could not be verified." Not sure what is going on here. There must be something missing on my end that’s not on your end. Not sure what it is.
However, according to PeerAssets/peercoin-OP_RETURN, I don’t need an address to write data to the testnet. I have been using: python store-OP_RETURN.py ‘This example stores 44 bytes in the testnet.’ 1 as they suggest, but as I mentioned before, it says that data_len is undefined. I tried declaring it and having it set to the length of the data passed in from the command line but that did not work either. Should I be using a modified version of the curl command from peercoinops/vagrant-peercoind to add data?
Thank you for your help!
-G


#11

Store is to be used if your OP_RETURN data is going to exceed the max amount allowed within 1 transaction. For most use cases 1 transaction should be plenty.

There is now an updated version:
https://github.com/PeerAssets/op_return

For “Error” Send address could not be verified." Did you try adding quotations surrounding the address?


#12

Example of using the new op_return code:

[code]from op_return import *
from peercoin_rpc import Client

node = Client(testnet=True)

send(node, ‘mvyiYPvgnDGywEJJYLqFQTseNZQp1q3t9s’, 10, ’ Peercoin community is the best! ')[/code]

If successful it should return a transaction id such as ‘42747dfb5b34cefe9ef9eb4ae008d95fbbfbf447ee8c6e11b8f3f55828a0f9ed’