localnet/darkfid: Add some instructions to the README

This commit is contained in:
parazyd
2022-12-06 12:37:42 +01:00
parent 403971b419
commit 17f999449c

View File

@@ -5,3 +5,94 @@ This will start three darkfid and one faucetd network. Two of the
darkfid participate in the consensus, and one is just a sync node.
The faucetd is able to airdrop arbitrary tokens into wallets.
| Node | RPC endpoint | Consensus |
|------------|------------------------|-----------|
| `darkfid0` | `tcp://127.0.0.1:8340` | `true` |
| `darkfid1` | `tcp://127.0.0.1:8440` | `true` |
| `darkfid2` | `tcp://127.0.0.1:8540` | `false` |
| `faucetd` | `tcp://127.0.0.1:8640` | `false` |
## Initialize wallets
```
$ ./drk -e tcp://127.0.0.1:8340 wallet --initialize
$ ./drk -e tcp://127.0.0.1:8340 wallet --keygen
$ ./drk -e tcp://127.0.0.1:8440 wallet --initialize
$ ./drk -e tcp://127.0.0.1:8440 wallet --keygen
$ ./drk -e tcp://127.0.0.1:8540 wallet --initialize
$ ./drk -e tcp://127.0.0.1:8540 wallet --keygen
```
Make note of the addresses given by `keygen`.
## Airdrops
Let's airdrop some money do `darkfid1` and `darkfid2`. For this to
work, we also need to subscribe to their RPC endpoints so we can scan
incoming blocks and add them to our wallet.
```
$ ./drk -e tcp://127.0.0.1:8440 subscribe
$ ./drk -e tcp://127.0.0.1:8540 subscribe
```
And now we can execute our airdrop calls:
```
$ ./drk -e tcp://127.0.0.1:8440 airdrop -f tcp://127.0.0.1:8640 \
15.57 A7f1RKsCUUHrSXA7a9ogmwg8p3bs6F47ggsW826HD4yd
$ ./drk -e tcp://127.0.0.1:8540 airdrop -f tcp://127.0.0.1:8640 \
66.31 BNBZ9YprWvEGMYHW4dFvbLuLfHnN9Bs64zuTFQAbw9Dy
```
If successful, `drk` should give a transaction ID. Now watch the
network and wait until the blocks with these transactions get
finalized.
Then you can check the wallets' balances:
```
$ ./drk -e tcp://127.0.0.1:8440 wallet --balance
$ ./drk -e tcp://127.0.0.1:8540 wallet --balance
```
## Payments
Now let's try to send a little bit of funds from `darkfid1` to
`darkfid2`:
```
$ ./drk -e tcp://127.0.0.1:8440 transfer 1.33 \
A7f1RKsCUUHrSXA7a9ogmwg8p3bs6F47ggsW826HD4yd \
6uw3S12RWnhikrrTrtVsTJFQQdc5i9QWoVLUEfGd8B5Z \
> transaction
```
The command will build proving keys, and create a transaction on
stdout which you should redirect into a file.
You can optionally inspect this transaction:
```
$ ./drk -e tcp://127.0.0.1:8440 inspect < transaction
```
And then we broadcast it:
```
$ ./drk -e tcp://127.0.0.1:8440 broadcast < transaction
```
On success, you should see a transaction ID.
Now wait again until the tx is finalized and scanned by your `drk`
subscribers so you'll see the balance changes.
## Swaps
TODO