Skip to content

Commit

Permalink
Merge pull request #1748 from demergent-labs/documentation_tokens
Browse files Browse the repository at this point in the history
add basic tokens, good bitcoin, and only examples for Ethereum docume…
  • Loading branch information
lastmjs authored Apr 18, 2024
2 parents 5ce1edc + 99792fb commit f4fd486
Show file tree
Hide file tree
Showing 179 changed files with 1,404 additions and 188 deletions.
2 changes: 1 addition & 1 deletion docs/404.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/assets.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/authentication.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/azle.html

Large diffs are not rendered by default.

267 changes: 267 additions & 0 deletions docs/bitcoin.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/candid.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/candid_based_documentation.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/canister_lifecycle.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/canisters_overview.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/caveats.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/cross_canister.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/cycles.html

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions docs/debugging.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/deployment.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/deployment_candid_based.html

Large diffs are not rendered by default.

206 changes: 206 additions & 0 deletions docs/ethereum.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/examples.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/fetch.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/get_started.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/hello_world.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/http.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/index.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/installation.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/internet_computer_overview.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/limitations.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/management_canister.html

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions docs/npm.html

Large diffs are not rendered by default.

161 changes: 156 additions & 5 deletions docs/print.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/project_structure.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/query_methods.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/bitcoin.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/call_apis/accept_message.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/call_apis/arg_data_raw.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/call_apis/arg_data_raw_size.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/call_apis/call.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/call_apis/call_apis.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/call_apis/call_raw.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/call_apis/call_raw128.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/call_apis/call_with_payment.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/call_apis/call_with_payment128.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/call_apis/caller.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/call_apis/method_name.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/call_apis/msg_cycles_accept.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/call_apis/msg_cycles_accept128.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/call_apis/msg_cycles_available.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/call_apis/msg_cycles_available128.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/call_apis/msg_cycles_refunded.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/call_apis/msg_cycles_refunded128.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/call_apis/notify.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/call_apis/notify_raw.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/call_apis/notify_with_payment_128.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/call_apis/reject.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/call_apis/reject_code.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/call_apis/reject_message.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/call_apis/reply.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/call_apis/reply_raw.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/candid/blob.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/candid/bool.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/candid/candid.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/candid/empty.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/candid/float32.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/candid/float64.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/candid/func.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/candid/int.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/candid/int16.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/candid/int32.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/candid/int64.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/candid/int8.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/candid/nat.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/candid/nat16.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/candid/nat32.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/candid/nat64.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/candid/nat8.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/candid/null.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/candid/opt.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/candid/principal.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/candid/record.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/candid/reserved.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/candid/service.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/candid/text.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/candid/variant.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/candid/vec.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/canister_apis/candid_decode.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/canister_apis/candid_encode.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/canister_apis/canister_apis.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/canister_apis/canister_balance.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/canister_apis/canister_balance128.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/canister_apis/canister_id.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/canister_apis/canister_version.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/canister_apis/data_certificate.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/canister_apis/instruction_counter.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/canister_apis/is_controller.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/canister_apis/performance_counter.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/canister_apis/print.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/canister_apis/set_certified_data.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/canister_apis/time.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/canister_apis/trap.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/canister_methods/canister_methods.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/canister_methods/heartbeat.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/canister_methods/http_request.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/canister_methods/http_request_update.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/canister_methods/init.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/canister_methods/inspect_message.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/canister_methods/post_upgrade.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/canister_methods/pre_upgrade.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/canister_methods/query.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/canister_methods/update.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/environment_variables.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/management_canister/bitcoin_get_utxos.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/management_canister/canister_status.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/management_canister/create_canister.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/management_canister/delete_canister.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/management_canister/deposit_cycles.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/management_canister/ecdsa_public_key.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/management_canister/http_request.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/management_canister/install_code.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/management_canister/raw_rand.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/management_canister/sign_with_ecdsa.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/management_canister/start_canister.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/management_canister/stop_canister.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/management_canister/uninstall_code.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/management_canister/update_settings.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/plugins.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/reference.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/stable_memory/stable64_grow.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/stable_memory/stable64_read.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/stable_memory/stable64_size.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/stable_memory/stable64_write.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/stable_memory/stable_bytes.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/stable_memory/stable_grow.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/stable_memory/stable_memory.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/stable_memory/stable_read.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/stable_memory/stable_size.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/stable_memory/stable_structures.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/stable_memory/stable_write.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/timers/clear_timer.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/timers/set_timer.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/timers/set_timer_interval.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/timers/timers.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/wasm_binary_optimization.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference_http/autoreload.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference_http/environment_variables.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference_http/native_compilation.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference_http/reference.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/rest_based_examples.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/searchindex.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/searchindex.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/servers.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/stable_structures.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/the_azle_book.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/timers.html

