Meter Scan backend service includes two major components:
sync
that extracts data from chain and store it in base dbapi
that exposes query endpoints
+----------------+ +--------------+ +----------------+
| | | | | |
| Meter FullNode +-----> + Base DB +------->+ Defined Entity |
| | | | | |
+----------------+ +--------------+ +----------------+
Base DB
: Blocks/TXs/PowBlocks/PowTxs/Receipts/...Defined Entity
: Balances/Transfers/ etc
- Blocks/TXs/Receipts
- Committee/Epoch
- MTR/MTRG Native Balance and Transfer
- MTR/MTRG System Contract Transfer
- ERC20 Token Balance and Transfer
- Staking Engine
- Auction Engine
- AccountLock Engine
- NFT
- Install dependency
git clone https://github.com/meterio/scan-service
cd scan-service
yarn
- Prepare .env file with these information
# file .env
# database
MONGO_PATH=localhost:27017
MONGO_PWD=scan
MONGO_USER=scan
MONGO_SSL_CA=
# used by api
SWAPPER_PRIVATE_KEY=
SWAPPER_RPC_URL=
- Help
yarn start help
- Run sync
# sync pos
yarn start sync pos -n main
# sync nft
yarn start sync nft -n main
- Run api
yarn start api -n main -p 3000
# build docker
./api.docker.sh
Mainnet API base:
https://api.meter.io:8000/api
Testnet API base:
https://api.meter.io:4000/api
Notice: page
and limit
are optional params for API access, limit
means how many entries will be included in one page. The total number of entries will be returned in response with the name of totalRows
, you'll need to loop the page number from 1 to Math.ceiling(totalRows
/limit
) to collect all the information
GET /nfts/:address/tokens?page=1&limit=20
eg: https://api.meter.io:8000/api/nfts/0x608203020799f9bda8bfcc3ac60fc7d9b0ba3d78/tokens
GET /nfts/:address/:tokenId
eg: https://api.meter.io:8000/api/nfts/0x608203020799f9bda8bfcc3ac60fc7d9b0ba3d78/3445
GET /accounts/:address/nfts?page=1&limit=20
GET /account/:tokenAddress/holders?page=1&limit=20