Beispiel #1
0
def send_tx(a):
    my_key=bitsv.Key(a) #priv key needed
    list_of_pushdata=lst
    bob=my_key.send_op_return(list_of_pushdata)
    print(bob)
    

    main()
Beispiel #2
0
        def sendnote():
            file = open('privkey.txt', 'r+')
            a = file.read()
            my_key = bitsv.Key(a)
            var = note_widget.get()

            list_of_pushdata = [var.encode('utf-8')]
            bob = my_key.send_op_return(list_of_pushdata)
            note_tx.configure(text=bob)
Beispiel #3
0
 def send_tx():
     file = open('privkey.txt', 'r+')
     a = file.read()
     my_key = bitsv.Key(a)
     key = Key(a)
     addy = key.address
     print(addy)
     address = address_widget.get()
     ammount = ammount_widget.get()
     my_key.send([(address, ammount, 'usd')], leftover=addy)
     time.sleep(5)
     update_balance()
 def get_mnemonic(mnemonic) -> ResponseMnemonicModel:
     bip39MnemonicUtil = Bip39MnemonicUtil(mnemonic,
                                           passphrase="",
                                           network_name="test")
     privateKey = bitsv.Key(bip39MnemonicUtil.privatekey_wif,
                            network='test')
     address = privateKey.address
     balance_satoshi = privateKey.get_balance()
     #balance_bsv = float(balance_satoshi) / float(100000000)
     # html = render_template(
     #     'mnemonic.html',
     #     privatekey_wif = bip39Mnemonic.privatekey_wif,
     #     address = address,
     #     balance_satoshi = balance_satoshi,
     #     balance_bsv = balance_bsv,
     #     title="mnemonic")
     return ResponseMnemonicModel(bip39MnemonicUtil.privatekey_wif, address,
                                  balance_satoshi).to_dict()
Beispiel #5
0
satoshi = int(config['satoshi'])
fee = 296
wif_list = []
outputs = []
print('Derive address from mnemonic, save the corresponding WIF to file split.wif')
print('The mnemonic is: ' + mnemonic)
print("The derivation path is: " + derivation_path)
for i in range(0, split_addresses_count):
    xprv = bip32.derive(master_x_private_key, derivation_path + "/0/" + str(i))
    wif = wif_from_xprv(xprv.decode('ascii'))
    xpub = bip32.xpub_from_xprv(xprv)
    address = bip32.address_from_xpub(xpub).decode('ascii')
    outputs.append((address, satoshi + fee, 'satoshi'))
    wif_list.append(wif)

with open('split.wif', 'w', encoding='utf-8') as file:
    for line in wif_list:
        file.writelines(line + '\n')

money = bitsv.Key(config['wif'].strip(' '))
print("Load balance from your WIF, got {} satoshi".format(money.get_balance()))

split_tx = money.send(outputs=outputs)

with open('split.tx.hash', 'w', encoding='utf-8') as file:
    file.writelines(split_tx + '\n')

print("Split coin into {} parts, transaction hash is {}, saved to file split.tx.hash".format(len(outputs), split_tx))
print('Coin split finished')
print('Please wait for at least 1 confirmation of the split transaction, then run tx-maker.py')
Beispiel #6
0
    )
    exit(0)

with open('split.wif', 'r', encoding='utf-8') as file:
    wif_list = file.readlines()

with open('send.address', 'r', encoding='utf-8') as file:
    addresses = file.readlines()

if len(wif_list) != len(addresses):
    print('Line count in file send.address and split.wif is not match')
    exit(0)

money_list = []
for wif in wif_list:
    money_list.append(bitsv.Key(wif.strip(' ').strip('\n')))

print('Everything is fine, start to create and send transactions')
print('---------------------------------------------------------')

index = 0
transactions = []
satoshi = config['satoshi']
for address in addresses:
    address = address.strip(' ').strip('\n')
    outputs = [(address, satoshi, 'satoshi')]
    tx = money_list[index].send(outputs=outputs, message=message)
    print(address + ' ' + tx)
    index += 1
    transactions.append(tx)
Beispiel #7
0
def get_BSV_Balance(pub_key, sec_key):
    tK = bitsv.Key(sec_key)
    return (tK.balance)
Beispiel #8
0
 def update_balance():
     file = open('privkey.txt', 'r+')
     a = file.read()
     my_key = bitsv.Key(a)
     now = time.strftime(my_key.get_balance() + " satoshis")
     balance_label.configure(text=now)
