Connect to local devnet
Run a chain on your laptop before touching public testnet. Full node setup: Run a local devnet.
Start the node
./safrodevnet/scripts/bootstrap.sh
Endpoints: Local devnet endpoints.
Constants
export const RPC = 'http://127.0.0.1:26657';
export const REST = 'http://127.0.0.1:1317';
export const CHAIN_ID = 'safro-devnet-1';
export const DENOM = 'usaf';
Query and send
- Web (CosmJS)
- React Native
- Flutter (CosmJS)
import { StargateClient } from '@cosmjs/stargate';
import { DirectSecp256k1HdWallet } from '@cosmjs/proto-signing';
import { SigningStargateClient } from '@cosmjs/stargate';
const client = await StargateClient.connect(RPC);
console.log(await client.getChainId()); // safro-devnet-1
// Dev key from bootstrap (test keyring) — local only
const wallet = await DirectSecp256k1HdWallet.fromMnemonic(process.env.DEV_MNEMONIC!, {
prefix: 'addr_safro',
});
const signing = await SigningStargateClient.connectWithSigner(RPC, wallet, {
gasPrice: { denom: 'usaf', amount: '0.05' },
});
Point RPC at your machine LAN IP if testing on a physical device, e.g. http://192.168.1.10:26657. Emulator can use http://10.0.2.2:26657 (Android) or host IP (iOS).
Same RPC / CHAIN_ID in your bundled CosmJS module. Ensure the device can reach your host port 26657.
SafHandle on devnet
- Deploy safhandle-contract to your local node
- Pass the contract address to the client:
const safHandle = new SafHandle({
rpcUrl: RPC,
contractAddress: 'addr_safro1...', // your local instantiate address
});
Then follow Resolve and Register.
vs public testnet
| Local devnet | safro-testnet-1 | |
|---|---|---|
| Faucet | Genesis-funded dev key | faucet.safrochain.com |
| IBC | Not available | Noble, Osmosis |
| Explorer | Query via REST only | explorer.safrochain.com |
Next
- First transaction (switch constants to devnet)
- Local contract testing