Skip to main content

Map the Software Supply Chain

Trace the dependencies in a software bill of materials (SBOM) for a given repository and assign weights or other metrics to each node. New to OSO? Check out our Getting Started guide to set up your BigQuery or API access.

Dependency Graph

Getting Started

Before running any analysis, you'll need to set up your environment:

If you haven't already, subscribe to OSO public datasets in BigQuery by clicking the "Subscribe" button on our Datasets page.

You can run all queries in this guide directly in the BigQuery console.

Identify Repositories and Packages

Repository Metadata

Get metadata and basic stats about a repository using OSO's indexed data:

select *
from `oso_production.repositories_v0`
where artifact_url = 'https://github.com/ethereum/go-ethereum'

SBOMs (Package Dependencies)

OSO uses GitHub's Software Bill of Materials (SBOMs) dataset to identify package dependencies. Note that this data doesn't differentiate between direct and indirect dependencies, but provides a good starting point for mapping the software supply chain:

select *
from `oso_production.sboms_v0`
where from_artifact_id = '0mjl8VhWsui_6TEZZnbQzyf8h1A9bOioIlK17p0D5hI='

Package Maintainers

OSO leverages Open Source Insights (deps.dev) data to identify the repo that maintains a given package. This covers approximately 90% of packages based on our testing:

select
package_artifact_source,
package_artifact_name,
package_owner_project_id,
package_owner_artifact_namespace,
package_owner_artifact_name
from `oso_production.package_owners_v0`
where package_artifact_name = '@libp2p/echo'

Build a Deep Funding Graph

This example demonstrates how to create a dependency graph for a group of related repositories, such as the one used by Deep Funding. The analysis maps relationships between key Ethereum repositories and their package dependencies:

select distinct
sboms.from_artifact_namespace as seed_repo_owner,
sboms.from_artifact_name as seed_repo_name,
sboms.to_package_artifact_name as package_name,
package_owners.package_owner_artifact_namespace as package_repo_owner,
package_owners.package_owner_artifact_name as package_repo_name,
sboms.to_package_artifact_source as package_source
from `oso_production.sboms_v0` sboms
join `oso_production.package_owners_v0` package_owners
on
sboms.to_package_artifact_name = package_owners.package_artifact_name
and sboms.to_package_artifact_source = package_owners.package_artifact_source
where
sboms.to_package_artifact_source in ('NPM','RUST','GO','PIP')
and package_owners.package_owner_artifact_namespace is not null
and concat(sboms.from_artifact_namespace, '/', sboms.from_artifact_name)
in ('prysmaticlabs/prysm','sigp/lighthouse','consensys/teku','status-im/nimbus-eth2',
'chainsafe/lodestar','grandinetech/grandine','ethereum/go-ethereum',
'nethermindeth/nethermind','hyperledger/besu','erigontech/erigon',
'paradigmxyz/reth','ethereum/solidity','ethereum/remix-project',
'vyperlang/vyper','ethereum/web3.py','ethereum/py-evm',
'eth-infinitism/account-abstraction','safe-global/safe-smart-account',
'a16z/helios','web3/web3.js','ethereumjs/ethereumjs-monorepo')

For more examples of dependency analysis, check out the Deep Funding repo.

Weight Nodes and Edges

Most Used Dependencies

Find the most commonly used dependencies across all projects in OSO. This query joins package ownership data with SBOM data to count how many projects depend on each package:

select
p.project_id,
pkgs.package_artifact_source,
pkgs.package_artifact_name,
count(distinct sboms.from_project_id) as num_dependents
from `oso_production.package_owners_v0` pkgs
join `oso_production.sboms_v0` sboms
on pkgs.package_artifact_name = sboms.to_package_artifact_name
and pkgs.package_artifact_source = sboms.to_package_artifact_source
join `oso_production.projects_v1` p
on pkgs.package_owner_project_id = p.project_id
where pkgs.package_owner_project_id is not null
group by 1,2,3
order by 4 desc

Downstream Impact

This is an example of a more advanced analysis that demonstrates how to analyze relationships between onchain projects and their development dependencies:

select
onchain_projects.project_name as `onchain_builder`,
onchain_metrics.event_source as `network`,
onchain_metrics.address_count_90_days,
onchain_metrics.gas_fees_sum_6_months,
onchain_metrics.transaction_count_6_months as transactions_6_months,
code_metrics.project_name as `dev_tool_maintainer`,
package_owners.package_artifact_source as `package_source`,
code_metrics.active_developer_count_6_months,
code_metrics.contributor_count_6_months,
code_metrics.commit_count_6_months,
code_metrics.opened_issue_count_6_months,
code_metrics.opened_pull_request_count_6_months,
code_metrics.fork_count,
code_metrics.star_count,
code_metrics.last_updated_at_date
from `oso_production.sboms_v0` sboms
join `oso_production.projects_v1` onchain_projects
on sboms.from_project_id = onchain_projects.project_id
join `oso_production.projects_by_collection_v1` projects_by_collection
on onchain_projects.project_id = projects_by_collection.project_id
join `oso_production.onchain_metrics_by_project_v1` onchain_metrics
on onchain_projects.project_id = onchain_metrics.project_id
join `oso_production.package_owners_v0` package_owners
on sboms.to_package_artifact_name = package_owners.package_artifact_name
join `oso_production.code_metrics_by_project_v1` code_metrics
on package_owners.package_owner_project_id = code_metrics.project_id
where
projects_by_collection.collection_name = 'op-retrofunding-4'
and transaction_count_6_months >= 1000
and address_count_90_days >= 420

You can go even further in your analysis by joining on other OSO datasets. For more examples, check out the Deep Funding repo.