> For the complete documentation index, see [llms.txt](https://docs.zebec.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.zebec.io/zebec-bridge/bridge-sdk/init-stream.md).

# Init Stream

&#x20;Asset stream initialization can be performed in following way.

```typescript
const now = nowInSec();
const startTime = now + 180; 
/* 
* three min added deliberately because it takes times for your payload to hit 
* zebec program in solana 
**/
const endTime = startTime + 6000; // 100 min 
const streamAmount = "1";
const receiver = <evm address>;
const sender = signer.address;
const canCancel = true;
const canUpdate = true;
const tokenMint = "<solana mint address>";

const sourceChain = CHAIN_ID_BSC;

const receipt = await ethClient.initStream(
   startTime.toString(),
   endTime.toString(),
   streamAmount,
   receiver,
   sender,
   canCancel,
   canUpdate,
   tokenMint,
);
```

Now you can find signed Vaa bytes of your payload sent from wormhole guardian rpc hosts.

```typescript
const sequence = parseSequenceFromLogEth(receipt, getBridgeAddressForChain(sourceChain));
const zebecEmitterAddress = getEmitterAddressEth(BSC_ZEBEC_BRIDGE_ADDRESS);
const { vaaBytes } = await getSignedVAAWithRetry(
   WORMHOLE_RPC_HOSTS,
   sourceChain,
   zebecEmitterAddress,
   sequence,
);
```

Now post this signed vaa to wormhole solana core bridge program, parse the payloads from vaa and send the parsed data to solana zebec bridge program. This part is optional because it's handled by zebec's specialized relayer.

```typescript
const payerAddress = wallet.publicKey.toString();
const bridgeAddress = getBridgeAddressForChain(targetChain);
const vaaBuf = Buffer.from(vaaBytes);

setDefaultWasm("node"); // use bundler for browser

// posting vaa in solana
await postVaaSolanaWithRetry(
   connection,
   wallet.signTransaction,
   bridgeAddress,
   payerAddress,
   vaaBuf,
   MAX_VAA_UPLOAD_RETRIES_SOLANA,
);

const parsedVaa = parse_vaa(streamVaa);
const parsedPayload = parseZebecPayload(Buffer.from(parsedVaa.payload));

const result = await solanaClient.initializeStream(streamVaa, <TokenStreamPayload>parsedPayload);
console.log(result);
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.zebec.io/zebec-bridge/bridge-sdk/init-stream.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
