Skip to content
Snippets Groups Projects
Commit e5ef8294 authored by Agustín Sacramento's avatar Agustín Sacramento
Browse files

* Se agrega funcionalidad para reprocesar transacciones pendientes.

 * Se modifica el Verify para poder identificar transacciones por contenido independientemente del ID de la transaccion.
 * Se agregan archivos Docker.
 * Se modifica el nombre del archivo License
parents bc197d5e 0a5599bf
No related branches found
No related tags found
No related merge requests found
Showing
with 184 additions and 31 deletions
FROM python:3.5.2
RUN apt-get update && apt-get -y upgrade && apt-get install -y --no-install-recommends apt-utils && apt-get install -y apt-transport-https software-properties-common libsasl2-dev python-dev libldap2-dev libssl-dev memcached
RUN apt-get install -y gettext
RUN git clone https://github.com/ethereum/pyethereum/ /opt/pyethereum
WORKDIR /opt/project
ADD requirements.txt /opt/project
RUN pip install -U pip
RUN pip install -r requirements.txt
WORKDIR /opt/pyethereum
RUN python setup.py install
RUN mkdir -p /opt/project
WORKDIR /opt/project
ADD . /opt/project
\ No newline at end of file
File moved
......@@ -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
......
File deleted
File deleted
File deleted
File deleted
File deleted
File deleted
File deleted
......@@ -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,
}
......@@ -7,18 +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/
"""
# APP_ROOT = '/home/python/TsaAPI/'
APP_ROOT = '/var/www/tsaapi.prod.bfa.local/'
# STATIC_ROOT = APP_ROOT + 'html/'
STATIC_URL = '/tsa/static/'
# ACCOUNT_ADDRESS = '0x21ea59FC5cE54a827E20BC9b736FeeD8F9C880Ff'
# HOST_ADDRESS = 'http://10.23.10.71:8501'
HOST_ADDRESS = 'http://127.0.0.1:8545'
ACCOUNT_ADDRESS = '0xac952ae0716e8aded07dda498f182f4983af682a'
......@@ -39,6 +27,6 @@ TEMPORARY_OTS_PREFIX = '0x'
PERMANENT_OTS_PREFIX = '1x'
GAS = 250000
GAS_PRICE = 100000000
GAS_PRICE = 100000000000
SENTRY_URL = 'http://36f4f241a007447d8a4441a13055b110:136cb6d1af854b869d13610603fa7321@10.1.100.118:9000/84'
\ No newline at end of file
......@@ -8,6 +8,8 @@ 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/
"""
# -*- coding: utf-8 -*-
import sys
"""
Django settings for TsaApi project.
......@@ -24,11 +26,9 @@ import os
import datetime
import raven
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.11/howto/deployment/checklist/
......@@ -40,7 +40,6 @@ DEBUG = True
ALLOWED_HOSTS = ['*']
# Application definition
INSTALLED_APPS = [
......@@ -54,9 +53,12 @@ INSTALLED_APPS = [
'raven.contrib.django.raven_compat',
'corsheaders',
'rest_framework_swagger',
'elasticapm.contrib.django',
'app'
]
MIDDLEWARE = [
'elasticapm.contrib.django.middleware.TracingMiddleware',
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
......@@ -89,7 +91,6 @@ TEMPLATES = [
WSGI_APPLICATION = 'TsaApi.wsgi.application'
# Database
# https://docs.djangoproject.com/en/1.11/ref/settings/#databases
......@@ -100,7 +101,6 @@ DATABASES = {
}
}
# Password validation
# https://docs.djangoproject.com/en/1.11/ref/settings/#auth-password-validators
......@@ -125,6 +125,7 @@ AUTH_PASSWORD_VALIDATORS = [
LANGUAGE_CODE = 'es'
from django.utils.translation import ugettext_lazy as _
LANGUAGES = (
('es', _('Spanish')),
)
......@@ -141,14 +142,11 @@ USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.11/howto/static-files/
STATIC_URL = '/static/'
# Habilitar para permitir la autenticación
REST_FRAMEWORK = {
'DEFAULT_PERMISSION_CLASSES': (
......@@ -161,13 +159,93 @@ REST_FRAMEWORK = {
),
}
APP_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + '/'
SENTRY_URL = 'http://2ec54beaab3b4459a1e5afadea070f98:92aee3f5d91e4e66996a3e0792985541@172.17.30.21:9000/54'
MEMCACHED_HOST = ''
MEMCACHED_PORT = 0 # OJO, TIENE QUE SER INT, sino REVIENTA MEMCACHED
PENDING_TXS_MEMCACHED_KEY = 'pending_txs'
TEST_MEMCACHED_HOST = ''
TEST_MEMCACHED_PORT = ''
TEST_PENDING_TXS_MEMCACHED_KEY = 'test_pending_txs'
ELASTIC_APM = {
'SERVICE_NAME': 'TsaApi',
'SERVER_URL': 'http://10.1.100.67:8200',
'DEBUG': False,
}
try:
from TsaApi.local_settings import *
except ImportError as e:
pass
LOG_ROOT = APP_ROOT + 'logs/'
STATIC_ROOT = APP_ROOT + 'html/'
RAVEN_CONFIG = {
'dsn': SENTRY_URL,
}
\ No newline at end of file
}
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'formatters': {
'detailed': {
'format': '%(levelname)s %(asctime)s %(filename)s %(funcName)s %(lineno)d %(message)s',
},
'history': {
'format': '%(asctime)s %(message)s'
}
},
'handlers': {
'console': {
'level': 'DEBUG',
'class': 'logging.StreamHandler',
'stream': sys.stdout,
'formatter': 'detailed'
},
'info_file': {
'level': 'INFO',
'class': 'logging.FileHandler',
'filename': LOG_ROOT + 'info.log',
'formatter': 'history',
},
'error_file': {
'level': 'ERROR',
'class': 'logging.FileHandler',
'filename': LOG_ROOT + 'error.log',
'formatter': 'detailed',
},
'sentry': {
'level': 'ERROR', # To capture more than ERROR, change to WARNING, INFO, etc.
'class': 'raven.contrib.django.raven_compat.handlers.SentryHandler',
}
},
'loggers': {
'django': {
'handlers': ['error_file', 'info_file', 'sentry'],
'level': 'WARNING',
'propagate': True,
},
'raven': {
'level': 'WARNING',
'handlers': ['sentry'],
'propagate': False,
},
'logger': {
'handlers': ['error_file', 'info_file', 'sentry'],
'level': 'INFO',
'propagate': True,
},
'console-logger': {
'handlers': ['console', 'info_file', 'error_file', 'sentry'],
'progagate': True,
'level': 'DEBUG'
}
},
}
File deleted
File deleted
File deleted
File deleted
File deleted
File deleted
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