-
While using branch 0.3.0-beta2, I was expecting to have something available along the lines of: Networks.devnet(); But still only see the two: Networks.testnet(); While attempting to use the Network class constructor with magic numbers of 9, 2, and 1 respectively, received exceptions. Is it too soon to be able to connect? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Ideally you should be able to create your own instance of Network class and use it. Can you please explain what exactly you are trying with some sample code (if possible)? Which backend provider are you using ? But I agree, we should add other public networks to the Networks class. I will create an enhancement for it. Fyi. Network magic/protocolMagic in Network is not directly used but has different values for different networks. Thanks |
Beta Was this translation helpful? Give feedback.
-
You are right. There are only two possible values for network Id, 0 (all testnets) and 1 (mainnet). But somewhere in the code, the whole network object is compared during address generation to find the address prefix. This is a bug. We need to fix that to check only networkId in the Network object. Yes, the workaround is - always pass Networks.testnet() during non mainnet address generation. This will be fixed as part of this PR to avoid any confusion.
No. It should work. The transaction object has an optional parameter "networkId" for either mainnet / testnet transaction. |
Beta Was this translation helpful? Give feedback.
You are right. There are only two possible values for network Id, 0 (all testnets) and 1 (mainnet).
NetworkId is used during address generation, not protocol magic.
But somewhere in the code, the whole network object is compared during address generation to find the address prefix. This is a bug. We need to fix that to check only networkId in the Network object.
Yes, the workaround is - always pass Networks.testnet() during non mainnet address generation.
This will be fixed as part of this PR to avoid any confusion.
#158
No. It should work.…