urbit/DEMO.md

102 lines
2.5 KiB
Markdown
Raw Normal View History

2020-12-11 14:15:25 +03:00
# Bitcoin Demo/Integration Test
Dec 9, 2020
Can use as the base of an integration test.
## Start Services
Runs the full node API services.
```
./local-start.sh
```
2021-02-01 13:15:40 +03:00
## Start Agents and set XPUBs
On `~zod`. Uses "abandon abandon..." mnemonic
2020-12-11 14:15:25 +03:00
```
2021-02-14 13:17:58 +03:00
=network %main
=network %testnet
|commit %home
2020-12-11 14:15:25 +03:00
|start %btc-provider
|start %btc-wallet
2020-12-11 14:15:25 +03:00
2021-02-14 13:17:58 +03:00
:btc-provider|command [%set-credentials api-url='http://localhost:50002' network]
2021-02-15 11:23:56 +03:00
:btc-wallet|command [%set-provider ~zod]
:btc-provider|command [%add-whitelist %users `(set ship)`(sy ~[~dopzod])]
2021-02-01 13:15:40 +03:00
=fprint [%4 0xbeef.dead]
=xpubmain 'zpub6rFR7y4Q2AijBEqTUquhVz398htDFrtymD9xYYfG1m4wAcvPhXNfE3EfH1r1ADqtfSdVCToUG868RvUUkgDKf31mGDtKsAYz2oz2AGutZYs'
=xpubtest 'vpub5Y6cjg78GGuNLsaPhmYsiw4gYX3HoQiRBiSwDaBXKUafCt9bNwWQiitDk5VZ5BVxYnQdwoTyXSs2JHRPAgjAvtbBrf8ZhDYe2jWAqvZVnsc'
2020-12-11 14:15:25 +03:00
```
2021-02-01 13:15:40 +03:00
On `~dopzod`. Uses "absurd sick..." mnemonic from PRIVATE.scratch.md
2020-12-11 14:15:25 +03:00
```
|commit %home
|start %btc-wallet
2021-02-02 12:04:59 +03:00
2021-02-15 11:23:56 +03:00
:btc-wallet|command [%set-provider ~zod]
2021-02-01 13:15:40 +03:00
=fprint [%4 0xdead.beef]
=xpubmain 'zpub6r8dKyWJ31XF6n69KKeEwLjVC5ruqAbiJ4QCqLsrV36Mvx9WEjUaiPNPGFLHNCCqgCdy6iZC8ZgHsm6a1AUTVBMVbKGemNcWFcwBGSjJKbD'
=xpubtest 'vpub5ZpY66FvUHYMSST9uWoUSFYBYxGx3aSFfQP8qg2HqGUuL8k9ReiWuKxSKZBwFmBKug8YStuGTmxsnL8ySc9dfPJQdJTM4dYAZcgJhSfRWKL'
2020-12-11 14:15:25 +03:00
```
### Add Wallets
2021-02-01 13:15:40 +03:00
On both `~zod`/`dopzod`, choose depending on whether you're on test or main
2021-02-14 13:17:58 +03:00
Using 1 confirmation for testing.
2020-12-11 14:15:25 +03:00
```
2021-02-14 13:17:58 +03:00
:btc-wallet|command [%add-wallet xpubmain fprint ~ [~ 8] [~ 1]]
2020-12-11 14:15:25 +03:00
2021-02-14 13:17:58 +03:00
:btc-wallet|command [%add-wallet xpubtest fprint ~ [~ 8] [~ 1]]
```
2020-12-11 14:15:25 +03:00
## Check Balance
`~dopzod`
```
2021-02-13 15:49:11 +03:00
.^((unit @ud) %gx /=btc-wallet=/balance/[xpubmain]/noun)
2021-02-01 13:15:40 +03:00
2021-02-13 15:49:11 +03:00
.^((unit @ud) %gx /=btc-wallet=/balance/[xpubtest]/noun)
2020-12-11 14:15:25 +03:00
```
## Pay a Ship
`~dopzod` will pay `~zod`. Both are acting as clients here (and use `~zod` as the provider).
`~dopzod`
```
2021-02-21 14:23:31 +03:00
:btc-wallet|command [%req-pay-address ~zod 20.000 feyb=10]
2020-12-11 14:15:25 +03:00
```
### Check State on ~zod/~dopzod
`~dopzod`: outgoing
```
2021-02-14 13:17:58 +03:00
:btc-wallet +dbug [%state 'poym']
2020-12-11 14:15:25 +03:00
```
`~zod`: incoming
```
2021-02-14 13:17:58 +03:00
:btc-wallet +dbug [%state 'piym']
2020-12-11 14:15:25 +03:00
```
### Idempotent
`~dopzod`
```
2021-02-14 13:17:58 +03:00
:btc-wallet|command [%req-pay-address ~zod 3.000 feyb=100]
2020-12-11 14:15:25 +03:00
```
Or can change amount:
```
2021-02-14 13:17:58 +03:00
:btc-wallet|command [%req-pay-address ~zod 3.000 feyb=100]
2020-12-11 14:15:25 +03:00
```
### Broadcast the Signed TX
```
2021-02-14 13:17:58 +03:00
:btc-wallet|command [%broadcast-tx tx]
```
2020-12-11 14:15:25 +03:00
## Scan a Real Xpub
```
=realxpub 'zpub6qvniDfrk9sRxz7H9Cbr8fccuGNd4RGMmifPVvbQtqtsG7VwCUrNsnNt8DiCH8kxh3vsDuJkfNqZQspVq2xEbE64fgXT5hVJiD8WkRhvuJc'
=fprint [%4 0xc93d.865c]
:btc-wallet|command [%add-wallet realxpub fprint ~ [~ 6] [~ 6]]
2020-12-11 14:15:25 +03:00
.^(@ud %gx /=btc-wallet=/balance/[realxpub]/noun)
2020-12-11 14:15:25 +03:00
```