Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when using go to call go-libdogecoin #2

Open
arvin-lau opened this issue Jul 28, 2023 · 0 comments
Open

Error when using go to call go-libdogecoin #2

arvin-lau opened this issue Jul 28, 2023 · 0 comments

Comments

@arvin-lau
Copy link

The system is macos 12.0.1, intel cpu

Here is my code

`package main

import (
"fmt"
"github.com/jaxlotl/go-libdogecoin"
)

func main() {
prev_output_txid_2 := "b4455e7b7b7acb51fb6feba7a2702c42a5100f61f61abafa31851ed6ae076074" // worth 2 dogecoin
prev_output_txid_10 := "42113bdc65fc2943cf0359ea1a24ced0b6b0b5290db4c63a3329c6601c4616e2" // worth 10 dogecoin
prev_output_n_2 := 1
prev_output_n_10 := 1
external_address := "nbGfXLskPh7eM1iG5zz5EfDkkNTo9TRmde"
my_address := "noxKJyGPugPRN4wqvrwsrtYXuQCk7yQEsy"
my_script_pubkey := "76a914d8c43e6f68ca4ea1e9b93da2d1e3a95118fa4a7c88ac"
my_privkey := "ci5prbqz7jXyFPVWKkHhPq4a9N8Dag3TpeRfuqqC2Nfr7gSqx1fy"

index := libdogecoin.W_start_transaction()
defer libdogecoin.W_clear_transaction(index)
libdogecoin.W_add_utxo(index, prev_output_txid_2, prev_output_n_2)
libdogecoin.W_add_utxo(index, prev_output_txid_10, prev_output_n_10)
libdogecoin.W_add_output(index, external_address, "5.0")
libdogecoin.W_finalize_transaction(index, external_address, "0.00226", "12.0", my_address)

// sign both inputs of the current finalized transaction
if libdogecoin.W_sign_transaction(index, []string{"2", "10"}, my_script_pubkey, my_privkey) != 1 {
	fmt.Println("!=1")
}
// error handling here
fmt.Println("The final signed transaction hex is:", libdogecoin.W_get_raw_transaction(index))

}`

The following error occurs when running the code

# testDogeCoin /usr/local/go1.19.8/go/pkg/tool/darwin_amd64/link: running clang failed: exit status 1 ld: warning: ignoring file /Users/xiaodong/go/pkg/mod/github.com/jaxlotl/[email protected]/build/darwin/amd64/libdogecoin.a, building for macOS-x86_64 but attempting to link with file built for unknown-unsupported file format ( 0x21 0x3C 0x61 0x72 0x63 0x68 0x3E 0x0A 0x2F 0x20 0x20 0x20 0x20 0x20 0x20 0x20 ) Undefined symbols for architecture x86_64: "_add_output", referenced from: __cgo_fe3e5889e15c_Cfunc_add_output in 000001.o (maybe you meant: __cgo_fe3e5889e15c_Cfunc_add_output) "_add_utxo", referenced from: __cgo_fe3e5889e15c_Cfunc_add_utxo in 000001.o (maybe you meant: __cgo_fe3e5889e15c_Cfunc_add_utxo) "_clear_transaction", referenced from: __cgo_fe3e5889e15c_Cfunc_clear_transaction in 000001.o (maybe you meant: __cgo_fe3e5889e15c_Cfunc_clear_transaction) "_dogecoin_ecc_start", referenced from: __cgo_fe3e5889e15c_Cfunc_dogecoin_ecc_start in 000001.o (maybe you meant: __cgo_fe3e5889e15c_Cfunc_dogecoin_ecc_start) "_dogecoin_ecc_stop", referenced from: __cgo_fe3e5889e15c_Cfunc_dogecoin_ecc_stop in 000001.o (maybe you meant: __cgo_fe3e5889e15c_Cfunc_dogecoin_ecc_stop) "_finalize_transaction", referenced from: __cgo_fe3e5889e15c_Cfunc_finalize_transaction in 000001.o (maybe you meant: __cgo_fe3e5889e15c_Cfunc_finalize_transaction) "_generateDerivedHDPubkey", referenced from: __cgo_fe3e5889e15c_Cfunc_generateDerivedHDPubkey in 000001.o (maybe you meant: __cgo_fe3e5889e15c_Cfunc_generateDerivedHDPubkey) "_generateHDMasterPubKeypair", referenced from: __cgo_fe3e5889e15c_Cfunc_generateHDMasterPubKeypair in 000001.o (maybe you meant: __cgo_fe3e5889e15c_Cfunc_generateHDMasterPubKeypair) "_generatePrivPubKeypair", referenced from: __cgo_fe3e5889e15c_Cfunc_generatePrivPubKeypair in 000001.o (maybe you meant: __cgo_fe3e5889e15c_Cfunc_generatePrivPubKeypair) "_get_raw_transaction", referenced from: __cgo_fe3e5889e15c_Cfunc_get_raw_transaction in 000001.o (maybe you meant: __cgo_fe3e5889e15c_Cfunc_get_raw_transaction) "_sign_raw_transaction", referenced from: __cgo_fe3e5889e15c_Cfunc_sign_raw_transaction in 000001.o (maybe you meant: __cgo_fe3e5889e15c_Cfunc_sign_raw_transaction) "_sign_transaction", referenced from: __cgo_fe3e5889e15c_Cfunc_sign_transaction in 000001.o (maybe you meant: __cgo_fe3e5889e15c_Cfunc_sign_transaction) "_start_transaction", referenced from: __cgo_fe3e5889e15c_Cfunc_start_transaction in 000001.o (maybe you meant: __cgo_fe3e5889e15c_Cfunc_start_transaction) "_store_raw_transaction", referenced from: __cgo_fe3e5889e15c_Cfunc_store_raw_transaction in 000001.o (maybe you meant: __cgo_fe3e5889e15c_Cfunc_store_raw_transaction) "_verifyHDMasterPubKeypair", referenced from: __cgo_fe3e5889e15c_Cfunc_verifyHDMasterPubKeypair in 000001.o (maybe you meant: __cgo_fe3e5889e15c_Cfunc_verifyHDMasterPubKeypair) "_verifyP2pkhAddress", referenced from: __cgo_fe3e5889e15c_Cfunc_verifyP2pkhAddress in 000001.o (maybe you meant: __cgo_fe3e5889e15c_Cfunc_verifyP2pkhAddress) "_verifyPrivPubKeypair", referenced from: __cgo_fe3e5889e15c_Cfunc_verifyPrivPubKeypair in 000001.o (maybe you meant: __cgo_fe3e5889e15c_Cfunc_verifyPrivPubKeypair) ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant