Просмотр исходного кода

tutorial: changed transfer to send/receive and documented withdraw

lunar-mining 4 лет назад
Родитель
Сommit
f2164f2c28
1 измененных файлов с 120 добавлено и 18 удалено
  1. 120 18
      doc/tutorial.md

+ 120 - 18
doc/tutorial.md

@@ -1,3 +1,5 @@
+# DarkFi User Tutorial
+
 Welcome to the dark renaissance. This tutorial will teach you how to
 Welcome to the dark renaissance. This tutorial will teach you how to
 install darkfi on your system, and how to use the testnet to send and
 install darkfi on your system, and how to use the testnet to send and
 receive anonymous tokens.
 receive anonymous tokens.
@@ -18,7 +20,7 @@ $ git clone https://github.com/darkrenaissance/darkfi
 
 
 In the project root directory, run provided Makefile. This will download
 In the project root directory, run provided Makefile. This will download
 the trusted setup params and compile the source code. This might take
 the trusted setup params and compile the source code. This might take
-some time.
+a while.
 
 
 ```
 ```
 $ make
 $ make
@@ -26,10 +28,10 @@ $ make
 
 
 ## Install
 ## Install
 
 
-We will now install the project. This will install the binaries on
-your device in /usr/local, so you can run darkfi from the command-line
+We will now install the project. This will install the binaries on your
+device in `/usr/local`, so you can run darkfi from the command-line
 directly. It will also create a new directory for config files at
 directly. It will also create a new directory for config files at
-$HOME/.config/darkfi.
+`$HOME/.config/darkfi`.
 
 
 Feel free to review the installed config files, but you don't need to
 Feel free to review the installed config files, but you don't need to
 change anything to run the testnet. The defaults will work fine.
 change anything to run the testnet. The defaults will work fine.
@@ -94,14 +96,21 @@ We'll go through the main features one by one. Let's start by depositing
 some coins into darkfi.
 some coins into darkfi.
 
 
 First, we need testnet coins on either Bitcoin or Solana. For
 First, we need testnet coins on either Bitcoin or Solana. For
