All Projects → luniehq → cosmos-keys

luniehq / cosmos-keys

Licence: other
Library for creating keys and signing messages on Cosmos 🔑

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to cosmos-keys

cosmonauts-world
Projects in the Cosmos and Tendermint ecosystem 🌌
Stars: ✭ 14 (-41.67%)
Mutual labels:  cosmos, cosmos-sdk
sommelier
Sommelier Chain
Stars: ✭ 64 (+166.67%)
Mutual labels:  cosmos, cosmos-sdk
cosmospy
Python tools for Cosmos wallet management and offline transaction signing
Stars: ✭ 57 (+137.5%)
Mutual labels:  cosmos, cosmos-sdk
Beef
Business Entity Execution Framework
Stars: ✭ 95 (+295.83%)
Mutual labels:  cosmos
desmos
Improving the well-being of users on social networks through the blockchain technology.
Stars: ✭ 82 (+241.67%)
Mutual labels:  cosmos-sdk
regen-ledger
Blockchain for planetary regeneration
Stars: ✭ 154 (+541.67%)
Mutual labels:  cosmos-sdk
kyve
KYVE - A protocol for verified data-streams
Stars: ✭ 51 (+112.5%)
Mutual labels:  cosmos
aragon-chain
(Deprecated) Proof-of-Stake, EVM-compatible blockchain focused on DAOs
Stars: ✭ 25 (+4.17%)
Mutual labels:  cosmos
cosmocope
Find repositories, releases, and modules for projects in the Cosmos ecosystem.
Stars: ✭ 13 (-45.83%)
Mutual labels:  cosmos-sdk
ledger-cosmos-js
No description or website provided.
Stars: ✭ 23 (-4.17%)
Mutual labels:  cosmos-sdk
likecoin-tx-poll
Firestore based service of polling eth status and resending tx
Stars: ✭ 13 (-45.83%)
Mutual labels:  cosmos-sdk
distributed-compliance-ledger
DCL is a public permissioned ledger framework for Zigbee compliance certification of device models. The ledger is based on Cosmos SDK and Tendermint.
Stars: ✭ 41 (+70.83%)
Mutual labels:  cosmos-sdk
testnets
Stargaze testnets
Stars: ✭ 43 (+79.17%)
Mutual labels:  cosmos-sdk
Prism-OS
An operating system created in c#, Made possible by the cosmos community!
Stars: ✭ 45 (+87.5%)
Mutual labels:  cosmos
hyperledger
Blockchain、Hyperledger、Ethereum、IPFS learning materials / 学习指南
Stars: ✭ 93 (+287.5%)
Mutual labels:  cosmos
cosmos-paychan
A Cosmos SDK module to add payment channels to any blockchain built using the SDK.
Stars: ✭ 14 (-41.67%)
Mutual labels:  cosmos-sdk
cosmos-logging
Logging component for .NET Core with nice APIs for developers to use.
Stars: ✭ 28 (+16.67%)
Mutual labels:  cosmos
Cosmos.Identity
A Cosmos storage provider for ASP.NET Core Identity.
Stars: ✭ 26 (+8.33%)
Mutual labels:  cosmos
curium
Bluzelle Decentralized Database Service
Stars: ✭ 61 (+154.17%)
Mutual labels:  cosmos-sdk
bonds
A custom Cosmos SDK module for universal token bonding curve functions.
Stars: ✭ 32 (+33.33%)
Mutual labels:  cosmos-sdk

Cosmos Keys

Cosmos Keys is a library for creating keys and signing messages on Cosmos. You can use it to generate keypairs and addresses and to sign messages for the Cosmos Network.

This library deals with tasks that are considered security-critical and should be used very carefully.

Install

yarn add @lunie/cosmos-keys

Usage

Create a wallet

import { getNewWallet } from "@lunie/cosmos-keys"

const { cosmosAddress, privateKey, publicKey } = getNewWallet()
// Attention: protect the `privateKey` at all cost and never display it anywhere!!

Import a seed

import { getNewWalletFromSeed } from "@lunie/cosmos-keys"

const seed = ...24 seed words here


//bech32prefix   

const bech32prefix = 'cosmos';
const { cosmosAddress, privateKey, publicKey } = getNewWalletFromSeed(seed, bech32prefix)

// Attention: protect the `privateKey` at all cost and never display it anywhere!!

Sign a message

import { signWithPrivateKey } from "@lunie/cosmos-keys"

const privateKey = Buffer.from(...)
const signMessage = ... message to sign, generate messages with "@lunie/cosmos-js"
const signature = signWithPrivateKey(signMessage, privateKey)

Using with cosmos-js

import { signWithPrivateKey } from "@lunie/cosmos-keys"
import Cosmos from "@lunie/cosmos-js"

const privateKey = Buffer.from(...)
const publicKey = Buffer.from(...)

// init cosmos sender
const cosmos = Cosmos(STARGATE_URL, ADDRESS)

// create message
const msg = cosmos
  .MsgSend({toAddress: 'cosmos1abcd09876', amounts: [{ denom: 'stake', amount: 10 }]})

// create a signer from this local js signer library
const localSigner = (signMessage) => {
  const signature = signWithPrivateKey(signMessage, privateKey)

  return {
    signature,
    publicKey
  }
}

// send the transaction
const { included }= await msg.send({ gas: 200000 }, localSigner)

// await tx to be included in a block
await included()
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].