Author

Topic: Initiate a transaction from a PK (Read 179 times)

legendary
Activity: 2870
Merit: 7490
Crypto Swap Exchange
April 05, 2022, 06:34:19 AM
#6
OP, do you mind sharing why exactly you need create to create a transaction from PK using library/3rd party API? It sounds like XY problem and we could suggest better solution if you tell what's your goal.

If you value security, I'd suggest downloading a wallet like electrum (from electrum.org). The initial sync of a new wallet can take a few minutes and a few MB but it's a lot faster than bitcoin core.

Electrum also support CLI[1] if OP use-case involve server which doesn't have GUI. The documentation doesn't mention all command though, so you need to run electrum help or check the source code[2]

[1] https://electrum.readthedocs.io/en/latest/cmdline.html
[2] https://github.com/spesmilo/electrum/blob/master/electrum/commands.py
legendary
Activity: 3290
Merit: 16489
Thick-Skinned Gang Leader and Golden Feather 2021
April 04, 2022, 09:40:07 AM
#5
If you value security, I'd suggest downloading a wallet like electrum (from electrum.org).
To avoid exposing your private key to an online computer, this is much safer:
I was considering Electrum, only downside is that when creating a wallet, seed creation is exposed
Online:
Install Electrum on your PC.
Import your address to create a watch-only wallet.
Preview the transaction, Copy the unsigned transaction. Put it on a USB stick.

Offline and running without hard drive storage:
Get a Linux LIVE DVD. Use Knoppix or Tails for instance, or any other distribution that comes with Electrum pre-installed.
Unplug your internet cable. Close the curtains. Reboot your computer and start up from that DVD. Don't enter any wireless connection password. Keep it offline.
Start Electrum. Import your private key.
Copy your unsigned transaction from the USB stick, load it into Electrum.
CHECK the transaction in Electrum. Check the fees, check the amount, check all destination addresses (character by character).
If all is okay, sign the transaction. Copy it back to your USB stick.
Turn off the computer. That wipes the Live LINUX from memory and all traces are gone.

Online:
Use your normal online Electrum to (check again and) broadcast the transaction.

Bonus:
After moving all your Bitcoin, and once the transaction confirmed, check if you own Forkcoins.
member
Activity: 69
Merit: 53
April 04, 2022, 08:47:38 AM
#4
Very simple with python
example code.

Code:
#!python3

from bit import Key
from bit.format import bytes_to_wif

#for compressed private key address.
compressedkey = Key.from_hex("hex key data") # or from int compressedkey = Key.from_int(intdata)
compressedkey.create_transaction([], leftover='addressofyourchoicetorecieveall')

#for uncompressed private key address.
uncompressedkey = Key(bytes_to_wif(bytes.fromhex("hexdata"),compressed=False)) # or from int uncompressedkey = Key(bytes_to_wif(Key.from_int(intdata),compressed=False))
uncompressedkey.create_transaction([], leftover='addressofyourchoicetorecieveall')

More details at https://ofek.dev/bit/
legendary
Activity: 3668
Merit: 6382
Looking for campaign manager? Contact icopress!
April 04, 2022, 08:32:24 AM
#3
Hi. Is there any library or even third party API that allows to initiate a transaction and send funds just by using private keys? I want a lightweight solution that doesn't require running a full node or downloading the blockchain.

I've seen today a topic about an open source web wallet that doesn't need local blockchain: https://bitcointalksearch.org/topic/open-source-serverless-anon-web-wallet-5392903
It does calls to various servers and block explorers to do the job, so privacy is zero.

It's a HD wallet, so it works based on a seed, not PK. But it's open source; I don't know, it may be close enough to what you need, and if not, at least it can be a source of inspiration.
copper member
Activity: 2856
Merit: 3071
https://bit.ly/387FXHi lightning theory
April 04, 2022, 08:25:46 AM
#2
If you value security, I'd suggest downloading a wallet like electrum (from electrum.org). The initial sync of a new wallet can take a few minutes and a few MB but it's a lot faster than bitcoin core.

There are websites too that can be used for signing transactions with private keys but you'd need good browser security and a good understanding of bitcoin to use them, like coinb.in
newbie
Activity: 9
Merit: 7
April 04, 2022, 08:21:11 AM
#1
Hi. Is there any library or even third party API that allows to initiate a transaction and send funds just by using private keys? I want a lightweight solution that doesn't require running a full node or downloading the blockchain.
Jump to: