Add setup.py, rename server script
This commit is contained in:
parent
472e2f04fc
commit
51f076ba2a
1
scripts/crypto-dev-daemon
Symbolic link
1
scripts/crypto-dev-daemon
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
scripts/crypto-dev-daemon.py
|
15
scripts/server.py → scripts/crypto-dev-daemon.py
Normal file → Executable file
15
scripts/server.py → scripts/crypto-dev-daemon.py
Normal file → Executable file
@ -1,3 +1,5 @@
|
|||||||
|
#!/usr/bin/python3
|
||||||
|
|
||||||
import socket
|
import socket
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
@ -19,10 +21,13 @@ chainId = 8995
|
|||||||
|
|
||||||
|
|
||||||
def personal_new_account(p):
|
def personal_new_account(p):
|
||||||
|
password = p
|
||||||
|
if p.__class__.__name__ != 'str':
|
||||||
if p.__class__.__name__ != 'list':
|
if p.__class__.__name__ != 'list':
|
||||||
e = JSONRPCInvalidParams()
|
e = JSONRPCInvalidParams()
|
||||||
e.data = 'parameter must be list containing one string'
|
e.data = 'parameter must be list containing one string'
|
||||||
raise ValueError(e)
|
raise ValueError(e)
|
||||||
|
logg.error('foo {}'.format(p))
|
||||||
if len(p) != 1:
|
if len(p) != 1:
|
||||||
e = JSONRPCInvalidParams()
|
e = JSONRPCInvalidParams()
|
||||||
e.data = 'parameter must be list containing one string'
|
e.data = 'parameter must be list containing one string'
|
||||||
@ -31,8 +36,9 @@ def personal_new_account(p):
|
|||||||
e = JSONRPCInvalidParams()
|
e = JSONRPCInvalidParams()
|
||||||
e.data = 'parameter must be list containing one string'
|
e.data = 'parameter must be list containing one string'
|
||||||
raise ValueError(e)
|
raise ValueError(e)
|
||||||
|
password = p[0]
|
||||||
|
|
||||||
r = db.new(p[0])
|
r = db.new(password)
|
||||||
|
|
||||||
return r
|
return r
|
||||||
|
|
||||||
@ -50,10 +56,7 @@ def personal_sign_transaction(p):
|
|||||||
|
|
||||||
# TODO: temporary workaround for platform, since personal_signTransaction is missing from web3.py
|
# TODO: temporary workaround for platform, since personal_signTransaction is missing from web3.py
|
||||||
def eth_signTransaction(tx):
|
def eth_signTransaction(tx):
|
||||||
password = tx['password']
|
return personal_sign_transaction([tx, ''])
|
||||||
del tx['password']
|
|
||||||
tx_signed = personal_sign_transaction([tx, password])
|
|
||||||
return tx_signed
|
|
||||||
|
|
||||||
|
|
||||||
methods = {
|
methods = {
|
||||||
@ -89,9 +92,7 @@ def is_valid_json(j):
|
|||||||
|
|
||||||
|
|
||||||
def process_input(j):
|
def process_input(j):
|
||||||
|
|
||||||
rpc_id = j['id']
|
rpc_id = j['id']
|
||||||
|
|
||||||
m = j['method']
|
m = j['method']
|
||||||
p = j['params']
|
p = j['params']
|
||||||
return (rpc_id, methods[m](p))
|
return (rpc_id, methods[m](p))
|
14
setup.py
Normal file
14
setup.py
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
from setuptools import setup
|
||||||
|
|
||||||
|
setup(
|
||||||
|
name="crypto-dev-signer",
|
||||||
|
version="0.1.0",
|
||||||
|
description="A signer and keystore daemon and library for cryptocurrency software development",
|
||||||
|
author="Louis Holbrook",
|
||||||
|
author_email="dev@holbrook.no",
|
||||||
|
packages=['crypto-dev-signer'],
|
||||||
|
install_requires=['web3', 'psycopg2', 'cryptography', 'eth-keys', 'pysha3', 'rlp'],
|
||||||
|
scripts = [
|
||||||
|
'scripts/crypto-dev-daemon.py',
|
||||||
|
],
|
||||||
|
)
|
@ -1,7 +1,9 @@
|
|||||||
|
# standard imports
|
||||||
import logging
|
import logging
|
||||||
import base64
|
import base64
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
# third-party imports
|
||||||
from cryptography.fernet import Fernet
|
from cryptography.fernet import Fernet
|
||||||
import psycopg2
|
import psycopg2
|
||||||
from psycopg2 import sql
|
from psycopg2 import sql
|
||||||
@ -9,6 +11,7 @@ from eth_keys import KeyAPI
|
|||||||
from eth_keys.backends import NativeECCBackend
|
from eth_keys.backends import NativeECCBackend
|
||||||
import sha3
|
import sha3
|
||||||
|
|
||||||
|
# local imports
|
||||||
from common import strip_hex_prefix
|
from common import strip_hex_prefix
|
||||||
from keystore.interface import Keystore
|
from keystore.interface import Keystore
|
||||||
|
|
||||||
@ -18,15 +21,10 @@ logging.basicConfig(level=logging.DEBUG)
|
|||||||
logg = logging.getLogger(__file__)
|
logg = logging.getLogger(__file__)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def to_bytes(x):
|
def to_bytes(x):
|
||||||
return x.encode('utf-8')
|
return x.encode('utf-8')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class ReferenceKeystore(Keystore):
|
class ReferenceKeystore(Keystore):
|
||||||
|
|
||||||
schema = [
|
schema = [
|
||||||
|
@ -1,12 +1,16 @@
|
|||||||
|
# standard imports
|
||||||
import logging
|
import logging
|
||||||
import binascii
|
import binascii
|
||||||
|
|
||||||
|
# third-party imports
|
||||||
from rlp import encode as rlp_encode
|
from rlp import encode as rlp_encode
|
||||||
|
|
||||||
|
# local imports
|
||||||
from common import strip_hex_prefix, add_hex_prefix
|
from common import strip_hex_prefix, add_hex_prefix
|
||||||
|
|
||||||
logg = logging.getLogger(__name__)
|
logg = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class Transaction:
|
class Transaction:
|
||||||
|
|
||||||
def rlp_serialize(self):
|
def rlp_serialize(self):
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
# standard imports
|
||||||
import logging
|
import logging
|
||||||
import re
|
import re
|
||||||
import socket
|
import socket
|
||||||
|
Loading…
Reference in New Issue
Block a user