We present the Stochastic Green Function (SGF) algorithm designed for bosons on lattices. This new quantum Monte Carlo algorithm is independent of the dimension of the system, works in continuous imaginary time, and is exact (no error beyond statistical errors). Hamiltonians with several species of bosons (and one-dimensional Bose-Fermi Hamiltonians) can be easily simulated. Some important features of the algorithm are that it works in the canonical ensemble and gives access to n-body Green functions.