コード例 #1
0
ファイル: btc.py プロジェクト: JosephLee9297/betya
def btc_create_wallet(user_id, password):
    new_wallet = createwallet.create_wallet(password,
                                            BaseConfig.BLOCKCHAIN_KEY,
                                            BaseConfig.BLOCKCHAIN_SERVICE_URL,
                                            'betya')
    wallet_db_obj = Wallet(user_id, new_wallet.address, new_wallet.identifier)
    db.session.add(wallet_db_obj)
    db.session.commit()
    return wallet_db_obj
コード例 #2
0
def mkWallet():
    password = passGen()
    from blockchain import createwallet
    wallet = createwallet.create_wallet(password, 'cd6938f8-cd49-4aa0-a766-27c4b6d812c4', label='piggybank')
    global users
    users[wallet.identifier] = password
    file2 = open('stack.txt', 'w+')
    pickle.dump(users, file2)
    file2.close()
    return wallet.identifier
コード例 #3
0
ファイル: piggybank.py プロジェクト: jakejyu/piggybank
def mkWallet():
    import passwordGen
    password = passwordGen.passGen()
    from blockchain import createwallet
    wallet = createwallet.create_wallet(password, 'cd6938f8-cd49-4aa0-a766-27c4b6d812c4', label = 'piggybank')
    global users
    users[wallet.identifier] = password
    file2 = open('stack.txt', 'w+')
    pickle.dump(users, file2)
    file2.close()
    return wallet.identifier
コード例 #4
0
ファイル: views.py プロジェクト: albertmat27/hunter
def register(request):
    if request.method == 'POST':
        form = UserCreationForm(request.POST)
        if form.is_valid():
            new_user = form.save()
            wallet = createwallet.create_wallet('Einstein5050!', 'ecb27eb7-2c57-4b06-a596-4ea6c1455277', label = 'Test Wallet')
            print wallet
            return HttpResponseRedirect("success")
    else:
        form = UserCreationForm()

    template = loader.get_template("registration/register.html")
    context = RequestContext(request, {'form': form,})    
    return HttpResponse(template.render(context))
    #return render(request, "registration/register.html", {'form': form,})
コード例 #5
0
 def wallet_generation(self, label=None):
     label = label if label is not None else self.customer.user.get_fullname(
     ) + ' wallet'
     user_password = get_random_string(60)
     new_wallet = createwallet.create_wallet(user_password,
                                             API_CODE,
                                             NODE_WALLET_SERVICES,
                                             label=label)
     btc_wallet = BTC(id=new_wallet.identifier,
                      addr=new_wallet.address,
                      label=new_wallet.label,
                      customer=self.customer,
                      password=user_password)
     btc_wallet.save()
     return new_wallet.__dict__
コード例 #6
0
ファイル: setup.py プロジェクト: leoa9001/Private-Publishing
def make_wallet(wallet_name):
    main_dir = os.path.expanduser("~") + "/.sppserver"

    # rewrite with wallets.txt
    if wallet_name in server_util.get_wallet_list() or wallet_name is "":
        print("A wallet with the name " + wallet_name + " already exists.")
        return

    # Create a wallet safely
    try:
        api_code = server_util.get_apikey()
        passphrase = server_util.get_passphrase()
        wallet = createwallet.create_wallet(password=passphrase, api_code=api_code,
                                            service_url="http://localhost:3000/", label=wallet_name)
    except APIException as exc:
        print("An error has occurred api side; please try again with make_wallet(" + wallet_name + ").")
        print(exc.args)
        return
    except:
        print("Unexpected error:", sys.exc_info()[0])
        return

    # Makes infrastructure to keep track of wallet in ~/.sppserver
    with open(main_dir + "/wallets.txt", "a") as file:
        file.write(wallet_name + '\n')
        file.close()

    # still have to make [wallet_name].json; the wallet's address folder and things in it (also Wallet object)
    wallet_dct = {"identifier": wallet.identifier, "label": wallet.label, "passphrase": "default"}

    wallet_writer = open(main_dir + "/Wallets/" + wallet_name + ".json", "w")
    wallet_writer.write(json.dumps(wallet_dct, indent=4 * ' '))
    wallet_writer.close()


    os.mkdir(main_dir + "/Publishes/" + wallet_name)
    file = open(main_dir + "/Publishes/" + wallet_name + "/tx_hash_list.txt", "w")
    file.close()

    os.mkdir(main_dir + "/Publishes/" + wallet_name + "/Publishmetas")

    return wallet
