diff --git a/README.md b/README.md index c9fb9e847cf9bb82e7f4e30199e2712f3806d3fb..4ad8eaf206d0f49c9158f1b12be73a7883af96c9 100644 --- a/README.md +++ b/README.md @@ -14,13 +14,11 @@ pip install -r requirements.txt ``` - Crear un link simbólico al archivo local_settings.py desde el local settings del entorno en que se encuentre el proyecto - Ejecutar: - - sudo apt-get install libssl-dev build-essential automake pkg-config libtool libffi-dev libgmp-dev libyaml-cpp-dev memcached + - sudo apt-get install libssl-dev build-essential automake pkg-config libtool libffi-dev libgmp-dev libyaml-cpp-dev - git clone https://github.com/ethereum/pyethereum/ - cd pyethereum - python setup.py install -- Poner en crontab el sig comando reemplazando donde corresponde los directorios - /directorio/del/venv/bin/python /directorio/de/aplicacion/manage.py desatascar_pendientes > /dev/null ### Utilización - Stamp - Método: POST diff --git a/TsaApi/local_settings_dev.py b/TsaApi/local_settings_dev.py index 100544d0e0b7bef45206694815634b4fdab1a831..5accc7edc2cd6eaf03908889ac3acb8994123994 100644 --- a/TsaApi/local_settings_dev.py +++ b/TsaApi/local_settings_dev.py @@ -7,9 +7,7 @@ This program is distributed in the hope that it will be useful, but WITHOUT ANY You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/ """ -APP_ROOT = '/opt/project/' - -LOG_ROOT = APP_ROOT + 'logs/' +APP_ROOT = '/home/python/TsaAPI/' STATIC_ROOT = APP_ROOT + 'html/' @@ -17,23 +15,11 @@ ACCOUNT_ADDRESS = '0x25c185dcaed065bac30a0a1cd0688a7aa02896d7' HOST_ADDRESS = 'http://10.23.10.72:8501' -# Contracts info +#Contracts info CONTRACTS = { - '01': { + '01':{ 'address': '0x88933138A9Ef6474ee4f255A6395210F4f014d6B', - 'abi': [{"constant": True, "inputs": [{"name": "ots", "type": "string"}], "name": "getHash", - "outputs": [{"name": "", "type": "string"}], "payable": False, "stateMutability": "view", - "type": "function"}, - {"constant": True, "inputs": [{"name": "ots", "type": "string"}], "name": "getBlockNumber", - "outputs": [{"name": "", "type": "uint256"}], "payable": False, "stateMutability": "view", - "type": "function"}, {"constant": True, "inputs": [{"name": "ots", "type": "string"}, - {"name": "file_hash", "type": "string"}], - "name": "verify", "outputs": [{"name": "", "type": "bool"}], "payable": False, - "stateMutability": "view", "type": "function"}, {"constant": False, "inputs": [ - {"name": "ots", "type": "string"}, {"name": "file_hash", "type": "string"}], "name": "stamp", - "outputs": [], "payable": False, - "stateMutability": "nonpayable", - "type": "function"}], + 'abi': [{"constant":True,"inputs":[{"name":"ots","type":"string"}],"name":"getHash","outputs":[{"name":"","type":"string"}],"payable":False,"stateMutability":"view","type":"function"},{"constant":True,"inputs":[{"name":"ots","type":"string"}],"name":"getBlockNumber","outputs":[{"name":"","type":"uint256"}],"payable":False,"stateMutability":"view","type":"function"},{"constant":True,"inputs":[{"name":"ots","type":"string"},{"name":"file_hash","type":"string"}],"name":"verify","outputs":[{"name":"","type":"bool"}],"payable":False,"stateMutability":"view","type":"function"},{"constant":False,"inputs":[{"name":"ots","type":"string"},{"name":"file_hash","type":"string"}],"name":"stamp","outputs":[],"payable":False,"stateMutability":"nonpayable","type":"function"}], }, } @@ -47,21 +33,4 @@ PERMANENT_OTS_PREFIX = '1x' GAS = 250000 GAS_PRICE = 1 -SENTRY_URL = 'http://2ec54beaab3b4459a1e5afadea070f98:92aee3f5d91e4e66996a3e0792985541@172.17.30.21:9000/54' - -MEMCACHED_HOST = '172.17.0.1' -MEMCACHED_PORT = 11211 # TIENE QUE SER INT - -PENDING_TXS_MEMCACHED_KEY = 'pending_txs' - -TEST_MEMCACHED_HOST = MEMCACHED_HOST -TEST_MEMCACHED_PORT = MEMCACHED_PORT - -TEST_PENDING_TXS_MEMCACHED_KEY = 'test_pending_txs' - -ELASTIC_APM = { - 'SERVICE_NAME': 'TsaApi-dev', - 'SERVER_URL': 'http://10.1.100.67:8200', - 'DEBUG': True, -} - +SENTRY_URL = 'http://2ec54beaab3b4459a1e5afadea070f98:92aee3f5d91e4e66996a3e0792985541@172.17.30.21:9000/54' \ No newline at end of file diff --git a/TsaApi/local_settings_preprod.py b/TsaApi/local_settings_preprod.py index 5f3a1dc4c0c0ed53022b7263a17c4dbc4398b444..3e45e9f9be26a7e32e66285e5306c94df4be4ccb 100644 --- a/TsaApi/local_settings_preprod.py +++ b/TsaApi/local_settings_preprod.py @@ -8,7 +8,6 @@ This program is distributed in the hope that it will be useful, but WITHOUT ANY You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/ """ APP_ROOT = '/var/www/tsaapi.pp.bfa.local/' -LOG_ROOT = APP_ROOT + 'logs/' STATIC_ROOT = APP_ROOT + 'html/' STATIC_URL = '/tsa/static/' @@ -33,10 +32,4 @@ PERMANENT_OTS_PREFIX = '1x' GAS = 250000 GAS_PRICE = 1 -SENTRY_URL = 'http://aa30f3ecd3bb4923a7046f197da61e07:47cd9f9ea1e243f6a9f47e2aa40b85c3@10.1.100.118:9000/82' - -ELASTIC_APM = { - 'SERVICE_NAME': 'TsaApi-pp', - 'SERVER_URL': 'http://10.20.99.87:8200', - 'DEBUG': True, -} +SENTRY_URL = 'http://aa30f3ecd3bb4923a7046f197da61e07:47cd9f9ea1e243f6a9f47e2aa40b85c3@10.1.100.118:9000/82' \ No newline at end of file diff --git a/TsaApi/local_settings_prod.py b/TsaApi/local_settings_prod.py index dbdd5cee9e8dee3cb6d1375aad1616e91e9d0af1..9d51a160ba5d96d9d00dc00fe70360b1c33281bf 100644 --- a/TsaApi/local_settings_prod.py +++ b/TsaApi/local_settings_prod.py @@ -41,10 +41,4 @@ PERMANENT_OTS_PREFIX = '1x' GAS = 250000 GAS_PRICE = 100000000 -SENTRY_URL = 'http://36f4f241a007447d8a4441a13055b110:136cb6d1af854b869d13610603fa7321@10.1.100.118:9000/84' - -ELASTIC_APM = { - 'SERVICE_NAME': 'TsaApi', - 'SERVER_URL': 'http://10.20.99.87:8200', - 'DEBUG': False, -} +SENTRY_URL = 'http://36f4f241a007447d8a4441a13055b110:136cb6d1af854b869d13610603fa7321@10.1.100.118:9000/84' \ No newline at end of file diff --git a/app/utils.py b/app/utils.py index d3fa00b4a3437e6d46acada06ef032f7893f04aa..d7e2b233fa5822086b7ef5574305ce7e5f273a48 100644 --- a/app/utils.py +++ b/app/utils.py @@ -7,7 +7,6 @@ This program is distributed in the hope that it will be useful, but WITHOUT ANY You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/ """ -import base64 import datetime import hashlib import time @@ -15,7 +14,7 @@ import math from TsaApi.settings import ACCOUNT_ADDRESS, CURRENT_CONTRACT_VERSION, PERMANENT_OTS_PREFIX, TEMPORARY_OTS_PREFIX -class Utils: +class Utils(): @staticmethod def sha256_encode(string): return hashlib.sha256(string.encode('utf-8')).hexdigest() @@ -26,10 +25,8 @@ class Utils: @staticmethod def get_ots_hash(file_hash): - # El ots se genera con los hashes sha256 de (archivo original+timestamp+dirección de la cuenta) + versión del - # contrato - return Utils.sha256_encode(str(file_hash + Utils.sha256_encode(str(int(time.time()))) + Utils.sha256_encode( - ACCOUNT_ADDRESS))) + CURRENT_CONTRACT_VERSION + #El ots se genera con los hashes sha256 de (archivo original+timestamp+dirección de la cuenta) + versión del contrato + return Utils.sha256_encode(str(file_hash + Utils.sha256_encode(str(int(time.time()))) + Utils.sha256_encode(ACCOUNT_ADDRESS))) + CURRENT_CONTRACT_VERSION @staticmethod def decode_contract_call(contract_abi, call_data): @@ -59,9 +56,4 @@ class Utils: @staticmethod def get_temporary_ots(ots_hash, tx_hash): - return TEMPORARY_OTS_PREFIX + '-' + ots_hash + '-' + tx_hash - - -class Base64EncodingService: - def encode(self, stuff): - return base64.b64encode(stuff) \ No newline at end of file + return TEMPORARY_OTS_PREFIX + '-' + ots_hash + '-' + tx_hash \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index e7e919e6c5f1ea1ae27a23d4c7d124c58f98abfe..409c0b57d2b1ac957849526b39094948017a1d09 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,10 +1,9 @@ -ipython==7.2.0 -ipython-genutils==0.2.0 -pymemcache==2.1.1 -elastic-apm==3.0.0 +asn1crypto==0.24.0 attrdict==2.0.0 certifi==2018.4.16 +cffi==1.11.5 chardet==3.0.4 +coincurve==9.0.0 coreapi==2.3.3 coreschema==0.0.4 cytoolz==0.9.0.1 @@ -20,6 +19,8 @@ eth-keyfile==0.5.1 eth-keys==0.2.0b3 eth-rlp==0.1.2 eth-utils==1.0.3 +ethereum==2.3.2 +future==0.16.0 hexbytes==0.1.0 idna==2.7 itypes==1.1.0 @@ -28,17 +29,27 @@ lru-dict==1.1.6 MarkupSafe==1.0 openapi-codec==1.3.2 parsimonious==0.8.0 +pbkdf2==1.3 +pkg-resources==0.0.0 +py-ecc==1.4.3 +pycparser==2.18 pycryptodome==3.6.4 +pyethash==0.1.27 PyJWT==1.6.4 +pysha3==1.0.2 python-bitcoinlib==0.10.1 pytz==2018.5 +PyYAML==4.2b4 raven==6.9.0 +repoze.lru==0.7 requests==2.19.1 rlp==1.0.1 +scrypt==0.8.6 simplejson==3.16.0 six==1.11.0 toolz==0.9.0 uritemplate==3.0.0 urllib3==1.23 web3==4.5.0 -websockets==5.0.1 \ No newline at end of file +websockets==5.0.1 +