Commit 17f4b4b8 authored by TonyFord's avatar TonyFord
Browse files

get transactions by address api for vindax

parent 7a330221
......@@ -74,70 +74,6 @@ start:
- docker-compose exec -T faircoin ./start_faircoin_services.sh
- export LH_PORT=${LH_PORT_jsonrpc} && curl https://git.fairkom.net/faircoin.co/admin/-/raw/master/nginx_proxy | sed -e s/DOMAIN/${CI_PROJECT_NAME}/g -e s/LH_PORT/${LH_PORT}/g > ${CI_PROJECT_NAME}
create_wallet:
stage: create_wallet
tags:
- FairCoin.Co
only:
refs:
- master
variables:
- $CMD =~ /^create wallet$/
before_script:
- export RUNNER_UID=`id -u`
- export RUNNER_GID=`id -g`
- docker-compose exec -T faircoin mkdir -p .electrumfair/wallets
script:
- docker-compose exec -T faircoin ./electrumfair/run_electrumfair create --passphrase ${PASSPHRASE} --password ${PASSWORD} --wallet .electrumfair/wallets/${WALLET:-default_wallet}
- docker-compose exec -T faircoin ls -l .electrumfair/wallets
load_wallet:
stage: load_wallet
tags:
- FairCoin.Co
only:
refs:
- master
variables:
- $CMD =~ /^load wallet$/
before_script:
- export RUNNER_UID=`id -u`
- export RUNNER_GID=`id -g`
script:
- docker-compose exec -T faircoin ./load_wallet.expect ${WALLET:-default_wallet} ${PASSWORD}
- docker-compose exec -T faircoin ./electrumfair/run_electrumfair getbalance --wallet .electrumfair/wallets/${WALLET:-default_wallet}
close_wallet:
stage: close_wallet
tags:
- FairCoin.Co
only:
refs:
- master
variables:
- $CMD =~ /^close wallet$/
before_script:
- export RUNNER_UID=`id -u`
- export RUNNER_GID=`id -g`
script:
- docker-compose exec -T faircoin ./electrumfair/run_electrumfair getbalance --wallet .electrumfair/wallets/${WALLET:-default_wallet}
- docker-compose exec -T faircoin ./electrumfair/run_electrumfair daemon close_wallet --wallet .electrumfair/wallets/${WALLET:-default_wallet}
walletinfo:
stage: walletinfo
tags:
- FairCoin.Co
only:
refs:
- master
variables:
- $CMD =~ /^walletinfo$|^load wallet$|^close wallet$/
before_script:
- export RUNNER_UID=`id -u`
- export RUNNER_GID=`id -g`
script:
- docker-compose exec -T faircoin ./electrumfair/run_electrumfair daemon status
stop:
stage: stop
tags:
......
......@@ -31,14 +31,6 @@ uninstall # remove container
remove
~~~
Wallet commands:
~~~
create wallet # create new electrumfair wallet
load wallet # load wallet ( make it hot )
close wallet # close wallet ( make it cold )
walletinfo # get electrumfair wallet info
~~~
#### CI/CD Settings
Go Gitlab **Settings** -> **CI/CD** -> **Variables**
......@@ -48,27 +40,6 @@ Go Gitlab **Settings** -> **CI/CD** -> **Variables**
LH_PORT_jsonrpc # php -S 0.0.0.0:${LH_PORT}
~~~
Pipeline variables:
~~~
CMD = create wallet
WALLET = <new wallet name> # optional specify the wallets name
PASSPHRASE = <new wallet passphrase> # passphrase make your seed more secure
PASSWORD = <new wallet password> # password encrypts all wallets data on your drive
~~~
~~~
CMD = load wallet
WALLET = <wallet name> # optional specify the wallets name
PASSWORD = <wallet password> # password encrypts all wallets data on your drive
~~~
~~~
CMD = close wallet
WALLET = <wallet name> # optional specify the wallets name
PASSWORD = <wallet password> # password encrypts all wallets data on your drive
~~~
## Manual usage
change localhost port in setenv.sh
......@@ -88,13 +59,3 @@ follow the commands in the .gitlab-ci.yml and do the same steps as the gitlab-ru
## Nginx server setup
follow the instructions on https://git.fairkom.net/faircoin.co/admin/-/blob/master/SERVERSETUP.md#configure-server-host
## Wallet
~~~
./run_electrumfair create --passphrase test123 --password test123 --wallet /home/faircoin/.electrumfair/wallets/test
~~~
<html>
<head>
<style>
body {
font-family: sans-serif;
padding-bottom: 50px;
}
h4 {
margin-top:5px;
margin-bottom: 0px;
color: grey;
cursor: pointer;
}
h5 {
margin-top:25px;
margin-bottom: 0px;
color: midnightblue;
}
h4 b {
color: black;
}
.hidden {
display: none;
}
textarea {
width: 100%;
padding: 10px;
margin-top: 10px;
margin-bottom: 20px;
}
</style>
<script src="assets/js/jquery.min.js"></script>
</head>
<body>
<h1>jsonrpc-php</h1>
<p>Connect to faircoin blockchain via PHP by jsonrpc api. You can find all instructions and sources in <a href="https://git.fairkom.net/faircoin.co/jsonrpc-api" target="sources">git.fairkom.net</a></p>
<?php
include_once('functions/faircoin.php');
//$address='fJEtS3HDHxqX8Kpa2FChzGypPJYLBTRStq';
//$pubkey='04efbdb57592d1d4384a42a16dda525bc217ef7ce5e471ddf750e508096b5e9f5d99a3aa13a461ef4319417239dceae094351006a99134a14d43b32737f10fe405';
//$signature='HEbYHmm+QlB0aYlA/KK/2/lFqw1gM2yTzomUPjmLBFpwC7NM2iBk3R3aE3q+GaPtUUUPXprPPbETeOfThD+OI7c=';
include('functions/faircoin.php');
$F = new Faircoin();
$txid='09268782af2883a829d99d4addd3a33142be0663199ebea2292ca791607c0bcc';
$message='Hello';
$address=$F->electrumfair->listaddresses()[0];
$pubkey=$F->electrumfair->getpubkeys($address)[0];
$signature=$F->electrumfair->signmessage($address,$message);
?><hr><h4>Example data</h4><?
?><textarea><?
echo json_encode(Array('address' => $address, 'pubkey' => $pubkey, 'message' => $message, 'encrypted' => $encrypted, 'signature' => $signature, 'txid' => $txid) );
?></textarea><?
?><hr><h2>System</h2><?
?><h4 onclick="$(this).next().toggleClass('hidden')">Faircoin->electrumfair-><b>version()</b></h4><?
?><textarea class="hidden"><?=json_encode($F->electrumfair->version())?></textarea><?
?><hr><h2>Message</h2><?
?><h4 onclick="$(this).next().toggleClass('hidden')">Faircoin->electrumfair-><b>signmessage($address,$message)</b></h4><?
?><textarea class="hidden"><?=json_encode($F->electrumfair->signmessage($address,$message))?></textarea><?
?><h4 onclick="$(this).next().toggleClass('hidden')">Faircoin->electrumfair-><b>verifymessage($address,$message,$signature)</b></h4><?
?><textarea class="hidden"><?=json_encode($F->electrumfair->verifymessage($address,$message,$signature))?></textarea><?
?><h4 onclick="$(this).next().toggleClass('hidden')">Faircoin->faircoind-><b>verifymessage($address,$message,$signature)</b></h4><?
?><textarea class="hidden"><?=json_encode($F->faircoind->verifymessage($address,$message,$signature))?></textarea><?
?><h4 onclick="$(this).next().toggleClass('hidden')">Faircoin->faircoind-><b>validatepubkey($pubkey)</b></h4><?
?><textarea class="hidden"><?=json_encode($F->faircoind->validatepubkey($pubkey))?></textarea><?
?><hr><h2>Address</h2><?
?><h4 onclick="$(this).next().toggleClass('hidden')">Faircoin->electrumfair-><b>getaddressbalance($address)</b></h4><?
?><textarea class="hidden"><?=json_encode($F->electrumfair->getaddressbalance($address))?></textarea><?
?><h4 onclick="$(this).next().toggleClass('hidden')">Faircoin->electrumfair-><b>getaddresshistory($address)</b></h4><?
?><textarea class="hidden"><?=json_encode($F->electrumfair->getaddresshistory($address))?></textarea><?
?><h4 onclick="$(this).next().toggleClass('hidden')">Faircoin->electrumfair-><b>getaddressunspent($address)</b></h4><?
?><textarea class="hidden"><?=json_encode($F->electrumfair->getaddressunspent($address))?></textarea><?
?><h4 onclick="$(this).next().toggleClass('hidden')">Faircoin->electrumfair-><b>validateaddress($address)</b></h4><?
?><textarea class="hidden"><?=json_encode($F->electrumfair->validateaddress($address))?></textarea><?
?><h4 onclick="$(this).next().toggleClass('hidden')">Faircoin->faircoind-><b>validateaddress($address)</b></h4><?
?><textarea class="hidden"><?=json_encode($F->faircoind->validateaddress($address))?></textarea><?
?><hr><h2>Block</h2><?
?><h4 onclick="$(this).next().toggleClass('hidden')">Faircoin->faircoind-><b>getbestblockhash()</b></h4><?
$blockhash=$F->faircoind->getbestblockhash();
?><textarea class="hidden"><?=json_encode($blockhash)?></textarea><?
?><h4 onclick="$(this).next().toggleClass('hidden')">Faircoin->faircoind-><b>getblock($blockhash)</b></h4><?
?><textarea class="hidden"><?=json_encode($F->faircoind->getblock($blockhash))?></textarea><?
?><h4 onclick="$(this).next().toggleClass('hidden')">Faircoin->faircoind-><b>getblockchaininfo()</b></h4><?
?><textarea class="hidden"><?=json_encode($F->faircoind->getblockchaininfo())?></textarea><?
?><h4 onclick="$(this).next().toggleClass('hidden')">Faircoin->faircoind-><b>getblockcount()</b></h4><?
$index= $F->faircoind->getblockcount();
?><textarea class="hidden"><?=json_encode($index)?></textarea><?
?><h4 onclick="$(this).next().toggleClass('hidden')">Faircoin->faircoind-><b>getblockhash($index)</b></h4><?
?><textarea class="hidden"><?=json_encode($F->faircoind->getblockhash($index))?></textarea><?
?><h4 onclick="$(this).next().toggleClass('hidden')">Faircoin->faircoind-><b>getblockheader($blockhash)</b></h4><?
?><textarea class="hidden"><?=json_encode($F->faircoind->getblockheader($blockhash))?></textarea><?
?><h4 onclick="$(this).next().toggleClass('hidden')">Faircoin->faircoind-><b>getchaintips()</b></h4><?
?><textarea class="hidden"><?=json_encode($F->faircoind->getchaintips())?></textarea><?
?><hr><h2>Transaction</h2><?
?><h4 onclick="$(this).next().toggleClass('hidden')">Faircoin->electrumfair-><b>deserialize($tx_hex)</b></h4><?
?><textarea class="hidden"><?=json_encode($F->electrumfair->deserialize($tx['hex']))?></textarea><?
?><h4 onclick="$(this).next().toggleClass('hidden')">Faircoin->electrumfair-><b>gettransaction($txid)</b></h4><?
$tx=$F->electrumfair->gettransaction($txid);
?><textarea class="hidden"><?=json_encode($tx)?></textarea><?
?><h4 onclick="$(this).next().toggleClass('hidden')">Faircoin->faircoind-><b>getrawtransaction($txid)</b></h4><?
$tx_hex=$F->faircoind->getrawtransaction($txid)?></textarea><?
?><textarea class="hidden"><?=json_encode($tx_hex);
?><h4 onclick="$(this).next().toggleClass('hidden')">Faircoin->faircoind-><b>decoderawtransaction($tx_hex)</b></h4><?
?><textarea class="hidden"><?=json_encode($F->faircoind->decoderawtransaction($tx_hex))?></textarea><?
?><h4 onclick="$(this).next().toggleClass('hidden')">Faircoin->faircoind-><b>getmempoolinfo()</b></h4><?
?><textarea class="hidden"><?=json_encode($F->faircoind->getmempoolinfo())?></textarea><?
?><h4 onclick="$(this).next().toggleClass('hidden')">Faircoin->faircoind-><b>getrawmempool()</b></h4><?
?><textarea class="hidden"><?=json_encode($F->faircoind->getrawmempool())?></textarea><?
?><h4 onclick="$(this).next().toggleClass('hidden')">Faircoin->faircoind-><b>gettxoutsetinfo()</b></h4><?
?><textarea class="hidden"><?=json_encode($F->faircoind->gettxoutsetinfo())?></textarea><?
?><hr><h2>Network</h2><?
?><h4 onclick="$(this).next().toggleClass('hidden')">Faircoin->electrumfair-><b>getservers()</b></h4><?
?><textarea class="hidden"><?=json_encode($F->electrumfair->getservers())?></textarea><?
?><h4 onclick="$(this).next().toggleClass('hidden')">Faircoin->electrumfair-><b>getfeerate()</b></h4><?
?><textarea class="hidden"><?=json_encode($F->electrumfair->getfeerate())?></textarea><?
?><h4 onclick="$(this).next().toggleClass('hidden')">Faircoin->faircoind-><b>getchainparameters()</b></h4><?
?><textarea class="hidden"><?=json_encode($F->faircoind->getchainparameters())?></textarea><?
?><h4 onclick="$(this).next().toggleClass('hidden')">Faircoin->faircoind-><b>getconnectioncount()</b></h4><?
?><textarea class="hidden"><?=json_encode($F->faircoind->getconnectioncount())?></textarea><?
?><h4 onclick="$(this).next().toggleClass('hidden')">Faircoin->faircoind-><b>getnettotals()</b></h4><?
?><textarea class="hidden"><?=json_encode($F->faircoind->getnettotals())?></textarea><?
?><h4 onclick="$(this).next().toggleClass('hidden')">Faircoin->faircoind-><b>getnetworkinfo()</b></h4><?
?><textarea class="hidden"><?=json_encode($F->faircoind->getnetworkinfo())?></textarea><?
?><h4 onclick="$(this).next().toggleClass('hidden')">Faircoin->faircoind-><b>getpeerinfo()</b></h4><?
?><textarea class="hidden"><?=json_encode($F->faircoind->getpeerinfo())?></textarea><?
?><h4 onclick="$(this).next().toggleClass('hidden')">Faircoin->faircoind-><b>estimatefee()</b></h4><?
?><textarea class="hidden"><?=json_encode($F->faircoind->estimatefee())?></textarea><?
?><h4 onclick="$(this).next().toggleClass('hidden')">Faircoin->faircoind-><b>getactiveadmins()</b></h4><?
?><textarea class="hidden"><?=json_encode($F->faircoind->getactiveadmins())?></textarea><?
?><h4 onclick="$(this).next().toggleClass('hidden')">Faircoin->faircoind-><b>getactivecvns()</b></h4><?
?><textarea class="hidden"><?=json_encode($F->faircoind->getactivecvns())?></textarea><?
?><h4 onclick="$(this).next().toggleClass('hidden')">Faircoin->faircoind-><b>getinfo()</b></h4><?
?><textarea class="hidden"><?=json_encode($F->faircoind->getinfo())?></textarea><?
?><hr><h2>Wallet</h2><?
?><h5>Wallet status</h5><?
?><h4 onclick="$(this).next().toggleClass('hidden')">Faircoin->electrumfair-><b>is_synchronized()</b></h4><?
?><textarea class="hidden"><?=json_encode($F->electrumfair->is_synchronized())?></textarea><?
?><h5>Payment requests</h5><?
?><h4 onclick="$(this).next().toggleClass('hidden')">Faircoin->electrumfair-><b>addrequest($amount,$memo)</b></h4><?
?><textarea class="hidden"><?=json_encode($F->electrumfair->addrequest(1,'mymemo'))?></textarea><?
?><h4 onclick="$(this).next().toggleClass('hidden')">Faircoin->electrumfair-><b>listrequests()</b></h4><?
$request=$F->electrumfair->listrequests()[0]['address'];
?><textarea class="hidden"><?=json_encode($F->electrumfair->listrequests())?></textarea><?
?><h4 onclick="$(this).next().toggleClass('hidden')">Faircoin->electrumfair-><b>getrequest($request)</b></h4><?
?><textarea class="hidden"><?=json_encode($F->electrumfair->getrequest($request))?></textarea><?
?><h4 onclick="$(this).next().toggleClass('hidden')">Faircoin->electrumfair-><b>rmrequest($request)</b></h4><?
?><textarea class="hidden"><?=json_encode($F->electrumfair->rmrequest($request))?></textarea><?
?><h4 onclick="$(this).next().toggleClass('hidden')">Faircoin->electrumfair-><b>clearrequests()</b></h4><?
?><textarea class="hidden"><?=json_encode($F->electrumfair->clearrequests())?></textarea><?
?><h5>Wallet addresses</h5><?
?><h4 onclick="$(this).next().toggleClass('hidden')">Faircoin->electrumfair-><b>createnewaddress()</b></h4><?
?><textarea class="hidden"><?=json_encode($F->electrumfair->createnewaddress())?></textarea><?
?><h4 onclick="$(this).next().toggleClass('hidden')">Faircoin->electrumfair-><b>getunusedaddress()</b></h4><?
?><textarea class="hidden"><?=json_encode($F->electrumfair->getunusedaddress())?></textarea><?
?><h4 onclick="$(this).next().toggleClass('hidden')">Faircoin->electrumfair-><b>ismine($address)</b></h4><?
?><textarea class="hidden"><?=json_encode($F->electrumfair->ismine($address))?></textarea><?
?><h4 onclick="$(this).next().toggleClass('hidden')">Faircoin->electrumfair-><b>listaddresses()</b></h4><?
?><textarea class="hidden"><?=json_encode($F->electrumfair->listaddresses())?></textarea><?
?><h4 onclick="$(this).next().toggleClass('hidden')">Faircoin->electrumfair-><b>listunspent()</b></h4><?
?><textarea class="hidden"><?=json_encode($F->electrumfair->listunspent())?></textarea><?
?><h4 onclick="$(this).next().toggleClass('hidden')">Faircoin->electrumfair-><b>notify($address,$URL)</b></h4><?
?><textarea class="hidden"><?=json_encode($F->electrumfair->notify($address,$URL))?></textarea><?
?><h4 onclick="$(this).next().toggleClass('hidden')">Faircoin->electrumfair-><b>freeze($address)</b></h4><?
?><textarea class="hidden"><?=json_encode($F->electrumfair->freeze($address))?></textarea><?
?><h4 onclick="$(this).next().toggleClass('hidden')">Faircoin->electrumfair-><b>unfreeze($address)</b></h4><?
?><textarea class="hidden"><?=json_encode($F->electrumfair->unfreeze($address))?></textarea><?
?><h5>Wallet history & balance</h5><?
?><h4 onclick="$(this).next().toggleClass('hidden')">Faircoin->electrumfair-><b>getbalance()</b></h4><?
?><textarea class="hidden"><?=json_encode($F->electrumfair->getbalance())?></textarea><?
?><h4 onclick="$(this).next().toggleClass('hidden')">Faircoin->electrumfair-><b>history()</b></h4><?
?><textarea class="hidden"><?=json_encode($F->electrumfair->history())?></textarea><?
?><h5>Wallet public keys</h5><?
?><h4 onclick="$(this).next().toggleClass('hidden')">Faircoin->electrumfair-><b>getmpk()</b></h4><?
?><textarea class="hidden"><?=json_encode($F->electrumfair->getmpk())?></textarea><?
?><h4 onclick="$(this).next().toggleClass('hidden')">Faircoin->electrumfair-><b>getpubkeys($address)</b></h4><?
?><textarea class="hidden"><?=json_encode($F->electrumfair->getpubkeys($address))?></textarea><?
$address=$_GET['address'];
echo json_encode($F->electrumfair->getaddresshistory($address));
?>
</body>
</html>
#!/usr/bin/expect
set wallet [lindex $argv 0]
set pass [lindex $argv 1]
set timeout 5
spawn ./electrumfair/run_electrumfair daemon load_wallet --wallet /home/faircoin/.electrumfair/wallets/$wallet
#Login
expect "Password: "
send -- "$pass\n"
expect eof
exit
......@@ -2,5 +2,6 @@
if [ ! -d ./electrumfair/packages ]; then ./electrumfair/contrib/make_packages; fi
rm ./electrumfair/electrumfair/servers.json
cp ./servers.json ./electrumfair/electrumfair/
./electrumfair/run_electrumfair daemon start
./faircoind -daemon
sleep 10
./electrumfair/run_electrumfair daemon start
......@@ -2,3 +2,4 @@
export RUNNER_UID=`id -u`
export RUNNER_GID=`id -g`
export LH_PORT_jsonrpc=4003
export CI_PROJECT_NAME=www.example.com
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment