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.git
Do a clean install of project dependencies:
npm ci
- Create an
.env
file (See.env.example
for an example.env
file). SetNETWORK
to 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
.env
file (See.env.example
for an example.env
file) and setMNEMONIC
to the wallet mnemonic from step 3. - If doing withdrawals, open your
.env
file and setWITHDRAWAL_ADDRESS
to the Core chain address where you would like to receive funds withdrawn from Platform. - (Optional) To minimize wallet sync time, open your
.env
file and setSYNC_START_HEIGHT
to 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.