BitShares Forum

Main => Technical Support => Topic started by: yfan on July 24, 2019, 03:15:52 pm

Title: How to connect to bitshares private testnet using bitsharesjs apis
Post by: yfan on July 24, 2019, 03:15:52 pm
Hi everyone,

I am new in bitshares and the first thing I do is try the private testnet myself.
It works out ok and I now want to use javascript to write code to play with my local private testnet, would it be possible?

I noticed the tutorial and examples from bitsharesjs GitHub repository but the apis.instance("wss://node.testnet.bitshares.eu", true) which indicates that the api will connect to the public testnet..

Am I taking this the wrong way?

Thank you guys!
Title: Re: How to connect to bitshares private testnet using bitsharesjs apis
Post by: pc on July 24, 2019, 04:56:16 pm
Edit the config file of your testnet node and enable the "rpc-endpoint" option, then restart the node.

You can then connect using the address "ws://<your-endpoint-ip:port>" instead of "wss://node.testnet.bitshares.eu".

Other changes may be necessary if your core token name is different etc. . I'm not very familiar with the JS lib.
Title: Re: How to connect to bitshares private testnet using bitsharesjs apis
Post by: yfan on July 25, 2019, 08:00:03 am
Thank you so much, it is very nice of you.
That is exactly what I did.

But I ran into different errors when using my testnet... where and do I need to specify my network name?
the example script won't recognize my network name, thus the response will return an error
 
TypeError: Cannot read property 'network' of undefined

It's been a nightmare for someone like me doesn't have the background in javascript to do the integration test...