# Using blockservice.New with echange parameter to store online

**URL:** <https://discuss.ipfs.tech/t/using-blockservice-new-with-echange-parameter-to-store-online/15296>\
**Category:** Help\
**Tags:** go-ipfs\
**Created:** [October 5, 2022, 1:20am UTC](https://discuss.ipfs.tech/t/using-blockservice-new-with-echange-parameter-to-store-online/15296 "2022-10-05T01:20:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ehsan6sha](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/ehsan6sha/32/4639_2.png) [@ehsan6sha](https://discuss.ipfs.tech/u/ehsan6sha)\
**Post date:** [October 5, 2022, 1:20am UTC](https://discuss.ipfs.tech/t/using-blockservice-new-with-echange-parameter-to-store-online/15296/1 "2022-10-05T01:20:00Z")

</div>

> [@Go-ds-crdt: A distributed key-value store implementation for IPFS](https://discuss.ipfs.tech/t/go-ds-crdt-a-distributed-key-value-store-implementation-for-ipfs/5239/4):
>
> ```auto
> bs := blockstore.NewBlockstore(sync.MutexWrap(datastore.NewMapDatastore()))
> network := bitswapnet.NewFromIpfsHost(host, routing)
> exchange := bitswap.New(ctx, network, bs, bitswap.ProvideEnabled(true))
> blsrv := blockservice.New(bs, exchange)
> 
> ```

Hi, I want to use the created blocksservice in WNFS and store te created DAGs on IPFS instead of locally.  
My question might be noob but this is the only piece of code I found on how to use blockservice.New with the echange parameter.  
Basically, I want to create a blockservice which stores data on IPFS network. Can someone please guide me on how can I achieve it with a sample piece of code?

---

<div class="post-metadata">

**Author:** ![ehsan6sha](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/ehsan6sha/32/4639_2.png) [@ehsan6sha](https://discuss.ipfs.tech/u/ehsan6sha)\
**Post date:** [October 5, 2022, 3:31am UTC](https://discuss.ipfs.tech/t/using-blockservice-new-with-echange-parameter-to-store-online/15296/2 "2022-10-05T03:31:11Z")

</div>

Found the answer in ipfslite code: [ipfs-lite/ipfs.go at master · hsanjuan/ipfs-lite · GitHub](https://github.com/hsanjuan/ipfs-lite/blob/master/ipfs.go)
