@anywalletkit/wallet-zcash (英语)
兹克什 透明 任何钱包的账户——BIP-44 m/44'/133'/0'/0/i, (中文(简体) ),
t1… 地址(透明的接收器Zashi、YWallet、Ledger和Trezor得出)
从同一种子出. 纯 Uint8Array, (中文(简体) ), @noble 编号 : @scure 只在赫尔墨斯跑步.
安装
npm install @anywalletkit/wallet-zcash
# or: pnpm add @anywalletkit/wallet-zcash · yarn add @anywalletkit/wallet-zcash
时间: @anywalletkit/wallet-zcash (英语)发表于 发布工作流程 与出处.
import WalletManagerZcash from '@anywalletkit/wallet-zcash'
const wallet = new WalletManagerZcash(seedPhrase, {
client: [
{ type: 'blockchair' }, // public, no key
{ type: 'blockbook-http', clientConfig: { url: 'https://zec-blockbook.nownodes.io', headers: { 'api-key': KEY } } },
],
maxFee: 100_000n, // zatoshi ceiling (default 1 000 000 = 0.01 ZEC)
})
const account = await wallet.getAccount(0)
const preview = await account.describeTransaction({ to: 't1…', value: 5_000_000n })
// { kind: 'zcash-transfer', version: 5, consensusBranchId, inputs, outputs: [{ role: 'recipient' | 'change' }],
// fee, conventionalFee, size, lockTime, expiryHeight, txid, warnings }
await account.transfer({ recipient: 't1…', amount: 5_000_000n }) // zatoshis
await account.sendTransaction({ to: 't1…', value: 5_000_000n, fee: 20_000n }) // explicit fee (still ≤ maxFee)
const hex = await account.signTransaction({ to: 't1…', value: 5_000_000n }) // sign only
const max = await account.getMaxSpendable() // sweep amount after fee
wallet.dispose()
花多少钱
A 类 v5 交易 (ZIP-225),有透明的投入和产出,为空
树苗/果园捆. 编号和签名散列随同 ZIP-244号卫星: 布莱克2b-256
以协商一致分支 id 进行个性化消化,所以签名只在
是用来升级的 树枝 id 是尖端+ 1 时有效的树枝 , 块
交易在(branchIdForHeight:NU5 → NU6 → NU6.1 → NU6.3 "Ironwood","Ironwood",
(一) 自第3 428 143项起有效),或 consensusBranchId 从配置中选择新
升级在软件包学习其 ID 之前激活。 在测试网和测试中
升级在其他高度激活, consensusBranchId 需要时间。 期满
提示+ 1 + expiryDelta; 没有提示, 无任何签名( 到期交易 0)
永不过期).
收费是 ZIP-317号卫星数字 : 5000 zatoshis × max(2, logical actions),逻辑动作=
max(⌈Σ input bytes / 150⌉, ⌈Σ output bytes / 34⌉) 1入2出支出支付
1万扎托什,没有收费市场. 在输入前, 硬币选择是第一
封面金额+收费;546-zatoshi粉尘底下的变化被折叠为收费.
nLockTime 是尖顶高(反收费狙击)和 nExpiryHeight 提示 + 40
(ZIP-203),所以一笔无人记账的交易在一小时内到期,而不是停留.
ZIP-244的实施工作以测试中埋有地雷的主网交易为主: 分析 – 串行对每个链条的往返、txid平等和ECDSA核查 此软件包在摘要上签名 .
安全检查
签字前 财务报告和审定财务报表 在广播前(也用于呼叫者提供的生六分法):
收费 maxFee,产出 输入,一个产出就是要求的接受者
金额和所有其他产出都是我们自己的地址。 警告(不是区块):费用低于
常规收费(节点不得中继),收费额的10%以上,粉尘输出,
没有变化,没有过期.
盾牌目的地被拒绝名称:统一 u1…树苗 zs1…发芽
zc…发送 改为 一个有屏蔽的地址和一个需要的有屏蔽的钱包
(注-承诺树同步+验证)——在本包中超出范围.
信件签名
sign(message) 现金 signmessage数字 : sha256d("\x16Zcash Signed Message:\n" ‖ len ‖ message), (中文(简体) ),
标题 31 + recovery (压缩键), base64. verify 恢复密钥并比较
p2PKH的地址.
运输
type | 后端 | 页:1 |
|---|---|---|
blockchair | https://api.blockchair.com/zcash | 公开的、CORS的、UTXOs的,包括Mempool、生tx, push/transaction; 可选 key; 仅主网 |
blockbook-http | 任何 Zcash 块簿(NOWNodes) zec-blockbook.nownodes.io(自主办) | /api/v2/{address,utxo,tx,sendtx}· ; headers aPI 密钥; 测试网也 |
列表按顺序失败; 节点 拒绝 广播为最后(未在
除非它之前的终点没有回答。 广播没有
确定答案( 无响应、 超时、 5xx、 HTML 502) 抛出
BroadcastUnknownError (单位:千美元)maybeSent, (中文(简体) ), hash = 发送前计算 txid : do
别再花硬币了 "已入"中"/"区块链"回"txid".
活动历史
createZcashHistory() (从) @anywalletkit/wallet-zcash/history是一个 HistorySource
a. 块椅上方:一项交易=所有者方向的一次本土转让;
被屏蔽的腿只作为进入或离开的透明值出现.