Skip to content

Instantly share code, notes, and snippets.

Last active December 15, 2022 20:25
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save whoabuddy/05e98cd8d83a671f39e8c15d6a6a5e9d to your computer and use it in GitHub Desktop.
Instructions to send tBTC back to the Krypton faucet

Replenishing the Krypton Faucet

With the faucet running dry over the holiday, we are asking that anyone with excess tBTC please return some to the faucet.

In order to do this, you will need local bitcoind running alongside stacks-node.

Note: this gist assumes you are using the defaults in LNow's original gist. If not, you may need to manually adjust some of the file locations.

Bitcoin conf update

Edit the bitcoin.conf file and add mintxfee and txconfirmtarget under [regtest]. I used the nano text editor.

nano $HOME/bitcoin/bitcoin.conf

Restart bitcoind to recognize new conf

Now stop and start bitcoind using the bitcoin-cli.

Be sure that the port, user, and password match your bitcoind configuration.

$HOME/bitcoin/bitcoin-0.20.1/bin/bitcoin-cli -regtest -rpcport=19443 -rpcuser=user -rpcpassword=password stop
$HOME/bitcoin/bitcoin-0.20.1/bin/bitcoind -conf=$HOME/bitcoin/bitcoin.conf

Use mnemonic phrase to get private wallet key

The stacks-gen tool from psq can accept a mnemonic phrase and generate the same testnet keychain, but also includes a wif value that can be imported into bitcoind.

This way, the local bitcoind instance will recognize your wallet and allow you to send funds from it.

npx -q stacks-gen sk --testnet --phrase "put 24 word phrase here" > $HOME/keychain-sg.json

The new keychain info is saved in keychain-sg.json and the wif value is used in the next step.

To view the keychain info:

cat $HOME/keychain-sg.json

Import private wallet key into bitcoind

$HOME/bitcoin/bitcoin-0.20.1/bin/bitcoin-cli -regtest -rpcport=19443 -rpcuser=user -rpcpassword=password importprivkey "wif-value" "wallet-name"

If this command is successful, you should be able to view your current wallet balance from bitcoind using the command below.

$HOME/bitcoin/bitcoin-0.20.1/bin/bitcoin-cli -regtest -rpcport=19443 -rpcuser=user -rpcpassword=password getwalletinfo

Sending funds back to the faucet

The command below will send funds to the faucet, please be sure the tBTC address matches the contents below and change BTCAMOUNT to match the amount of tBTC you want to send.

txid=$($HOME/bitcoin/bitcoin-0.20.1/bin/bitcoin-cli -regtest -rpcport=19443 -rpcuser=user -rpcpassword=password sendtoaddress my5G8TSCYKARY6VLQ7e2xGo2qGzPj4Xe8S BTCAMOUNT)

To see the transaction ID, you can then type:

echo $txid

Which will return a txid formatted like b5f4a42b79dade9616cce6e95e8a6420dfc619920d3926fd3c735e1b2f36b951 if successful.

After a few minutes, you should see your tBTC address drop by the BTCAMOUNT value used above.

If you took the time to follow this tutorial, THANK YOU for being a team player! 🙌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment