# 使用 Alchemy SDK 与链上数据交互

By [Superobin](https://paragraph.com/@rlog) · 2022-10-05

---

使用 Alchemy SDK 可以方便的让你的 dapp 与链上进行数据交互

1.  引入 sdk
    
        npm install alchemy-sdk
        
        import { Network, Alchemy } from 'alchemy-sdk';
        
        // Optional Config object, but defaults to demo api-key and eth-mainnet.
        const settings = {
          apiKey: 'demo', // Replace with your Alchemy API Key.
          network: Network.ETH_MAINNET, // Replace with your network.
        };
        
        const alchemy = new Alchemy(settings);
        
    
2.  使用 api 读取 nft 数据
    
        alchemy.nft.getNftsForOwner('vitalik.eth').then(res => {
          console.log(res);
        });
        
    

更多关于 Alchemy 介绍可查看这里：

[https://docs.alchemy.com/reference/alchemy-sdk-quickstart](https://docs.alchemy.com/reference/alchemy-sdk-quickstart)

---

*Originally published on [Superobin](https://paragraph.com/@rlog/alchemy-sdk)*
