Bitcoin Forum
August 05, 2025, 10:10:57 AM *
News: Latest Bitcoin Core release: 29.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Is there any standalone script to generate SegWit Address Key pair using PHP?  (Read 166 times)
CounterEntropy (OP)
Full Member
***
Offline Offline

Activity: 214
Merit: 278


View Profile
July 02, 2021, 06:43:07 PM
Merited by hugeblack (4), ABCbits (2), bitmover (2), NotATether (2)
 #1

Something similar is available for Bitcoin legacy addresses here -
https://github.com/BitcoinPHP/BitcoinECDSA.php/blob/master/src/BitcoinPHP/BitcoinECDSA/BitcoinECDSA.php
bitmover
Legendary
*
Offline Offline

Activity: 2744
Merit: 6793


bitcoindata.science


View Profile WWW
July 02, 2021, 07:27:16 PM
Merited by ABCbits (2), HCP (2), EFS (1), NotATether (1)
 #2

I know there is something for javascript here:

https://github.com/bitcoinjs

Specific discussion for segwit address generation::
https://github.com/bitcoinjs/bitcoinjs-lib/issues/1137

I have also found this Bitcoin PHP library:
https://github.com/Bit-Wasp/bitcoin-php

There is a discussion here about segwit addresses:
https://github.com/Bit-Wasp/bitcoin-php/issues/613

This might help you

█████████████████████████████████████████████████████████████████████████████
█████████████████████████████████████████████████████████████████████████████
█████████████▐██▌████████████████████████████████████▐████████████████▐██████
███████▌█████████████▐██▌██████████████████████████████▌█████████████████████
████████████▐██▌█████████████▐███████████▌█████████████████▌█████████████████
██████▌█████▀▀▀█████▐██▌█████▀▀▀▀▀▀▀▀▀████████▀▀▀▀▀▀▀▀▀█████████▐████████████
███████████████████▄█████████████████▐██▌█████████████▐███▌██████████████████

████████▄▄██████▄█████▌█████▄▄▄▄▄▄▄▄▄█████████▄▄▄▄▄▄▄▄█████████▐█████████████
█████████▌█████████████████▐███████████▌█████████████████▌███████████████████
██████████████▐██████▌█████████████▐██████████████████████████▐██████████████
████████▌█████████████▄█████████████████▄███████████▐███▌████████████████████
█████████████████████████████████████████████████████████████████████████████
█████████████████████████████████████████████████████████████████████████████
█████████████████
█████████████████
█████████████████
██░░▀░░░░░▀▀▀░░██
██░░░░░░░░░░░▄██
██░░▄▄▄▄▄▄░░▐████
████████▀░░░█████
██████▀░░░░▐█████
█████░░░░░░██████
████▌░░░░░░▐█████
█████████████████
█████████████████
█████████████████
█████████████████
█████████████████
█████████████████
███████▀░▀███████
█████▀░░░░░▀█████
███▀░░░░░░░░░▀███
██▀░░░░░░░░░░░▀██
██▄░░░░░░░░░░░▄█
████▄▄▄▀░▀▄▄▄████
█████▀░░░░░▀█████
█████████████████
█████████████████
█████████████████
█████████████████
█████████████████
█████████████████
████▀▀░░░░▀▀████
███░▀▄▀▀▀▀▀▄▀░███
██░░█░▄░░░▄░█░░█
██▀▀▌░░███░░▐▄▄██
██░░█░▀░░░▀░█░░██
███░▄▀▄▄▄▄▄▀▄░███
████▄▄░░█░░▄▄████
█████████████████
█████████████████
█████████████████
BITCOINTALK
LEADERBOARD

 
Ref Code : BTCTalk


$1,500 POOL PRIZE
IN EVERY 2 WEEKS!

.............Starts on July 15th.............

..PLAY NOW..
HCP
Legendary
*
Offline Offline

Activity: 2086
Merit: 4377

<insert witty quote here>


View Profile
July 05, 2021, 10:09:30 PM
Merited by ABCbits (2), bitmover (2), EFS (1), NotATether (1)
 #3

As bitmover has found, Bit-Wasp is probably your best bet for PHP specific code...

There are several examples that demonstrate how to generate the p2wpkh (bech32) and p2sh.p2wpkh (nested segwit) addresses listed here: https://github.com/Bit-Wasp/bitcoin-php/blob/1.0/examples/addresstypes.script.php

and other examples of generating keys/addresses here: https://github.com/Bit-Wasp/bitcoin-php/tree/1.0/examples/doc/keys

Indeed, there are lots of fairly useful examples for various use-cases: https://github.com/Bit-Wasp/bitcoin-php/tree/1.0/examples

█████████████████████████
████▐██▄█████████████████
████▐██████▄▄▄███████████
████▐████▄█████▄▄████████
████▐█████▀▀▀▀▀███▄██████
████▐███▀████████████████
████▐█████████▄█████▌████
████▐██▌█████▀██████▌████
████▐██████████▀████▌████
█████▀███▄█████▄███▀█████
███████▀█████████▀███████
██████████▀███▀██████████
█████████████████████████
.
BC.GAME
▄▄░░░▄▀▀▄████████
▄▄▄
██████████████
█████░░▄▄▄▄████████
▄▄▄▄▄▄▄▄▄██▄██████▄▄▄▄████
▄███▄█▄▄██████████▄████▄████
███████████████████████████▀███
▀████▄██▄██▄░░░░▄████████████
▀▀▀█████▄▄▄███████████▀██
███████████████████▀██
███████████████████▄██
▄███████████████████▄██
█████████████████████▀██
██████████████████████▄
.
..CASINO....SPORTS....RACING..
█░░░░░░█░░░░░░█
▀███▀░░▀███▀░░▀███▀
▀░▀░░░░▀░▀░░░░▀░▀
░░░░░░░░░░░░
▀██████████
░░░░░███░░░░
░░█░░░███▄█░░░
░░██▌░░███░▀░░██▌
░█░██░░███░░░█░██
░█▀▀▀█▌░███░░█▀▀▀█▌
▄█▄░░░██▄███▄█▄░░▄██▄
▄███▄
░░░░▀██▄▀


▄▄████▄▄
▄███▀▀███▄
██████████
▀███▄░▄██▀
▄▄████▄▄░▀█▀▄██▀▄▄████▄▄
▄███▀▀▀████▄▄██▀▄███▀▀███▄
███████▄▄▀▀████▄▄▀▀███████
▀███▄▄███▀░░░▀▀████▄▄▄███▀
▀▀████▀▀████████▀▀████▀▀
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!