2

When I add BitcoinDevKit as a dependency to the pallet-template, I get compilation errors within the socks crate that I don't get when compiling BDK standalone. It seems that BDK supports compilation to WASM, but I am not sure.

Is it possible to use BDK functionality within a pallet? How can I satisfy these compilation errors?

  error[E0599]: no method named `writev` found for struct `UdpSocket` in the current scope
     --> /home/max/.cargo/registry/src/github.com-1ecc6299db9ec823/socks-0.3.4/src/v5.rs:391:21
      |
  391 |         self.socket.writev([&header[..len + 3], buf])
      |                     ^^^^^^ method not found in `UdpSocket`
      |
      = help: items from traits can only be used if the trait is implemented and in scope
  note: `WritevExt` defines an item `writev`, perhaps you need to implement it
     --> /home/max/.cargo/registry/src/github.com-1ecc6299db9ec823/socks-0.3.4/src/writev.rs:4:1
      |
  4   | pub trait WritevExt {
      | ^^^^^^^^^^^^^^^^^^^

1 Answer 1

2

I don't know about bdk so can't provide specific info regarding it. Only libraries that allow compiling under no_std are supported to be used in the runtime. The fact that this is trying to compile sockets clearly shows that this is not the case (you can't do system calls from the runtime).

Here's an issue on their repo for this: https://github.com/bitcoindevkit/bdk/issues/205

1
  • 1
    Makes sense. I was thinking something like this was the case. I believe that I can create a new off-chain service separate from the node and then call that service from the OCW to do the BDK work.
    – Max
    Commented Feb 27, 2022 at 15:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.