Wallets
Everything starts with a wallet. Wallets are how you sign transactions, and without a signature nothing gets written to the chain.
Wallets in ULedger are hierarchical — you can create child wallets from a parent, which is useful when you need to separate concerns within the same organization. A wallet per app, a wallet per user, a wallet per department. The structure is yours to decide.
Creating a wallet
Call POST /api/v1/wallets with your access key and the network tag. The wallet is generated, optionally encrypted with a passphrase, and stored by the TMS.
const res = await fetch('https://your-tms-url/api/v1/wallets', {
method: 'POST',
headers: {
'X-AccessKey': 'your-entity-access-key',
'X-Tag': 'mainnet',
'Content-Type': 'application/json',
},
body: JSON.stringify({
entropy: 256,
key_type: 0, // 0 = secp256k1
output: 1, // 1 = address + mnemonic
passphrase: 'my-secure-passphrase',
save_to_storage: true,
}),
});
const wallet = await res.json();
console.log('Address:', wallet.address);
console.log('Mnemonic:', wallet.mnemonic);
Hold onto the mnemonic or wallet address . It's the only way to recover the wallet if you lose it.
If you created the wallet without a passphrase, leave passphrase out entirely. Every future operation with this wallet needs to match.
Loading a wallet
Retrieve a stored wallet at any time by address:
const res = await fetch('https://your-tms-url/api/v1/wallets/load-by-address', {
method: 'POST',
headers: {
'X-AccessKey': 'your-entity-access-key',
'Content-Type': 'application/json',
},
body: JSON.stringify({
address: 'your-wallet-address',
output: 2, // 2 = full wallet JSON
passphrase: 'my-secure-passphrase', // omit if created without one
}),
});
const data = await res.json();
console.log('Wallet:', data.wallet.address);
Auth groups
When creating a wallet you can assign auth groups — named permission sets that control what different roles can do with it. The names are yours to define.
body: JSON.stringify({
entropy: 256,
key_type: 0,
output: 1,
passphrase: 'my-secure-passphrase',
save_to_storage: true,
auth_groups: {
admin: { create: true, read: true, update: true, delete: true },
writer: { create: true, read: true, update: false, delete: false },
reader: { create: false, read: true, update: false, delete: false },
},
}),
Next step
A wallet on its own can't do anything on the blockchain until it's registered and to do so we need to create our first transaction. Head to Transactions to register your wallet and start writing data.