We perform a detailed study of double Higgs production via gluon fusion in the effective field theory (EFT) framework where effects from new physics (NP) are parametrized by local operators. Our analysis provides a perspective broader than the one followed in most of the previous analyses, where this process was merely considered as a way to extract the Higgs trilinear coupling. We focus on the hh -> b (b) over bar gamma gamma channel and perform a thorough simulation of signal and background at the 14 TeV LHC and a future 100 TeV proton-proton collider. We make use of invariant mass distributions to enhance the sensitivity on the EFT coefficients and give a first assessment of the impact of jet substructure techniques on the results. The range of validity of the EFT description is estimated, as required to consistently exploit the high-energy range of distributions, pointing out the potential relevance of dimension-8 operators. Our analysis contains a few important improvements over previous studies and identifies some inaccuracies there appearing in connection with the estimate of signal and background rates. The estimated precision on the Higgs trilinear coupling that follows from our results is less optimistic than previously claimed in the literature. We find that a similar to 30% accuracy can be reached on the trilinear coupling at a future 100 TeV collider with 3 ab(-1). Only an O(1) determination instead seems possible at the LHC with the same amount of integrated luminosity.