# Cardano Shelley Transactions
You can learn a lot by looking through the https://github.com/vacuumlabs/adalite wallet.
PSDK uses https://github.com/vacuumlabs/cardano-crypto.js for keys/addresses; cardano-crypto.js has sign/verify & encoding functions too.
## Misc Setup
<details><summary>[cardano-wallet] node setup via docker:</summary>
1) [https://github.com/input-output-hk/cardano-wallet](https://github.com/input-output-hk/cardano-wallet)
```
git clone https://github.com/input-output-hk/cardano-wallet
cd cardano-wallet
```
2) ```shell
NETWORK=testnet docker-compose up
```
3) Test with
```bash
curl http://localhost:8100/api/txs/last
```
</details>
## Misc Examples
<details><summary>[cardano-wallet] create wallet</summary>
```shell
docker run -i --network host --rm inputoutput/cardano-wallet wallet create from-recovery-phrase mnemonic.phrase --port 8090 --address-pool-gap 10
Please enter a 15–24 word recovery phrase:
excess behave track soul table wear ocean cash stay nature item turtle palm soccer lunch horror start stumble month panic right must lock dress
(Enter a blank line if you do not wish to use a second factor.)
Please enter a 9–12 word second factor:
Please enter a passphrase:
passphrase is too short: expected at least 10 characters
Please enter a passphrase: 1234567890
**********
Enter the passphrase a second time: 1234567890
**********
Ok.
```
```json
{
"passphrase": {
"last_updated_at": "2021-01-25T19:46:56.817376909Z"
},
"address_pool_gap": 10,
"state": {
"status": "syncing",
"progress": {
"quantity": 0,
"unit": "percent"
}
},
"balance": {
"reward": {
"quantity": 0,
"unit": "lovelace"
},
"total": {
"quantity": 0,
"unit": "lovelace"
},
"available": {
"quantity": 0,
"unit": "lovelace"
}
},
"name": "mnemonic.phrase",
"delegation": {
"next": [],
"active": {
"status": "not_delegating"
}
},
"id": "98c83431e94407bc0889e09953461fe5cecfdf18",
"tip": {
"height": {
"quantity": 0,
"unit": "block"
},
"time": "2019-07-24T20:20:16Z",
"epoch_number": 0,
"absolute_slot_number": 0,
"slot_number": 0
}
}
```
</details>
<details><summary>[cardano-wallet] get wallet addresses</summary>
```shell
docker run -i --network host --rm inputoutput/cardano-wallet address list 98c83431e94407bc0889e09953461fe5cecfdf18
Ok.
```
```json
[
{
"state": "used",
"id": "addr_test1qqy6nhfyks7wdu3dudslys37v252w2nwhv0fw2nfawemmn8k8ttq8f3gag0h89aepvx3xf69g0l9pf80tqv7cve0l33sw96paj"
},
{
"state": "unused",
"id": "addr_test1qrhvwtn8sa3duzkm93v5kjjxlv5lvg67j530wyeumngu23lk8ttq8f3gag0h89aepvx3xf69g0l9pf80tqv7cve0l33s4s8xvh"
},
{
"state": "unused",
"id": "addr_test1qrtlcnmfdyarpscqxa6nthjz0na7xyz3fa8vt3yjw2y5gs8k8ttq8f3gag0h89aepvx3xf69g0l9pf80tqv7cve0l33saf6px4"
},
{
"state": "unused",
"id": "addr_test1qzawae46edstqpdy84hhymuldnflyup0kjrp9ss5mgzvgplk8ttq8f3gag0h89aepvx3xf69g0l9pf80tqv7cve0l33sfwe8sv"
},
{
"state": "unused",
"id": "addr_test1qr37u32sathht33rxpfk80yrexxkypqyl9hg5c77lw5n58lk8ttq8f3gag0h89aepvx3xf69g0l9pf80tqv7cve0l33sy2mmsd"
},
{
"state": "unused",
"id": "addr_test1qz6uqrj8jqtylttlrtn0wsh084jp58z8r2fkfhuun5nasw8k8ttq8f3gag0h89aepvx3xf69g0l9pf80tqv7cve0l33s06dfg3"
},
{
"state": "unused",
"id": "addr_test1qzvq73tc9m40m0jnmttkmf74p2lx5thuhsclu03chd0xkshk8ttq8f3gag0h89aepvx3xf69g0l9pf80tqv7cve0l33sqqr8zu"
},
{
"state": "unused",
"id": "addr_test1qqq2jxjrrq8apv4u3gy9mjrufvs42myzasd65crwuhyvlp0k8ttq8f3gag0h89aepvx3xf69g0l9pf80tqv7cve0l33s883mq6"
},
{
"state": "unused",
"id": "addr_test1qrlge3t2tmlh7t2mmaas5gy7a82q5cdsuddhlff949xntmlk8ttq8f3gag0h89aepvx3xf69g0l9pf80tqv7cve0l33sncpvd9"
},
{
"state": "unused",
"id": "addr_test1qpf2jx3ndwqmldj89e9vpqcwmsw6h4wejp4gywz40wckmzlk8ttq8f3gag0h89aepvx3xf69g0l9pf80tqv7cve0l33suyy5ja"
},
{
"state": "unused",
"id": "addr_test1qq9nms699rfkkmrs9m4kml466kk034uvhz48p0plq2lld00k8ttq8f3gag0h89aepvx3xf69g0l9pf80tqv7cve0l33snh2d4v"
}
]
```
</details>
<details><summary>[cardano-wallet] wallet utxos</summary>
```shell
curl http://localhost:8090/v2/wallets/98c83431e94407bc0889e09953461fe5cecfdf18/statistics/utxos | json_pp
# or
docker run --network host --rm inputoutput/cardano-wallet wallet utxo 98c83431e94407bc0889e09953461fe5cecfdf18
```
```json
{
"scale" : "log10",
"total" : {
"unit" : "lovelace",
"quantity" : 2000000000
},
"distribution" : {
"100" : 0,
"1000000000000000" : 0,
"1000000000000" : 0,
"1000" : 0,
"10000" : 0,
"100000" : 0,
"1000000000" : 2,
"1000000" : 0,
"100000000" : 0,
"45000000000000000" : 0,
"10000000000000000" : 0,
"10000000" : 0,
"10" : 0,
"100000000000" : 0,
"100000000000000" : 0,
"10000000000000" : 0,
"10000000000" : 0
}
}
```
</details>
<details><summary>[cardano-wallet] get network tip</summary>
curl http://localhost:8090/v2/network/information | json_pp
```json
{
"network_tip": {
"time": "2021-01-25T19:38:41Z",
"epoch_number": 110,
"absolute_slot_number": 17234305,
"slot_number": 83905
},
"node_tip": {
"height": {
"quantity": 2259891,
"unit": "block"
},
"time": "2021-01-25T19:38:39Z",
"epoch_number": 110,
"absolute_slot_number": 17234303,
"slot_number": 83903
},
"sync_progress": {
"status": "ready"
},
"next_epoch": {
"epoch_start_time": "2021-01-29T20:20:16Z",
"epoch_number": 111
}
}
```
</details>
## Misc Links
- https://docs.cardano.org/projects/cardano-node/en/latest/stake-pool-operations/simple_transaction.html
- https://github.com/input-output-hk/cardano-transactions/wiki/How-to-submit-transaction-via-cardano-tx-CLI
- `cardano-wallet/api`
- https://input-output-hk.github.io/cardano-wallet/api/edge/
- https://github.com/input-output-hk/cardano-wallet/wiki/Wallet-command-line-interface
- `cardano-rest/explorer-api`
- https://input-output-hk.github.io/cardano-rest/explorer-api/
- `cardano-rest/submit-api` / Tx Submission
- https://input-output-hk.github.io/cardano-rest/submit-api/
- ```shell
curl -X POST \
--header "Content-Type: application/cbor" \
--data-binary @data http://localhost:8101/api/submit/tx
```