Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ranjbar-dev/litecoin-wallet
litecoin wallet package for creating and generating wallet, transferring LTC, getting wallet unspent transactions(UTXOs), getting wallet txs , getting wallet balance and crawling blocks to find wallet transactions
https://github.com/ranjbar-dev/litecoin-wallet
address litecoin ltc sign transaction wallet
Last synced: 10 days ago
JSON representation
litecoin wallet package for creating and generating wallet, transferring LTC, getting wallet unspent transactions(UTXOs), getting wallet txs , getting wallet balance and crawling blocks to find wallet transactions
- Host: GitHub
- URL: https://github.com/ranjbar-dev/litecoin-wallet
- Owner: ranjbar-dev
- Created: 2022-11-28T13:54:56.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2022-12-04T14:47:57.000Z (about 2 years ago)
- Last Synced: 2024-06-20T17:35:43.486Z (8 months ago)
- Topics: address, litecoin, ltc, sign, transaction, wallet
- Language: Go
- Homepage:
- Size: 30.3 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# litecoin-wallet
litecoin wallet package for creating and generating wallet, transferring LTC, getting wallet unspent transactions(UTXOs), getting wallet txs , getting wallet balance and crawling blocks to find wallet transactions
### Installation
```
go get github.com/ranjbar-dev/[email protected]
```### Supported nodes
check `enums/nodes` file### Wallet methods
Generating litecoin wallet
```
w := GenerateLitecoinWallet(node)
w.Address // strnig
w.PrivateKey // strnig
w.PublicKey // strnig
```Creating litecoin wallet from private key
```
w := CreateLitecoinnWallet(node,privateKeyHex)
w.Address // strnig
w.PrivateKey // strnig
w.PublicKey // strnig
```Getting wallet litecoin balance
```
balanceInSatoshi,err := w.Balance()
balanceInSatoshi // int64
```Getting wallet UTXOs
```
utxos,err := w.UTXOs()
utxos // []response.UTXO
```Getting wallet transactions
```
txs,err := w.Txs()
txs // []response.Transaction
```crawl blocks for addresses transactions
```c := &Crawler{
Node: node,
Addresses: []string{
"tb1qppv790u4dz48ctnk3p7ss7fmspckagp3wrfyp0", // list of your addresses
},
}
res, err := c.ScanBlocks(40) // scan latest 40 block on block chain and extract addressess transactionsExample
// *
{
{
"address": "tb1qppv790u4dz48ctnk3p7ss7fmspckagp3wrfyp0",
"tranasctions": {
{
"tx_id": "e6160c52401949139688623ce33a6290eed43d8d564d6e16c38006c4dc28f4a8",
"from_address": "tb1qppv790u4dz48ctnk3p7ss7fmspckagp3wrfyp0",
"to_address": "tb1q0r23g66m9rhhak8aahsg53wfp5egt2huuc4tnu",
"amount": 100000,
"confirmations": 2,
}
}
},
...
}
* //
```Estimate transfer ltc fee
```
feeInLitoshi,err := w.EstimateTransferFee("tb1q0r23g66m9rhhak8aahsg53wfp5egt2huuc4tnu",10000)
feeInLitoshi // int64
```Transfer ltc
```
txId,err := w.Transfer("tb1q0r23g66m9rhhak8aahsg53wfp5egt2huuc4tnu",10000)
txId // string
```### LTC Faucet
check this website https://testnet-faucet.com/ltc-testnet/### Provider
sign up and create free account at https://blockdaemon.com and use your own node
```
config = ConfigBlockDaemon{
Protocol: "litecoin",
Network: "mainnet",
Token: "your token here",
}
node := Node{
Config: config,
Test: false, // or true if you want to use testnet network
}
```
### Important
I simplified this repository github.com/ltcsuite/ltcd repository to create this package You can check go it for better examples and functionalities and do not use this package in production, I created this package for education purposes.### Donation
Address `ltc1q5m8nzek2459kvqvnmshhluc56lgl0mjyc8p3dc`