1
0
Fork 0
mirror of https://github.com/ACINQ/eclair.git synced 2025-02-23 06:35:11 +01:00
eclair/TESTING.md
2016-02-10 11:51:36 +01:00

2.1 KiB
Raw Blame History

Testing eclair and lightnind

Configure bitcoind to run in regtest mode

edit ~/.bitcoin/bitcoin.conf and add:

server=1
regtest=1
rpcuser=***
rpcpassword=***

make sure that bitcoin-cli is on the path

Start bitcoind

Mine a few blocks:

bitcoin-cli generate 101

Start lighnind (here well use port 50000)

lightningd --port 50000

Start eclair:

mvn exec:java -Dexec.mainClass=fr.acinq.eclair.Boot

Tell eclair to connect to lightnind:

curl -X POST -H "Content-Type: application/json" -H "Cache-Control: no-cache" -H "Postman-Token: 7c9823a3-3b83-e881-fdcd-21a38bdd9905" -d '{
>     "id": 12345,
>     "method": "connect",
>     "params" : [ "localhost", 50000, 1000000 ]
> }' "http://localhost:8080"

Since eclair is funder, it will create and publish the anchor tx

Mine a few blocks to confirm the anchor tx:

bitcoin-cli generate 10

eclair and lightnind are now both in NORMAL state (high priority for eclair, low priority for lightnind)

Tell eclair to send a htlc

Well use the following values for R and H:

R = 0102030405060708010203040506070801020304050607080102030405060708
H = 8cf3e5f40cf025a984d8e00b307bbab2b520c91b2bde6fa86958f8f4e7d8a609

Youll need a unix timestamp that is not too far into the future. Now + 100000 is fine:

echo `date +%s` + 100000 | bc
curl -X POST -H "Content-Type: application/json" -H "Cache-Control: no-cache" -H "Postman-Token: 7b422190-3f64-2a38-e8b7-0044d207dab0" -d '{
    "id": 12345,
    "method": "addhtlc",
    "params" : [ "akka://default/user/register/handler-1/channel", 100000, "8cf3e5f40cf025a984d8e00b307bbab2b520c91b2bde6fa86958f8f4e7d8a609", YOURTIMESTAMP  ]
}' "http://localhost:8080"

Tell lighningd to fulfill the HTLC:

./lightning-cli fulfillhtlc 0277863c1e40a2d4934ccf18e6679ea949d36bb0d1333fb098e99180df60d0195a 0102030405060708010203040506070801020304050607080102030405060708

Check balances on both eclair and lightningd

Close the channel

./lightning-cli close 0277863c1e40a2d4934ccf18e6679ea949d36bb0d1333fb098e99180df60d0195a