Skip to content
Snippets Groups Projects
Commit 1c65b01d authored by Agustin Dorda's avatar Agustin Dorda
Browse files

Requirements con pymemcached y ipython, README con el cron, settings menores

parent 6c1230e3
No related branches found
No related tags found
No related merge requests found
......@@ -14,11 +14,13 @@ 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
- sudo apt-get install libssl-dev build-essential automake pkg-config libtool libffi-dev libgmp-dev libyaml-cpp-dev memcached
- 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
......
......@@ -15,11 +15,23 @@ 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"}],
},
}
......@@ -33,4 +45,21 @@ PERMANENT_OTS_PREFIX = '1x'
GAS = 250000
GAS_PRICE = 1
SENTRY_URL = 'http://2ec54beaab3b4459a1e5afadea070f98:92aee3f5d91e4e66996a3e0792985541@172.17.30.21:9000/54'
\ No newline at end of file
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,
}
......@@ -8,6 +8,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 = '/var/www/tsaapi.pp.bfa.local/'
LOG_ROOT = APP_ROOT + 'logs/'
STATIC_ROOT = APP_ROOT + 'html/'
STATIC_URL = '/tsa/static/'
......@@ -15,11 +16,47 @@ ACCOUNT_ADDRESS = '0xA9cAc6C2EF4909A05eF24A12Ecadf9E541B5995F' # cuenta con bal
HOST_ADDRESS = 'http://10.23.10.73:54450' # Nodo de la BFA de Test
#Contracts info
# Contracts info
CONTRACTS = {
'01':{
'01': {
'address': '0xD5110AB5cE1be270d5B8c5FB7A25c60765994ca8',
'abi': [ { "constant": False, "inputs": [], "name": "selfDestroy", "outputs": [], "payable": False, "stateMutability": "nonpayable", "type": "function" }, { "constant": False, "inputs": [ { "name": "ots", "type": "string" }, { "name": "file_hash", "type": "string" } ], "name": "stamp", "outputs": [], "payable": False, "stateMutability": "nonpayable", "type": "function" }, { "anonymous": False, "inputs": [ { "indexed": True, "name": "from", "type": "address" }, { "indexed": True, "name": "hash", "type": "string" }, { "indexed": True, "name": "ots", "type": "string" } ], "name": "Stamped", "type": "event" }, { "anonymous": False, "inputs": [ { "indexed": True, "name": "from", "type": "address" }, { "indexed": True, "name": "contract_address", "type": "address" } ], "name": "Deploy", "type": "event" }, { "anonymous": False, "inputs": [ { "indexed": True, "name": "from", "type": "address" }, { "indexed": True, "name": "contract_address", "type": "address" } ], "name": "SelfDestroy", "type": "event" }, { "inputs": [], "payable": False, "stateMutability": "nonpayable", "type": "constructor" }, { "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": "getHash", "outputs": [ { "name": "", "type": "string" } ], "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" } ],
'abi': [{"constant": False, "inputs": [], "name": "selfDestroy", "outputs": [], "payable": False,
"stateMutability": "nonpayable", "type": "function"}, {"constant": False,
"inputs": [{"name": "ots", "type": "string"},
{"name": "file_hash",
"type": "string"}], "name": "stamp",
"outputs": [], "payable": False,
"stateMutability": "nonpayable",
"type": "function"}, {"anonymous": False,
"inputs": [
{"indexed": True,
"name": "from",
"type": "address"},
{"indexed": True,
"name": "hash",
"type": "string"},
{"indexed": True,
"name": "ots",
"type": "string"}],
"name": "Stamped",
"type": "event"},
{"anonymous": False, "inputs": [{"indexed": True, "name": "from", "type": "address"},
{"indexed": True, "name": "contract_address", "type": "address"}],
"name": "Deploy", "type": "event"}, {"anonymous": False,
"inputs": [{"indexed": True, "name": "from", "type": "address"},
{"indexed": True, "name": "contract_address",
"type": "address"}], "name": "SelfDestroy",
"type": "event"},
{"inputs": [], "payable": False, "stateMutability": "nonpayable", "type": "constructor"},
{"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": "getHash",
"outputs": [{"name": "", "type": "string"}], "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"}],
},
}
CURRENT_CONTRACT_VERSION = '01'
......@@ -32,4 +69,10 @@ PERMANENT_OTS_PREFIX = '1x'
GAS = 250000
GAS_PRICE = 1
SENTRY_URL = 'http://aa30f3ecd3bb4923a7046f197da61e07:47cd9f9ea1e243f6a9f47e2aa40b85c3@10.1.100.118:9000/82'
\ No newline at end of file
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,
}
......@@ -41,4 +41,10 @@ PERMANENT_OTS_PREFIX = '1x'
GAS = 250000
GAS_PRICE = 100000000
SENTRY_URL = 'http://36f4f241a007447d8a4441a13055b110:136cb6d1af854b869d13610603fa7321@10.1.100.118:9000/84'
\ No newline at end of file
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,
}
......@@ -7,6 +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/
"""
import base64
import datetime
import hashlib
import time
......@@ -14,7 +15,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()
......@@ -25,7 +26,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
# 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
......@@ -56,4 +58,9 @@ class Utils():
@staticmethod
def get_temporary_ots(ots_hash, tx_hash):
return TEMPORARY_OTS_PREFIX + '-' + ots_hash + '-' + tx_hash
\ No newline at end of file
return TEMPORARY_OTS_PREFIX + '-' + ots_hash + '-' + tx_hash
class Base64EncodingService:
def encode(self, stuff):
return base64.b64encode(stuff)
......@@ -30,7 +30,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
......@@ -52,4 +51,7 @@ uritemplate==3.0.0
urllib3==1.23
web3==4.5.0
websockets==5.0.1
elastic-apm==3.0.0
ipython==7.2.0
ipython-genutils==0.2.0
pymemcache==2.1.1
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment