Bitcoin uses a distributed database across a peer-to-peer computer network to record transactions , and uses cryptography to provide basic security functions , such as ensuring that bitcoins can only be spent once , and only by the person who owns them . Bitcoin uses a distributed database spread across nodes of a peer-to-peer network to journal transactions , and uses cryptography in order to provide basic security functions , such as ensuring that bitcoins can only be spent by the person who owns them , and never more than once .