Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update basic_bitcoin example to use bitcoinjs-lib #1775

Merged
merged 17 commits into from
May 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ jobs:
"examples/audio_and_video",
"examples/audio_recorder",
"examples/autoreload",
"examples/basic_bitcoin",
"examples/bitcoin",
"examples/bitcoinjs-lib",
"examples/bitcore-lib",
Expand Down
3 changes: 3 additions & 0 deletions examples/basic_bitcoin/.bitcoin.conf
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@ regtest=1
rpcuser=ic-btc-integration
rpcpassword=QPQiNaph19FqUsCrBRN0FII7lyM26B51fAMeBQzCb-E=
rpcauth=ic-btc-integration:cdf2741387f3a12438f69092f0fdad8e$62081498c98bee09a0dce2b30671123fa561932992ce377585e8e08bb0c11dfa

# Enable indexing so we can look up transactions by their ids
txindex=1
1 change: 0 additions & 1 deletion examples/basic_bitcoin/.gitignore
lastmjs marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@
.dfx
dfx_generated
node_modules

20 changes: 10 additions & 10 deletions examples/basic_bitcoin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ This is an implementation of the [basic_bitcoin example](https://github.com/dfin
## bitcoind

```bash
mkdir .bitcoin
mkdir .bitcoin/data

curl https://bitcoincore.org/bin/bitcoin-core-23.0/bitcoin-23.0-x86_64-linux-gnu.tar.gz -o bitcoin.tar.gz

tar xzf bitcoin.tar.gz --overwrite --strip-components=1 --directory=.bitcoin/ bitcoin-23.0/bin/

rm -rf bitcoin.tar.gz
mkdir -p .bitcoin/data

# Check if bitcoind executable exists; if not, download and extract it
if [ ! -f ".bitcoin/bin/bitcoind" ]; then
curl -o bitcoin.tar.gz https://bitcoincore.org/bin/bitcoin-core-23.0/bitcoin-23.0-x86_64-linux-gnu.tar.gz
tar xzf bitcoin.tar.gz --overwrite --strip-components=1 --directory=.bitcoin/ bitcoin-23.0/bin/
rm -rf bitcoin.tar.gz
fi
```

# Deployment
Expand All @@ -28,13 +28,13 @@ rm -rf bitcoin.tar.gz

```bash
# Do this in its own terminal
dfx start --clean --host 127.0.0.1:8000 --enable-bitcoin
dfx start --clean --host 127.0.0.1:8000
```

## basic_bitcion

```bash
dfx deploy --argument='(variant { Regtest })'
BITCOIN_NETWORK=regtest dfx deploy'
```

# Usage
Expand Down
36 changes: 18 additions & 18 deletions examples/basic_bitcoin/dfx.json
lastmjs marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
{
"canisters": {
"basic_bitcoin": {
"type": "custom",
"type": "azle",
"main": "src/index.ts",
"candid": "src/index.did",
"build": "npx azle basic_bitcoin",
"wasm": ".azle/basic_bitcoin/basic_bitcoin.wasm.gz",
"declarations": {
"output": "test/dfx_generated/basic_bitcoin",
"node_compatibility": true
},
"metadata": [
{
"name": "candid:service",
"path": "src/index.did"
},
{
"name": "cdk:name",
"content": "azle"
}
]
"env": ["BITCOIN_NETWORK"]
}
},
"networks": {
"local": {
"bind": "127.0.0.1:8000",
"type": "ephemeral",
"replica": {
"subnet_type": "system"
}
}
},
"defaults": {
"bitcoin": {
"enabled": true,
"nodes": ["127.0.0.1:18444"],
"log_level": "info"
}
}
}
Loading
Loading