-Bitcoin these can be acquired from a faucet like [this one](https://testnet-faucet.mempool.co/).
-You will need to switch your Bitcoin wallet to testnet mode.
+Bitcoin these can be acquired from a faucet like [this
+one](https://testnet-faucet.mempool.co/). You will need to switch your
+Bitcoin wallet to testnet mode.
+
+If you don't have a Bitcoin wallet, [Electrum](https://electrum.org/)
+is an excellent option. Configuring Electrum
+for testnet depends on the operating system: see [this
+tutorial](https://bitzuma.com/posts/a-beginners-guide-to-the-electrum-bitcoin-wallet/#testnet-on-ubuntu)
+for more details.
 
 
-For Solana, you can either install the Solana command-line suite or
-use [sollet](sollet.io).
+For Solana, you can either install the Solana command-line suite or use
+[sollet](sollet.io).
 
 
 Follow [this tutorial](https://docs.solana.com/cli) for the Solana
 Follow [this tutorial](https://docs.solana.com/cli) for the Solana
-command-line For sollet.io, switch the network to testnet and click
+command-line. For sollet.io, switch the network to testnet and click
 'Request Airdrop' to airdrop yourself some testnet coins.
 'Request Airdrop' to airdrop yourself some testnet coins.
 
 
 Now that we have testnet coins we can deposit into darkfi.
 Now that we have testnet coins we can deposit into darkfi.
@@ -109,7 +118,8 @@ Now that we have testnet coins we can deposit into darkfi.
 We'll do this by sending testnet coins to the darki cashier, which will
 We'll do this by sending testnet coins to the darki cashier, which will
 issue darkened versions of the deposted coin. This process of darkening
 issue darkened versions of the deposted coin. This process of darkening
 involves the cashier minting new anonymous tokens that are 1:1 redeemable
 involves the cashier minting new anonymous tokens that are 1:1 redeemable
-for deposits.
+for deposits. For example, if you deposit 1 BTC, you will receive 1 dBTC,
+or darkened SOL.
 
 
 To deposit testnet BTC:
 To deposit testnet BTC:
 
 
@@ -132,7 +142,7 @@ $ drk deposit [ASSET] --network solana
 
 
 ```
 ```
 
 
-This command will send a deposit request to the cashier.  After running
+This command will send a deposit request to the cashier. After running
 it, you should get an address printed to your terminal, like this:
 it, you should get an address printed to your terminal, like this:
 
 
 ```
 ```
@@ -142,7 +152,7 @@ Deposit your coins to the following address: "734JBp3FRPoDs6ibSMyq3CV9zyMiDeynxM
 Using Bitcoin or Solana, deposit the desired tokens to the specified
 Using Bitcoin or Solana, deposit the desired tokens to the specified
 address. Wait a moment- it should take about 30 seconds to receive your
 address. Wait a moment- it should take about 30 seconds to receive your
 deposit. You can follow the progress on the terminal window where you ran
 deposit. You can follow the progress on the terminal window where you ran
-`darkfid`.  Then check your updated balance, like so:
+`darkfid`. Then check your updated balance, like so:
 
 
 ```
 ```
 $ drk wallet --balances
 $ drk wallet --balances
@@ -155,7 +165,7 @@ $ drk wallet --balances
 
 
 ```
 ```
 
 
-## Transfer
+## Send
 
 
 Now that you have darkened tokens inside darkfi, you can send them
 Now that you have darkened tokens inside darkfi, you can send them
 around anonymously.
 around anonymously.
@@ -167,20 +177,112 @@ address. Then run the transfer command:
 $ drk transfer <TOKEN> <ADDRESS> <AMOUNT>
 $ drk transfer <TOKEN> <ADDRESS> <AMOUNT>
 ```
 ```
 
 
-For example, to transfer 1 SOL to a user at XXX address, you would run
-the following command:
+For example, to transfer 1 SOL to a user at
+9GmLk7kkbxhsbLTYFMeg6FyuQJV9Na2GcJYFNrs3VLkv address, you would run the
+following command:
+
+```
+$ drk transfer sol 9GmLk7kkbxhsbLTYFMeg6FyuQJV9Na2GcJYFNrs3VLkv 1
+```
+
+## Receive
+
+To receive anonymous tokens your darkfid account, you must retrieve your
+darkfi address. Send this address to others so they can send you tokens.
 
 
 ```
 ```
-$ drk transfer sol <ADDRESS> 1
+$ drk wallet --address
+    
+Wallet address: "9GmLk7kkbxhsbLTYFMeg6FyuQJV9Na2GcJYFNrs3VLkv"
 ```
 ```
 
 
 ## Withdraw
 ## Withdraw
 
 
-TODO
+Withdrawing your testnet funds can be done at any time. This will exchange
+your anonymous darkened tokens for their underlying collaterol, i.e. if
+you have 1 dBTC you will receive 1 BTC.
+
+To do so, simply send the following request to the cashier:
+
+```
+$ drk withdraw <TOKENSYM> <ADDRESS> <AMOUNT> --network <network>
+```
+
+For example, if you want to withdraw 0.5 SOL to the Solana address
+4q7rkNvH5BVs6VLz6nyhKLvqXmwDyjGnUsE5sZzRNgp4, you would write:
+
+```
+$ drk withdraw sol 4q7rkNvH5BVs6VLz6nyhKLvqXmwDyjGnUsE5sZzRNgp4 0.5 --network solana
+```
+
+For Bitcoin, the command would look like this:
+
+```
+$ drk withdraw btc bc1qw7nt2yca0zykh8a5sc6nmy3r3clx4ha206wepn 0.5 --network bitcoin
+```
 
 
 ## Configure
 ## Configure
 
 
 DarkFi is highly configurable by design. Key system parameters can be
 DarkFi is highly configurable by design. Key system parameters can be
 changed inside the config files.
 changed inside the config files.
 
 
-TODO
+This is the darkfid config file. Your local copy can be found in
+`~/.config/darkfi`.
+
+```
+## darkfid configuration file
+##
+## Please make sure you go through all the settings so you can configure
+## your daemon properly.
+
+# The address where darkfid should bind its RPC socket
+rpc_listen_address = "127.0.0.1:8000"
+
+# Whether to listen with TLS or plain TCP
+serve_tls = false
+
+# Path to DER-formatted PKCS#12 archive. (Unused if serve_tls=false)
+# This can be created using openssl:
+# openssl pkcs12 -export -out identity.pfx -inkey key.pem -in cert.pem -certfile chain_certs.pem
+tls_identity_path = "~/.config/darkfi/darkfid_identity.pfx"
+
+# Password for the created TLS identity. (Unused if serve_tls=false)
+tls_identity_password = "FOOBAR"
+
+# The endpoint to a gatewayd protocol API
+gateway_protocol_url = "tcp://185.165.171.77:3333"
+
+# The endpoint to a gatewayd publisher API
+gateway_publisher_url = "tcp://185.165.171.77:4444"
+
+# Path to mint.params
+mint_params_path = "~/.config/darkfi/mint.params"
+
+# Path to spend.params
+spend_params_path = "~/.config/darkfi/spend.params"
+
+# Path to the client database
+database_path = "~/.config/darkfi/darkfid_client.db"
+
+# Path to the wallet database
+wallet_path = "~/.config/darkfi/darkfid_wallet.db"
+
+# The wallet password
+wallet_password = "TEST_PASSWORD"
+
+# The configured cashiers to use.
+[[cashiers]]
+
+# Cashier name
+name = "testnet.cashier.dark.fi"
+
+# The RPC endpoint for a selected cashier
+#rpc_url = "tcp://127.0.0.1:9000"
+rpc_url = "tcp://185.165.171.77:9000"
+
+# The selected cashier public key
+public_key = "2MezH7FrtzGwtEEeTU8anM2b67Nzfv8XsojggGUavCUd"
+```  
+
+You can set up a custom cashier on your local host. To do so, following
+this tutorial: [].