Setting up local BTC environment errors

working thru

m1 mac
bitcoin-core running locally
port 8333 is default port … has been running several months without issues
set dfx.json to port above

fails on:

basic_bitcoin % dfx deploy basic_bitcoin --argument ‘(variant { Regtest })’

console log is here

then added command
cargo add secp256k1-sys

been hanging on nostr with our BTCmaxi brothers and what to show this off :slight_smile:

1 Like

error occurred: Failed to find tool. Is clang installed?

Sounds like a problem with your machine’s setup to me. Can you make sure that clang is available?

1 Like

douglassmith@static-76-161-87-250 basic_bitcoin % clang --version
Apple clang version 14.0.0 (clang-1400.0.29.202)
Target: arm64-apple-darwin22.2.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

added path to .zshrc

same error

this is where things derail

TARGET_CC = None
CC = Some(“/opt/homebrew/opt/llvm/bin/clang”)

reinstalled llvm and added suggested paths to .zshrc

it compiles now but …

~/Fossils/examples/rust/basic_bitcoin
Installing canisters…
Installing code for canister basic_bitcoin, with canister ID rrkah-fqaaa-aaaaa-aaaaq-cai
Error: Failed while trying to deploy canisters.
Caused by: Failed while trying to deploy canisters.
Failed while trying to install all canisters.
Failed to install wasm module to canister ‘basic_bitcoin’.
Failed to install wasm in canister ‘rrkah-fqaaa-aaaaa-aaaaq-cai’.
Failed to install wasm.
The replica returned an HTTP Error: Http Error: status 413 Payload Too Large, content type “”, content: Request 0x544cdb792de775359f407e4ef3cbc67faa3a1887624abc3db3988d695627e971 is too large. Message byte size 2841690 is larger than the max allowed 2097152.
douglassmith@static-76-161-87-250 basic_bitcoin %

It’s pretty common to have rust canisters be too big. There’s a few things you can try. Probably easiest is cargo install ic-wasm, which will try to remove unused code from the wasm before uploading. Next is to gzip the wasm before uploading it. This requires a custom build script and you should be able to find more info about it in this or this thread.

thanks got things working by compressing wasm and rolling back dfx 12.1. → dfx 12.0

i was not able to install ic-wasm

some issues may be from using a M1 mac