Author Topic: How to connect to bitshares private testnet using bitsharesjs apis  (Read 138 times)

0 Members and 1 Guest are viewing this topic.

Offline yfan

  • Newbie
  • *
  • Posts: 2
    • View Profile
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!

Offline pc

  • Hero Member
  • *****
  • Posts: 1492
    • View Profile
    • Bitcoin - Perspektive oder Risiko?
  • BitShares: cyrano
Re: How to connect to bitshares private testnet using bitsharesjs apis
« Reply #1 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.
Bitcoin - Perspektive oder Risiko? ISBN 978-3-8442-6568-2 http://bitcoin.quisquis.de

Offline yfan

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: How to connect to bitshares private testnet using bitsharesjs apis
« Reply #2 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...