Client Basics
Learn the basics of creating and using an Evolution SDK client
Client Basics
The Evolution SDK client is your primary interface to the Cardano blockchain. It combines wallet management, provider communication, and transaction building into a single, cohesive API. Once configured, the client handles UTxO selection, fee calculation, and signing—letting you focus on your application logic.
Think of the client as your persistent connection: configure it once with your network, provider, and wallet, then use it throughout your application to build and submit transactions. All operations maintain type safety and composability through Effect-TS.
Creating a Client
Configure your client with three essential pieces: the network (mainnet/preprod/preview), your blockchain provider, and the wallet for signing:
import { } from "@evolution-sdk/evolution";
const = ({
: "preprod",
: {
: "blockfrost",
: "https://cardano-preprod.blockfrost.io/api/v0",
: ..!
},
: {
: "seed",
: "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about",
: 0
}
});The Transaction Workflow
Evolution SDK follows a three-stage pattern: build, sign, submit. Each stage returns a new builder with stage-specific methods, preventing invalid operations (like submitting before signing).
Stage 1: Building
Start with client.newTx() and chain operations to specify outputs, metadata, or validity ranges:
import { , } from "@evolution-sdk/evolution";
const = ({
: "preprod",
: { : "blockfrost", : "", : "" },
: { : "seed", : "", : 0 }
});
const = .();
.({
: ..("addr_test1qzx9hu8j4ah3auytk0mwcupd69hpc52t0cw39a65ndrah86djs784u92a3m5w475w3w35tyd6v3qumkze80j8a6h5tuqq5xe8y"),
: ..(2000000n)
});
const = await .();Stage 2: Signing
Call .sign() on the built transaction to create signatures with your wallet:
import { , } from "@evolution-sdk/evolution";
const = ({
: "preprod",
: { : "blockfrost", : "", : "" },
: { : "seed", : "", : 0 }
});
const = .();
.({ : ..("addr_test1qzx9hu8j4ah3auytk0mwcupd69hpc52t0cw39a65ndrah86djs784u92a3m5w475w3w35tyd6v3qumkze80j8a6h5tuqq5xe8y"), : ..(2000000n) });
const = await .();
const = await .();Stage 3: Submitting
Finally, .submit() broadcasts the signed transaction to the blockchain and returns the transaction hash:
import { , } from "@evolution-sdk/evolution";
const = ({
: "preprod",
: { : "blockfrost", : "", : "" },
: { : "seed", : "", : 0 }
});
const = .();
.({ : ..("addr_test1qzx9hu8j4ah3auytk0mwcupd69hpc52t0cw39a65ndrah86djs784u92a3m5w475w3w35tyd6v3qumkze80j8a6h5tuqq5xe8y"), : ..(2000000n) });
const = await .();
const = await .();
const = await .();
.("Transaction submitted:", );Putting It All Together
Here's the complete workflow in a single example—from client creation through transaction submission:
import { , } from "@evolution-sdk/evolution";
const = ({
: "preprod",
: {
: "blockfrost",
: "https://cardano-preprod.blockfrost.io/api/v0",
: ..!
},
: {
: "seed",
: ..!,
: 0
}
});
// Build transaction
const = .();
.({
: ..("addr_test1qzx9hu8j4ah3auytk0mwcupd69hpc52t0cw39a65ndrah86djs784u92a3m5w475w3w35tyd6v3qumkze80j8a6h5tuqq5xe8y"),
: ..(2000000n)
});
// Build, sign, and submit
const = await .();
const = await .();
const = await .();
.("Transaction ID:", );Next Steps
- Provider Setup Comparison - Choose the right provider
- Building Transactions - Learn transaction construction
- Wallets - Explore wallet types