Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RPC] Address history index #724

Merged
merged 11 commits into from
Jul 10, 2020
Merged

Conversation

aguycalled
Copy link
Member

@aguycalled aguycalled commented Jun 23, 2020

This PR adds a new RPC method getaddresshistory. Related to #722

getaddresshistory

Returns the history for an address(es) (requires addressindex to be enabled).

Arguments:

{
  "addresses"
    [
      "address"  (string) The base58check encoded address
      ,...
    ]
  "start" (number, optional) The start block height
  "end" (number, optional) The end block height
}

Result:

[
  {
    "block": (integer) the block height when this entry was seen
    "txindex": (integer) the index of the transaction inside of the block
    "time": (integer) timestamp when this entry happened
    "txid": (string) hash of the transaction
    "address": (string) the address affected
    "changes": {
      "balance": (signed integer) the change in spendable balance
      "stakable": (signed integer) the change in stakable balance
      "voting_weight": (signed integer) the change in voting weight
      "flags": (integer) 1 if is a coinstake or coinbase transaction, 0 otherwise
    },
    "result": {
      "balance": (integer) the spendable balance after the change
      "stakable": (integer) the stakable balance after the change
      "voting_weight": (integer) the voting weight after the change
    }
  }
]

Examples:

> navcoin-cli getaddresshistory '{"addresses": ["NNX4j3QtATFGMTFiAxdVDGR5mwL4v8Q57o"]}'
> navcoin-cli getaddresshistory '{"addresses": ["Y65KbGXT3SHSMjHBAYsB3fgpsqJ9Jp1PwstgNYG8X1AgbmevmkA5mCkG6E79K"]}'
> navcoin-cli getaddresshistory '{"addresses": ["4Eea43rawnG5uF4DVS3ZwPhAcNpxhHCD8R2AjyZi5MZjCFW7fCSY59FfsEe5YfKTvBjRudiAjEtmnMr9LHgbjosRN"]}'

When cold staking or cold staking v2 addresses are queried, it will print results from the individual addresses part of the cold staking address in their role.

@mxaddict
Copy link
Contributor

Looks good, will test in a few hours

@navbuilder
Copy link

A new build of 038e060 has completed succesfully!
Binaries available at https://build.nav.community/binaries/address-history

@navbuilder
Copy link

A new build of c16b6f5 has completed succesfully!
Binaries available at https://build.nav.community/binaries/address-history

@mxaddict mxaddict added gui rpc and removed gui labels Jun 26, 2020
@navbuilder
Copy link

A new build of 65fe893 has completed succesfully!
Binaries available at https://build.nav.community/binaries/address-history

@aguycalled
Copy link
Member Author

added count of balance of staking-active addresses to getstakinginfo to substitute the functionality from navexplorer

@navbuilder
Copy link

A new build of 79b8722 has completed succesfully!
Binaries available at https://build.nav.community/binaries/address-history

@mxaddict
Copy link
Contributor

mxaddict commented Jul 1, 2020

Tested gitian built: https://build.nav.community/binaries/address-history/navcoin-5.0.1-x86_64-linux-gnu.tar.gz

Works fine on ubuntu 18.04

Copy link

@sakdeniz sakdeniz left a comment

Choose a reason for hiding this comment

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

I have tried this feature on NavCoin 5.0.1 build and it works as expected.

@navbuilder
Copy link

A new build of 36f7c08 has completed succesfully!
Binaries available at https://build.nav.community/binaries/address-history

@aguycalled aguycalled merged commit 0f92edb into navcoin:master Jul 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants