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:
<?php // 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); $result=json_decode($value); print_r($result); socket_close($socket); ?>
If you prefer to connect to your server with SSL (I suppose you have a self-signed certificate), here is your code:
<?php // Defining host, port, and timeout $host = '127.0.0.1'; $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"); $value=fread($socket,10240); $result=json_decode($value); print_r($result); fclose($socket); } 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 )
u0ujbe
43inqp
ufabu6
bshm40
9wp70r
1a7fn7
wapvxu
mhdy4m
4mh8sr
1cogc6
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 https://bit.ly/2RJDlNn Search nude scene clipsEscort passpott gt2Nakwd came
the sasquatch https://bit.ly/3ET43pd Dirty nerdy chicks nudeShavfed
and hammeredVintage luhr jenssen https://bit.ly/33slFv5 Tityy fuck galleriesSexuall
abuse self esteem victim overcomeCondoms smmall https://cutt.ly/mOaG49X Vintage two gallon sears oil cansJessica clement sex
tapeObsrssive sexual thoughts mental https://bit.ly/30OkGBa Crazy adult clipsPussy creampie povAsian web graphics https://tinyurl.com/6rz69w5r Molly thhe girel next door aand nake picsMature older seniorsAsian teen celebrities https://tinyurl.com/szykxe57 Seexy njde bodiesOld
women pissingJapaneze first time lesbian massage https://tinyurl.com/y8lygoqk Videos xxx dde
larya duracionFucking hott lesbian erotgic storiesCam free movie wweb xxx https://tinyurl.com/y88mhayz Usb thumb drive on windows 98Breeast
uppift exercisesWorld’s rarest vintage electruc guiutar
https://tinyurl.com/2knphhbt Cat charm pussy southernMnstrual cycles effect on breastBooob kimmie https://bit.ly/32v5kFt Gentle adult sex spankingWilll masturbation preevent wet dreamsJacquie michel couple
ajateur https://bit.ly/2Si2xed Actror joey lawernce is gayBraziloian ggay porrn starSex adter youhr period https://cutt.ly/gUTuXhB Go fuck yourself i hste your worldUnblurred hentai videoMusclee tee polrn https://bit.ly/30ZLu4P Gal thumbsHealin time ffor breast augmentationCelebrity
nude pics fake https://bit.ly/3qwC1u3 I love tthe taaste cumHairy pussy huge
dongs samplesGay gguy aand straijght guy friehds https://bit.ly/3hnZVUt Pregnancy ratge with
condom usePhone sexx doo it4 cumm https://bit.ly/3wK203x Boy first
sex wioth grtlEl mejor ideo pornoAustin adult
parole bard https://bit.ly/3x1TOfo Meeet sexy teensGaay attorneys in kansas city missouriHatden penatierre
naked https://bit.ly/3qcvs0e Lingerie geisha costumeFreee hsoka tano hentai videoAlajuela costa ggay rijca https://bit.ly/3vaxiz4 Femdom hndjobs
freeTeen dream bedroomNude dasha https://bit.ly/2PRaAx1 Clean like who the fuck
iis thatOlivia olovely asss masterpieceSaratoa power strip https://cutt.ly/4UN6QIt Russian ssters nudeSexy
leexy saint kentigern collegeButt naked fat woman https://tinyurl.com/2j4pkbrt Breadt naztural wmvCelebs lesian kissesVinttage buick part https://tinyurl.com/ygujjzvf Russan bridxes xxxVirhin records in denverWhatt the fucxk erp
https://bit.ly/3HpKjvk Video strdip oker deluxeThe gay
phenomsnon and christianityNaed gjrls pigtails https://bit.ly/3xvS5Pj Watch tesn titan seasokn 5Aaron doulas
gayFucking oldest womkan https://cutt.ly/LUBAB7x Facebook girls nudeAlley pornn icture archiveLouiisiana
ssex offendder listing https://bit.ly/3dOE8TD Air ex officio stripFree aimm adult
smilesTeerns with deep sleep https://cutt.ly/7UfS0MS Free naked pics of kasjmi of doaDick kerffer dodgeVery big anime tikts https://bit.ly/31xbcLa Teen sex with goatsSexy
touchingLesbian nude eerotica https://bit.ly/3AQnD4D Free gay black ale
chat roomsPainless facial swelling on half faceFreee pics sexy women https://bit.ly/33G7EI6 Free young
teens porn vidsProductt sucking thumbEjaculayion cunts at it’s best https://tinyurl.com/yjy6q2ff Jennai escortWhite discharge from
clitSexually erotic farries https://tinyurl.com/2kvfbfuk Etraa strong fuckingHow to massagye you breastPhotos of vinntage nuydists https://bit.ly/3IIoTuux Uk twijks sex moviesTony lamma antjque vintage western bootsHot porn blow jjob https://cutt.ly/gx5PVR9 Caander 2004
nudeHandd sexy womanPornogralhy iin nature https://bit.ly/30w3PTi Sexual rolepla
as a copPussy abuse hardcoreJaamie cullum nude https://bit.ly/3qyiQPc Nude boy gallewry portalChaur tied shemaleNaked
gijrls from fresno https://tinyurl.com/yh9ub764 Jessicva lang
nudeKareena porfn videosLlisa annd bart porn https://bit.ly/3clFZ30 Monty python nude chicksPorn free stripperNked chubby pormstars https://bit.ly/3crqFAS Seasly latex
twin xlPumpinbg irenne pornWatcing pareents fuk viods https://tinyurl.com/rm6995yp Lacey duhvalle fuck pornSex
tiight skinnyWonan sex toy reeview https://bit.ly/3kaD0w0 Hot japaneese
porn videoKarii sweets hairy phssy fuzzBeikng roomiws sesy https://bit.ly/3h1hKZx Brazlian sexAss naturazl sweetFoow too exztreme cum https://bit.ly/34sDDux Free
nude tesn boyts picsFree imges of naked oldedr menNude clothing
models https://tinyurl.com/yk3lkms2 Chikcken brezsts pineappleGothh lesbiian picsSaints row escort help https://tinyurl.com/yhahxkrp Freenudecelebrity pissHide bottom links aand itt will giveSexy stripping viid https://bit.ly/3sDZf4S Nudde picc mila kunisGuys who lolve cumm tgpSmall
ttitts and biig ass https://cutt.ly/4Ua1bxe Ass granny bbwFoods thawt ggrow yur penisBrazil sluts lick balls https://tinyurl.com/2ptv8ukv 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
figure
yxy0ea