Skip to main content

Connect to a Local Network

If you haven't already done so, install dWallet on your system.

Start the Local Network

To start the local network, run the following command from the root folder of your dwallet-network repository (the one you cloned during the dWallet Environment Setup):

RUST_MIN_STACK=16777216 RUST_LOG="off,sui_node=info" cargo run --bin sui-test-validator

This command starts the sui-test-validator. The RUST_MIN_STACK=16777216 ensures enough resources are allocated to install and run the node. The RUST_LOG="off,sui_node=info" turns off logging for all components except for the sui-node. If you want to see more detailed logs, you can remove RUST_LOG from the command.

Important: Every time you start the sui-test-validator, it initializes a new network with no previous data. The local network is not persistent.

To customize your local dWallet network, such as changing the port, you can include additional parameters in the sui-test-validator command:

OPTIONS:
--epoch-duration-ms <EPOCH_DURATION_MS>
The duration for epochs (defaults to one minute) [default: 60000]
--faucet-port <FAUCET_PORT>
Port to start the Sui faucet on [default: 9123]
--fullnode-rpc-port <FULLNODE_RPC_PORT>
Port to start the Fullnode RPC server on [default: 9000]

To see all available options, run sui-test-validator --help in your console.

Access Your Local Full Node

Use the following command to retrieve the total transaction count from your local network:

curl --location --request POST 'http://127.0.0.1:9000' \
--header 'Content-Type: application/json' \
--data-raw '{
"jsonrpc": "2.0",
"id": 1,
"method": "sui_getTotalTransactionBlocks",
"params": []
}'

If successful, you will see a response like the following:

{
"jsonrpc": "2.0",
"result": 168,
"id": 1
}

Connect the dWallet Client CLI to Your Local Network

You can connect the dWallet Client CLI to your local network by creating a new environment alias named local and setting the RPC URL to your local network.

dwallet client new-env --alias local --rpc http://127.0.0.1:9000

Next, use the following command to switch to the new local environment:

dwallet client switch --env local

The command will return:

Active environment switched to [local]

To verify the current active environment, run:

dwallet client active-env

The command will return:

local

Show the Current Active Address

The dWallet Client CLI uses the active address for commands unless you specify a different one. To view the active address for your local network, run:

dwallet client active-address

The command will return an address similar to:

0xbc33e6e4818f9f2ef77d020b35c24be738213e64d9e58839ee7b4222029610de

You can use this active address to request test DWLT tokens for use on your local network. To see all addresses in your local wallet, run:

dwallet client addresses

Note: The address returned by the command is unique and will not match the example above.

Use the Local Faucet

Transactions on your local network require DWLT tokens to pay for gas fees, just like other networks. To send tokens to an account on your local dWallet network, use the address from the Setup a local dWallet Network account section. You can use this address with the local faucet.

To request test DWLT coins from the local faucet, run the following cURL command:

curl -X POST --location "http://127.0.0.01:9123/gas" \
-H "Content-Type: application/json" \
-d '{
"FixedAmountRequest": {
"recipient": "<YOUR-ACTIVE-ADDRESS>"
}
}'

If successful, the response will resemble:

{
"transferredGasObjects": [
{
"amount": 200000000,
"id": "0x192ce62506ed8705b76e8423be1f6e011064a3f887ba924605f27a8c83c8c970",
"transferTxDigest": "7sp4fFPH2WaUgvN43kjDzCpEhKfifqjx5RTki74y8T3E"
},
{
"amount": 200000000,
"id": "0x31d003ade00675d1ab82b225bfcceaa60bb993f5d90e9d0aa88f81dc24ec14d6",
"transferTxDigest": "7sp4fFPH2WaUgvN43kjDzCpEhKfifqjx5RTki74y8T3E"
},
{
"amount": 200000000,
"id": "0x98cbdc93ae672110f91bc0c39c0c87bc66f36984c79218bb2c0bac967260970c",
"transferTxDigest": "7sp4fFPH2WaUgvN43kjDzCpEhKfifqjx5RTki74y8T3E"
},
{
"amount": 200000000,
"id": "0xba66aee6289cc6d0203c451bea442ad30d4cfe699e50b36fed0ff3e99ba51529",
"transferTxDigest": "7sp4fFPH2WaUgvN43kjDzCpEhKfifqjx5RTki74y8T3E"
},
{
"amount": 200000000,
"id": "0xd9f0b521443d66227eddc2aac2e16f667ca9caeef9f1b7afb4a6c2fc7dcb58d8",
"transferTxDigest": "7sp4fFPH2WaUgvN43kjDzCpEhKfifqjx5RTki74y8T3E"
}
],
"error": null
}

Check Gas Coin Objects for the Active Address

After requesting coins from the faucet, you can view the coin objects associated with your address using the following command:

dwallet client gas

The response will resemble the following, but with different IDs:

╭────────────────────────────────────────────────────────────────────┬────────────╮
│ gasCoinId │ gasBalance │
├────────────────────────────────────────────────────────────────────┼────────────┤
│ 0x1d790713c1c3441a307782597c088f11230c47e609af2cec97f393123ea4de45 │ 200000000 │
│ 0x20c1d5ad2e8693953fca09fd2fec0fbc52a787e0a0f77725220d36a09a5b312d │ 200000000 │
│ 0x236714566110f5624516faa0da215ad29f8daa611e8b651d1e972168207567b2 │ 200000000 │
│ 0xc81f30256bb04ad84bc4a92017cffd7c1f98286e028fa504d8515ad72ddd1088 │ 200000000 │
│ 0xf61c8b21b305cc8e062b3a37de8c3a37583e17f437a449a2ab42321d019aeeb4 │ 200000000 │
╰────────────────────────────────────────────────────────────────────┴────────────╯

Set Up dWallet Network Explorer on Your Local Network

To run the explorer, ensure that you have pnpm installed. Then, run the following commands from the root folder of dwallet-network:

pnpm install
pnpm explorer dev

Once the command completes, open your local dWallet Network Explorer at http://localhost:3000/.

For more details, see the Explorer README.