def __init__(self, wallet, logger): self.wallet = wallet self.logger = logger self.dynamodb = resource_factory.get_dynamodb(config) try: self.notarization_table = self.dynamodb.Table('Notarization') self.logger.debug("Notarization Table is %s" % self.notarization_table.table_status) except botocore.exceptions.ClientError as e: self.logger.exception("Problem accessing notarization table %s " % e.response) if e.response['Error']['Code'] == 'ResourceNotFoundException': self.logger.debug("Attempting to create Notarization table since it did not exist.") self.create_notarization_table()
def __init__(self, wallet, logger): # Initializes some dictionaries to store accounts self.wallet = wallet self.logger = logger self.dynamodb = resource_factory.get_dynamodb(config) try: self.account_table = self.dynamodb.Table('Account') self.logger.debug("Account Table is %s" % self.account_table.table_status) except botocore.exceptions.ClientError as e: self.logger.exception("Problem accessing account table %s " % e.response) if e.response['Error']['Code'] == 'ResourceNotFoundException': self.create_account_table()
def instance(self): try: self.kms = boto3.client('kms', region_name='us-east-1') self.dynamodb = resource_factory.get_dynamodb(self.config) except botocore.exceptions.ClientError as e: self.logger.exception("Error creating server wallet %s " % e.message) if not self.wallet_exists(): self.create_new_wallet() try: self.private_key_hex = self.read_private_key() self.private_key_wif = base58.base58_check_encode(0x80, self.private_key_hex.decode("hex")) self.private_key = CBitcoinSecret(self.private_key_wif) except ValueError as e: self.logger.exception("Problem with wallet %s " % e.message)
def instance(self): try: self.kms = boto3.client('kms', region_name='us-east-1') self.dynamodb = resource_factory.get_dynamodb(self.config) except botocore.exceptions.ClientError as e: self.logger.exception("Error creating server wallet %s " % e.message) if not self.wallet_exists(): self.create_new_wallet() try: self.private_key_hex = self.read_private_key() self.private_key_wif = base58.base58_check_encode( 0x80, self.private_key_hex.decode("hex")) self.private_key = CBitcoinSecret(self.private_key_wif) except ValueError as e: self.logger.exception("Problem with wallet %s " % e.message)
from __future__ import print_function # Python 2/3 compatibility import botocore import configuration import resource_factory config = configuration.NotaryConfiguration('../notaryconfig.ini') try: dynamodb = resource_factory.get_dynamodb(config) wallet_table = dynamodb.Table('Wallet') wallet_table.delete() # wallet_table = dynamodb.create_table( # TableName='Wallet', # KeySchema=[ # { # 'AttributeName': 'key_id', # 'KeyType': 'HASH' # } # ], # AttributeDefinitions=[ # { # 'AttributeName': 'key_id', # 'AttributeType': 'S' # } # ], # ProvisionedThroughput={ # 'ReadCapacityUnits': 10, # 'WriteCapacityUnits': 10 # } # ) print("Wallet Table status: %s " % wallet_table.table_status)
from __future__ import print_function # Python 2/3 compatibility import botocore import configuration import resource_factory config = configuration.NotaryConfiguration('../notaryconfig.ini') dynamodb = resource_factory.get_dynamodb(config) try: account_table = dynamodb.Table('Account') account_table.delete() print(account_table.table_status) print("Account Table status: %s " % account_table.table_status) except botocore.exceptions.ClientError as e: print(e.response['Error']['Code']) try: notarization_table = dynamodb.Table('Notarization') notarization_table.delete() print("Notarization Table status: %s " % notarization_table.table_status) except botocore.exceptions.ClientError as e: print(e.response['Error']['Code'])