Skip to content
Max edited this page Oct 8, 2022 · 14 revisions

For prague:

Create a directory called workshop, which you can remove afterwards to remove all data created by the containers. All following commands are run inside this workshop directory.

mkdir workshop
cd workshop

To run fedimintd via docker with the container name fedimintd:

docker run -d --name fedimintd -p 17440:17440 -p 17340:17340 -p 17240:17240 -v $PWD/demo:/var/fedimint fedimint/fedimintd:f69f4fe5c5acb548751c937ddb614f4bf6df3162 fedimintd /var/fedimint/mint.json /var/fedimint/mint.db --run-setup

Follow the logs with:

docker logs -f fedimintd

Open http://127.0.0.1:17440/ in your browser.

Until we merge distributed key generation, one server acts as dealer and generates all configs and others download them manually from the dealer.

You will need your IP address for the steps below. You can get in the terminal with ip a and look at your wireless interface.

  • Dealer

    • Click "Get Started"
    • Enter your IP
    • Click "Create a Federation"
    • For each guardian they would like to add:
      • Click "add guardian". Enter their name and connection string.
    • To run federation, enter federation name and bitcoin-rpc connection string (user:password@host:port). Then click "Start your Federation".
      • IPv6 IPs not supported here, but if we need to we could add them tomorrow before the workshop.
    • Send client and server configs to each player
      • ("Copy" button might not work if browser doesn't trust the host)
  • Player

    • Click "Get Started"
    • Enter your IP
    • Click "Join a Federation"
    • Copy connection string and send to the dealer
      • ("Copy" button might not work if browser doesn't trust the host)
    • Past in client & federation configs sent to you by dealer
    • Click "download configs"

Network permitting, QR might work with Fluttermint. It did for 2/2 federation Justin + Kody ran in cloud. Connection string will work with mint-client-cli, which can be run in docker as well. You can find all subcommands for mint-client-cli here.

You can create a temporary alias in your current shell called mint-client for easier interaction with the client:

alias mint-client="docker run -v $PWD/demo:/var/fedimint fedimint/mint-client-cli:f69f4fe5c5acb548751c937ddb614f4bf6df3162 mint-client-cli /var/fedimint"

If this server also ran the fedimintd command above, these configs should already be in $PWD/demo due to volume mounting. If not this could download them with:

mint-client join-federation <connection-string>

Deposit some coins

Get your fedimint address

$ mint-client peg-in-address
<DEPOSIT_ADDRESS>

Send 0.0001000 btc to the peg-in address. This returns the transaction ID

$ bitcoin-cli -regtest -rpcconnect=192.168.52.146 -rpcpassword=bitcoin -rpcuser=bitcoin sendtoaddress <DEPOSIT_ADDRESS> 0.00001000
<TRANSACTION_ID>

Get new btc address to mine to

$ bitcoin-cli -regtest -rpcconnect=192.168.52.146 -rpcpassword=bitcoin -rpcuser=bitcoin getnewaddress
<BTC_ADDRESS>

Mine 20 block to just generated address

$ bitcoin-cli -regtest -rpcconnect=192.168.52.146 -rpcpassword=bitcoin -rpcuser=bitcoin generatetoaddress 20 <BTC_ADDRESS>

Generate the proofs using the transaction ID obtained above.

$ bitcoin-cli -regtest -rpcconnect=192.168.52.146 -rpcpassword=bitcoin -rpcuser=bitcoin gettxoutproof '["<TRANSACTION_ID>"]'
<PROOF_HEX_STRING>

Get the raw transaction for the transaction ID.

$ bitcoin-cli -regtest -rpcconnect=192.168.52.146 -rpcpassword=bitcoin -rpcuser=bitcoin getrawtransaction <TRANSACTION_ID>
<RAW_TRANSACTION>

Finalize peg-in:

$ mint-client peg-in <PROOF_HEX_STRING> <RAW_TRANSACTION>
<ANOTHER_TRANSACTION_ID>

Fetch it:

$ mint-client fetch

Show your total amount with info.

$ mint-client info

Handy docker things:

  • If ctrl-c doesn't work to kill docker, try docker ps and docker kill <container-id>
  • If you get the error that the container name is already in use, you can remove the container with docker rm fedimintd.
Clone this wiki locally