This adds a small python script that can be used to fetch Signet coins from the default (or custom) faucet.
contrib: add getcoins.py script to get coins from (signet) faucet #20145
pull kallewoof wants to merge 2 commits into bitcoin:master from kallewoof:202010-signet-getcoins changing 2 files +55 −0-
kallewoof commented at 11:28 PM on October 13, 2020: member
-
contrib: add getcoins.py script to get coins from (signet) faucet 355d0c4f6b
- fanquake added the label Scripts and tools on Oct 13, 2020
- fanquake requested review from ajtowns on Oct 15, 2020
-
laanwj commented at 9:57 AM on October 15, 2020: member
I think this also needs a mention and documentation in some
README.md, probably that incontrib/signet, it's quite hard to discover random scripts. -
ajtowns commented at 10:38 AM on October 15, 2020: member
The script is referenced from https://en.bitcoin.it/wiki/Signet#Using_the_command_line_tool (well the old .sh version anyway) which is probably more helpful for discovering it than a README in the same directory would be?
Probably would be a good idea to update the faucet to give a more helpful error than "Nuh-uh" when the same IP requests multiple times.
Might be interesting to make the rate limit be something like:
requests_from[ip] += 1 amt = int(1.1e8 / 1.1**(requests_from[ip]))so that the first request gets 1 sBTC, the second gets 0.91 sBTC, the third gets 0.82 sBTC, etc; you can do ~120 requests from an IP before you're only getting 1000 sats per request, and it still limits it to 11 sBTC per IP per day.
Note that if you want to pass options to bitcoin-cli you need to use
--so python doesn't try interpreting the options already, eggetcoins.py -c './bitcoin-cli' -- -rpcwallet= -signetACK 355d0c4f6b8a7687a3940a2d90d66b08e560bfa7
-
jonatack commented at 11:09 AM on October 15, 2020: member
Tested as follows:
$ ./contrib/signet/getcoins.py -a tb1qacjkkdgkrm7fc50kws0740cdcnw78xynxgn8p5 Payment of 8.10000000 BTC sent with txid 6690a2ef222544f162e8a68d70169c19a4d77aa8d8eeee963a65f7b45c4dfd21 $ ./contrib/signet/getcoins.py -a tb1q6m9f3sh85ccpvr93xntrvvmt2pf580gq2jchey Nuh-uh...change of VPN location...
$ ./contrib/signet/getcoins.py -a tb1qacjkkdgkrm7fc50kws0740cdcnw78xynxgn8p5 Payment of 7.29000000 BTC sent with txid 4d45e3c0ea795a3e05d38892fb4a007f5c5cd3ea64c4b2cb983d79a987471df8I agree that "Nuh-uh" could be replaced with a more helpful message.
The help formatting could be more readable:
$ ./contrib/signet/getcoins.py -h usage: getcoins.py [-h] [-c CMD] [-f FAUCET] [-a ADDR] [-p PASSWORD] [bitcoin_cli_args [bitcoin_cli_args ...]] Script to get coins from a faucet. positional arguments: bitcoin_cli_args Arguments to pass on to bitcoin-cli (default: -signet) optional arguments: -h, --help show this help message and exit -c CMD, --cmd CMD bitcoin-cli command to use -f FAUCET, --faucet FAUCET URL of the faucet -a ADDR, --addr ADDR Bitcoin address to which the faucet should send -p PASSWORD, --password PASSWORD Faucet password, if any You may need to start with double-dash (--) when providing bitcoin-cli arguments. -
in contrib/signet/getcoins.py:14 in 355d0c4f6b outdated
9 | +import sys 10 | + 11 | +parser = argparse.ArgumentParser(description='Script to get coins from a faucet.', epilog='You may need to start with double-dash (--) when providing bitcoin-cli arguments.') 12 | +parser.add_argument('-c', '--cmd', dest='cmd', default='bitcoin-cli', help='bitcoin-cli command to use') 13 | +parser.add_argument('-f', '--faucet', dest='faucet', default='https://signetfaucet.com/claim', help='URL of the faucet') 14 | +parser.add_argument('-a', '--addr', dest='addr', default='', help='Bitcoin address to which the faucet should send')
jonatack commented at 11:10 AM on October 15, 2020:maybe s/Bitcoin address/signet address/
kallewoof commented at 3:51 AM on October 16, 2020:In theory you can use it for e.g. testnet faucets too, assuming they use the bitcoin-faucet code.
doc: add contrib/signet readme e9c8e6eea2in contrib/signet/getcoins.py:11 in 355d0c4f6b outdated
6 | +import argparse 7 | +import subprocess 8 | +import requests 9 | +import sys 10 | + 11 | +parser = argparse.ArgumentParser(description='Script to get coins from a faucet.', epilog='You may need to start with double-dash (--) when providing bitcoin-cli arguments.')
jonatack commented at 11:11 AM on October 15, 2020:maybe s/coins/signet coins/
kallewoof commented at 3:53 AM on October 16, 2020: memberUpdated the error message when using faucet 2nd time. I intend to replace the 1-per-IP-per-day rule with a system where you can pick the amount you want and it lets you get up to a certain amount per hour, but haven't gotten around to it yet.
DrahtBot commented at 2:19 PM on November 11, 2020: member<!--e57a25ab6845829454e8d69fc972939a-->
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
<!--174a7506f384e20aa4161008e828411d-->
Conflicts
Reviewers, this pull request conflicts with the following ones:
- #19937 (signet mining utility by ajtowns)
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.
laanwj commented at 11:08 AM on November 19, 2020: memberCode and documentation review ACK e9c8e6eea2dde6ccd5f685956392ee70c8cfefb7
laanwj merged this on Nov 19, 2020laanwj closed this on Nov 19, 2020in contrib/signet/README.md:12 in e9c8e6eea2
7 | + 8 | +A script to call a faucet to get Signet coins. 9 | + 10 | +Syntax: `getcoins.py [-h|--help] [-c|--cmd=<bitcoin-cli path>] [-f|--faucet=<faucet URL>] [-a|--addr=<signet bech32 address>] [-p|--password=<faucet password>] [--] [<bitcoin-cli args>]` 11 | + 12 | +* `--cmd` lets you customize the bitcoin-cli path. By default it will look for it in the PATH
MarcoFalke commented at 11:23 AM on November 19, 2020:nit: Instead of duplicating the help with varying verbosity and details, you could write it one (in python) and then just mention in the readme to call
getcoins.py --helpto get the up-to-date help.This avoid conflicting and outdated markdown help texts.
in contrib/signet/getcoins.py:36 in e9c8e6eea2
31 | +try: 32 | + res = requests.post(args.faucet, data=data) 33 | +except: 34 | + print('Unexpected error when contacting faucet:', sys.exc_info()[0]) 35 | + exit() 36 | +print(res.text)
MarcoFalke commented at 11:27 AM on November 19, 2020:I am wondering if this should be escaped, as those are raw bytes from the network that could contain any instructions or commands, telling the user to run them.
sidhujag referenced this in commit 66916381c4 on Nov 19, 2020PastaPastaPasta referenced this in commit b343a651a9 on Jun 27, 2021PastaPastaPasta referenced this in commit fbf2ce7d80 on Jun 28, 2021PastaPastaPasta referenced this in commit 12a4f9d662 on Jun 29, 2021PastaPastaPasta referenced this in commit 94806a50d4 on Jul 1, 2021PastaPastaPasta referenced this in commit c2daa70bcb on Jul 1, 2021PastaPastaPasta referenced this in commit f74d64ee97 on Jul 15, 2021PastaPastaPasta referenced this in commit f2d2b120ae on Jul 15, 2021PastaPastaPasta referenced this in commit bd30b851f7 on Sep 17, 2021DrahtBot locked this on Feb 15, 2022
github-metadata-mirror
This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-14 18:14 UTC
This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me