Large diffs are not rendered by default.

272 changes: 272 additions & 0 deletions docs/tokens.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/update_methods.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion the_azle_book/book/404.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion the_azle_book/book/azle.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion the_azle_book/book/candid.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion the_azle_book/book/canisters_overview.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion the_azle_book/book/cross_canister.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion the_azle_book/book/cycles.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion the_azle_book/book/deployment.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion the_azle_book/book/examples.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion the_azle_book/book/http.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion the_azle_book/book/index.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion the_azle_book/book/installation.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion the_azle_book/book/internet_computer_overview.html

Large diffs are not rendered by default.

161 changes: 156 additions & 5 deletions the_azle_book/book/print.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion the_azle_book/book/searchindex.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion the_azle_book/book/searchindex.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion the_azle_book/book/timers.html

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions the_azle_book/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
- [Assets](./assets.md)
- [Authentication](./authentication.md)
- [fetch](./fetch.md)
- [Databases]()
- [npm](./npm.md)
- [Tokens](./tokens.md)
- [Bitcoin](./bitcoin.md)
- [Ethereum](./ethereum.md)
- [Databases]()
- [Cycles]()
- [Tokens]()
- [Bitcoin]()
- [Ethereum]()
- [Debugging](./debugging.md)
- [Limitations](./limitations.md)
- [Reference](./reference_http/reference.md)
Expand Down
83 changes: 83 additions & 0 deletions the_azle_book/src/bitcoin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# Bitcoin

Examples:

