Skip to content

Instantly share code, notes, and snippets.

@denisshevchenko
Last active February 14, 2018 15:14
Show Gist options
  • Save denisshevchenko/a073af7463b46ad7a27c832f68097813 to your computer and use it in GitHub Desktop.
Save denisshevchenko/a073af7463b46ad7a27c832f68097813 to your computer and use it in GitHub Desktop.

IMPORTANT: It's actual for API V0

Create a new wallet

First of all, you need a new mnemonic for backup passphrase. Please go here and generate English BIP39 Mnemonic. Choose 12 words and click "Generate" button. You will get something like this:

refuse layer pill agent wagon effort party fetch come degree hope real

Use this mnemonic (as a comma-separated list of strings) to create a new wallet, for example:

$ curl -X POST -H "Content-Type: application/json" -d '{"cwBackupPhrase": {"bpToList":["refuse","layer","pill","agent","wagon","effort","party","fetch","come","degree","hope","real"]}, "cwInitMeta": {"cwName": "Personal Wallet 2", "cwAssurance": "CWANormal", "cwUnit": 0}}' --cacert ./scripts/tls-files/ca.crt https://localhost:8090/api/wallets/new

Please note that you cannot create two or more wallets with the same mnemonic!

Create a new account in wallet

Please note that every wallet already contains at least one account.

You can check existing accounts by command:

$ curl -k -X GET https://localhost:8090/api/accounts

To add a new account use this command:

$ curl -X POST -H "Content-Type: application/json" -d '{"caInitMeta": {"caName": "Account N2"},"caInitWId": "Ae2tdPwUPEZAUappYUWsNtJ3wLQFuB5kCqUAiALA9bveu9ptgndiC3PFnKX"}' --cacert ./scripts/tls-files/ca.crt https://localhost:8090/api/accounts

where Ae2tdPwUPEZAUappYUWsNtJ3wLQFuB5kCqUAiALA9bveu9ptgndiC3PFnKX is an id of wallet.

You can use exactly the same command to add as many accounts in one wallet as you need.

Create a new address in account

Please note that every account already contains at least one address.

You can check existing addresses by command:

$ curl -k -X GET https://localhost:8090/api/accounts

To add a new address use this command:

$ curl -X POST -H "Content-Type: application/json" -d '"Ae2tdPwUPEZAUappYUWsNtJ3wLQFuB5kCqUAiALA9bveu9ptgndiC3PFnKX@2147483648"' --cacerts/ca.crt https://localhost:8090/api/addresses

where Ae2tdPwUPEZAUappYUWsNtJ3wLQFuB5kCqUAiALA9bveu9ptgndiC3PFnKX@2147483648 is an id of account.

You can use exactly the same command to add as many addresses in one account as you need.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment