Giter Site home page Giter Site logo

trustedcoin's Introduction

The trustedcoin plugin

A plugin that uses block explorers (blockstream.info, mempool.space, blockchair.com and blockchain.info) as backends instead of your own Bitcoin node.

This isn't what you should be doing, but sometimes you may need it.

(Remember this will download all blocks c-lightning needs from blockchain.info or blockchair.com in raw, hex format.)

How to install

This is distributed as a single binary for your delight (or you can compile it yourself with go get, or ask me for binaries for other systems if you need them).

Download it, call chmod +x <binary> and put it in ~/.lightning/plugins (create that directory if it doesn't exist).

You only need the binary you can get in the releases page, nothing else.

Then add the following line to your ~/.lightning/config file:

disable-plugin=bcli

This disables the default Bitcoin backend plugin so trustedcoin can take its place.

If you're running on testnet, signet or liquid trustedcoin will also work automatically.

Using bitcoind

If you have bitcoind available and start lightningd with the settings bitcoin-rpcuser, bitcoin-rpcpassword, and optionally bitcoin-rpcconnect (defaults to 127.0.0.1) and bitcoin-rpcport (defaults to 8332 on mainnet etc.), then trustedcoin will try to use that and fall back to the explorers if it is not available.

Extra: how to bootstrap a Lightning node from scratch, without Bitcoin Core, on Ubuntu amd64

add-apt-repository ppa:lightningnetwork/ppa
apt update
apt install lightningd
mkdir -p ~/.lightning/plugins
echo 'disable-plugin=bcli' >> .lightning/config
cd ~/.lightning/plugins
wget https://github.com/nbd-wtf/trustedcoin/releases/download/v0.6.1/trustedcoin-v0.6.1-linux-amd64.tar.gz
tar -xvf trustedcoin-v0.6.1-linux-amd64.tar.gz
cd
lightningd

How to build

go build

trustedcoin's People

Contributors

5antoshernandez avatar cryptodeity avatar erikarvstedt avatar evd0kim avatar fiatjaf avatar kiwiidb avatar rohankapurdev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

trustedcoin's Issues

Request: GPG-sign releases or commits

While packaging trustedcoin for nix-bitcoin, where we use signature checking for all package releases, I noticed that trustedcoin provides no signatures at all.
Could you add sigs? This would remove Github as a trusted party for distributing trustedcoin.

(Yes, it's slightly amusing to request this for a package like trustedcoin.)

Bug in fee-retrieval logic

I have an intuition that it may be related to channel force-closes.

Oct 15 07:06:57 satoshis-box lightningd[30247]: plugin-trustedcoin returning block 652815, 0000000000000000000a22cf38…, 1415537 bytes
Oct 15 07:07:18 satoshis-box lightningd[30247]: panic: runtime error: invalid memory address or nil pointer dereference
Oct 15 07:07:18 satoshis-box lightningd[30247]: [signal SIGSEGV: segmentation violation code=0x1 addr=0x40 pc=0x746303]
Oct 15 07:07:18 satoshis-box lightningd[30247]: goroutine 393 [running]:
Oct 15 07:07:18 satoshis-box lightningd[30247]: main.getFeeRatesFromEsplora(0xc000326738, 0x0, 0x0)
Oct 15 07:07:18 satoshis-box lightningd[30247]:         /home/fiatjaf/comp/go/src/github.com/fiatjaf/lightningd-gjson-rpc/cmd/trustedcoin/estimatefees.go:23 +0x113
Oct 15 07:07:18 satoshis-box lightningd[30247]: main.main.func3(0xc0000b60f0, 0x0, 0x815e78, 0x0, 0x0, 0x0, 0x0)
Oct 15 07:07:18 satoshis-box lightningd[30247]:         /home/fiatjaf/comp/go/src/github.com/fiatjaf/lightningd-gjson-rpc/cmd/trustedcoin/main.go:90 +0x34
Oct 15 07:07:18 satoshis-box lightningd[30247]: github.com/fiatjaf/lightningd-gjson-rpc/plugin.handleMessage(0xc0000b60f0, 0xc0000582d0, 0xc000484f87, 0x3, 0x784060, 0xc0004
Oct 15 07:07:18 satoshis-box lightningd[30247]:         /home/fiatjaf/comp/go/src/github.com/fiatjaf/lightningd-gjson-rpc/plugin/plugin.go:204 +0x5c2
Oct 15 07:07:18 satoshis-box lightningd[30247]: created by github.com/fiatjaf/lightningd-gjson-rpc/plugin.(*Plugin).Listener
Oct 15 07:07:18 satoshis-box lightningd[30247]:         /home/fiatjaf/comp/go/src/github.com/fiatjaf/lightningd-gjson-rpc/plugin/plugin.go:182 +0xa7e
Oct 15 07:07:20 satoshis-box lightningd[30247]: txprepare: Lost connection to the RPC socket.
Oct 15 07:07:20 satoshis-box lightningd[30247]: keysend: Lost connection to the RPC socket.
Oct 15 07:07:20 satoshis-box lightningd[30247]: autoclean: Lost connection to the RPC socket.
Oct 15 07:07:20 satoshis-box systemd[1]: lightningd.service: Main process exited, code=dumped, status=6/ABRT
Oct 15 07:07:20 satoshis-box systemd[1]: lightningd.service: Failed with result 'core-dump'.

Unable to catch to the tip

On startup the plugin correctly reports tip block, but then is lagging behind and never catches up. It looks like it is not even trying, and just accepts old blocks one by one in ~10 min. intervals, so it can never progress and catch with current block.

(I run this on beefy Ryzen, so it is not by lack of computing power)

Occasional RPC error when running offline

When starting trustedcoin in an offline environment, it sometimes fails with:

error: bad response to getchaininfo (bad 'result' field: Parsing '{result:': object does not have member result), response was {"jsonrpc":"2.0","id":"cln:getchaininfo#15","error":{"code":20,"message":"failed to get tip: Get \"https://mempool.space/api/blocks/tip/height\": dial tcp: lookup mempool.space: no such host","data":null}}

This causes the clightning process to exit with a failure.

cc @seberm

different/changing fee estimates

  1. if you type lightning-cli estimatefees multiple times - the fees jump from one second to the other. i guess this is because the 3 esplora instances return different feerates
  2. the estimates are different from what bitcoind would give as a backend which can lead to some side effects (peers not agreeing on fees for example, leading to closed channels)

the first point i could solve with just using one esplora backend (which kind of makes it less reliable if that backend goes bust, but would be kind of okay) - but i am not sure about the second point. would it be possible to use bitcoind for the estimatefees call and the esplora instances for the rest, especially getting the blocks? i would like to use trustedcoin with a pruned bitcoind backend

i also looked into btc-rpx-proxy (which would support getting missing blocks), but failed to run it on openbsd

edit: maybe i could use something like https://github.com/Toorop/go-bitcoind
edit2: maybe i can tweak trustedcoin itself here to get similar feerates

plugin-trustedcoin getblock error

Hello all, thanks for the plugin we have been using it with our LNBits server for months now. Just recently it keeps on shutting down on us. We went into our terminal again to start lightningd again and we now see this error as it tries to return blocks

plugin-trustedcoin getblock error: readScript: script witness item is larger than the max allowed size [count 33970, max 11000]

any thoughts to help out would be much appreciated

Trustedcoin crashes on startup

2022-10-17T07:58:26.684Z DEBUG   plugin-manager: started(23) /opt/lightningd/plugins/trustedcoin
/opt/lightningd/plugins/trustedcoin: 1: Syntax error: word unexpected (expecting ")")
2022-10-17T07:58:26.689Z DEBUG   plugin-manager: started(24) /opt/lightningd/plugins/poncho_x64
2022-10-17T07:58:26.695Z INFO    plugin-trustedcoin: Killing plugin: exited before replying to getmanifest

Release: https://github.com/nbd-wtf/trustedcoin/releases/download/v0.5.7/trustedcoin-linux-arm64.tar.gz
CLN version 0.12.0

`estimatefees` has changed in CLN version v23.05

estimatefees has changed in CLN version v23.05.

See deprecated section in https://github.com/ElementsProject/lightning/blob/master/CHANGELOG.md#23051---2023-06-05-austin-texas-agreementatxa-ii.

The new spec is (https://github.com/ElementsProject/lightning/blob/master/doc/PLUGINS.md#estimatefees):

estimatefees

Polled by lightningd to get the current feerate, all values must be passed in sat/kVB.

The plugin must return feerate_floor (e.g. 1000 if mempool is
empty), and an array of 0 or more feerates. Each element of
feerates is an object with blocks and feerate, in
ascending-blocks order, for example:

{
	"feerate_floor": <sat per kVB>,
	"feerates": {
		{ "blocks": 2, "feerate": <sat per kVB> },
		{ "blocks": 6, "feerate": <sat per kVB> },
		{ "blocks": 12, "feerate": <sat per kVB> }
		{ "blocks": 100, "feerate": <sat per kVB> }
	}
}

lightningd will currently linearly interpolate to estimate between given blocks (it will not extrapolate, but use the min/max blocks values).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.