- [basic_bitcoin](https://github.com/demergent-labs/azle/tree/main/examples/basic_bitcoin)
- [bitcoin](https://github.com/demergent-labs/azle/tree/main/examples/bitcoin)
- [bitcoinjs-lib](https://github.com/demergent-labs/azle/tree/main/examples/bitcoinjs-lib)
- [bitcore-lib](https://github.com/demergent-labs/azle/tree/main/examples/bitcore-lib)
- [ckbtc](https://github.com/demergent-labs/azle/tree/main/examples/ckbtc)

There are two main ways to interact with Bitcoin on ICP: through the [management canister](#management-canister) and through the [ckBTC canister](#ckbtc).

## management canister

To sign Bitcoin transactions using [threshold ECDSA](https://internetcomputer.org/docs/current/developer-docs/smart-contracts/encryption/t-ecdsa) and interact with the Bitcoin blockchain directly from ICP, make [cross-canister calls](./fetch.md) to the following methods on the [management canister](https://internetcomputer.org/docs/current/references/ic-interface-spec#ic-management-canister): `ecdsa_public_key`, `sign_with_ecdsa`, `bitcoin_get_balance`, `bitcoin_get_balance_query`, `bitcoin_get_utxos`, `bitcoin_get_utxos_query`, `bitcoin_send_transaction`, `bitcoin_get_current_fee_percentiles`.

To construct your cross-canister calls to these methods, use `canister id` `aaaaa-aa` and the management canister's [Candid type information](https://internetcomputer.org/docs/current/references/ic-interface-spec#ic-candid) to construct the arguments to send in the `body` of your `fetch` call.

Here's an example of doing a test cross-canister call to the `bitcoin_get_balance` method:

```typescript
import { serialize } from 'azle';

// ...

const response = await fetch(`icp://aaaaa-aa/bitcoin_get_balance`, {
body: serialize({
args: [
{
'bc1q34aq5drpuwy3wgl9lhup9892qp6svr8ldzyy7c',
min_confirmations: [],
network: { regtest: null }
}
],
cycles: 100_000_000n
})
});
const responseJson = await response.json();

// ...
```

## ckBTC

[ckBTC](https://internetcomputer.org/docs/current/developer-docs/multi-chain/bitcoin/ckbtc/overview) is an [ICRC](https://internetcomputer.org/docs/current/references/icrc1-standard) canister that wraps underlying bitcoin controlled with threshold ECDSA.

ICRCs are a set of standards for ICP canisters that define the method signatures and corresponding types for those canisters.

You interact with the `ckBTC` canister by calling its methods. You can do this from the frontend with [@dfinity/agent](https://www.npmjs.com/package/@dfinity/agent), or from an Azle canister through [cross-canister calls](./fetch.md).

Here's an example of doing a test cross-canister call to the `ckBTC` `icrc1_balance_of` method:

```typescript
import { ic, serialize } from 'azle';

// ...

const response = await fetch(
`icp://mc6ru-gyaaa-aaaar-qaaaq-cai/icrc1_balance_of`,
{
body: serialize({
candidPath: `/candid/icrc.did`,
args: [
{
owner: ic.id(),
subaccount: [
padPrincipalWithZeros(ic.caller().toUint8Array())
]
}
]
})
}
);
const responseJson = await response.json();

// ...

function padPrincipalWithZeros(principalBlob: Uint8Array): Uint8Array {
let newUin8Array = new Uint8Array(32);
newUin8Array.set(principalBlob);
return newUin8Array;
}
```
8 changes: 8 additions & 0 deletions the_azle_book/src/ethereum.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Ethereum

Examples:

- [ethereum_json_rpc](https://github.com/demergent-labs/azle/tree/main/examples/ethereum_json_rpc)
- [ethers](https://github.com/demergent-labs/azle/tree/main/examples/ethers)
- [ethers_base](https://github.com/demergent-labs/azle/tree/main/examples/ethers_base)
- [ic_evm_rpc](https://github.com/demergent-labs/azle/tree/main/examples/ic_evm_rpc)
78 changes: 78 additions & 0 deletions the_azle_book/src/tokens.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# Tokens TL;DR

[Canisters](https://internetcomputer.org/docs/current/concepts/canisters-code) can either:

1. Interact with tokens that already exist
2. Implement, extend, or proxy tokens

Canisters can use cross-canister calls to interact with tokens implemented using [ICRC](https://github.com/dfinity/ICRC) or other standards. They can also interact with non-ICP tokens through [threshold ECDSA](https://internetcomputer.org/docs/current/developer-docs/smart-contracts/encryption/t-ecdsa).

Canisters can implement tokens from scratch, or extend or proxy implementations already written.

Demergent Labs does not keep any token implementations up-to-date. Here are some old implementations for inspiration and learning:

- [ICRC-1](https://github.com/demergent-labs/ICRC-1)
- [extendable-token-azle](https://github.com/lastmjs/extendable-token-azle)

# Tokens

Examples:

- [basic_bitcoin](https://github.com/demergent-labs/azle/tree/main/examples/basic_bitcoin)
- [bitcoin](https://github.com/demergent-labs/azle/tree/main/examples/bitcoin)
- [bitcoinjs-lib](https://github.com/demergent-labs/azle/tree/main/examples/bitcoinjs-lib)
- [bitcore-lib](https://github.com/demergent-labs/azle/tree/main/examples/bitcore-lib)
- [ckbtc](https://github.com/demergent-labs/azle/tree/main/examples/ckbtc)
- [ethereum_json_rpc](https://github.com/demergent-labs/azle/tree/main/examples/ethereum_json_rpc)
- [ethers](https://github.com/demergent-labs/azle/tree/main/examples/ethers)
- [ethers_base](https://github.com/demergent-labs/azle/tree/main/examples/ethers_base)
- [extendable-token-azle](https://github.com/lastmjs/extendable-token-azle)
- [ic_evm_rpc](https://github.com/demergent-labs/azle/tree/main/examples/ic_evm_rpc)
- [icrc](https://github.com/demergent-labs/azle/tree/main/examples/icrc)
- [ICRC-1](https://github.com/demergent-labs/ICRC-1)
- [ledger_canister](https://github.com/demergent-labs/azle/tree/main/examples/ledger_canister)

<!-- - ICRC transfer from frontend
- ICRC transfer from backend
- ckBTC/ckETH transfer from frontend
- ckBTC/ckETH transfer from backend
- BTC/ETH transfers from backend
- Show get balance, total supply, etc as well
- Basically show the basic needs of users, how to transfer tokens and look up balances
## Interacting with tokens
### ICP tokens
### Foreign blockchain tokens
## Implementing tokens
There are three ways to interact with tokens on ICP. You can interact with a token implemented in another canister with its own standard. You can interact with a token implemented in another canister using ICRC. You can interact with a token canister. You can initiate transfers in a token canister. Or you can implement your own token canister to augment underlying functionality.
You could also act as a proxy to another canister.
You could also interact with tokens on another blockchain like Bitcoin or Ethereum. You can also use ckTokens.
Interacting with:
Custom standard/non-standard ICP tokens
ICRC standard ICP tokens
ck foreign ICP tokens
Foreign tokens
Implementing:
Custom standard/non-standard ICP tokens
ICRC standard ICP tokens
ck foreign ICP tokens
So you can initiate transfers on a custom ICP token. You can initiate transfers on ICRC ICP tokens. You can initiate transfers, read balances, etc on ck tokens which are wrapped tokens on another blockchain. And you can interact with tokens on other blockchains with ECDSA now and soon EdDSA.
So there's interacting with a token that already exists. And then there's creating your own token. If you want to create your own token without changing its functionality, you can just deploy a canister that already exists. If you need to implement your own functionality, you would have to implement your own.
Let's have implementations of all ICRC standards in Azle with tests.
For the TL;DR let's just explain each of these categories and show some code snippets.
This could take a bit of work. -->

0 comments on commit f4fd486

Please sign in to comment.