{"id":20400744,"url":"https://github.com/bifrost-technologies/link-stream","last_synced_at":"2025-04-12T14:08:30.778Z","repository":{"id":65391011,"uuid":"591522015","full_name":"Bifrost-Technologies/Link-Stream","owner":"Bifrost-Technologies","description":"LinkStream is middleware designed to be integrated into applications or games that use Solana's C# SDK. Utilizing TCP server \u0026 client protocols to send transaction messages from dapps to wallet based applications.","archived":false,"fork":false,"pushed_at":"2024-11-11T13:32:06.000Z","size":55,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-26T08:47:33.503Z","etag":null,"topics":["middleware","solana","solnet","tcp-server","transaction"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Bifrost-Technologies.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2023-01-21T00:54:50.000Z","updated_at":"2025-03-11T02:11:01.000Z","dependencies_parsed_at":"2023-02-16T07:01:42.522Z","dependency_job_id":null,"html_url":"https://github.com/Bifrost-Technologies/Link-Stream","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bifrost-Technologies%2FLink-Stream","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bifrost-Technologies%2FLink-Stream/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bifrost-Technologies%2FLink-Stream/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bifrost-Technologies%2FLink-Stream/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Bifrost-Technologies","download_url":"https://codeload.github.com/Bifrost-Technologies/Link-Stream/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248578867,"owners_count":21127713,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["middleware","solana","solnet","tcp-server","transaction"],"created_at":"2024-11-15T04:45:51.001Z","updated_at":"2025-04-12T14:08:30.755Z","avatar_url":"https://github.com/Bifrost-Technologies.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# LinkStream\n![linkstream-thin-banner](https://user-images.githubusercontent.com/24855008/214090668-e52dfc8f-00a2-47dd-807c-fd4c3cfd8a9a.png)\nLinkStream is middleware designed to be integrated into applications or games that use Solana's C# SDK.\nUtilizing TCP server \u0026 client protocols to send transaction messages from dapps to wallet based applications. \n\nLocal streams can be protected with encryption, while remote usage should be strict with whitelisted IP access. \nReference the Server/Client Examples provided on github. \n\nTranquility is currently the only compatible desktop wallet and can be downloaded here [Tranquility](https://github.com/Bifrost-Technologies/Tranquility)\n\n\n### Wallet (Server) Example:\n```\nusing LinkStream.Server;\nusing Solnet.Rpc;\nusing Solnet.Rpc.Models;\nusing Solnet.Wallet;\n\n//Initialize the Link Server - Port must match - Every dapp should use a unique port to prevent socket issues. 50505 is an example port.\nLinkNetwork _LinkNetwork = new LinkNetwork(50505, _LinkServerName: \"Pseudo Wallet App\");\n\n//Setting a request handler event is required in order to respond to the packets in the packetprocessor. \n_LinkNetwork.SignatureRequestEvent += HandleRequestEvent;\n\n//When integrating LinkStream into applications force this task to run in the background. In this example it runs on the main thread but ideally you want it to run on its own thread to prevent thread blocking issues.\nawait _LinkNetwork.LinkStream();\nConsole.ReadKey();\n\n\n\n//Event triggered when a transaction message is requested from a client\nasync void HandleRequestEvent(object? sender, SignRequestEventArgs e)\n{\n    //Our pseudo wallet app decodes the instructions and displays it. In a real application the user would click a button and sign the transaction after reading the instructions. In this example we auto sign and send the transaction.\n    string _decodedInstructions = PacketProcessor.DecodeTransactionMessage(Convert.FromBase64String(e.Message));\n    Console.WriteLine(_decodedInstructions);\n\n    IRpcClient rpcClient = ClientFactory.GetClient(Cluster.MainNet);\n\n    Wallet wallet = new Wallet(\"\", passphrase: \"\");\n    Account signer = wallet.GetAccount(0);\n\n    byte[] transactionMessage = Convert.FromBase64String(e.Message);\n    byte[] signedTransaction = signer.Sign(transactionMessage);\n    List\u003cbyte[]\u003e signatures = new() { signedTransaction };\n    Transaction tx = Transaction.Populate(Message.Deserialize(transactionMessage), signatures);\n\n    _LinkNetwork.SetOutboundMessage(Convert.ToBase64String(tx.Serialize()));\n    await Task.CompletedTask;\n}\n\n```\n\n\n### DApp (Client) Example\n```\nusing LinkStream.Client;\nusing LinkStream.Packets;\nusing Solnet.Programs;\nusing Solnet.Rpc;\nusing Solnet.Rpc.Builders;\nusing Solnet.Rpc.Core.Http;\nusing Solnet.Rpc.Messages;\nusing Solnet.Rpc.Models;\nusing Solnet.Wallet;\n\n//Initialize the LinkStream Client - Match the port to the server. \nLinkClient linkClient = new LinkClient(50505, _LinkClientName: \"Pseudo Dapp/Game\");\n\nIRpcClient rpcClient = ClientFactory.GetClient(Cluster.MainNet);\nPublicKey fromAccount = new PublicKey(\"ENTER WALLET ADDRESS HERE\");\nRequestResult\u003cResponseValue\u003cLatestBlockHash\u003e\u003e blockHash = rpcClient.GetLatestBlockHash();\n\n\nbyte[] transactionMessage = new TransactionBuilder()\n    .SetRecentBlockHash(blockHash.Result.Value.Blockhash)\n    .SetFeePayer(fromAccount)\n    .AddInstruction(MemoProgram.NewMemoV2(\"LinkStream Client Test!\"))\n    .CompileMessage();\n\n//Retrieve serialized tx and send it to an RPC to be processed etc\nstring tx = await linkClient.SendPacket(LinkPackets.CraftPacket(linkClient, LinkStream.Types.PacketTypes.RequestSignature, Convert.ToBase64String(transactionMessage)));\nConsole.WriteLine(tx);\n\n\nConsole.ReadKey();\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbifrost-technologies%2Flink-stream","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbifrost-technologies%2Flink-stream","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbifrost-technologies%2Flink-stream/lists"}