Giter VIP home page Giter VIP logo

cardano-go's People

Contributors

echovl avatar emmecorelli avatar sean118 avatar tclairet avatar visopsys avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

cardano-go's Issues

Add client api

-- The client will provide a cardano-node api and wallet managment features

Validate Signing Key Length

Hey, I've create a transaction then sign by my signing key. But, when i debug the size of private key is 256 bits (32 bytes). However, the lib validate that private key size must be 64.

How to generate private key with 64 bit or I've must modify the lib?

Thanks

PrvKey not generating the same signature as PyCardano

Hello,

We are trying to sign transactions using the library and we came across an issue with signatures:

Given the following private key (only has 5 testnet ADA):

bc4070aa2ac9883c1f61a46e8f9e06bb7a432211f3689125c3d6e8c136b270e8

Using the following procedure, we try to sign the hash of the transaction:

  var psk crypto.PrvKey
  var ssk crypto.PrvKey

  psk, _ = hex.DecodeString(paymentSkey[4:])
  ssk, _ = hex.DecodeString(stakeSkey[4:])

  var tx cardano.Tx

  bytes, err := hex.DecodeString(transactionCBOR)

  if err != nil {
    log.Fatal(err)
  }

  cbor.Unmarshal(bytes, tx)

  txHash, err := tx.Hash()

  fmt.Println("SKEY: ", paymentSkey[4:])
  fmt.Println("TXHASH: ", hex.EncodeToString(txHash))
  fmt.Println("PUBKEY: ", hex.EncodeToString(psk.PubKey()))

This results in:

SKEY:  bc4070aa2ac9883c1f61a46e8f9e06bb7a432211f3689125c3d6e8c136b270e8
TXHASH:  0f1b6d09c85eaec039f086c96c5dfc05adc4ca413e2886bd08e72a8c2cafc03f
PUBKEY:  18be1cd172326473a80b085008101b999d85f1f3610f297cd36268ee064d6082
PKH:  8afcd22c9c898f6c1e244419ba52f4b1ed91c1cfbbcfff6eaf1a769c

a1008282582018be1cd172326473a80b085008101b999d85f1f3610f297cd36268ee064d608258405c30ce7ceb5f358cae1055aaaf0d09cec17ec8c39bdf2e23f05f1b405dc3cb71df263408038f8546b5b33d4c2c22046e6ffd594c6edb094c67bfcfc0c0a8310f825820baa5f44a3de96cf55d0cfa0b6a2ad4df94b37d88fa9dbad0111af2cc68cd31f15840fcb1ba2be3778f1bf5410dfa95a3a9b5221a245646146fc6d35931d24ba0efb33cd6426142cd8784e8aa856da44b603ea74ff0e9dc3002085645807313a2b30c

Transaction signing is not working for me right now using that.

However, another library pycardano produces the following:

Python 3.9.13 (main, May 24 2022, 21:13:51) 
[Clang 13.1.6 (clang-1316.0.21.2)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from pycardano import *
>>> psk = PaymentSigningKey.from_cbor("5820bc4070aa2ac9883c1f61a46e8f9e06bb7a432211f3689125c3d6e8c136b270e8") # 5820 prefix is just CBOR for 'bytes'
>>> psk.to_verification_key().to_primitive().hex()
'448601922876ffa826afebc1dbd2cc1affa4fd6efc65056f9db6dfb958fe1803'
>>> tx_hash = b'0f1b6d09c85eaec039f086c96c5dfc05adc4ca413e2886bd08e72a8c2cafc03f'
>>> psk.sign(tx_hash).hex()
'dd9276eb0f51ec1f3a2c0d764b797ef8423b376e8ee43ac8016c9de6613cde61692d16d38589b8e62471e015f13df1c362c3a369a41719ea1aca43342e2c9601'
>>> 

What am I missing?

Add support for preprod testnet

This repo currently only supports old testnet. We need to add support for preprod.

I can create a PR for this repo as I already has the PR in my forked version

Incorrect min amount for multiasset transaction

I think this min value calculation for multiasset transaction is incorrect:

func (tb *TxBuilder) MinCoinsForTxOut(txOut *TxOutput) Coin {
	var size uint
	if txOut.Amount.OnlyCoin() {
		size = 1
	} else {
		numAssets := txOut.Amount.MultiAsset.numAssets()
		assetsLength := txOut.Amount.MultiAsset.assetsLength()
		numPIDs := txOut.Amount.MultiAsset.numPIDs()

		size = 6 + uint(math.Floor(
			float64(numAssets*12+assetsLength+numPIDs*28+7)/8,
		))
	}
	return Coin(utxoEntrySizeWithoutVal+size) * tb.protocol.CoinsPerUTXOWord
}

I have a multi-asset input and my values are as follow:

numAssets = 1, assetsLength = 8, numPIDs = 1, utxoEntrySizeWithoutVal = 27, tb.protocol.CoinsPerUTXOWord
 = 4310

Total coin amount = 168090 (or 0.16809 ADA)

This number is clearly smaller than min 1.3 ADA required to transfer multiasset. I got BabbageOutputTooSmallUTxO error when submitting this. Please check this function again for multi-asset

Add support for CIP 68

Hey, I got an error when trying to unmarshal cbor string to tx

Error: cannot unmarshal map into Go struct field cardano.rawTx.Body of type cardano.TxOutput (cannot decode CBOR map to struct with toarray option)

Here is cbor string: 84a50082825820b3578db07b274dd8d81012a16abe67f55f7d1698f1485623f5a5f46e3a93d40b018258202e01017ba4b9423f4bf55bc9ffbba26f1a5169e1fbef762ea923e730da4b037b000185a300583911d3f00c944c02e92d01373ba8401a0845ad9b2b98df54ad826c5858a25ea481523030b23a495286ca1a18bd141a493e9b5a19d889953f6cdb01821a002e0928a1581cfca746f58adf9f3da13b7227e5e2c6052f376447473f4d49f8004195a151000643b0436974697a656e20233834353401028201d81859019dd87983a7446e616d654d436974697a656e202338343534446f70656e4566616c73654566696c657382a3437372635835697066733a2f2f516d5842755158696a4450776a626853486d5a57454659534231576f46563171706e634d4d634170544553703148446e616d654d436974697a656e202338343534496d656469615479706549696d6167652f676966a3437372635835697066733a2f2f516d614843753641696f73484734697674456a665a6378684b7062464b7833384c64784758366750794d7477486b446e616d654850617373706f7274496d656469615479706549766964656f2f6d703445696d6167655835697066733a2f2f516d5842755158696a4450776a626853486d5a57454659534231576f46563171706e634d4d63417054455370314846476f6c64656e4566616c7365467374616d7073427b7d496d656469615479706549696d6167652f67696601d879860181581ce36f43a40751c35295b19a218301cc7be019d016e8927c0321fd28c7d87a80581cfca746f58adf9f3da13b7227e5e2c6052f376447473f4d49f8004195d87a80d87a80825839019f2c5d54d9cf8466e0109aec09ea58a5060fd75fcaf463cde64d08cd9e81f619476906491b519e3805c0e67e6ccaa6516052b7842d9081f21a11f4b5d082583901dfcb5f6c42f7529f31be82e0e68a75c2db94e425409770341011ef805ea481523030b23a495286ca1a18bd141a493e9b5a19d889953f6cdb1a008583b082583901dfd0594ef1f0f093e16a1c63f7cf76aeab68728b037d6a0945ff5fad2f4ad699c92ce6d1991dd05b64b6275dc3b714641db2b09cffefc830821a0012378ea1581cfca746f58adf9f3da13b7227e5e2c6052f376447473f4d49f8004195a151000de140436974697a656e2023383435340182583901dfd0594ef1f0f093e16a1c63f7cf76aeab68728b037d6a0945ff5fad2f4ad699c92ce6d1991dd05b64b6275dc3b714641db2b09cffefc8301a04caebbc021a00034201031a0536522109a1581cfca746f58adf9f3da13b7227e5e2c6052f376447473f4d49f8004195a251000643b0436974697a656e2023383435340151000de140436974697a656e20233834353401a0f5f6

Add support for building partially signed transaction (especially delegation ones)

I would like to be able to create a transaction that include delegation certificate for a 3rd party (the stake key owner) that will sign the tx lately.
To do so the address package should be improved to facilitate the management of stake addresses (aka reward addresses), and allow the tx builder to know that the transaction will be signed by a well known number of witnesses in advance, to be able to calculate fees correctly.

Why cannot use TASKFILE instead of MAKE?

I I know that MAKE is a milestone of all developer, but there is another powerful utility developed with go: TASKFILE.

It would be great to use a linter (i.e. golanci-lint). I have some suggestions from the linter that I would like to fix.

Let's take a look!

Avoid building transaction in AddChangeIfNeeded of TxBuilder

The AddChangeIfNeeded of TxBuilder calls tx.build() inside which does a transaction signing. Calling tx.Build() at this stage is an awkward way of verifying transaction, especially when the build function mostly does transaction signing.

Note that after AddChangeIfNeeded is called, we still need to build the transaction again and therefore do the signing twice. In general, we should only do transaction signing once when all data is available.

Can we remove tx.build() in AddChangeIfNeeded ?

Testnet Option Not Working Due to Decommissioned Testnet

Hey there!

I added some code to log the raw response from the API, and to my surprise, I got a message saying the Cardano testnet network has been decommissioned. Here's the snippet where I logged the response in the AddressUTXOs function:

bodyBytes, err := io.ReadAll(res.Body)
if err != nil {
    return nil, err
}
bodyString := string(bodyBytes)
fmt.Println(bodyString)

And here's the message I got:
{"status_code":400,"error":"Bad Request","message":"Cardano testnet network has been decommissioned."}

I initially thought this was an issue with the library, but then I realized it was just the API response to my request. Maybe we could update the library or its documentation to give a heads up about the testnet situation? It could save others some time and confusion.

Thanks!

Add Deserialize function for Tx model

The current Tx model does not have MarshalCBOR and UnmarshalCBOR functions. I know this model is complicated and might take time to do it right but I still want to file an issue here to keep track of the progress

how to set socket path in cardano wallet ?

hey every one
i charge my testnet address that generated by this package wallet but when i call balance method i get 0 .
i guess that it's because of socket path that not set in variable 'CARDANO_NODE_SOCKET_PATH'

how we should do that ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.