Skip to content
This repository has been archived by the owner on Dec 7, 2023. It is now read-only.

Adding RPC Endpoints for viewing available gas and claiming gas #1

Closed
wants to merge 1 commit into from

Conversation

localhuman
Copy link

Like calls to the getbalance method of the RPC server, these methods require the wallet to be unlocked on the server side.

sample python usage:

>>> data = {"jsonrpc": "2.0", "method": "getunclaimedgas", "params": [], "id": 1}
>>> req = requests.post(endpoint, json.dumps(data))
>>> req.content
>>> b'{"jsonrpc":"2.0","id":5,"result":{"unavailable":"0.42032656","available":"0"}}'
>>> data = {"jsonrpc": "2.0", "method": "claimgas", "params": [], "id": 1}
>>> req = requests.post(endpoint, json.dumps(data))
>>> req.json()
>>> {'id': 5,
 'jsonrpc': '2.0',
 'result': {'attributes': [],
            'claims': [{'txid': '3be87ae6baa799ca8fb99c1e943e98654993ebcbe1715ec2a61750a90c89bd5e',
                        'vout': 0}],
            'net_fee': '0',
            'scripts': [{'invocation': '400fdbc6b6993cd9b4325b8533b2e963e56d44c18085d99753d96a47b24c8f67f545c32f0fa86e3eb1e7dc78746da9a34032a55ab2ec0cc32b0c91c99953d67251',
                         'verification': '210286c2277497e82d2d0f5c112aa175545fd68ac04b06ec0d4123d4b5ee6a1c5a6cac'}],
            'size': 203,
            'sys_fee': '0',
            'txid': 'd875a010e541f4283d808fc59ccd7c2bb9c0f14153c01778af351e4bd8d5fcac',
            'type': 'ClaimTransaction',
            'version': 0,
            'vin': [],
            'vout': [{'address': 'AFsRovA3GyLznpAyAYXiv8ZwDswKj1g5A2',
                      'asset': '602c79718b16e442de58778e148d0b1084e3b2dffd5de6b7b16cee7969282de7',
                      'n': 0,
                      'value': '9.0552'}]}}

Copy link
Member

@erikzhang erikzhang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the claim failed, it will print logs to console, which is unexpected.

@localhuman
Copy link
Author

I'm going to close this one, as there is currently no pressing use-case for the functionality.
The Light Wallet app however needs a way to calculate the amount of NEOGas to claim in order to send a ClaimTransaction, and to do that the light wallet needs the system fee by block.

Please see PR neo-project/neo#35 for that functionality.

@localhuman localhuman closed this Jul 24, 2017
@bmclain
Copy link

bmclain commented Jun 19, 2018

@localhuman I (respectfully!) beg to differ. If neo-cli is being used as the primary node by an application, being able to claim gas via RPC is essential. @erikzhang is there no way for us to include this in the next version? I really don't want to have to run a custom version of neo-cli locally just to get the ability to claim gas via RPC.

@bmclain
Copy link

bmclain commented Jun 20, 2018

@erikzhang I'd like to formally request this be re-opened. The use case is for exchanges who are running open wallets on neo-cli and need to be able to claim gas for all addresses within their wallet.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants