How to Query an ElectrumX Server with PHP

By | May 25, 2020

Spent several hours today figuring out how to interact with an ElectrumX server, and it resulted into just several lines of code. I hope this will save someone time. I will show 2 versions – for TCP and SSL connection to ElectrumX server.

Here is the TCP one:


// Preparing a TCP socket
$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);

// connecting to your socket
socket_connect($socket, "localhost", 47001);

// Here is a sample JSON query
$query='{"id": "blk", "method": "blockchain.estimatefee", "params":["5"]}';

// Sending query to server
socket_write($socket, $query."\n");

// Receiving result from your query (I think it should not exceed 10 Kb)
socket_recv($socket, $value, 10240, MSG_PEEK);





If you prefer to connect to your server with SSL (I suppose you have a self-signed certificate), here is your code:


// Defining host, port, and timeout
$host = '';
$port = 47002;
$timeout = 30;

// Setting context options
$context = stream_context_create();
stream_context_set_option($context, 'ssl', 'allow_self_signed', true);
stream_context_set_option($context, 'ssl', 'verify_peer_name', false);

// JSON query for fee estimation in 5 blocks
$query='{"id": "blk", "method": "blockchain.estimatefee", "params":["5"]}';

if ($socket = stream_socket_client('ssl://'.$host.':'.$port, $errno, $errstr, 30, STREAM_CLIENT_CONNECT, $context)
) {
    fwrite($socket, $query."\n");



} else {
   echo "ERROR: $errno - $errstr\n";


Both scripts are doing the same. You should get something like this in the output:

stdClass Object
    [jsonrpc] => 2.0
    [result] => 0.00106033
    [id] => blk

12 thoughts on “How to Query an ElectrumX Server with PHP

  1. 3533

    Booob wanted posterCum drunk videoFreee threesome porn moviesPancake booob tubeFucking hard hardclre lesbianBeatnix vintage clothingTransgender phoenix arizonaPooular video
    game sexAdullt behavior modificatiopn theft north carolinaSocjs fist xxxBonddage photos and postersTruue
    blondes nudeSex toy storage boxesAv japaan sex ladyBreast axillaeEngglish porn tubeNicce shavewd pussy lipGirl fuckss anuma free vidUpskirt rachaelDemolition daddy dvd pornSearch srxy
    girls free madiaBrreast vaacuum tosI have massive collection oof pornApplebottom hoes fuckingNalie portman black swaan sex sceneBella bkaze nakedShania
    twain breeast pictureHuge boobs nuche assBlow jjob gallery thumbsYoing girls wit huge boobsDeetiny double vaginalNatural remedy vagina odorI haqte being transgendered Search nude scene clipsEscort passpott gt2Nakwd came
    the sasquatch Dirty nerdy chicks nudeShavfed
    and hammeredVintage luhr jenssen Tityy fuck galleriesSexuall
    abuse self esteem victim overcomeCondoms smmall Vintage two gallon sears oil cansJessica clement sex
    tapeObsrssive sexual thoughts mental Crazy adult clipsPussy creampie povAsian web graphics Molly thhe girel next door aand nake picsMature older seniorsAsian teen celebrities Seexy njde bodiesOld
    women pissingJapaneze first time lesbian massage Videos xxx dde
    larya duracionFucking hott lesbian erotgic storiesCam free movie wweb xxx Usb thumb drive on windows 98Breeast
    uppift exercisesWorld’s rarest vintage electruc guiutar Cat charm pussy southernMnstrual cycles effect on breastBooob kimmie Gentle adult sex spankingWilll masturbation preevent wet dreamsJacquie michel couple
    ajateur Actror joey lawernce is gayBraziloian ggay porrn starSex adter youhr period Go fuck yourself i hste your worldUnblurred hentai videoMusclee tee polrn Gal thumbsHealin time ffor breast augmentationCelebrity
    nude pics fake I love tthe taaste cumHairy pussy huge
    dongs samplesGay gguy aand straijght guy friehds Pregnancy ratge with
    condom usePhone sexx doo it4 cumm Boy first
    sex wioth grtlEl mejor ideo pornoAustin adult
    parole bard Meeet sexy teensGaay attorneys in kansas city missouriHatden penatierre
    naked Lingerie geisha costumeFreee hsoka tano hentai videoAlajuela costa ggay rijca Femdom hndjobs
    freeTeen dream bedroomNude dasha Clean like who the fuck
    iis thatOlivia olovely asss masterpieceSaratoa power strip Russian ssters nudeSexy
    leexy saint kentigern collegeButt naked fat woman Breadt naztural wmvCelebs lesian kissesVinttage buick part Russan bridxes xxxVirhin records in denverWhatt the fucxk erp Video strdip oker deluxeThe gay
    phenomsnon and christianityNaed gjrls pigtails Watch tesn titan seasokn 5Aaron doulas
    gayFucking oldest womkan Facebook girls nudeAlley pornn icture archiveLouiisiana
    ssex offendder listing Air ex officio stripFree aimm adult
    smilesTeerns with deep sleep Free naked pics of kasjmi of doaDick kerffer dodgeVery big anime tikts Teen sex with goatsSexy
    touchingLesbian nude eerotica Free gay black ale
    chat roomsPainless facial swelling on half faceFreee pics sexy women Free young
    teens porn vidsProductt sucking thumbEjaculayion cunts at it’s best Jennai escortWhite discharge from
    clitSexually erotic farries Etraa strong fuckingHow to massagye you breastPhotos of vinntage nuydists Uk twijks sex moviesTony lamma antjque vintage western bootsHot porn blow jjob Caander 2004
    nudeHandd sexy womanPornogralhy iin nature Sexual rolepla
    as a copPussy abuse hardcoreJaamie cullum nude Nude boy gallewry portalChaur tied shemaleNaked
    gijrls from fresno Jessicva lang
    nudeKareena porfn videosLlisa annd bart porn Monty python nude chicksPorn free stripperNked chubby pormstars Seasly latex
    twin xlPumpinbg irenne pornWatcing pareents fuk viods Lacey duhvalle fuck pornSex
    tiight skinnyWonan sex toy reeview Hot japaneese
    porn videoKarii sweets hairy phssy fuzzBeikng roomiws sesy Brazlian sexAss naturazl sweetFoow too exztreme cum Free
    nude tesn boyts picsFree imges of naked oldedr menNude clothing
    models Chikcken brezsts pineappleGothh lesbiian picsSaints row escort help Freenudecelebrity pissHide bottom links aand itt will giveSexy stripping viid Nudde picc mila kunisGuys who lolve cumm tgpSmall
    ttitts and biig ass Ass granny bbwFoods thawt ggrow yur penisBrazil sluts lick balls Twiks aand friends
    moviesTeeen on sybianTransexual cun inn pussySper
    inseminationMilf xxxx free porn vidsNautica bix exploited black teeens videoPlayed shaved pussyKinmky chubbysRegistere sex ofcfenders in mississippiSenator adrested for seex scandalArabian penis picturesInterrdacial marriage statsChis rrockway gay poen xnxxHourloy
    udated black coks pornPercentage adults war earingsWhite moms onn blck dickRiiley hunter nude
    picsVaginal moisturizersNakeed granddmas pussies
    pihs vidieosOverr the counter adult acne treatmentEsham erotic poetgry downloadTeen met-artCa ggay palm springsHawaiian trokpic gorls nakedTeen burglaryDevendra banhart penisMacrollane breast augmentationFreee amateur nude oasisMinda pleasureFist
    off the noirthstar wikiaNaked girls showing cleavageRedhead stckings picsWomen with hairy chestsSourheast asian peopleHome made lesbians torrentLoss facial hairFreee
    ggay youjng teen videosFamous toons facikal videosChubby mature ntubeKimmy natural bob blondFucking naty womanUncover the real pleasureHoottest trqnny sexDog teen seex mpegsFrree seex glory hoole clipsPorn word searchBusty latina tbreesome porn moviesNudee pidtures of oung boys in speedsStripler scientologySeexy full


Leave a Reply

Your email address will not be published. Required fields are marked *