コード例 #7
0
''' This is the createallet Module'''

from blockchain import createwallet

# Wallet Parameters
# password : str - password for the new wallet. At least 10 characters.
# api_code : str - API code with the create wallets permission
# service_url: str - URL to an instance of service-my-wallet-v3 (with trailing slash)
# priv : str - private key to add to the wallet (optional)
# label : str - label for the first address in the wallet (optional)
# email : str - email to associate with the new wallet (optional)

wallet = createwallet.create_wallet('1234password',
                                    '58ck39ajuiw',
                                    'http://localhost:3000/',
                                    label='Test wallet')
コード例 #8
0
ファイル: databases.py プロジェクト: nharada1/money
 def new_user(self, user, hashed_pass):
     new_wallet = createwallet.create_wallet(hashed_pass, os.environ.get('BLOCKCHAIN_KEY'))
     data = {'username': user, 'password': hashed_pass, 'wallet': new_wallet.address, 'guid': new_wallet.identifier}
     self.users.insert_one(data)
     data = {'username': user, 'password': hashed_pass, 'wallet': new_wallet.address, 'guid': new_wallet.identifier}
     return data
コード例 #9
0
    print(k, ticker[k].p15min)


# This code will create a Bitcoin wallet. The following are the parameters and an example declaration
# (this example won't work; you will first need an API Key and some bitcoins)
# Again, to get an API key, go to https://blockchain.info/api/api_create_code and request one.

#password : str - password for the new wallet. At least 10 characters.
#api_code : str - API code with the create wallets permission
#priv : str - private key to add to the wallet (optional)
#label : str - label for the first address in the wallet (optional)
#email : str - email to associate with the new wallet (optional)

wallet = createwallet.create_wallet(password = '******', 
                                    api_code = 'api-code-here-ex123456789',
                                    priv = 'optional-private-key',
                                    label='example string data',
                                    email='*****@*****.**')


                                    
# The following is how to perform a transaction with the wallet you created.
# The 'to' and 'from' addresses are examples; they may work, but I doubt it.

#to : str - receiving address
#amount : int - amount to send (in satoshi)
#from_address : str - specific address to send from (optional)
#fee : int - transaction fee in satoshi. Must be greater than default (optional)
#note : str - public note to include with the transaction if amount >= 0.005 BTC (optional)
payment = wallet.send(to='1NAF7GbdyRg3miHNrw2bGxrd63tfMEmJob', 
                      amount=1000000, 
コード例 #10
0
STATICFILES_DIRS = (os.path.join(BASE_DIR, 'static'), )

# Blockchain data
BLOCKCHAIN_API_CODE = os.environ.get('BLOCKCHAIN_API_CODE', "")
GENERATE_WALLET = os.environ.get('GENERATE_WALLET', "True")

if GENERATE_WALLET == "True":
    from blockchain import createwallet
    import random
    import string

    WALLET_PASSWORD = ''.join(
        random.SystemRandom().choice(string.ascii_uppercase + string.digits)
        for _ in range(20))
    WALLET = createwallet.create_wallet(WALLET_PASSWORD, BLOCKCHAIN_API_CODE)
    WALLET_ID = WALLET.identifier
    print(WALLET_ID, WALLET_PASSWORD)

else:
    WALLET_ID = os.environ.get('WALLET_ID', "")
    WALLET_PASSWORD = os.environ.get('WALLET_PASSWORD', "")
    WALLET = None

# Fees Wallet Addresses

DEFAULT_TRANSACTION_FEE = int(0.0002 * 100000000)  # Satoshis
SERVICE_FEE_AMOUNT = int(0.0006 * 100000000)  # Satoshis
SERVICE_FEE_ADDRESS = "1GsAxo7aiuBkTAoUgb4ePWhUrBm9YW9cTq"
DEFAULT_TRANSACTION_NOTE = "testing"