jansenmarc / wavesgatewayframework Goto Github PK
View Code? Open in Web Editor NEWA framework to connect other cryptocurrencies to the Waves platform.
License: MIT License
A framework to connect other cryptocurrencies to the Waves platform.
License: MIT License
Hello!
Yesterday there was pywaves support for all waves based networks.
Now is my question, how hard would it be to do the same for the gateway?
I screened through the code and I saw that you are heavy depending on mainnet/testnet and that it is hard to overwrite this stuff without changing the framework every time.
So my q is, would it be a hard task to make it support all waves networks?
In Pywaves we can now do this:
py.setNode("https://privatenode.blackturtle.eu","TurtleNetwork", "L")
When visiting the url in the browser the redirect gives a 404 on this url: http://127.0.0.1:5000/static/index.html
In the main.py the following code is included.
`import gevent.monkey
gevent.monkey.patch_all()
from waves_TurtleNode_gateway import TurtleNodeGateway
file = open("config.cfg", "r")
gateway = TurtleNodeGateway.from_config_file(file.read())
gateway.run()
`
The request is registered and the following output is printed in the consol:
[2018-04-05 20:01:24,962] INFO {waves-gw.GatewayApplicationService.pywsgi} - 127.0.0.1 - - [2018-04-05 20:01:24] "GET /static/index.html HTTP/1.1" 404 342 0.001001
The port is listed as open.
The console shows that both chains are watched.
Hi, users are unable to run WavesGatewayFramework due to dependency conflict with base58 package.
As shown in the following full dependency graph of WavesGatewayFramework, WavesGatewayFramework requires base58>=0.2.5,while PyWaves requires base58==0.2.5.
According to pip’s “first found wins” installation strategy, base58 1.0.3 is the actually installed version. However, base58 1.0.3 does not satisfy base58==0.2.5.
WavesGatewayFramework-master
| +-base58(version range:>=0.2.5)
| +-flask(version range:>=0.12.2)
| | +-click(version range:>=5.1)
| | +-itsdangerous(version range:>=0.24)
| | +-jinja2(version range:>=2.10.1)
| | | +-markupsafe(version range:>=0.23)
| | +-werkzeug(version range:>=0.15)
| +-gevent(version range:>=1.2.2)
| +-pymongo(version range:>=3.4.0)
| +-python-doc-inherit(version range:>=0.3.0)
| +-pywaves(version range:>=0.8.8)
| | +-base58(version range:==0.2.5)
| | +-pyblake2(version range:*)
| | +-python-axolotl-curve25519(version range:*)
| | +-requests(version range:*)
| | | +-certifi(version range:>=2017.4.17)
| | | +-chardet(version range:<3.1.0,>=3.0.2)
| | | +-idna(version range:>=2.5,<2.9)
| | | +-urllib3(version range:<1.26,>=1.21.1)
| +-requests(version range:>=2.9.1)
| | +-certifi(version range:>=2017.4.17)
| | +-chardet(version range:<3.1.0,>=3.0.2)
| | +-idna(version range:>=2.5,<2.9)
| | +-urllib3(version range:<1.26,>=1.21.1)
| +-simplejson(version range:>=3.11.1)
Thanks for your help.
Best,
Neolith
Hello!
Here I am again...
I heard there should be a setting somewhere that makes it possible to easy convert from a 2 digit network to a 8 digit network, what setting is this?
Thanks in advance
When doing a clone from the project and running the tests as they are, there is one failing
ERROR: test_inject (tests.common.test_injector.TestInjector)
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Users\bramV\Documents\PycharmProjects\WavesGatewayFrameworkQuart\tests\common\test_injector.py", line 53, in test_inject
other_class_with_deps_instance = self._global_injector.get(other_class_with_deps_token)
File "C:\Users\bramV\Documents\PycharmProjects\WavesGatewayFrameworkQuart\waves_gateway\common\injector.py", line 114, in get
if self._dependency_map[token].instance is not None:
AttributeError: 'NoneType' object has no attribute 'instance'
There is something going on, not sure what exactly, but whenever I ask a balans from an addr it's empty, however if I redifine it from a clean "Address" instance, the balans shows up:
self._w_ltc = pw.Asset(waves_asset_id) #shows asset correct
self._gateway_pywaves_address = gateway_pywaves_address #has correct waves instance
temppub=str(gateway_pywaves_address.publicKey.decode("utf-8")) #shows correct
temppriv=str(gateway_pywaves_address.privateKey.decode("utf-8")) #shows correct
tempaddr=str(gateway_pywaves_address.address.decode("utf-8")) #shows correct
pw.setNode("https://privatenode.blackturtle.eu", "TurtleNetwork", "L")#just as test but doesnt make any change
print(temppub+" "+temppriv+" "+tempaddr)#shows everything correct again
self._addr=pw.Address(address=tempaddr,privateKey=temppriv)#no errors
print(str(self._addr.balance()))#wrong balance
print(str(pw.Address("3JqAYiRnuiJxdMVmdTUsxuTV39LXHR5JWXk").balance()))#correct balans
Checks done: correct addr, correct node (with pw.getNode()), addr works, wrong addr it detects, new addr instance does work, latest framework and pywaves version. A clean piece of Python code does return correct balans.
Instantiating an address from the privatekey does return the correct public key and addr, however this also fails to get the correct balans.
So my guess it's a combo from the framework with maybee wrong settings?
Parameters set:
waves_node=config.waves_node, waves_address_web_link="https://privatenode.blackturtle.eu/transactions/info/{{tx}}", waves_transaction_web_link="https://privatenode.blackturtle.eu/transactions/info/{{tx}}", waves_chain_id='L',
With those optimizations a Gateway may be created like this:
import waves_gateway as gw
custom_dependency = gw.InjectionToken("custom_dependency")
@gw.Factory(provides=custom_dependency)
def createCustomDependency():
return something
@gw.Injectable(depends=[custom_dependency], provides=gw.TransactionService)
class CustomTransactionService(gw.TransactionService):
# implementation
pass
# may be used to override some special tokens
gw.set(gw.API_KEY, "some custom api key")
gw.set(gw.CUSTOM_CURRENCY_NAME, "custom currency")
gw.run() # will block the execution and start the Gateway
This enhancement is meant to simplify the creation of a Gateway, reduce the LOC, but also offer more control. It is possible to override certain services of the Framework. But it is only possible to override services which injection token is exposed by the Framework. This allows to have private services that cannot be changed. The user will be provided with custom error messages of which providers he is required to specify and a description of those (docstring where available).
Custom services will be able to define dependencies to Framework exposed services and custom ones. For example, most currencies will have some kind of proxy to the node. This could be provided automatically.
The Framework exposes a child injector to the custom code that may be used to define a variety of tokens required.
The Injectable decorator is already in use in the Framework. The exposed one would use the global child injector. Same with the Factory decorator.
The set
method is a shortcut for the set method of the child injector.
The run
method handles the complete startup. It includes the monkey patching, loads a configuration file if any and creates a Gateway instance with the child injector.
It has a small but important difference to the Angular hierarchical injector (for those who know Angular).
A child injector has a reference to the global injector that already exists.
It has the same functionality as the global injector.
But, if a token is demanded that the child injector does not know about, the parent injector is asked about it. The required information will be fetched and the instance is created in the child injector. So, the parent injector does not know about the instance. This has the advantage that everything that is defined in the child injector overrides the parent injectors tokens.
The old API will still work. What changes is the behavior of the already exposed injector. Which, as far as I know, no one uses.
Firefox only allows 1 time copy pasting.
After that it glitches and the user can't copy paste his generated addr anymore.
This was reported by a user from me, and I could redo this.
Firefox browser, normal addr create.
After 1 time copy paste, impossible to select.
error: can't copy 'waves_gateway/static/assets': doesn't exist or not a regular file
Pip install on a ubuntu 16.04 gives above error.
Some suggestions I have thought about:
-Show both chains what block height was scanned last
-Use Waves as a variable in the static interface
-Show total fees.
-Be able to set a minimal treshold of tx in total with fees. This to prevent dust tx. Or unneccassary small spam tx that could fill up the tx list pool from the gateway.
Hello!
I played with the framework a bit, the send option to send tokens inside the fork does work with some small edits/issues.
Now when I want to send the tokens out the fork, the next events happen:
-I require an addr, addr get stored in the database mapped
-I send tokens to the addr
-The framework detects this and prepares to do a transfer
-The transfer fails because it only has the addr and no secret.
Some suggestion was to edit the db save, BUT this requires me to edit the framework if I am correct?
I concluded that the gateway framework can't work with pywaves as an addr generator but does need a node to generate addr and sign the transactions, is this correct?
How should I tackle this?
If needed I can share the github repository
I am not sure yet what is the case, but it could be a potential bug.
When a users spams a few transactions to the gateway, it only picks up one.
Not sure what is the cause/ what part of the gateway is making this happen.
This is the generated addr from the user for reference.
https://explorer.blackturtle.eu/address/3JuYgZNMmbMpuCUXyfxRQiAFL54rdciJEqr
EDIT:
The framework seems to "forget" tx is fhey are fast after each other.
On the following link it get's 6 tx and only send out 3:
Waves: https://wavesdesk.com/account/3PJ33ZasLyhLaFuK4gHGTFSQbpFBP5Entor
TN: https://explorer.blackturtle.eu/address/3JqAYiRnuiJxdMVmdTUsxuTV39LXHR5JWXk
Hello I did the test gateway but what do I do for this one? can you help me please
I'm guessing PyWaves library changed it's behavior slightly at some point, and that before the following used to work and properly generate the publicKey from the provided privateKey:
WavesGatewayFramework/waves_gateway/gateway.py
Lines 105 to 109 in b3674a3
However, currently it doesn't seem to be the case anymore. Now when the address
argument is provided, the Address.__init__
doesn't bother with generating the publicKey
anymore. A simple fix would to change the gateway.py file (above), to just pass in the privateKey part to the Address(...)
:
@Factory(GATEWAY_PYWAVES_ADDRESS, deps=[GATEWAY_WAVES_ADDRESS_SECRET, WAVES_NODE, WAVES_CHAIN], opt_deps=[WAVES_CHAIN_ID])
def gateway_pywaves_address(gateway_waves_address_secret: model.KeyPair, waves_node: str, waves_chain: str, waves_chain_id: Optional[str] = None):
"""Creates an address instance from the pywaves library that represents the Gateway waves address."""
pywaves.setNode(waves_node, waves_chain, waves_chain_id)
return pywaves.Address(privateKey=gateway_waves_address_secret.secret)
Though maybe there's also some usecase which entails running the gateway without the account private key.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.