Skip to content

Commit

Permalink
Merge pull request #1775 from demergent-labs/basic-bitcoin-with-bitco…
Browse files Browse the repository at this point in the history
…injs-lib

Update basic_bitcoin example to use bitcoinjs-lib
  • Loading branch information
lastmjs authored May 20, 2024
2 parents 6952375 + 4938b8e commit 0162634
Show file tree
Hide file tree
Showing 24 changed files with 3,279 additions and 2,315 deletions.
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
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
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

0 comments on commit 0162634

Please sign in to comment.