Side Ledger Protocol
Run python-slp node
First install Mongo DB and run the mongodb service:
sudo systemctl start mongod.service
Install python-slp node via easy installation script:
bash <(curl -s https://raw.githubusercontent.com/Moustikitos/python-slp/master/slp-install.sh)
python-slp node will then run as a background service on your system. Status and logs are accessible from systemctl and journalctl commands.
python-slp can also be launched on server startup:
sudo systemctl enable mongod.service
sudo systemctl enable slp.service
Settings
- webhook has to be enabled on
Arkrelay - set
webhook peerinark.jsonfile
if python-slp is running on a standalone node
- node ip where
python-slpis installed has to be whitelisted by theArkrelay
Custom deployment
python-slp is configured for Ark blockchain on port 5200 and 5100. To deploy node and api with a specific Ark-fork, copy ark.json to name.json in package directory where name is the name of the targeted blockchain. Then edit created json file accordingly and deploy:
python -c "import app;app.deploy(host='127.0.0.1', port=5243, blockchain='name')"
python -c "import slp.api;slp.api.deploy(host='127.0.0.1', port=5124, blockchain='name')"
Where name is the basename of json configuration used to store specific blockchain parameters.
Webhook management
Webhook subsciption is done on python-slp launch. It can also be created/removed with:
python -c "import app;app.init('name');app.sync.chain.subscribe()"
python -c "import app;app.init('name');app.sync.chain.unsubscribe()"
API endpoint for slp database
An endpoint is available to get data from mongo database with the pattern:
/<table_name>/find[?field=value&..][&operator_field=op:value&..][&orderBy=field_i:direction_i,..][&page=number]
Where:
- op is one of
eq,neg,gt,gte,lt,lte - direction
descorreversed(default isasc)
| table name | fields | operator fields |
|---|---|---|
| slp1 | address, tokenId, blockStamp, owner, frozen |
balance |
| slp2 | address, tokenId, blockStamp, owner, frozen |
|
| journal | slp_type, emitter, receiver, legit, tp, sy, id, pa, mi |
qt |
| contracts | tokenId, height, index, type, owner, paused, symbol |
minted, burned, exited, globalSupply |
| rejected | tokenId, height, index, type, owner, paused, symbol |
minted, burned, exited, globalSupply |
curl http://127.0.0.1:5100/slp2/find?tokenId=0c1b5ed5cff799a0dee2cadc6d02ac60
{
"status": 200,
"meta": {
"page": 1,
"totalPage": 1,
"count": 2,
"totalCount": 2
},
"data": [
{
"address": "ARypXg91KdTCFxUCtjktZMdDEne3AcA8A7",
"tokenId": "0c1b5ed5cff799a0dee2cadc6d02ac60",
"blockStamp": "17902732#1",
"owner": false,
"metadata": {
"trait_background": "ice",
"trait_base": "zombie",
"trait_clothing": "astronaut",
"trait_face": "angry",
"trait_hat": "beanie"
}
},
{
"address": "AR2xF13MYMnTKGiqF5Z6oNp1nMue9Qpp84",
"tokenId": "0c1b5ed5cff799a0dee2cadc6d02ac60",
"blockStamp": "17902732#1",
"owner": true,
"metadata": {}
}
]
}
Releases
current work
- full SLP2 contract execution
- SIGTEMR securely handled
- run slp API separately
-
ubuntuinstall script - blockchain syncer
- full SLP1 contract execution
- mongo db api
- TODO:
- test suite
- documentation
- use websocket to sync slp database
- slp database rebuild before sync process
- p2p messaging
- improve logging messages