Is pocket-ic opensource? how do you build that binary file? Its so cool!

Im also curious about:
Can i use pocket-ic to test with local ic-replica?
Is it the same env like dfx start when using pocket-ic?

1 Like

Here’s the repo: GitHub - dfinity/pocketic: A canister smart contract testing solution for the Internet Computer.

It does not support the right interface yet that would allow dfx or agents to make calls against it, but it’s one of the things the team is working on AFAIK



PocketIC is a testing platform that consists of a PocketIC binary and several libraries that integrate the binary with the corresponding language and ecosystem.

Is PocketIC opensource?

The binary’s source code resides in the IC repository, and the IC repo’s open source policy applies.

How do you build the binary?

It is built with bazel like all mainnet components, but due to deep dependencies and the build complexity, this may not be easy to replicate. But in principle it is possible. We cannot offer support for this at the moment.

The libraries are intended to be owned and maintained by the public. We have initiated the effort by developing the Rust library and the Python library in order to show how to integrate different languages, and for the moment, we will keep these two up to date. We hope, however, that the community adopts the existing libraries (and of course, creates new ones, like this typescript library).

Can I use PocketIC to test with local replica?

No, PocketIC is an alternative to the local replica.

Think of the local replica as the whole SW stack of an IC node running on your machine, basically a single-node subnet.

PocketIC uses only the execution environment of the mainnet, because for canister testing, the consensus and networking layers are mostly unnecessary. That’s why it is faster.

Is it the same env like dfx start?

I don’t fully understand the question, but here is a guess:

dfx start gives you an interactive testing environment by launching a local single-node subnet. PocketIC currently does not support the protocol (that is, the IC HTTP interface) necessary to work with DFX and the / agent.js libraries. But we are currently exploring possible steps in this direction.

In the meantime, PocketIC is intended to be launched (automatically) by your integration tests, simply by being instantiated in your test code. The libraries take care of the server lifetime and instance management (yes, you can have many concurrent IC instances on PocketIC).

If you have any more questions, let us know.


wahoo. im so grateful with so passionate answer!
Thank you very much for detailed reply.
I learn alot from it!

And, I also try to build ic-replica from source code ,but also encounter some issue, hah.

I have find pocket-ic is in ic main codebase.So i understood how to build pocket-ic from source code.

1 Like

Can we get http outcalls or something similar integrated into pocket-ic?

Yes, http outcalls are on the roadmap. I can’t give an estimate for the next release, but this feature is relatively small, so it might come early 2024.

1 Like