What I'm doing

When I compile and deploy a contract using Truffle, I get a .json build artifact that contains information about where the contract is deployed on the network (its address).

So far I have just been checking this file into version control in order to distribute the interface to my contract, but this is less than ideal since the artifact file contains the compiled binary of the contract.

Why it's bad

Since git is not meant to handle binaries, changes to a binary make the repo unnecessarily large, and diffs become extremely noisy.

My question is this:

How can I distribute an interface to my deployed contract without checking a binary into version control?

"Solutions" I can think of

  • I am aware of git-annex and similar solutions, but they seem like overkill.

  • I've also thought about doing something like: truffle networks > networks.txt but this is hacky and requires consumers to create their own interface with the contract addresses I distribute.

  • We only commit the .sol files in the repository. Only after deployment we generate a document with the contracts addresses and abis (which are JSON). – Ismael Jul 6 '17 at 14:25
  • @Ismael ok, but you don't distribute the .json, is that right? How can someone know the addresses of your contracts after they've been deployed? – Travis Jacobs Jul 6 '17 at 14:49
  • It's part of the documentation, we add to a section in the readme, deployment address and contract abi, also the abi is in a separate file for those who need it that way. But this is done once, after deployment. – Ismael Jul 6 '17 at 16:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.