Bitcoin Forum
May 07, 2024, 11:20:24 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Move p2pk balance  (Read 99 times)
pbies (OP)
Full Member
***
Offline Offline

Activity: 245
Merit: 126



View Profile
December 24, 2023, 07:13:19 AM
Merited by ABCbits (1)
 #1

What would be the easiest way to move balance from a p2pk address?

If it is pay to public key then only public key would be needed only, right?

Can I build a raw transaction to move such funds? How?

BTC: bc1qmrexlspd24kevspp42uvjg7sjwm8xcf9w86h5k
I have 9900K and 1080 Ti, gathering funds for new desktop PC for Bitcoin operations - 14900K and RTX 4090
1715124024
Hero Member
*
Offline Offline

Posts: 1715124024

View Profile Personal Message (Offline)

Ignore
1715124024
Reply with quote  #2

1715124024
Report to moderator
1715124024
Hero Member
*
Offline Offline

Posts: 1715124024

View Profile Personal Message (Offline)

Ignore
1715124024
Reply with quote  #2

1715124024
Report to moderator
1715124024
Hero Member
*
Offline Offline

Posts: 1715124024

View Profile Personal Message (Offline)

Ignore
1715124024
Reply with quote  #2

1715124024
Report to moderator
"There should not be any signed int. If you've found a signed int somewhere, please tell me (within the next 25 years please) and I'll change it to unsigned int." -- Satoshi
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1715124024
Hero Member
*
Offline Offline

Posts: 1715124024

View Profile Personal Message (Offline)

Ignore
1715124024
Reply with quote  #2

1715124024
Report to moderator
1715124024
Hero Member
*
Offline Offline

Posts: 1715124024

View Profile Personal Message (Offline)

Ignore
1715124024
Reply with quote  #2

1715124024
Report to moderator
digaran
Copper Member
Hero Member
*****
Offline Offline

Activity: 1330
Merit: 899

🖤😏


View Profile
December 24, 2023, 07:23:04 AM
Merited by ABCbits (1), pbies (1)
 #2

https://bitcointalk.org/index.php?topic=5465605.0

🖤😏
BitMaxz
Legendary
*
Offline Offline

Activity: 3248
Merit: 2965


Block halving is coming.


View Profile WWW
December 24, 2023, 07:44:05 AM
 #3

It seems you can only move your balance out from P2PK if you using a Bitcoin core wallet and import it and send them via Bitcoin cli(RPC) commands.

Check this link below

- https://bitcoin.stackexchange.com/questions/118127/how-to-recover-and-sweep-p2pk-coins

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
pbies (OP)
Full Member
***
Offline Offline

Activity: 245
Merit: 126



View Profile
December 24, 2023, 12:11:46 PM
 #4

In the end I've written Python script to create raw TX for p2pk:

Code:
#!/usr/bin/env python3

import sys
import struct
import json
import binascii

txid="4e9e28b2e7d9b28824ab19f02ace19dff86aed90d8fb422c640279a6fe82e0af"
vout=0
pubkey="02396543d7ab32e75c6682b4fca35c0e68f0694b0dde355de5cc2a7f8fa4affc62"
amount=0.067

tx = bytearray()
tx = tx + binascii.unhexlify('0100000001') # one input tx - last digit
txb = bytes.fromhex(txid)
seqno = 1
txb=txb[::-1]
tx = tx + bytes(txb)
tx = tx + struct.pack('<I',vout)
tx = tx + b'\x00'
tx = tx + struct.pack('<i',seqno)
tx = tx + bytes([1]) # ?
pk = pubkey
v = amount
if len(pk) != 66:
    raise ValueError("pk not 33 bytes (66 hex digits) - it has bytes: "+str(len(pk)/2))
v = int(100000000 * v)
tx = tx + struct.pack('<Q',v)
tx = tx + b'\x23'
tx = tx + b'\x21'
tx = tx + binascii.unhexlify(pk)
tx = tx + b'\xac'
tx = tx + binascii.unhexlify('00000000')
print(binascii.hexlify(tx))

Obviously to sign the TX you need to have private key in Base58Check form already to provide while signing TX in Bitcoin Core or this UTXO in wallet.

BTC: bc1qmrexlspd24kevspp42uvjg7sjwm8xcf9w86h5k
I have 9900K and 1080 Ti, gathering funds for new desktop PC for Bitcoin operations - 14900K and RTX 4090
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!