Skip to content

Commit

Permalink
Add new endpoint for dcrweb statistics.
Browse files Browse the repository at this point in the history
Collects data from dcrdata and caches it, serves to JavaScript running
on the homepage of decred.org.
  • Loading branch information
jholdstock committed Jan 23, 2024
1 parent 871ff80 commit 79a0e82
Show file tree
Hide file tree
Showing 5 changed files with 1,075 additions and 6 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ISC License

Copyright (c) 2017-2023 The Decred developers
Copyright (c) 2017-2024 The Decred developers

Permission to use, copy, modify, and distribute this software for any
purpose with or without fee is hereby granted, provided that the above
Expand Down
19 changes: 19 additions & 0 deletions docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,22 @@ Example: <https://api.decred.org/?c=vsp>
},
}
```

## Get Web Info

Collects data from dcrdata and caches it, serves to JavaScript running on the
homepage of <https://decred.org>.

Example: <https://api.decred.org/?c=webinfo>

```json
{
"circulatingsupply": 15802432.15830938,
"ultimatesupply": 20999999.9839432,
"stakedsupply": 9877100.80510565,
"blockreward": 6.44881,
"treasuryusd": 11627589.675361848,
"ticketprice": 253.5278664,
"daysuntilrewardchange": 16
}
```
58 changes: 56 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,60 @@ module github.com/decred/dcrwebapi

go 1.18

require github.com/gorilla/handlers v1.5.1
require (
github.com/decred/dcrd/dcrutil/v4 v4.0.0
github.com/decred/dcrdata/exchanges/v3 v3.1.0
github.com/decred/dcrdata/v6 v6.0.0
github.com/gorilla/handlers v1.5.1
)

require github.com/felixge/httpsnoop v1.0.3 // indirect
require (
decred.org/dcrdex v0.4.3 // indirect
decred.org/dcrwallet v1.7.0 // indirect
github.com/agl/ed25519 v0.0.0-20170116200512-5312a6153412 // indirect
github.com/carterjones/go-cloudflare-scraper v0.1.2 // indirect
github.com/carterjones/signalr v0.3.5 // indirect
github.com/dchest/siphash v1.2.2 // indirect
github.com/decred/base58 v1.0.3 // indirect
github.com/decred/dcrd/blockchain/stake/v3 v3.0.0 // indirect
github.com/decred/dcrd/blockchain/standalone/v2 v2.1.0 // indirect
github.com/decred/dcrd/certgen v1.1.1 // indirect
github.com/decred/dcrd/chaincfg/chainhash v1.0.3 // indirect
github.com/decred/dcrd/chaincfg/v3 v3.1.1 // indirect
github.com/decred/dcrd/crypto/blake256 v1.0.1-0.20200921185235-6d75c7ec1199 // indirect
github.com/decred/dcrd/crypto/ripemd160 v1.0.1 // indirect
github.com/decred/dcrd/database/v2 v2.0.2 // indirect
github.com/decred/dcrd/dcrec v1.0.1-0.20200921185235-6d75c7ec1199 // indirect
github.com/decred/dcrd/dcrec/edwards/v2 v2.0.2 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v3 v3.0.0 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect
github.com/decred/dcrd/dcrjson/v3 v3.1.0 // indirect
github.com/decred/dcrd/dcrutil/v3 v3.0.0 // indirect
github.com/decred/dcrd/hdkeychain/v3 v3.1.0 // indirect
github.com/decred/dcrd/rpc/jsonrpc/types/v2 v2.3.0 // indirect
github.com/decred/dcrd/txscript/v3 v3.0.0 // indirect
github.com/decred/dcrd/txscript/v4 v4.0.0 // indirect
github.com/decred/dcrd/wire v1.5.0 // indirect
github.com/decred/go-socks v1.1.0 // indirect
github.com/decred/slog v1.2.0 // indirect
github.com/felixge/httpsnoop v1.0.3 // indirect
github.com/go-chi/chi/v5 v5.0.4 // indirect
github.com/golang/protobuf v1.4.3 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/gorilla/websocket v1.4.2 // indirect
github.com/lib/pq v1.10.3 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/robertkrimen/otto v0.0.0-20180617131154-15f95af6e78d // indirect
github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 // indirect
go.etcd.io/bbolt v1.3.7-0.20220130032806-d5db64bdbfde // indirect
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97 // indirect
golang.org/x/net v0.0.0-20210903162142-ad29c8ab022f // indirect
golang.org/x/sys v0.0.0-20210902050250-f475640dd07b // indirect
golang.org/x/text v0.3.6 // indirect
golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba // indirect
google.golang.org/genproto v0.0.0-20201022181438-0ff5f38871d5 // indirect
google.golang.org/grpc v1.36.1 // indirect
google.golang.org/protobuf v1.25.0 // indirect
gopkg.in/ini.v1 v1.55.0 // indirect
gopkg.in/sourcemap.v1 v1.0.5 // indirect
)
Loading

0 comments on commit 79a0e82

Please sign in to comment.