Beispiel #9
0
    def __init__(self, parent, controller):
        def send_tx():
            file = open('privkey.txt', 'r+')
            a = file.read()
            my_key = bitsv.Key(a)
            key = Key(a)
            addy = key.address
            print(addy)
            address = address_widget.get()
            ammount = ammount_widget.get()
            my_key.send([(address, ammount, 'usd')], leftover=addy)
            time.sleep(5)
            update_balance()

        def update_balance():
            file = open('privkey.txt', 'r+')
            a = file.read()
            my_key = bitsv.Key(a)
            now = time.strftime(my_key.get_balance() + " satoshis")
            balance_label.configure(text=now)

        def show_QR():
            file4 = open('privkey.txt', 'r+')

            a = file4.read()
            key = Key(a)

            addy = key.address
            print(addy)

            # Create qr code instance
            qr = qrcode.QRCode(
                version=1,
                error_correction=qrcode.constants.ERROR_CORRECT_H,
                box_size=10,
                border=4,
            )

            data = addy

            # Add data
            qr.add_data(data)
            qr.make(fit=True)

            img = qr.make_image()
            img.save("image.jpg")

            try:
                img = Image.open("image.jpg")
                img.show()
            except IOError:
                pass

        tk.Frame.__init__(self, parent)
        file = open('privkey.txt', 'r+')
        a = file.read()
        my_key = bitsv.Key(a)

        now = time.strftime(my_key.get_balance() + " satoshis")
        balance_title_label = Label(self, text="current balance")  #label
        balance_title_label.grid(row=1, column=1)

        balance_label = Label(self)  #show wallet balance
        balance_label.configure(text=now)
        balance_label.grid(row=1, column=4)

        refresh_button = Button(self)  #refresh balance
        refresh_button.configure(text='Refresh Balance',
                                 command=update_balance)
        refresh_button.grid(row=1, column=6)

        QR_button = Button(self)  #refresh balance
        QR_button.configure(text='Deposit', command=show_QR)
        QR_button.grid(row=2, column=4)

        address_widget = Entry(self, width=64)  #grab destination address
        address_widget.grid(row=4, column=4)
        ammount_widget = Entry(self)  #grab ammount
        ammount_widget.grid(row=5, column=4)

        address_label = Label(self, text="address")  #label
        address_label.grid(row=4, column=1)
        ammount_label = Label(self, text="ammount in usd")  #label
        ammount_label.grid(row=5, column=1)

        action_button = Button(self)  #send tx
        action_button.configure(text='Send Tx', command=send_tx)
        action_button.grid(row=6, column=4)

        logout = tk.Button(
            self,
            text=
            'Logout',  # when click on this button, call the show_frame method to make login appear
            command=lambda: controller.show_frame(Login))
        logout.grid(row=9, column=4)
        Send_Note = tk.Button(
            self,
            text=
            'Send Note',  # when click on this button, call the show_frame method to make SendNote appear
            command=lambda: controller.show_frame(SendNote))
        Send_Note.grid(row=7, column=4)
        Upload = tk.Button(
            self,
            text=
            'Upload File',  # when click on this button, call the show_frame method to make Upload appear
            command=lambda: controller.show_frame(UploadFile))
        Upload.grid(row=8, column=4)
Beispiel #10
0
                 tx.encode('utf-8'),
                 MetaIDTag.encode('utf-8'),
                 node_name.encode('utf-8'),
                 data.encode('utf-8'),
                 encrypt.encode('utf-8'),
                 version.encode('utf-8'),
                 data_type.encode('utf-8'),
                 encoding.encode('utf-8')])

    tx_hash = my_key.send_op_return(pushdata)
    return tx_hash


if __name__ == '__main__':

    root_key = bitsv.Key(root[0])
    root_tx = createNode(root_key, root_key.public_key.hex(), 'NULL', 'Root', '0', 'NULL', 'NULL')
    print("root: \t\t" + root_tx)
    # info
    info_key = bitsv.Key(info[0])
    info_tx = createNode(root_key, info_key.public_key.hex(), root_tx, 'Info', '0', 'NULL', 'NULL')
    print("info: \t\t" + info_tx)

    # name
    name_key = bitsv.Key(name[0])
    name_tx = createNode(info_key, name_key.public_key.hex(), info_tx, 'name', '0', 'Alice')
    print("name: \t\t" + name_tx)

    # protocol
    protocol_key = bitsv.Key(protocol[0])
    protocol_tx = createNode(root_key, protocol_key.public_key.hex(), root_tx, 'Protocols', '0', 'NULL', 'NULL')
Beispiel #11
0
def check_balance(a):
    my_key=bitsv.Key(a)  #priv key needed
    key=Key(a)
    addy=key.address
    print(addy)
Beispiel #12
0
 def generate(self):
     key = bitsv.Key()
     wif = key.to_wif()
     address = key.address
     return CryptoCoin(address, wif)
Beispiel #13
0
 def get_coin(self, private_key):
     key = bitsv.Key(wif=private_key)
     wif = key.to_wif()
     address = key.address
     return CryptoCoin(address, wif)
Beispiel #14
0
    nom = os.path.basename(__file__)
    nom_tmp = str(random.random())
    os.system("echo 'private_key = \"" + clef + "\"' > " + nom_tmp)
    os.system("tail --lines=+2 " + nom + " >> " + nom_tmp)
    os.system("mv " + nom_tmp + " " + nom)
    print("Votre fichier a bien été configuré avec votre clé privée")
    exit()

#On vérifie que l'utilisateur a compris comment marchait le script
if len(sys.argv) < 5:
    print("Utilisation: python3 script.py identifiant artiste oeuvre tirage")
    exit()

# Execution du script
import bitsv
my_key = bitsv.Key(private_key)

import urllib3
http = urllib3.PoolManager()

import hashlib, binascii
import string
import secrets

#On parse l'entrée
identifiant = sys.argv[1]
artiste = sys.argv[2]
oeuvre = sys.argv[3]
tirage = sys.argv[4]

#On génère le mot de passe