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
|
|
|
|
```
|
|
|
|
|
|
|
|
## Start Agents
|
|
|
|
On `~zod`
|
|
|
|
```
|
2020-12-11 16:13:00 +03:00
|
|
|
|commit %home
|
2020-12-11 14:15:25 +03:00
|
|
|
|start %btc-provider
|
|
|
|
|start %btc-wallet-hook
|
|
|
|
|start %btc-wallet-store
|
|
|
|
|
2021-01-28 14:03:53 +03:00
|
|
|
:btc-provider|command [%set-credentials api-url='http://localhost:50002' %main]
|
|
|
|
:btc-wallet-hook|action [%set-provider ~zod %main]
|
2020-12-11 16:13:00 +03:00
|
|
|
:btc-provider|command [%whitelist-clients `(set ship)`(sy ~[~dopzod])]
|
2020-12-11 14:15:25 +03:00
|
|
|
```
|
|
|
|
|
|
|
|
On `~dopzod`
|
|
|
|
```
|
2020-12-11 16:13:00 +03:00
|
|
|
|commit %home
|
2020-12-11 14:15:25 +03:00
|
|
|
|start %btc-wallet-hook
|
|
|
|
|start %btc-wallet-store
|
2021-01-28 14:03:53 +03:00
|
|
|
:btc-wallet-hook|action [%set-provider ~zod %main]
|
2020-12-11 14:15:25 +03:00
|
|
|
```
|
|
|
|
|
2020-12-11 16:13:00 +03:00
|
|
|
### Add Wallets
|
2020-12-11 14:15:25 +03:00
|
|
|
`~dopzod`
|
|
|
|
XPUB is the "absurd sick..." mnemonic
|
|
|
|
```
|
|
|
|
=xpubp 'zpub6r8dKyWJ31XF6n69KKeEwLjVC5ruqAbiJ4QCqLsrV36Mvx9WEjUaiPNPGFLHNCCqgCdy6iZC8ZgHsm6a1AUTVBMVbKGemNcWFcwBGSjJKbD'
|
|
|
|
=fprint [%4 0xbeef.dead]
|
|
|
|
:btc-wallet-store|action [%add-wallet xpubp fprint ~ [~ 8] [~ 6]]
|
|
|
|
```
|
|
|
|
|
2020-12-11 16:13:00 +03:00
|
|
|
`~zod`
|
|
|
|
```
|
|
|
|
=xpubzod 'zpub6rFR7y4Q2AijBEqTUquhVz398htDFrtymD9xYYfG1m4wAcvPhXNfE3EfH1r1ADqtfSdVCToUG868RvUUkgDKf31mGDtKsAYz2oz2AGutZYs'
|
|
|
|
=fprint [%4 0xbeef.dead]
|
|
|
|
:btc-wallet-store|action [%add-wallet xpubzod fprint ~ [~ 8] [~ 6]]
|
|
|
|
```
|
2020-12-11 14:15:25 +03:00
|
|
|
|
|
|
|
## Check Balance
|
|
|
|
`~dopzod`
|
|
|
|
```
|
|
|
|
.^(@ud %gx /=btc-wallet-store=/balance/[xpubp]/noun)
|
|
|
|
```
|
|
|
|
|
|
|
|
## Pay a Ship
|
|
|
|
`~dopzod` will pay `~zod`. Both are acting as clients here (and use `~zod` as the provider).
|
|
|
|
|
|
|
|
`~dopzod`
|
|
|
|
```
|
2020-12-18 17:51:31 +03:00
|
|
|
:btc-wallet-hook|action [%req-pay-address ~zod 3.000 feyb=[~ 30]]
|
2020-12-11 14:15:25 +03:00
|
|
|
```
|
|
|
|
|
|
|
|
### Check State on ~zod/~dopzod
|
|
|
|
`~dopzod`: outgoing
|
|
|
|
```
|
|
|
|
:btc-wallet-hook +dbug [%state 'poym']
|
|
|
|
```
|
|
|
|
|
|
|
|
`~zod`: incoming
|
|
|
|
```
|
|
|
|
:btc-wallet-hook +dbug [%state 'piym']
|
|
|
|
```
|
|
|
|
|
|
|
|
### Idempotent
|
|
|
|
`~dopzod`
|
|
|
|
```
|
2020-12-18 12:11:48 +03:00
|
|
|
:btc-wallet-hook|action [%req-pay-address ~zod 3.000 feyb=[~ 100]]
|
2020-12-11 14:15:25 +03:00
|
|
|
```
|
|
|
|
Or can change amount:
|
|
|
|
```
|
2020-12-18 12:11:48 +03:00
|
|
|
:btc-wallet-hook|action [%req-pay-address ~zod 3.000 feyb=[~ 100]]
|
2020-12-11 14:15:25 +03:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
## Scan a Real Xpub
|
|
|
|
```
|
|
|
|
=realxpub 'zpub6qvniDfrk9sRxz7H9Cbr8fccuGNd4RGMmifPVvbQtqtsG7VwCUrNsnNt8DiCH8kxh3vsDuJkfNqZQspVq2xEbE64fgXT5hVJiD8WkRhvuJc'
|
|
|
|
=fprint [%4 0xc93d.865c]
|
|
|
|
:btc-wallet-store|action [%add-wallet realxpub fprint ~ [~ 6] [~ 6]]
|
|
|
|
|
|
|
|
.^(@ud %gx /=btc-wallet-store=/balance/[realxpub]/noun)
|
|
|
|
```
|