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

Scripts gathering external website data #18

Closed
grctest opened this issue Jan 23, 2017 · 7 comments
Closed

Scripts gathering external website data #18

grctest opened this issue Jan 23, 2017 · 7 comments

Comments

@grctest
Copy link
Owner

grctest commented Jan 23, 2017

Could grab:

  • The latest block numbers from the explorers and full node websites.
  • The latest prices from multiple exchanges
  • Steemit content?

We need to change the cross site scripting security though & we shouldn't make the website too slow nor tacky/bulky.

Has to be JS, we don't have access to the underlying web server terminal.

@startailcoon
Copy link
Contributor

As soon as I've completed the upgrade of Gridcoinstats I can supply the Gridcoin webpage with API access, trough JS, to the basic functions. This would include functions like latest block number and exchange prices (gathered by gridcoinstats).

Timeframe: 1-2 months

@startailcoon
Copy link
Contributor

Two Public functions that can be used for the webpage for latest Projects status, Active (whitelisted) or Inactive and latest Block information on the chain.

Latest Projects Data: https://www.gridcoinstats.eu/API/api.php?a=getProjectData

Data: Array(
 "active"=>Array(name=>string, url=>string, lastActive=>date),
 "inactive"=>Array(name=>string, url=>string, lastActive=>date)
)

Latest Block Data: https://www.gridcoinstats.eu/API/api.php?a=getLastBlock
Data: Array(id=>string, hash=>string, blockTime=>date, blockDiff=>double, totalBlockMinted=>double)

@startailcoon
Copy link
Contributor

Coinmarketcap has a public API for grabbing the latest price feed for Gridcoin.
https://api.coinmarketcap.com/v1/ticker/gridcoin/

[
    {
        "id": "gridcoin", 
        "name": "GridCoin", 
        "symbol": "GRC", 
        "rank": "92", 
        "price_usd": "0.0571596", 
        "price_btc": "0.00002416", 
        "24h_volume_usd": "486330.0", 
        "market_cap_usd": "22310121.0", 
        "available_supply": "390312753.0", 
        "total_supply": "390312753.0", 
        "percent_change_1h": "4.06", 
        "percent_change_24h": "-2.65", 
        "percent_change_7d": "-31.33", 
        "last_updated": "1498590012"
    }
]

@startailcoon
Copy link
Contributor

Sample code to get this working with jQuery

    function loadBlocksData() {
      var request = $.ajax({
        url:'https://www.gridcoinstats.eu/API/api.php?a=getLastBlock',
        crossDomain: true,
        dataType: 'json',
      });
      request.done(function(data) {
        $('#blockDataDiv').append('Block ID: ' + data['id'] + ', Block Hash: ' + data['hash'] + ', Time: ' + data['blockTime']);
      });
    }

$(document).ready(function() {
     loadBlockHeaders();
});

@grctest
Copy link
Owner Author

grctest commented Aug 16, 2017

This issue has arisen again regarding the slack invite portal being added to the gridcoin website.

@barton2526
Copy link
Contributor

I can change the cross site scripting file to accommodate these and the slack scripts.

@grctest
Copy link
Owner Author

grctest commented Aug 24, 2017

This issue was moved to gridcoin-community/Gridcoin-Site#6

@grctest grctest closed this as completed Aug 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants