# Packaging

A chaincode should be packaged in a specifically structured **.tar.gz** file before it can be installed on the organization's peers. The chaincode package includes the **metadata.json** file along with the chaincode codebase packaged with all dependencies in the **code.tar.gz** file.

Package metadata contains three fields describing the chaincode programming language, code path, and package label―a succinct and human readable identifier of the package. An example of package metadata is shown below.

```javascript
{
   "Path": "/path/to/chaincode/source",
   "Type": "node",
   "Label": "chaincode_1.0"
}
```

It is possible to reproduce a chaincode package structure using third-party tools, such as GNU **tar**. However, it is easier to use the Hyperledger Fabric **peer** binary, as it automatically packages a chaincode in a prescribed format.

```javascript
peer lifecycle chaincode package chaincode.tar.gz --path /path/to/chaincode/source --lang node --label chaincode_1.0
```

*Note:* Chaincode’s source code should be populated with all necessary dependencies before packaging.

The chaincode can be packaged separately by different organizations. Moreover, it is not necessary for organizations to give identical labels to the same packages.

The other approach is to create a chaincode package on behalf of one organization and then share it with other channel participants to ensure integrity.
