Code for the tutorials found on the Platform documentation site.
Note: NodeJS (v20+) must be installed to run the tutorial code.
git clone https://github.com/dashpay/platform-readme-tutorials.gitDo a clean install of project dependencies:
npm ci- Create an
.envfile (See.env.examplefor an example.envfile). SetNETWORKto the desired network type (normally 'testnet'). - Check connection:
node connect.js - Create wallet:
node create-wallet.js - Go to the Testnet faucet and add funds to the address reported in the previous step
- Open the
.envfile (See.env.examplefor an example.envfile) and setMNEMONICto the wallet mnemonic from step 3. - If doing withdrawals, open your
.envfile and setWITHDRAWAL_ADDRESSto the Core chain address where you would like to receive funds withdrawn from Platform. - (Optional) To minimize wallet sync time, open your
.envfile and setSYNC_START_HEIGHTto a Core chain block height just below the height of your wallet's first transaction. Otherwise you can skip this step and use the default value from.env.example.
Proceed with the tutorials
Identities and Names tutorials first and the
Contracts And Documents tutorials next. They
align with the tutorials section found on the
documentation site.
Many client configuration options are included as comments in
setupDashClient.js if more advanced configuration is
required.
After creating an identity, set
the IDENTITY_ID value in your .env file to your new identity ID. After
registering a data contract,
set the CONTRACT_ID value in your .env file to your new contract ID. To do
credit transfers between identities, create a second identity and set the
RECIPIENT_ID value in your .env file to its ID.
PRs accepted.