The SecretPay Ledger repository contains the necessary canister to run the ledger for the SecretPay application locally, enabling anonymous sending of gift cards with money through the ICP blockchain.
Ensure you have a recent version of the IC SDK installed. If not, follow the instructions in the IC SDK installation section.
git clone https://github.com/abundance-io/secretpay_ledger
cd secretpay_ledger_canister
Access the releases overview and copy the latest replica binary revision. For instance, the revision could be d87954601e4b22972899e9957e800406a0a6b929
.
- Ledger Wasm Module URL: Download Link
- Ledger .did File URL: Raw File Link
[OPTIONAL] For the latest ICP ledger files:
curl -o download_latest_icp_ledger.sh "<DOWNLOAD_SCRIPT_LINK>"
chmod +x download_latest_icp_ledger.sh
./download_latest_icp_ledger.sh
Modify the dfx.json
file to change canister name or settings .
dfx start --background --clean
dfx identity new secretpay_minter
dfx identity use secretpay_minter
export MINTER_ACCOUNT_ID=$(dfx ledger account-id)
dfx identity use default
export DEFAULT_ACCOUNT_ID=$(dfx ledger account-id)
dfx deploy --specified-id ryjl3-tyaaa-aaaaa-aaaba-cai secretpay_ledger_canister --argument "
(variant {
Init = record {
minting_account = \"$MINTER_ACCOUNT_ID\";
initial_values = vec {
record {
\"$DEFAULT_ACCOUNT_ID\";
record {
e8s = 10_000_000_000 : nat64;
};
};
};
send_whitelist = vec {};
transfer_fee = opt record {
e8s = 10_000 : nat64;
};
token_symbol = opt \"SEC\";
token_name = opt \"Secret Coin\";
}
})
"
Run CLI commands to interact with the canister:
dfx canister call secretpay_ledger_canister name
Here are some functions that you can run on the secretpay_ledger_canister
:
Retrieve the token's name.
dfx canister call secretpay_ledger_canister name
Fetch the token's symbol.
dfx canister call secretpay_ledger_canister symbol
Check the balance of a specific account.
dfx canister call secretpay_ledger_canister getBalance <account_id>
Initiate a token transfer from one account to another.
dfx canister call secretpay_ledger_canister transfer <to_account_id> <amount>
Add an account to the send whitelist.
dfx canister call secretpay_ledger_canister addToWhitelist <account_id>
Modify the transfer fee for transactions.
dfx canister call secretpay_ledger_canister setTransferFee <new_fee_amount>
Access the Candid UI at the deployed URL:
http://127.0.0.1:4943/?canisterId=<CANISTER_ID>&id=ryjl3-tyaaa-aaaaa-aaaba-cai