logo

Unlock ABI modules

We publish our ABI as npm modules

By Julien Genestoux on

ABI

We write our smart contracts using the Solidity language. Once compiled they are deployed to the Ethereum chain. Ethereum nodes, such as the ones from Alchemy (which we use and love!), provide RPC endpoints to retrieve or alter the state of the contracts.

The "description" of the method calls is inside of the Application Binary Interface (ABI). The Contract ABI is the standard way to interact with contracts in the Ethereum ecosystem, both from outside the blockchain and for contract-to-contract interaction. Data is encoded according to its type, as described in this specification. The encoding is not self describing and thus requires a schema in order to decode.

We verify all of our contract on Etherscan, which means that creators and consumers can easily inspect each implementation and ensure that the protocol works as they expect. You can also use Etherscan to inspect the ABI themselves. See for example the ABI of the lock on this blog.

npm modules

3rd party developers can use our ABIs directly, but, for convenience, we also provide npm modules. These modules can be used inside of JavaScript applications, either front-end or backend! The module can also be used with other Solidity applications since several solidity developer tools, such as Truffle! For example, you can look at our very own smart contract extensions!

We publish each and every Unlock ABI as module for every version that we publish: @unlock-protocol/contracts

The Unlock contract, which is a factory contract will always deploy locks from the latest version, but older locks are, by design, not updagradable by us, which means that they will remain on the version at the time of their deployment. You should use etherscan to inspect which version a specific lock uses!