# SLP-List
List all token holder addresses and balances at any specified blockchain height. This package makes queries to a SLPDB (opens new window) via the slpserve http gateway.
NOTE
All list results provided by this package should be double-checked between multiple SLPDB nodes because any instance of SLPDB may be out-of-sync, have an outdated version, or have a corrupted database. Be sure to know the SLPDB node instances you connecting to can be trusted and are properly maintained.
# Introduction
Applications can use information generated by SLP-List to:
- Distribute Bitcoin Cash rewards to token holders, pro rata
- Airdrop existing token holders with new SLP tokens, pro rata
- Build a token staking rewards systems using coin age
- Public key and user coordination in decentralized applications
By default this package connects to a public SLPDB node, but this can be overridden using Config.SetUrl("<slpserve URL>")
.
# Install
# node.js
$ npm i slp-list
# browser
<script src='https://unpkg.com/slp-list'></script>
# Example Usage
# List of token holders
Get a list of token holder addresses and balances for a token using custom SLPDB instance:
let slplist = require("slp-list");
slplist.Config.SetUrl("https://slpdb.fountainhead.cash");
const blockCutoff = 620971;
let list;
(async () => {
list = await slplist.List.GetAddressListFor(
"c4b0d62156b3fa5c8f3436079b5394f7edc1bef5dc1cd2f9d0c4d46f82cca479",
blockCutoff,
true
);
console.log(list);
})();
# Result:
{
"simpleledger:qqwap3lfel8wevd4rk5w2hkjs35kxc82fyvalykv09": "7",
"simpleledger:qpcgmrsal20mf8hvdqhja0w2m9s3q026l5gjqxd8v5": "1",
"simpleledger:qz5wajf8f0mkpl4n5mmsfv3am3qfq6wdxu504vaajf": "2",
"simpleledger:qrmvmvqqll53v8k4x5e64t0wdnwf4asp6uxx35vhag": "1",
"simpleledger:qpuh688c60gfqe5agwrfztyaype4h69lnqu86n6c72": "1",
"simpleledger:qqlrnm8pcc9jqkkq2glhp22tnjzzxpkv3cqvdts0tf": "1",
"simpleledger:qzn02dvpz6js49ykrtjr6jeyvlyk0j4s0gl08f2prd": "9",
"simpleledger:qrwnnkfc0z7er0vjw6wnf4m56agewjlj05s4wqzrqj": "0.8"
// ...
}
# List all holders of an NFT in an NFT1 Group
List the NFT holders for a specific NFT1 Group:
let slplist = require("slp-list");
slplist.Config.SetUrl("https://nyc1.slpdb.io");
let list;
(async () => {
list = await slplist.Nft1List.GetConfirmedNftTokenHolders(
"33e02bc67d71dab03d10a0f46050f7bfb8d8c3363a5b5bca622bcd837ca3feb8"
);
console.log(list);
})();
# Result:
Map {
'44f339784c8afc2d26ac821ab68394dfceed803a3b987df6abe5de5a81664b33': 'simpleledger:qqzjzzlmx8h3hum3drsuk894jnf8r909ku4lankkg5',
// ...
}
# List linked tokens
List all tokens with a Genesis pointing to a specific Document Hash:
let slplist = require("slp-list");
slplist.Config.SetUrl("https://slpdb.fountainhead.cash");
let list;
(async () => {
list = await slplist.List.SearchForTokenIdInDocHash(
"94dbe7179abd236cfb0fc5aaef86aad92214053f6de2885872dd85235cfa9f67",
);
console.log(list);
})();
# Result:
[
{
"stats": {
"block_created": 633158,
"approx_txns_since_genesis": 1
},
"token": {
"decimals": 0,
"tokenIdHex": "4b7d2757d155520e0c6a9653a9750d9b574bd9779e9cb106b9d7c1ac22226260",
"timestamp": "2020-05-01 03:41:12",
"timestamp_unix": 1588304472,
"transactionType": "GENESIS",
"versionType": 129,
"documentUri": "http://ipfs.pics/ipfs/Qmep61aZqJhhmSkhQHUSUme5RFbi8ZfccxXC1TyjKHcEig",
"documentSha256Hex": "94dbe7179abd236cfb0fc5aaef86aad92214053f6de2885872dd85235cfa9f67",
"symbol": "slp.network",
"name": "SLP Sage Chat Group",
"batonVout": 2,
"containsBaton": true,
"genesisOrMintQuantity": "100",
"sendOutputs": null
}
}
]
# List all NFTs in an NFT1 Group (not only the current holders)
List all NFTs created for this specific NFT1 Group:
let slplist = require("slp-list");
slplist.Config.SetUrl("https://slpdb.fountainhead.cash");
let list;
(async () => {
list = await slplist.Nft1List.SearchForNftsInGroup(
"9ce9ebb34a1efcbe1649dc6cc9e62a2b2c2c4fb0947d7ea6412adefbc725829c"
);
console.log(list);
})();
# Result:
[
{
"stats": {
"block_created": 626896,
"approx_txns_since_genesis": 1
},
"token": {
"decimals": 0,
"tokenIdHex": "c67c6423767a86e27c56ad9c04581f4500d88baff12b865611a39602f449b465",
"timestamp": "2020-03-18 01:51:35",
"timestamp_unix": 1584496295,
"transactionType": "GENESIS",
"versionType": 65,
"documentUri": "",
"documentSha256Hex": null,
"symbol": "",
"name": "",
"batonVout": null,
"containsBaton": false,
"genesisOrMintQuantity": "1",
"sendOutputs": null
}
}
]