{"id":37197348,"url":"https://github.com/tosynthegeek/mcw","last_synced_at":"2026-01-14T22:56:35.954Z","repository":{"id":246009630,"uuid":"812059240","full_name":"tosynthegeek/mcw","owner":"tosynthegeek","description":"A Golang multichain wallet library for managing wallets, transactions, and interactions across multiple blockchains including Ethereum, Bitcoin, Solana, Aptos, Flow and EVM compatible blockchains.","archived":false,"fork":false,"pushed_at":"2024-06-27T14:53:06.000Z","size":931,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-11-15T22:27:31.700Z","etag":null,"topics":["aptos","bitcoin","blockcahin","crosschain","ethereum","evm","flow","golang","multichain","solana","wallet","wallet-generator"],"latest_commit_sha":null,"homepage":"https://pkg.go.dev/github.com/tosynthegeek/mcw","language":"Go","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/tosynthegeek.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-06-07T21:41:09.000Z","updated_at":"2024-09-16T06:53:09.000Z","dependencies_parsed_at":"2024-06-27T18:07:25.072Z","dependency_job_id":null,"html_url":"https://github.com/tosynthegeek/mcw","commit_stats":null,"previous_names":["tosynthegeek/mcw"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/tosynthegeek/mcw","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tosynthegeek%2Fmcw","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tosynthegeek%2Fmcw/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tosynthegeek%2Fmcw/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tosynthegeek%2Fmcw/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tosynthegeek","download_url":"https://codeload.github.com/tosynthegeek/mcw/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tosynthegeek%2Fmcw/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28437448,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T22:37:52.437Z","status":"ssl_error","status_checked_at":"2026-01-14T22:37:31.496Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["aptos","bitcoin","blockcahin","crosschain","ethereum","evm","flow","golang","multichain","solana","wallet","wallet-generator"],"created_at":"2026-01-14T22:56:35.253Z","updated_at":"2026-01-14T22:56:35.922Z","avatar_url":"https://github.com/tosynthegeek.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Multichain Wallet (MCW)\n\nMCW is a Go package that provides a unified interface for managing wallets, generating mnemonics, and interacting with different blockchain networks: Ethereum, Solana, Bitcoin, and Aptos.The interface includes functionality for creating and managing wallets, handling transactions, and performing other blockchain-related operations.\n\n# Table of Contents\n\n- [Installation](https://github.com/tosynthegeek/multichain-wallet?tab=readme-ov-file#installation)\n- [Usage](https://github.com/tosynthegeek/multichain-wallet?tab=readme-ov-file#usage)\n- [Methods](https://github.com/tosynthegeek/multichain-wallet?tab=readme-ov-file#methods)\n- [Error Handling](https://github.com/tosynthegeek/multichain-wallet?tab=readme-ov-file#error-handling)\n- [Contribute](https://github.com/tosynthegeek/multichain-wallet?tab=readme-ov-file#contribute)\n\n## Installation\n\n```go\ngo get github.com/tosynthegeek/mcw\ngo get github.com/tosynthegeek/mcw/wallet\n```\n\n## Usage\n\nImport the package in your Go code:\n\n```go\nimport \"github.com/tosynthegeek/mcw/wallet\"\n```\n\n## Methods\n\n| Method                                                                                                                    | Ethereum | Solana | Bitcoin | Aptos | Flow |\n| ------------------------------------------------------------------------------------------------------------------------- | -------- | ------ | ------- | ----- | ---- |\n| [GenerateMnemonic](https://github.com/tosynthegeek/multichain-wallet?tab=readme-ov-file#generatemnemonic)                 | ✓        | ✓      | ✓       | ✓     | ✓    |\n| [WalletFromMnemonic](https://github.com/tosynthegeek/multichain-wallet?tab=readme-ov-file#walletfrommnemonic)             | ✓        | ✓      | ✓       | ✓     | ✓    |\n| [CreateWallet](https://github.com/tosynthegeek/multichain-wallet?tab=readme-ov-file#createwallet)                         | ✓        | ✓      | ✓       | ✓     | ✓    |\n| [GetAddressFromPrivateKey](https://github.com/tosynthegeek/multichain-wallet?tab=readme-ov-file#getaddressfromprivatekey) | ✓        | ✓      | ✓       | ✓     | ✗    |\n| [GetBalance](https://github.com/tosynthegeek/multichain-wallet?tab=readme-ov-file#getbalance)                             | ✓        | ✓      | ✓       | ✓     | ✓    |\n| [GetTokenBalance](https://github.com/tosynthegeek/multichain-wallet?tab=readme-ov-file#gettokenbalance)                   | ✓        | ✓      | ✗       | ✓     | ✗    |\n| [GetTxByHash](https://github.com/tosynthegeek/multichain-wallet?tab=readme-ov-file#gettxbyhash)                           | ✓        | ✓      | ✓       | ✓     | ✓    |\n| [Transfer](https://github.com/tosynthegeek/multichain-wallet?tab=readme-ov-file#transfer)                                 | ✓        | ✓      | ✓       | ✓     | ✓    |\n| [TransferToken](https://github.com/tosynthegeek/multichain-wallet?tab=readme-ov-file#transfertoken)                       | ✓        | ✓      | ✗       | ✗     | ✗    |\n| [GetTokenInfo](https://github.com/tosynthegeek/multichain-wallet?tab=readme-ov-file#gettokeninfo)                         | ✓        | ✓      | ✗       | ✗     | ✗    |\n| [SmartContractCall](https://github.com/tosynthegeek/multichain-wallet?tab=readme-ov-file#smartcontractcall)               | ✓        | ✗      | ✗       | ✗     | ✗    |\n| [CreateAccountCreationTx](https://github.com/tosynthegeek/multichain-wallet?tab=readme-ov-file#createaccountcreationtx)   | ✗        | ✗      | ✗       | ✗     | ✓    |\n\n### GenerateMnemonic\n\nGenerates a BIP-39 mnemonic phrase based on the specified entropy bit size. EThe mnemonic phrase is generated based on a specific bit size of entropy (randomness). 128 bits of entropy gives a 12-word mnemonic. 160 bits of entropy gives a 15-word mnemonic. 192 bits of entropy gives an 18-word mnemonic. 224 bits of entropy gives a 21-word mnemonic. 256 bits of entropy gives a 24-word mnemonic.\n\n```go\nbitsize:= 128\nmnemonic, err := wallet.GenerateMnemonic(bitsize)\nif err != nil {\n    fmt.Println(\"Error:\", err)\n} else {\n    fmt.Println(\"Mnemonic:\", mnemonic)\n}\n```\n\n- **Output**\n\n```\nMnemonic: abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about\n```\n\n### WalletFromMnemonic\n\n`WalletFromMnemonic` generates a wallet for a specified network using a given mnemonic phrase and passphrase. It takes in mnemonic, passphrase and network in a `types.WalletParam` struct.\n\nIt supports Ethereum, Solana, Bitcoin, and Aptos\n\n```go\nmnemonic := \"abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about\"\npassphrase:= \"mysecretpassword\"\nnetwork:= \"ethereum\"\nwp:= types.WalletParam {\n    Mnemonic: mnemonic,\n    Passphrase: passphrase,\n    Network: network,\n}\nwallet, err:= wallet.WalletFromMnemonic(wp)\nif err != nil {\n    fmt.Println(\"Error:\", err)\n}\n\nfmt.Printf(\"Mnemonic: %s\\n\", wallet.Mnemonic)\nfmt.Printf(\"Private Key: %s\\n\", wallet.PrivateKey)\nfmt.Printf(\"Public Key: %s\\n\", wallet.PublicKey)\nfmt.Printf(\"Address: %s\\n\", wallet.Address)\n```\n\n- **Output**:\n\n```go\n    Mnemonic: abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about,\n    PrivateKey: 5e62984d8bda6a40bbdb08496b1d3f6f5e1be8b1fe4a575d18b9e0f5934eac4d,\n    PublicKey: 0360ec40d4ec3132b3c5d6d9b4cddf8e17bb2c0e9e20d69e2e0bb9f9d7f9d20d6f,\n    Address: 0x1234567890123456789012345678901234567890\n```\n\n### CreateWallet\n\n`CreateWallet` generates a new wallet for a specified network. It takes in network and other parameters in a `types.CWParam` struct. It returns a Wallet struct containing the mnemonic, private key, public key, and address.\n\n```go\ncwp := types.CWParam{\n    Network: \"ethereum\",\n    Passphrase: \"mysecretpassword\",\n}\nwallet, err := wallet.CreateWallet(cwp)\nif err != nil {\n    fmt.Println(\"Error:\", err)\n}\n```\n\n- **Output**\n\n```go\n    Mnemonic: abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about,\n    PrivateKey: 5e62984d8bda6a40bbdb08496b1d3f6f5e1be8b1fe4a575d18b9e0f5934eac4d,\n    PublicKey: 0360ec40d4ec3132b3c5d6d9b4cddf8e17bb2c0e9e20d69e2e0bb9f9d7f9d20d6f,\n    Address: 0x1234567890123456789012345678901234567890\n```\n\n### GetAddressFromPrivateKey\n\n`GetAddressFromPrivateKey` derives the address from a given private key for a specified network. It takes in the network and private key as strings. It returns an Address struct.\nIt supports Ethereum, Solana, Bitcoin,and Aptos. There is no Flow support because Flow addresses aren't derived from private or public keys. In Flow, addresses are assigned by the network when an account is created.\n\n```go\nnetwork := \"ethereum\"\nprivateKey := \"5e62984d8bda6a40bbdb08496b1d3f6f5e1be8b1fe4a575d18b9e0f5934eac4d\"\naddress, err := wallet.GetAddressFromPrivateKey(network, privateKey)\nif err != nil {\n    fmt.Println(\"Error:\", err)\n} else {\n    fmt.Println(\"Address:\", address)\n}\n```\n\n- **Output**\n\n```go\nAddress: {\n    Address: \"0x1234567890123456789012345678901234567890\"\n}\n```\n\n\u003e **Note:** The actual address output will vary depending on the network and private key provided. Each supported blockchain (Ethereum, Solana, Bitcoin, and Aptos) has its own method of deriving addresses from private keys:\n\n- Ethereum: Addresses are derived from the public key, which is in turn derived from the private key.\n- Solana: Addresses are essentially the public key in base58 encoding.\n- Bitcoin: Addresses are derived from the public key and can be in different formats (e.g., P2PKH, P2SH, Bech32).\n- Aptos: Addresses are derived from the public key.\n\nFor Flow, addresses are assigned by the network when an account is created, not derived from keys. This is why the function doesn't support Flow addresses.\n\n### GetBalance\n\n`GetBalance` retrieves the balance for a given address on a specified network. It takes in network, address, and other parameters in a `types.BalanceParam` struct. It returns a `Balance` struct.\nIt supports Ethereum, Solana, Bitcoin, Aptos, and Flow.\n\n```go\nbp := types.BalanceParam{\n    Network: \"ethereum\",\n    Address: \"0x1234567890123456789012345678901234567890\",\n    EndpointURL: \"http://dummy-ethereum-rpc.com:8545\" // replace with your EndpointURL\n    // Add other necessary parameters\n}\nbalance, err := wallet.GetBalance(bp)\nif err != nil {\n    fmt.Println(\"Error:\", err)\n} else {\n    fmt.Println(\"Balance:\", balance)\n}\n```\n\n- **Output**\n\n```go\nBalance: {\n    Address: 0x1234567890123456789012345678901234567890\n    Balance: \"1000000000000000000\",  // 1 ETH in wei\n}\n```\n\n### GetTokenBalance\n\n`GetTokenBalance` retrieves the token balance for a given address and token on a specified network. It takes in network, address, token address, and other parameters in a `types.TBParam` struct. It returns a `TokenBalance` struct.\nIt supports Ethereum, Solana, and Aptos. There is no Flow and Bitcoin support yet.\n\n```go\ntbp := types.TBParam{\n    Network: \"solana\",\n    EndpointURL: \"rpc.MainnetRPCEndpoint\"\n    Address: \"GLHCm5rMasb1kX7M7QL6Q9SVRWPscXsXpw32bmYgT7xo\",\n    TokenAddress: \"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v\",  // USDC token address\n    Context: context.TODO()\n    // Add other necessary parameters\n}\ntokenBalance, err := wallet.GetTokenBalance(tbp)\nif err != nil {\n    fmt.Println(\"Error:\", err)\n} else {\n    fmt.Println(\"Token Balance:\", tokenBalance)\n}\n```\n\n- **Output**\n\n```go\nToken Balance: {\n    Address: GLHCm5rMasb1kX7M7QL6Q9SVRWPscXsXpw32bmYgT7xo\n    Data: 58.90\n}\n```\n\n### GetTxByHash\n\n`GetTxByHash` retrieves transaction details for a given transaction hash on a specified network. It takes in network, transaction hash, and other parameters in a `types.HashParam` struct. It returns a `TransactionByHash` struct.\nIt supports Ethereum, Solana, Bitcoin, Aptos, and Flow.\n\n```go\nhp := types.HashParam{\n    Network: \"ethereum\",\n    Hash: \"0x123456789abcdef123456789abcdef123456789abcdef123456789abcdef1234\",\n    // Add other necessary parameters\n}\ntx, err := wallet.GetTxByHash(hp)\nif err != nil {\n    fmt.Println(\"Error:\", err)\n} else {\n    fmt.Println(\"Transaction:\", tx)\n}\n```\n\n- **Output**\n\n```go\nTransaction: {\n    isPending: false,\n    Transaction: {\n\n    }\n}\n```\n\n### Transfer\n\n`Transfer` initiates a transfer of native currency on a specified network. It takes in network, from address, to address, amount, and other parameters in a `types.TransferParam` struct. It returns a `TransferData` struct.\nIt supports Ethereum, Solana, Bitcoin, Aptos, and Flow.\n\n```go\ntp := types.TransferParam{\n    Network: \"ethereum\",\n    From: \"0x1234567890123456789012345678901234567890\",\n    To: \"0x0987654321098765432109876543210987654321\",\n    Amount: \"1000000000000000000\",  // 1 ETH in wei\n    // Add other necessary parameters\n    }\n    transferData, err := wallet.Transfer(tp)\n    if err != nil {\n        fmt.Println(\"Error:\", err)\n    } else {\n        fmt.Println(\"Transfer Data:\", transferData)\n    }\n```\n\n- **Output**\n\n```go\nash: 0x123456789abcdef123456789abcdef123456789abcdef123456789abcdef1234,\nData: {\n\n}\n```\n\n### TransferToken\n\n`TransferToken` initiates a transfer of tokens on a specified network. It takes in network, from address, to address, token address, amount, and other parameters in a `types.TransferTokenParam` struct. It returns a `TransferData` struct.\nIt supports only Ethereum and Solana. There is no Bitcoin, Aptos, and Flow support yet.\n\n```go\nttp := types.TransferTokenParam{\n    Network: \"ethereum\",\n    From: \"0x1234567890123456789012345678901234567890\",\n    To: \"0x0987654321098765432109876543210987654321\",\n    TokenAddress: \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",  // USDC token address\n    Amount: \"1000000\",\n    // Add other necessary parameters\n}\ntransferData, err := wallet.TransferToken(ttp)\nif err != nil {\n    fmt.Println(\"Error:\", err)\n} else {\n    fmt.Println(\"Transfer Data:\", transferData)\n}\n```\n\n- **Output**\n\n```go\nTransfer Data: {\n    TxHash: \"0x123456789abcdef123456789abcdef123456789abcdef123456789abcdef1234\",\n    Data: {\n\n    }\n    // Other transfer details\n}\n```\n\n### GetTokenInfo\n\n`GetTokenInfo` retrieves information about a token on a specified network. It takes in network, token address, and other parameters in a `types.TokenInfoParam` struct. It returns a `TokenInfo` struct.\nIt supports only Ethereum and Solana. There is no Bitcoin, Aptos, and Flow support yet.\n\n```go\ntip := types.TokenInfoParam{\n    Network: \"ethereum\",\n    TokenAddress: \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",  // USDC token address\n    // Add other necessary parameters\n}\ntokenInfo, err := wallet.GetTokenInfo(tip)\nif err != nil {\n    fmt.Println(\"Error:\", err)\n} else {\n    fmt.Println(\"Token Info:\", tokenInfo)\n}\n```\n\n- **Output**\n\n```go\nToken Info: {\n    Name: \"USD Coin\",\n    Symbol: \"USDC\",\n    Decimals: 6,\n    TotalSupply: \"1000000000000000\",\n    // Other token details\n}\n```\n\n### SmartContractCall\n\n`SmartContractCall` executes a smart contract function on a specified network. It takes in network, contract address, function name, parameters, and other details in a types.`SmartContractCallPayload` struct. It returns an `interface{}` which can be type-asserted to the expected return type.\nIt supports only Ethereum at the moment.\n\n```go\npayload := types.SmartContractCallPayload{\n    Network: \"ethereum\",\n    ContractAddress: \"0x1234567890123456789012345678901234567890\",\n    FunctionName: \"balanceOf\",\n    Params: []interface{}{\"0x0987654321098765432109876543210987654321\"},\n    // Add other necessary parameters\n}\nresult, err := wallet.SmartContractCall(payload)\nif err != nil {\n    fmt.Println(\"Error:\", err)\n} else {\n    fmt.Println(\"Result:\", result)\n}\n```\n\n- **Output**\n\n```go\nResult: 1000000000000000000\n```\n\n### CreateAccountCreationTx\n\n`CreateAccountCreationTx` prepares a transaction to create a new Flow account and calculates the expected address for this account. It takes in a `wallet`, payer address, and network. It returns a pointer to the prepared transaction, the expected address of the new account, and an error if any.\n\nThis function is specific to the Flow blockchain.\n\n\u003e **Note:** This function only prepares the transaction and calculates the expected address. The transaction still needs to be signed and submitted to the blockchain to actually create the account.\n\n```go\nwallet := types.Wallet{\n    PublicKey: \"0360ec40d4ec3132b3c5d6d9b4cddf8e17bb2c0e9e20d69e2e0bb9f9d7f9d20d6f\",\n    // Other wallet details\n}\npayer := Flow.HexToAddress(\"0x1234567890123456\")\nnetwork := Flow.Mainnet\n\ntx, expectedAddress, err := wallet.CreateAccountCreationTx(wallet, payer, network)\nif err != nil {\n    fmt.Println(\"Error:\", err)\n} else {\n    fmt.Println(\"Transaction:\", tx)\n    fmt.Println(\"Expected Address:\", expectedAddress)\n}\n```\n\n- **Output**\n\n```go\nTransaction: {...}  // Flow transaction object\nExpected Address: 0x9876543210987654\n```\n\n## Error Handling\n\nErrors in the interface are returned in Go's idiomatic way as the second return value. The error messages provide detailed information about what went wrong. The error `ErrUnsupportedNetwork` is returned when an unsupported network is specified.\n\n```go\nvar ErrUnsupportedNetwork = errors.New(\n    \"unsupported network: the specified network is not recognized. Please ensure that the network name is correct and supported by the application.\"\n    )\n```\n\n## Contribute\n\nOpen to contributions. Couple of contributions to be made. Check out the [contribution guidelines](https://github.com/tosynthegeek/multichain-wallet/blob/main/CONTRIBUTING.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftosynthegeek%2Fmcw","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftosynthegeek%2Fmcw","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftosynthegeek%2Fmcw/lists"}