sugarchain-project / api-server Goto Github PK
View Code? Open in Web Editor NEWThis project forked from microbitcoinorg/apiserver
API Server for Sugarchain
Home Page: https://api.sugarchain.org/
License: MIT License
This project forked from microbitcoinorg/apiserver
API Server for Sugarchain
Home Page: https://api.sugarchain.org/
License: MIT License
this is single thread and slow
$ python3 app.py
By doing python3 app.py you running api server in single thread with development server, which is highly not recommendation for production
Volbil, [08.02.20 11:03]
There is couple ways to do that, I'm personally using gunicorn and systemd
Volbil, [08.02.20 11:33]
Well, it's not a python but flask server
Volbil, [08.02.20 11:33]
Framework which I'm using
Volbil, [08.02.20 11:39]
Also debug server is bad for production
Volbil, [08.02.20 11:39]
Since it can expose some debug consoles and etc
Volbil, [08.02.20 11:39]
[Forwarded from Fork]
pip3 install gunicorn
pip3 install eventlet
gunicorn app:app --worker-class eventlet -w 1 --bind 0.0.0.0:5000 --reload
Volbil, [08.02.20 11:39]
[In reply to Volbil]
[Unit]
Description=uWSGI instance to serve sugar api
After=network.target
[Service]
User=ubuntu
Group=www-data
WorkingDirectory=/home/ubuntu/api
Environment="PATH=/home/ubuntu/api/venv/bin"
ExecStart=/home/ubuntu/api/venv/bin/gunicorn app:app --worker-class eventlet -w 1 --bind 0.0.0.0:5000 --reload
[Install]
WantedBy=multi-user.target
Volbil, [08.02.20 11:39]
[In reply to Volbil]
Systemd config
https://blog.fossasia.org/setting-up-nginx-gunicorn-and-flask-socketio/
sugarchaind -server=1 -rpcuser=abc -rpcpassword=123 -testnet -txindex=1 -addressindex -spentindex -daemon -rpcworkqueue=192
-rpcworkqueue=192
, but still i got the error. any suggest?
api.sugarchain.org has been erroring for at least more than 2 weeks now, since at least July 27th. In the mentioned link several example requests result in a 404 with the message invalid request. In the same time period also the web wallet has shown no coin amount (just says loading and nothing happens).
https://ping.chinaz.com/api.sugarchain.org
https://ping.chinaz.com/api-testnet.sugarchain.org
i suggest current singapore mainnet move location to japan or korea
https://1explorer.sugarchain.org/address/sugar1q9kph0mzahcju8wv46ywf33hknkmht6md288e8r
https://sugar.wtf/esplora/tx/0055f26c3c7a116d34c0e0c6c7ecac9ecd23b605e2f394fd3adc2107531c5f9f
https://sugar.wtf/#/transaction/0055f26c3c7a116d34c0e0c6c7ecac9ecd23b605e2f394fd3adc2107531c5f9f
why 1sat is different? Addressindex?
commit 7c5ce87d226e623b913b0f4c03441534e22ed2b0
Author: volbil <[email protected]>
Date: Fri Jun 5 19:10:22 2020 +0900
Fix spent info method
$HOME/sugarchain/src/sugarchaind -server=1 -rpcuser=rpcuser -rpcpassword=rpcpassword -testnet -txindex=1 -addressindex -spentindex -daemon
$ python3 app.py
Traceback (most recent call last):
File "app.py", line 1, in <module>
from server import config
File "/root/api-server/server/__init__.py", line 28, in <module>
from server import esplora
File "/root/api-server/server/esplora.py", line 101
return Response(f"start index must be a multipication of {config.tx_page}", mimetype="text/plain", status=400)
^
SyntaxError: invalid syntax
$ cat config.py
rid = 'api-server'
cache = 3600 # Cache request for 1 hour
secret = 'PASSWORD'
endpoint = 'http://rpcuser:[email protected]:44229/' # Testnet5
host = '0.0.0.0'
port = 1234
debug = False
block_page = 10
tx_page = 25
whats missing in config?
You need to rebuild the database using -reindex to change -spentindex. Please restart with -reindex or -reindex-chainstate to recover.
2020-06-14 20:02:57 Checking all blk files are present...
2020-06-14 20:02:58 LoadBlockIndexDB: address index enabled
2020-06-14 20:02:58 LoadBlockIndexDB: timestamp index disabled
2020-06-14 20:02:58 LoadBlockIndexDB: spent index disabled
2020-06-14 20:02:58 LoadBlockIndexDB: transaction index enabled
2020-06-14 20:02:58 : You need to rebuild the database using -reindex to change -spentindex.
Please restart with -reindex or -reindex-chainstate to recover.
2020-06-14 20:02:58 Aborted block database rebuild. Exiting.
2020-06-14 20:02:58 Shutdown: In progress...
2020-06-14 20:02:58 scheduler thread interrupt
2020-06-14 20:02:58 Shutdown: done
-reindex-chainstate
-reindex
or sync again from zero$HOME/sugarchain/src/sugarchaind -server=1 -rpcuser=rpcuser -rpcpassword=rpcpassword -testnet -txindex=1 -addressindex -spentindex -daemon
getnetworkinfo
https://bitcoin.stackexchange.com/questions/13165/check-which-bitcoind-version-i-am-running
{
"version": 160330,
"subversion": "/Yumekawa:0.16.3.30/",
"protocolversion": 70015,
"localservices": "000000000000040d",
"localrelay": true,
"timeoffset": 0,
"networkactive": true,
"connections": 7,
"networks": [
{
"name": "ipv4",
"limited": false,
"reachable": true,
"proxy": "",
"proxy_randomize_credentials": false
},
{
"name": "ipv6",
"limited": false,
"reachable": true,
"proxy": "",
"proxy_randomize_credentials": false
},
{
"name": "onion",
"limited": true,
"reachable": false,
"proxy": "",
"proxy_randomize_credentials": false
}
],
"relayfee": 0.00001000,
"incrementalfee": 0.00001000,
"localaddresses": [
],
"warnings": ""
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.