Test Setup

Test your DSP with vRAM

Please note, if you wish to test on the mainnet, this will require the purchase of DAPP tokens or the use of DAPPHDL tokens (Air-HODL). In the case of Kylin, we provide a DAPP token faucet.

Create Kylin Account

We will create a Kylin account for the vRAM eosio.token contract. To setup the account, visit here.

Install Zeus:

1
npm i -g @liquidapps/zeus-cmd
Copied!

Unbox coldtoken contract:

1
mkdir coldtoken; cd coldtoken
2
zeus box create
3
zeus unbox coldtoken
Copied!

Compile and deploy contract for testing:

1
# your DSP's API endpoint
2
export DSP_ENDPOINT=
3
# a new account to deploy your contract to
4
export ACCOUNT=
5
# your new account's active public key
6
export ACTIVE_PUBLIC_KEY=
7
# compile coldtoken contract
8
zeus compile
9
cd contracts/eos
10
# set eosio.code permission
11
cleos -u $DSP_ENDPOINT set account permission $ACCOUNT active "{\"threshold\":1,\"keys\":[{\"weight\":1,\"key\":\"$ACTIVE_PUBLIC_KEY\"}],\"accounts\":[{\"permission\":{\"actor\":\"$ACCOUNT\",\"permission\":\"eosio.code\"},\"weight\":1}]}" owner -p $ACCOUNT@active
12
# set contract
13
cleos -u $DSP_ENDPOINT set contract $ACCOUNT ./coldtoken
Copied!

Select and stake to DSP:

1
# your DSP's account
2
export DSP_ACCOUNT=
3
# your DSP's service
4
export DSP_SERVICE=
5
# your DSP's package
6
export DSP_PACKAGE=
7
# your DSP's minimum stake quantity in DAPP or DAPPHDL (example: 10.0000 DAPP or 10.0000 DAPPHDL)
8
export MIN_STAKE_QUANTITY=
9
# select DSP package
10
cleos -u $DSP_ENDPOINT push action dappservices selectpkg "{\"owner\":\"$ACCOUNT\",\"provider\":\"$DSP_ACCOUNT\",\"service\":\"$DSP_SERVICE\",\"package\":\"$DSP_PACKAGE\"}" -p $ACCOUNT
11
# stake to DSP package with DAPP
12
cleos -u $DSP_ENDPOINT push action dappservices stake "{\"owner\":\"$ACCOUNT\",\"provider\":\"$DSP_ACCOUNT\",\"service\":\"$DSP_SERVICE\",\"quantity\":\"$MIN_STAKE_QUANTITY\"}" -p $ACCOUNT
13
# stake to DSP package with DAPPHDL, only available on mainnet
14
cleos -u $DSP_ENDPOINT push action dappairhodl1 stake "{\"owner\":\"$ACCOUNT\",\"provider\":\"$DSP_ACCOUNT\",\"service\":\"$DSP_SERVICE\",\"quantity\":\"$MIN_STAKE_QUANTITY\"}" -p $ACCOUNT
Copied!

Run test commands:

1
# create coldtoken
2
cleos -u $DSP_ENDPOINT push action $ACCOUNT create "{\"issuer\":\"$ACCOUNT\",\"maximum_supply\":\"1000000000 TEST\"}" -p $ACCOUNT
3
# issue some TEST
4
cleos -u $DSP_ENDPOINT push action $ACCOUNT issue "{\"to\":\"$ACCOUNT\",\"quantity\":\"1000 TEST\",\"memo\":\"Testing issue\"}" -p $ACCOUNT
Copied!

Test vRAM get table row:

1
# you must be in the root of the box to run this command
2
cd ../../
3
zeus get-table-row $ACCOUNT "accounts" $ACCOUNT "TEST" --endpoint $DSP_ENDPOINT | python -m json.tool
4
# with curl:
5
curl http://$DSP_ENDPOINT/v1/dsp/ipfsservice1/get_table_row -d '{"contract":"CONTRACT_ACCOUNT","scope":"SCOPE","table":"TABLE_NAME","key":"TABLE_PRIMARY_KEY"}' | python -m json.tool
Copied!

Transfer:

1
cleos -u $DSP_ENDPOINT push action $ACCOUNT transfer "{\"from\":\"$ACCOUNT\",\"to\":\"natdeveloper\",\"quantity\":\"1000 TEST\",\"memo\":\"Testing transfer\"}" -p $ACCOUNT
2
zeus get-table-row $ACCOUNT "accounts" "natdeveloper" "TEST" --endpoint $DSP_ENDPOINT | python -m json.tool
Copied!
Look for β€œxcommit” and β€œxcleanup” actions on your contract: https://bloks.io/
  • xcommit - The commit request instructs a DSP to write new data to their local IPFS cluster node. A developer can utilize the setData function from within their smart contract to first hash the new data in order to return a URI, before dispatching a commit request which is caught by the DSP node. In a similar way the getData function can be utilized in order to fetch the data for the smart contract or request a Warmup in case it is missing.
  • xcleanup - A cleanup request sends a request to the DSP to evict a file from the cache. This is an asynchronous request.
More information on vRAM related actions can be found here
Copy link