Code Monkey home page Code Monkey logo

example-helloworld's People

Contributors

0xekez avatar artsiukhou avatar brson avatar criesofcarrots avatar dependabot-preview[bot] avatar dependabot[bot] avatar fanatid avatar gondar00 avatar hey-ynot avatar jackcmay avatar jacobcreech avatar joeaba avatar joncinque avatar jstarry avatar kemargrant avatar kigawas avatar liang256 avatar lsmod avatar mvines avatar olexandr13 avatar panda850819 avatar pierreneter avatar remjx avatar rmshea avatar thearas avatar whosoup avatar willhickey avatar willrnch avatar yihau avatar zurgl 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  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  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

example-helloworld's Issues

Why are the deployment expenses such high?

I followed this tutorial and was able to successfully deploy the program and query the counter with the client app. I did the whole thing on devnet. What me shocked a bit was the high amount of SOL I had to pay for the deployment. At the beginning I airdroped my account with 10 SOL. After deployment I had only ~9.15 SOL remaining. Converted to USD, I had to pay roughly 150 USD to deploy such a simple program?

Before the airdrop I received the following message:
Account CYW9nog4sKTxAHLNcprZHEykUGgHFgko4PdhiaYTYimZ has insufficient funds for spend (0.4265436 SOL) + fee (0.001355 SOL)

Gitpod cold start fails

Hey folks! Awesome Gitpod integration but it's breaking slightly:

(Duplicate of #207)

Repro

Gitpod cold start + npm run start results in:

๐Ÿค™ This task ran as a workspace prebuild
๐ŸŽ‰ Well done on saving 1 minute

PATH=/home/gitpod/.local/share/solana/install/active_release/bin:/home/gitpod/.sdkman/candidates/maven/current/bin:/home/gitpod/.sdkman/candidates/java/current/bin:/home/gitpod/.sdkman/candidates/gradle/current/bin:/home/gitpod/.rvm/gems/ruby-2.6.6/bin:/home/gitpod/.rvm/gems/ruby-2.6.6@global/bin:/home/gitpod/.rvm/rubies/ruby-2.6.6/bin:/home/gitpod/.pyenv/plugins/pyenv-virtualenv/shims:/home/gitpod/.pyenv/shims:/workspace/.cargo/bin:/workspace/.pip-modules/bin:/workspace/.rvm/bin:/ide/bin:/home/gitpod/.pyenv/bin:/home/gitpod/.pyenv/shims:/workspace/go/bin:/home/gitpod/go/bin:/home/gitpod/go-packages/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin/:/home/gitpod/.nvm/versions/node/v14.16.1/bin:/home/gitpod/.cargo/bin:/home/gitpod/.rvm/bin
Bad status code: 404: Not found.
bash: solana-keygen: command not found
bash: solana: command not found
bash: solana: command not found
gitpod /workspace/example-helloworld $ npm run start

> [email protected] start /workspace/example-helloworld
> ts-node src/client/main.ts

Let's say hello to a Solana account...
Failed to read RPC url from CLI config file, falling back to localhost
FetchError: request to http://localhost:8899/ failed, reason: connect ECONNREFUSED 127.0.0.1:8899
    at ClientRequest.<anonymous> (/workspace/example-helloworld/node_modules/node-fetch/lib/index.js:1461:11)
    at ClientRequest.emit (events.js:315:20)
    at ClientRequest.EventEmitter.emit (domain.js:467:12)
    at Socket.socketErrorListener (_http_client.js:469:9)
    at Socket.emit (events.js:315:20)
    at Socket.EventEmitter.emit (domain.js:467:12)
    at emitErrorNT (internal/streams/destroy.js:106:8)
    at emitErrorCloseNT (internal/streams/destroy.js:74:3)
    at processTicksAndRejections (internal/process/task_queues.js:80:21) {
  type: 'system',
  errno: 'ECONNREFUSED',
  code: 'ECONNREFUSED'
}
npm ERR! code ELIFECYCLE
npm ERR! errno 255
npm ERR! [email protected] start: `ts-node src/client/main.ts`
npm ERR! Exit status 255
npm ERR! 
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/gitpod/.npm/_logs/2021-05-19T17_50_46_517Z-debug.log

Workaround

It's possible the root issue is just that the PATH export failed, but I had to execute the following commands (which are not in README-gitpod.md) before I could run the example:
$ PATH="/home/gitpod/.local/share/solana/install/active_release/bin:$PATH"
$ solana-keygen new
$ solana-test-validator
(Open new bash window)
$ solana program deploy dist/program/helloworld.so
$ npm run start

BpfLoader.load sometimes fails

BpfLoader.load sometimes fails, sometimes succeeds, with the same program, on TDS.

Recreate like this:

Clone the repo, make no changes to the SC program.

Set CLUSTER to testnet, LIVE=1, and make your environment point to TDS, and fund your id.json account with TDS coins.

Edit /client/hello_world.js change the loadProgram function to do the load with your id.json account then quit.

export async function loadProgram(): Promise<void> {

  const secret = JSON.parse( await fs.readFile( '/Users/mrsmith/.config/solana/id.json' ))
  const account = new Account( secret )
  console.log( `Balance of ${account.publicKey} is ${await connection.getBalance( account.publicKey )}` )

[...]

  //const bpf_payer = await newAccountWithLamports(connection, cost);
  const bpf_payer = account
  
  // Load the program
  console.log('Loading hello world program...');
  programId = await BpfLoader.load(connection, bpf_payer, data);
  console.log('Program loaded to account', programId.toBase58());

  process.exit(0)

Repeatedly execute the program - which will typically succeed in the load - until it fails:

~/SOLANA/example-helloworld/src/client$ npm run start

> [email protected] start /Users/mrsmith/SOLANA/example-helloworld
> babel-node src/client/main.js

Let's say hello to a Solana account...
Connection to cluster established: http://testnet.solana.com { 'solana-core': '1.1.2' }
Balance of FKfGiCuNXXFTr7E3GCYkN7fXCm6SgAohkgGb2JiPSa3e is 2058561600
SMITH LOAD: /Users/mrsmith/SOLANA/example-helloworld/store/config.json
Loading hello world program...
Program loaded to account ASg8CZn8tKBLQ7xZDPYXhCx3E6gN8AzhVtVVZnLXSE6t
~/SOLANA/example-helloworld/src/client$ npm run start

> [email protected] start /Users/mrsmith/SOLANA/example-helloworld
> babel-node src/client/main.js

Let's say hello to a Solana account...
Connection to cluster established: http://testnet.solana.com { 'solana-core': '1.1.2' }
Balance of FKfGiCuNXXFTr7E3GCYkN7fXCm6SgAohkgGb2JiPSa3e is 1940876800
SMITH LOAD: /Users/mrsmith/SOLANA/example-helloworld/store/config.json
Loading hello world program...
Error: Transaction 2EQbPzz3H9yU3MhhSEqEpURgH9HoDuWcCc3aTzmvxKb6Xju9s4Yi6eWqgeaq8o48XVgiKaVLbahoaSurBgNsFjug failed ({"slot":7829168,"confirmations":0,"err":{"InstructionError":[0,"InvalidAccountData"]}})
    at _callee3$ (/Users/mrsmith/SOLANA/example-helloworld/node_modules/@solana/web3.js/src/util/send-and-confirm-transaction.js:79:15)
    at tryCatch (/Users/mrsmith/SOLANA/example-helloworld/node_modules/regenerator-runtime/runtime.js:45:40)
    at Generator.invoke [as _invoke] (/Users/mrsmith/SOLANA/example-helloworld/node_modules/regenerator-runtime/runtime.js:274:22)
    at Generator.prototype.<computed> [as next] (/Users/mrsmith/SOLANA/example-helloworld/node_modules/regenerator-runtime/runtime.js:97:21)
    at asyncGeneratorStep (/Users/mrsmith/SOLANA/example-helloworld/node_modules/@babel/runtime/helpers/asyncToGenerator.js:3:24)
    at _next (/Users/mrsmith/SOLANA/example-helloworld/node_modules/@babel/runtime/helpers/asyncToGenerator.js:25:9)

Env

~/SOLANA/example-helloworld/src/client$ uname -a
Darwin Mrs-MacBook-Pro 19.3.0 Darwin Kernel Version 19.3.0: Thu Jan  9 20:58:23 PST 2020; root:xnu-6153.81.5~1/RELEASE_X86_64 x86_64
~/SOLANA/example-helloworld/src/client$ solana --version
solana-cli 1.1.2
~/SOLANA/example-helloworld/src/client$ npm --version
6.11.3
~/SOLANA/example-helloworld/src/client$ node --version
v12.12.0

connection refused error

npm run localnet:up

curl -X POST -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0","id":1, "method":"getTransactionCount"}' http://localhost:8899
curl: (7) Failed to connect to localhost port 8899: Connection refused

More info:

node --version
v12.8.0

npm --version
6.12.0

docker -v
Docker version 19.03.3, build a872fc2

rustup --version
rustup 1.22.1 (b01adbbc3 2020-07-08)

rustc --version
rustc 1.45.2 (d3fb005a3 2020-07-31)

cargo --version
cargo 1.45.1 (f242df6ed 2020-07-22)

lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 16.04.6 LTS
Release:	16.04
Codename:	xenial

uname -a
Linux oren 4.4.0-179-generic #209-Ubuntu SMP Fri Apr 24 17:48:44 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

StructError on running npm start

When running npm run start, I run into this error:

> ts-node src/client/main.ts

Let's say hello to a Solana account...
Error: 
    at new StructError (/Users/patrick/code/solana-chainlink/example-helloworld/node_modules/superstruct/src/struct-error.ts:37:18)
    at Function.assert (/Users/patrick/code/solana-chainlink/example-helloworld/node_modules/superstruct/src/struct.ts:55:13)
    at GetVersionRpcResult (/Users/patrick/code/solana-chainlink/example-helloworld/node_modules/superstruct/src/struct.ts:31:46)
    at Connection._callee38$ (/Users/patrick/code/solana-chainlink/example-helloworld/node_modules/@solana/web3.js/src/connection.js:2519:17)
    at tryCatch (/Users/patrick/code/solana-chainlink/example-helloworld/node_modules/regenerator-runtime/runtime.js:63:40)
    at Generator.invoke [as _invoke] (/Users/patrick/code/solana-chainlink/example-helloworld/node_modules/regenerator-runtime/runtime.js:293:22)
    at Generator.next (/Users/patrick/code/solana-chainlink/example-helloworld/node_modules/regenerator-runtime/runtime.js:118:21)
    at asyncGeneratorStep (/Users/patrick/code/solana-chainlink/example-helloworld/node_modules/@babel/runtime/helpers/asyncToGenerator.js:3:24)
    at _next (/Users/patrick/code/solana-chainlink/example-helloworld/node_modules/@babel/runtime/helpers/asyncToGenerator.js:25:9)
    at processTicksAndRejections (internal/process/task_queues.js:97:5) {
  type: 'pick<{solana-core,feature-set}>',
  value: undefined,
  path: [ 'result' ],
  branch: [
    {
      jsonrpc: '2.0',
      id: '357a4b49-f721-4c2a-88ef-7d2a24dcc60e',
      error: [Object]
    },
    undefined
  ],
  failures: [
    {
      value: undefined,
      branch: [Array],
      path: [Array],
      type: 'pick<{solana-core,feature-set}>'
    }
  ]
}
npm ERR! code ELIFECYCLE
npm ERR! errno 255
npm ERR! [email protected] start: `ts-node src/client/main.ts`
npm ERR! Exit status 255
npm ERR! 
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/patrick/.npm/_logs/2021-01-12T12_09_32_269Z-debug.log

When running npm run localnet:logs I get to this point in the logs:

+ trap abort INT TERM EXIT
+ faucet=46
+ args=(--identity "$dataDir"/validator-identity.json --vote-account "$dataDir"/validator-vote-account.json --ledger "$ledgerDir" --gossip-port 8001 --rpc-port 8899 --rpc-faucet-address 127.0.0.1:9900 --log - --enable-rpc-exit --enable-rpc-transaction-history --init-complete-file "$dataDir"/init-completed --require-tower)
+ solana-faucet --keypair /usr/bin/config/solana-run/faucet.json
+ validator=47
+ wait 47
+ solana-validator --identity /usr/bin/config/solana-run/validator-identity.json --vote-account /usr/bin/config/solana-run/validator-vote-account.json --ledger /usr/bin/config/ledger --gossip-port 8001 --rpc-port 8899 --rpc-faucet-address 127.0.0.1:9900 --log - --enable-rpc-exit --enable-rpc-transaction-history --init-complete-file /usr/bin/config/solana-run/init-completed --require-tower

I have the local cluster up (I can see the container in docker ps), npm run build:program-rust looksl like it was successful, docker has 8 GB of memory and 3 GB of swap, I'm not sure where the program log is though.

OS: MacOS BigSur v11.1
Node: 12.20.0, v14.15.2, v10.23.0
npm: v6.14.9, v6.14.8
rustc: 1.49.0
solana-cli: 1.5.2
docker: 20.10.2

make test_helloworld error on Mac (Big Sur)

Environment:
MacBook Pro (15-inch, 2016), Big Sur 11.6 (20G165)
2.7 GHz 4 Cores Intel Core i7

Sonala Version: solana-cli 1.7.12 (src:ca83167c; feat:2013646575)

Steps to reproduce:

  1. Follow README.md, clone this repo, install dependencies (Solana and NPM packages), to build the c-program. npm build:program-c.
  2. Try to build test_helloworld: V=1 make -C ./src/program-c test_helloworld
  3. Build failure with the following error:
/Users/kaiba/.local/share/solana/install/active_release/bin/sdk/bpf/scripts/install.sh
[test cc] ../../dist/program/helloworld/test_helloworld (./src/helloworld/test_helloworld.c)
mkdir -p ../../dist/program/helloworld/
/Users/kaiba/.local/share/solana/install/active_release/bin/sdk/bpf/c/../dependencies/bpf-tools/llvm/bin/clang -Werror -O2 -fno-builtin -std=c17 -isystem/Users/kaiba/.local/share/solana/install/active_release/bin/sdk/bpf/c/inc -isystem/Users/kaiba/.local/share/solana/install/active_release/bin/sdk/bpf/c/../dependencies/bpf-tools/llvm/lib/clang/12.0.1/include  -DSOL_TEST -isystem /Users/kaiba/.local/share/solana/install/active_release/bin/sdk/bpf/c/../dependencies/criterion/include -L /Users/kaiba/.local/share/solana/install/active_release/bin/sdk/bpf/c/../dependencies/criterion/lib -rpath /Users/kaiba/.local/share/solana/install/active_release/bin/sdk/bpf/dependencies/criterion/lib -lcriterion   -o ../../dist/program/helloworld/test_helloworld ./src/helloworld/test_helloworld.c -MD -MF ../../dist/program/helloworld/test_helloworld
ld: library not found for -lSystem
clang-12: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [../../dist/program/helloworld/test_helloworld] Error 1

no such subcommand: `build-bpf`

npm run build:program-rust giving me this error no such subcommand: build-bpf
below is the .log

0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli '/usr/local/bin/node',
1 verbose cli '/usr/local/bin/npm',
1 verbose cli 'run',
1 verbose cli 'build:program-rust'
1 verbose cli ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [
4 verbose run-script 'prebuild:program-rust',
4 verbose run-script 'build:program-rust',
4 verbose run-script 'postbuild:program-rust'
4 verbose run-script ]
5 info lifecycle [email protected]prebuild:program-rust: [email protected]
6 info lifecycle [email protected]
build:program-rust: [email protected]
7 verbose lifecycle [email protected]build:program-rust: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]
build:program-rust: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/ateeq/projects/code/rust - hellowordl/example-helloworld/node_modules/.bin:/home/ateeq/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/local/go/bin:/usr/local/go/bin
9 verbose lifecycle [email protected]build:program-rust: CWD: /home/ateeq/projects/code/rust - hellowordl/example-helloworld
10 silly lifecycle [email protected]
build:program-rust: Args: [
10 silly lifecycle '-c',
10 silly lifecycle 'cargo build-bpf --manifest-path=./src/program-rust/Cargo.toml --bpf-out-dir=dist/program'
10 silly lifecycle ]
11 silly lifecycle [email protected]build:program-rust: Returned: code: 101 signal: null
12 info lifecycle [email protected]
build:program-rust: Failed to exec build:program-rust script
13 verbose stack Error: [email protected] build:program-rust: cargo build-bpf --manifest-path=./src/program-rust/Cargo.toml --bpf-out-dir=dist/program
13 verbose stack Exit status 101
13 verbose stack at EventEmitter. (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
13 verbose stack at EventEmitter.emit (events.js:315:20)
13 verbose stack at ChildProcess. (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:315:20)
13 verbose stack at maybeClose (internal/child_process.js:1048:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
14 verbose pkgid [email protected]
15 verbose cwd /home/ateeq/projects/code/rust - hellowordl/example-helloworld
16 verbose Linux 5.4.0-65-generic
17 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "build:program-rust"
18 verbose node v14.15.0
19 verbose npm v6.14.8
20 error code ELIFECYCLE
21 error errno 101
22 error [email protected] build:program-rust: cargo build-bpf --manifest-path=./src/program-rust/Cargo.toml --bpf-out-dir=dist/program
22 error Exit status 101
23 error Failed at the [email protected] build:program-rust script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 101, true ]

`npm run build:program-c`: makefile:2: bpf-sdk/c/bpf.mk: No such file or directory

max@mbp example-helloworld (master)*$ npm run build:program-c

> [email protected] build:program-c
> V=1 make -C ./src/program-c helloworld

makefile:2: bpf-sdk/c/bpf.mk: No such file or directory
make: *** No rule to make target `bpf-sdk/c/bpf.mk'.  Stop.
npm ERR! code 2
npm ERR! path /Users/max/projects/tmp/example-helloworld
npm ERR! command failed
npm ERR! command sh -c V=1 make -C ./src/program-c helloworld

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/max/.npm/_logs/2021-04-30T07_23_45_128Z-debug.log

Build Error on a Mac

Hi,

I am currently working through the "example-helloworld" instructions on a Mac. I have been taking notes along the way and will submit a PR to enhance the README file when I am done.

I am currently stuck on npm run build:program. Here is the error:

$ npm run build:program

> [email protected] build:program /Users/brianlong/Library/Mobile Documents/com~apple~CloudDocs/Projects/example-helloworld
> npm run clean:store && ./src/program/do.sh build


> [email protected] clean:store /Users/brianlong/Library/Mobile Documents/com~apple~CloudDocs/Projects/example-helloworld
> rm -rf store

Building /Users/brianlong/Projects/example-helloworld/src/program
+ cargo + install xargo
error: no such subcommand: `+`

   Did you mean `doc`?
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build:program: `npm run clean:store && ./src/program/do.sh build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] build:program script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/brianlong/.npm/_logs/2020-04-10T19_23_38_809Z-debug.log

Suggestions? TIA!

solana-test-validator error on Ubuntu

Not sure how to get past this error, anyone?

$ solana-test-validator
thread 'main' panicked at 'called Result::unwrap() on an Err value: Os { code: 2, kind: NotFound, message: "No such file or directory" }', validator/src/bin/solana-test-validator.rs:294:71
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace

Yes I am a noob :-)

TextEncoder is not defined.

I followed instructions step-by-step. in npm run start I got this error:

> [email protected] start /data/Dev/example-helloworld
> ts-node src/client/main.ts

Let's say hello to a Solana account...
Connection to cluster established: http://localhost:8899 { 'feature-set': 1813598585, 'solana-core': '1.8.0' }
Failed to create keypair from CLI config file, falling back to new random keypair
Using account 5hjVQFq1hANQ5HYfbMbdnTAD3BtrLHT2s8HQFRMJjkzY containing 0.00141872 SOL to pay for fees
Error: Failed to read program keypair at '/data/Dev/example-helloworld/dist/program/helloworld-keypair.json' due to error: TextEncoder is not defined. Program may need to be deployed with `solana program deploy dist/program/helloworld.so`
    at /data/Dev/example-helloworld/src/client/hello_world.ts:145:11
    at Generator.throw (<anonymous>)
    at rejected (/data/Dev/example-helloworld/src/client/hello_world.ts:27:65)
npm ERR! code ELIFECYCLE
npm ERR! errno 255
npm ERR! [email protected] start: `ts-node src/client/main.ts`
npm ERR! Exit status 255
npm ERR! 
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/ali/.npm/_logs/2021-10-07T08_51_28_739Z-debug.log

solana-test-validator Library not loaded error

m1 chip
macOS 11.3.1
node version v14.16.1

when start solana-test-validator

dyld: Library not loaded: /usr/local/opt/[email protected]/lib/libssl.1.1.dylib
  Referenced from: /Users/123/.local/share/solana/install/active_release/bin/solana-test-validator
  Reason: image not found
zsh: abort      solana-test-validator

google searched this thread:
https://stackoverflow.com/questions/59006602/dyld-library-not-loaded-usr-local-opt-openssl-lib-libssl-1-0-0-dylib

but can't switch openssl vserion

Error: Unknown command: switch

tried different node versions
tried reinstall xcode and brew with no luck

which openssl
/usr/bin/openssl
cd /usr/local/opt/[email protected]
cd: no such file or directory: /usr/local/opt/[email protected]

Error while running :npm run build:program-rust

getting this error :

[email protected] build:program-rust /home/neha/example-helloworld
cargo build-bpf --manifest-path=./src/program-rust/Cargo.toml --bpf-out-dir=dist/program

BPF SDK: /home/neha/.local/share/solana/install/releases/1.7.10/solana-release/bin/sdk/bpf
Running: rustup toolchain list -v
Running: rustup toolchain link bpf /home/neha/.local/share/solana/install/releases/1.7.10/solana-release/bin/sdk/bpf/dependencies/bpf-tools/rust
error: not a directory: '/home/neha/.local/share/solana/install/releases/1.7.10/solana-release/bin/sdk/bpf/dependencies/bpf-tools/rust/bin'
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build:program-rust: cargo build-bpf --manifest-path=./src/program-rust/Cargo.toml --bpf-out-dir=dist/program
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] build:program-rust script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /home/neha/.npm/_logs/2021-08-21T17_12_40_680Z-debug.log

solana/localhost error

i've just tried to run the testnet node and everything went fine except the part with

solana catchup ~/solana/validator-keypair.json

it can't see my pubkey
and when i try this
solana catchup validator-keypair.json --our-localhost

it says:
Error: error sending request for url (http://localhost:8899/): error trying to connect: tcp connect error: Connection refused (os error 111)

Please help with fixing that. Thanks

TextEncoder is not defined

When following the instructions in the README, I get:

$ npm run start
...
Error: Failed to read program keypair at '/home/david/projects/example-helloworld/dist/program/helloworld-keypair.json' due to error: TextEncoder is not defined. Program may need to be deployed with `solana program deploy dist/program/helloworld.so`
    at Object.<anonymous> (/home/david/projects/example-helloworld/src/client/hello_world.ts:153:11)
    at Generator.throw (<anonymous>)
    at rejected (/home/david/projects/example-helloworld/src/client/hello_world.ts:27:65)
npm ERR! code ELIFECYCLE
npm ERR! errno 255
npm ERR! [email protected] start: `ts-node src/client/main.ts`
npm ERR! Exit status 255
npm ERR! 
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/david/.npm/_logs/2021-08-03T23_01_53_539Z-debug.log

Cargo `exclude_entrypoint` feature doesn't appear to be used correctly

The Solana docs seem to suggest that an exclude-entrypoint feature should be provided which stops the entryponit! macro invocation from being run.

The Rust example program seems to have a different no-entrypoint feature that is unused. I figure that should probably be renamed to exclude-entrypoint and the entrypoint macro invocation should look something like this:

#[cfg(not(feature = "exclude_entrypoint"))]
entrypoint!(process_instruction);

I'm happy to put up a PR for this if what I'm saying sounds reasonable.

TextEncoder is not defined.

  • Able to run the cluster on Solana version 1.6.20
  • Able to build the rust program on Solana version 1.7.10
  • Able to deploy the program on the cluster
  • Facing errors in running the JavaScript Client

Here are the logs
WhatsApp Image 2021-08-14 at 1 02 48 PM

Could someone help with what I am doing wrong or is this a bug? I am guessing that there is a lack of dependencies on my end, but I couldn't solve this error.

no such subcommand: `+bpf`

When I run the command "npm run build:program-rust"
I faced this issue.

[email protected] build:program-rust
cargo build-bpf --manifest-path=./src/program-rust/Cargo.toml --bpf-out-dir=dist/program

BPF SDK: /usr/bin/solana-release/bin/sdk/bpf
Running: rustup toolchain list -v
Running: cargo +bpf build --target bpfel-unknown-unknown --release
error: no such subcommand: +bpf

Did you mean `b`?

What is the solution?

bug: solana program deploy error in macos

in my macos workround, I found it can't deploy program.

solana 1.6.9 on mac

example-helloworld on ๎‚  master [!] is ๐Ÿ“ฆ v0.0.1 via โฌข v14.15.5 on โ˜๏ธ [email protected] 
โฏ npm run build:program-rust

> [email protected] build:program-rust /Users/xiaods/Documents/code/example-helloworld
> cargo build-bpf --manifest-path=./src/program-rust/Cargo.toml --bpf-out-dir=dist/program

BPF SDK: /Users/xiaods/Downloads/solana-release/bin/sdk/bpf
Running: rustup toolchain list -v
Running: cargo +bpf build --target bpfel-unknown-unknown --release
    Finished release [optimized] target(s) in 0.97s

To deploy this program:
  $ solana program deploy /Users/xiaods/Documents/code/example-helloworld/dist/program/helloworld.so

example-helloworld on ๎‚  master [!] is ๐Ÿ“ฆ v0.0.1 via โฌข v14.15.5 on โ˜๏ธ [email protected] took 4s 
โฏ solana program deploy /Users/xiaods/Documents/code/example-helloworld/dist/program/helloworld.so
Error: Dynamic program error: No such file or directory (os error 2)

npm install: failed to parse Cargo.lock

When I run npm install I get the following error. Any ideas how to fix it?

Console Output

Cleaning /home/user/dev/blockchain/solana/example-helloworld/src/program-rust

> [email protected] clean:store /home/user/dev/blockchain/solana/example-helloworld
> rm -rf store

error: failed to parse lock file at: /home/user/dev/blockchain/solana/example-helloworld/src/program-rust/Cargo.lock

Caused by:
  invalid serialized PackageId for key `package.dependencies`
npm ERR! code ELIFECYCLE
npm ERR! errno 101
npm ERR! [email protected] postinstall: `npm run bpf-sdk:update && cargo update --manifest-path=src/program-rust/Cargo.toml`
npm ERR! Exit status 101
npm ERR! 
npm ERR! Failed at the [email protected] postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/user/.npm/_logs/2020-08-04T11_02_02_349Z-debug.log

Log File

32968 verbose lifecycle [email protected]~postinstall: CWD: /home/user/dev/blockchain/solana/example-helloworld
32969 silly lifecycle [email protected]~postinstall: Args: [
32969 silly lifecycle   '-c',
32969 silly lifecycle   'npm run bpf-sdk:update && cargo update --manifest-path=src/program-rust/Cargo.toml'
32969 silly lifecycle ]
32970 silly lifecycle [email protected]~postinstall: Returned: code: 101  signal: null
32971 info lifecycle [email protected]~postinstall: Failed to exec postinstall script
32972 verbose stack Error: [email protected] postinstall: `npm run bpf-sdk:update && cargo update --manifest-path=src/program-rust/Cargo.toml`
32972 verbose stack Exit status 101
32972 verbose stack     at EventEmitter.<anonymous> (/home/user/.nvm/versions/node/v12.16.1/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
32972 verbose stack     at EventEmitter.emit (events.js:311:20)
32972 verbose stack     at ChildProcess.<anonymous> (/home/user/.nvm/versions/node/v12.16.1/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
32972 verbose stack     at ChildProcess.emit (events.js:311:20)
32972 verbose stack     at maybeClose (internal/child_process.js:1021:16)
32972 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
32973 verbose pkgid [email protected]
32974 verbose cwd /home/user/dev/blockchain/solana/example-helloworld
32975 verbose Linux 5.4.0-42-generic
32976 verbose argv "/home/user/.nvm/versions/node/v12.16.1/bin/node" "/home/user/.nvm/versions/node/v12.16.1/bin/npm" "install"
32977 verbose node v12.16.1
32978 verbose npm  v6.13.4
32979 error code ELIFECYCLE
32980 error errno 101
32981 error [email protected] postinstall: `npm run bpf-sdk:update && cargo update --manifest-path=src/program-rust/Cargo.toml`
32981 error Exit status 101
32982 error Failed at the [email protected] postinstall script.
32982 error This is probably not a problem with npm. There is likely additional logging output above.

Environment

  • Ubuntu 20
  • node v12.16.1
  • npm 6.13.4
  • Docker version 19.03.12
  • Wget 1.20.3
  • rustup 1.18.1
  • rustc 1.34.1
  • cargo 1.34.0

Why can't I deploy the Rust program?

I am attempting to run the HelloWorld solana.

solana-test-validator

I ran npm install and then was able to build the rust project with

npm run build:program-rust

I can see the .so file in the directory /dist/program/helloworld.so. When I try to deploy the program to solana, I run

solana program deploy dist/program/helloworld.so

And here is the error I get

Error: Dynamic program error: No such file or directory (os error 2)

It can't find the file, but I have verified it is there. I have tried the full path and get the same error. I have tried to clean and reinstall the libs, but it hasn't helped.

What else should I try?

connect ECONNREFUSED

This is the result of running the hello world in Gitpod versiรณn

$ npm run start

[email protected] start
ts-node src/client/main.ts

Let's say hello to a Solana account...
Failed to read RPC url from CLI config file, falling back to localhost
FetchError: request to http://localhost:8899/ failed, reason: connect ECONNREFUSED 127.0.0.1:8899
at ClientRequest. (/workspace/example-helloworld/node_modules/node-fetch/lib/index.js:1461:11)
at ClientRequest.emit (events.js:315:20)
at ClientRequest.EventEmitter.emit (domain.js:467:12)
at Socket.socketErrorListener (_http_client.js:469:9)
at Socket.emit (events.js:315:20)
at Socket.EventEmitter.emit (domain.js:467:12)
at emitErrorNT (internal/streams/destroy.js:106:8)
at emitErrorCloseNT (internal/streams/destroy.js:74:3)
at processTicksAndRejections (internal/process/task_queues.js:80:21) {
type: 'system',
errno: 'ECONNREFUSED',
code: 'ECONNREFUSED'
}

Transactions not completing on solana-test-validator

Hi guys,

I am unable to deploy the program successfully on solana-test-validator node running on the remote host 192.168.10.2:8899.
Everything seems to be working fine except transactions verification on program deployment is not completing for some reason, there is no error in logs either.

image

Solana Config
image

Solana logs:
image

Install npm dependencies - npm install error

I got the next error when running npm install. Can you tell how to fix this issue?

npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: '[email protected]',
npm WARN EBADENGINE   required: { node: '12.x' },
npm WARN EBADENGINE   current: { node: 'v16.0.0', npm: '7.11.2' }
npm WARN EBADENGINE }
npm WARN deprecated @types/[email protected]: This is a stub types definition. yaml provides its own type definitions, so you do not need this installed.
npm ERR! code 1
npm ERR! path /home/ryan/Blockchains/solana-labs/example-helloworld/node_modules/secp256k1
npm ERR! command failed
npm ERR! command sh -c node-gyp rebuild
npm ERR! make: Entering directory '/home/ryan/Blockchains/solana-labs/example-helloworld/node_modules/secp256k1/build'
npm ERR!   CC(target) Release/obj.target/secp256k1/src/secp256k1/src/secp256k1.o
npm ERR!   AR(target) Release/obj.target/secp256k1.a
npm ERR!   COPY Release/secp256k1.a
npm ERR!   CXX(target) Release/obj.target/addon/src/addon.o
npm ERR! make: Leaving directory '/home/ryan/Blockchains/solana-labs/example-helloworld/node_modules/secp256k1/build'
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using [email protected]
npm ERR! gyp info using [email protected] | linux | x64
npm ERR! gyp info find Python using Python version 3.9.4 found at "/usr/bin/python3"
npm ERR! gyp WARN EACCES current user ("ryan") does not have permission to access the dev dir "/root/.cache/node-gyp/16.0.0"
npm ERR! gyp WARN EACCES attempting to reinstall using temporary dev dir "/tmp/.node-gyp"
npm ERR! (node:44353) [DEP0150] DeprecationWarning: Setting process.config is deprecated. In the future the property will be read-only.
npm ERR! (Use `node --trace-deprecation ...` to show where the warning was created)
npm ERR! gyp info spawn /usr/bin/python3
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args   '/usr/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
npm ERR! gyp info spawn args   'binding.gyp',
npm ERR! gyp info spawn args   '-f',
npm ERR! gyp info spawn args   'make',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/home/ryan/Blockchains/solana-labs/example-helloworld/node_modules/secp256k1/build/config.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/usr/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/tmp/.node-gyp/16.0.0/include/node/common.gypi',
npm ERR! gyp info spawn args   '-Dlibrary=shared_library',
npm ERR! gyp info spawn args   '-Dvisibility=default',
npm ERR! gyp info spawn args   '-Dnode_root_dir=/tmp/.node-gyp/16.0.0',
npm ERR! gyp info spawn args   '-Dnode_gyp_dir=/usr/lib/node_modules/npm/node_modules/node-gyp',
npm ERR! gyp info spawn args   '-Dnode_lib_file=/tmp/.node-gyp/16.0.0/<(target_arch)/node.lib',
npm ERR! gyp info spawn args   '-Dmodule_root_dir=/home/ryan/Blockchains/solana-labs/example-helloworld/node_modules/secp256k1',
npm ERR! gyp info spawn args   '-Dnode_engine=v8',
npm ERR! gyp info spawn args   '--depth=.',
npm ERR! gyp info spawn args   '--no-parallel',
npm ERR! gyp info spawn args   '--generator-output',
npm ERR! gyp info spawn args   'build',
npm ERR! gyp info spawn args   '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! gyp info spawn make
npm ERR! gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
npm ERR! warning: unknown warning option '-Wno-nonnull-compare' [-Wunknown-warning-option]
npm ERR! 1 warning generated.
npm ERR! make: g++: No such file or directory
npm ERR! make: *** [addon.target.mk:119: Release/obj.target/addon/src/addon.o] Error 127
npm ERR! gyp ERR! build error 
npm ERR! gyp ERR! stack Error: `make` failed with exit code: 2
npm ERR! gyp ERR! stack     at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:365:28)
npm ERR! gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
npm ERR! gyp ERR! System Linux 5.11.0-16-generic
npm ERR! gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd /home/ryan/Blockchains/solana-labs/example-helloworld/node_modules/secp256k1
npm ERR! gyp ERR! node -v v16.0.0
npm ERR! gyp ERR! node-gyp -v v7.1.2
npm ERR! gyp ERR! not ok

Environment
Ubuntu 21.04
solana-cli 1.6.6
node v16.0.0
npm 7.11.2
rustup 1.24.1
rustc 1.51.0
cargo 1.51.0

macOS ts-node error

Attempting to npm run start failed with sh: ts-node: command not found

I had to do:

npm install -D typescript
npm install -D ts-node

Worked after that

curl: (7) Failed to connect to localhost port 8899: Connection refused

Hello. I'm trying to launch the example, but it fails with the error in title. Please find logs together with my setup description below. Could you help me to launch the example, please?

System

$ uname -a
Linux ubuntu-focal 5.4.0-51-generic #56-Ubuntu SMP Mon Oct 5 14:28:49 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
$ node --version
v11.15.0                                                                   
$ npm --version
6.7.0                                                                      
$ docker -v
Docker version 19.03.13, build 4484c46d9d
$ rustup --version
rustup 1.22.1 (b01adbbc3 2020-07-08)                                       
$ rustc --version
rustc 1.47.0 (18bf6b4f0 2020-10-07)
$ cargo --version
cargo 1.47.0 (f3c7e066a 2020-08-28)

Output

$ npm run localnet:update
vagrant@ubuntu-focal:~/Workspace/example-helloworld$ git rev-parse --short HEAD
6218f79
vagrant@ubuntu-focal:~/Workspace/example-helloworld$ npm run localnet:update
                                                                                                                                                      
> [email protected] localnet:update /home/vagrant/Workspace/example-helloworld
> solana-localnet update             
                                     
Docker version 19.03.13, build 4484c46d9d                                                                                                             
+ docker pull solanalabs/solana:v1.3.17                                    
v1.3.17: Pulling from solanalabs/solana                                    
50e431f79093: Pull complete          
03bf2c599cee: Pull complete                                                                                                                           
9eed2595ba1f: Pull complete                                                
Digest: sha256:02e185a958def8a17d6851827fb702eddf3807301d825aa2ea0d075fa24a6e87
Status: Downloaded newer image for solanalabs/solana:v1.3.17               
docker.io/solanalabs/solana:v1.3.17                                                                                                                   
vagrant@ubuntu-focal:~/Workspace/example-helloworld$ npm run localnet:up   
                                     
> [email protected] localnet:up /home/vagrant/Workspace/example-helloworld  
> set -x; solana-localnet down; set -e; solana-localnet up                                                                                            
                                                                           
+ solana-localnet down               
Docker version 19.03.13, build 4484c46d9d                                  
++ docker ps --filter 'name=^/solana-localnet$' -q                                                                                                    
+ [[ -n '' ]]                                                              
+ set -e                                                                                                                                              
+ solana-localnet up                                                                                                                                  
Docker version 19.03.13, build 4484c46d9d                                                                                                             
+ RUST_LOG=solana=info               
+ ARGS=(--detach --name solana-localnet --rm --publish 8001:8001/tcp --publish 8899:8899/tcp --publish 8900:8900/tcp --publish 8901:8901/tcp --publish
 8902:8902/tcp --publish 9900:9900/tcp --publish 8000:8000/udp --publish 8001:8001/udp --publish 8002:8002/udp --publish 8003:8003/udp --publish 8004:
8004/udp --publish 8005:8005/udp --publish 8006:8006/udp --publish 8007:8007/udp --publish 8008:8008/udp --tty --ulimit "nofile=500000" --env "RUST_LO
G=$RUST_LOG")                        
+ [[ -n '' ]]                        
+ docker run --detach --name solana-localnet --rm --publish 8001:8001/tcp --publish 8899:8899/tcp --publish 8900:8900/tcp --publish 8901:8901/tcp --pu
blish 8902:8902/tcp --publish 9900:9900/tcp --publish 8000:8000/udp --publish 8001:8001/udp --publish 8002:8002/udp --publish 8003:8003/udp --publish 
8004:8004/udp --publish 8005:8005/udp --publish 8006:8006/udp --publish 8007:8007/udp --publish 8008:8008/udp --tty --ulimit nofile=500000 --env RUST_
LOG=solana=info solanalabs/solana:v1.3.17                                  
bb34a2bdb9e888b522db8984ff826e61da3c51eafceb1b15f2d52870385c3dc7
+ for _ in 1 2 3 4 5                 
+ curl -X POST -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0","id":1, "method":"getTransactionCount"}' http://localhost:8899
curl: (56) Recv failure: Connection reset by peer                          
+ sleep 1                            
+ for _ in 1 2 3 4 5                 
+ curl -X POST -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0","id":1, "method":"getTransactionCount"}' http://localhost:8899
curl: (52) Empty reply from server   
+ sleep 1                            
+ for _ in 1 2 3 4 5                 
+ curl -X POST -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0","id":1, "method":"getTransactionCount"}' http://localhost:8899
curl: (7) Failed to connect to localhost port 8899: Connection refused     
+ sleep 1                            
+ for _ in 1 2 3 4 5                 
+ curl -X POST -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0","id":1, "method":"getTransactionCount"}' http://localhost:8899
curl: (7) Failed to connect to localhost port 8899: Connection refused     
+ sleep 1                            
+ for _ in 1 2 3 4 5                 
+ curl -X POST -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0","id":1, "method":"getTransactionCount"}' http://localhost:8899
curl: (7) Failed to connect to localhost port 8899: Connection refused     
+ sleep 1                            
vagrant@ubuntu-focal:~/Workspace/example-helloworld$ docker ps             
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
vagrant@ubuntu-focal:~/Workspace/example-helloworld$

Crates `solana-bpf-helloworld` and `solana-program` use different versions of `borsh` lib

Problem: function solana_program::borsh::get_packed_len doesn't work with types, which implement borsh::shema::BorshSchema.

The reason is that ัrates solana-bpf-helloworld and solana-program use different versions of borsh lib.

Possible solutions:

  • Update deps at cargo.toml and make sure both crates use same version of borsh:
[dependencies]
borsh = "=0.8.2"
borsh-derive = "=0.8.2"
solana-program = "=1.7.1"
  • Re-export borsh types from solana-program crate

thread panic on `solana-test-validator --log`

When doing this part of the quick start, I get:

$ solana-test-validator --log                                                                                                                    
[2021-01-27T16:24:31.000372750Z DEBUG solana_runtime::message_processor] Program Vote111111111111111111111111111111111111111 invoke [1]
[2021-01-27T16:24:31.000419678Z DEBUG solana_runtime::message_processor] Program Vote111111111111111111111111111111111111111 success
[2021-01-27T16:24:31.405176680Z DEBUG solana_runtime::message_processor] Program Vote111111111111111111111111111111111111111 invoke [1]
[2021-01-27T16:24:31.405257191Z DEBUG solana_runtime::message_processor] Program Vote111111111111111111111111111111111111111 success
[2021-01-27T16:24:31.810215933Z DEBUG solana_runtime::message_processor] Program Vote111111111111111111111111111111111111111 invoke [1]
[2021-01-27T16:24:31.810286525Z DEBUG solana_runtime::message_processor] Program Vote111111111111111111111111111111111111111 success
[2021-01-27T16:24:32.215071070Z DEBUG solana_runtime::message_processor] Program Vote111111111111111111111111111111111111111 invoke [1]
[2021-01-27T16:24:32.215129459Z DEBUG solana_runtime::message_processor] Program Vote111111111111111111111111111111111111111 success
[2021-01-27T16:24:32.619923250Z DEBUG solana_runtime::message_processor] Program Vote111111111111111111111111111111111111111 invoke [1]
[2021-01-27T16:24:32.619975739Z DEBUG solana_runtime::message_processor] Program Vote111111111111111111111111111111111111111 success
[2021-01-27T16:24:33.025636930Z DEBUG solana_runtime::message_processor] Program Vote111111111111111111111111111111111111111 invoke [1]
[2021-01-27T16:24:33.025678298Z DEBUG solana_runtime::message_processor] Program Vote111111111111111111111111111111111111111 success
thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 98, kind: AddrInUse, message: "Address already in use" }', faucet/src/faucet.rs:299:58
stack backtrace:                                                                                                                                                                    
[2021-01-27T16:24:33.429596895Z DEBUG solana_runtime::message_processor] Program Vote111111111111111111111111111111111111111 invoke [1]
[2021-01-27T16:24:33.429649894Z DEBUG solana_runtime::message_processor] Program Vote111111111111111111111111111111111111111 success
   0: rust_begin_unwind            
             at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/panicking.rs:483
   1: core::panicking::panic_fmt
             at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/core/src/panicking.rs:85
   2: core::option::expect_none_failed
             at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/core/src/option.rs:1234
   3: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
   4: tokio::park::thread::CachedParkThread::block_on
   5: tokio::runtime::thread_pool::ThreadPool::block_on
   6: tokio::runtime::Runtime::block_on                                                   
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
thread 'main' panicked at 'run faucet: RecvError', validator/src/bin/solana-test-validator.rs:312:25  
stack backtrace:                                                                          
   0: rust_begin_unwind
             at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/panicking.rs:483
   1: core::panicking::panic_fmt                                                          
             at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/core/src/panicking.rs:85
   2: core::option::expect_none_failed
             at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/core/src/option.rs:1234
   3: solana_test_validator::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

This still generates a test-ledger folder but apparently blocks the next step, npm run build:program-rust, which can't find a package.json in that folder. I also ran npm install to no effect.

unable to get packages from source

Error when running npm run build:program-rust

cargo 1.53.0 (4369396ce 2021-04-27)

error: failed to download zeroize v1.4.1`

Caused by:
unable to get packages from source

Caused by:
failed to parse manifest at /home/gabriel/.cargo/registry/src/github.com-1ecc6299db9ec823/zeroize-1.4.1/Cargo.toml

Caused by:
feature resolver is required`

What is solana-localnet script?

So I am trying to start a localnet for Solana cluster. And I ran the following (as suggested from the README):

 npm run localnet:update

Then it's telling me:

solana-localnet: not found

So I am wondering what is this and how can I download/install it? Thanks!

FetchError: request to http://localhost:8899/ failed, reason: connect ECONNREFUSED 127.0.0.1:8899

Hi I am trying to run this hello world in my Linux Mint distro with all the latest dev environment:
NodeJs: 15.14.0,
solana-cli 1.6.4
rustc 1.51.0
docker 19.03.12, build 48a66213fe

I downloaded this repo, changed the node version in package.json
"engines": {
"node": "15.x"
}
And also re-installed @solana/web3.js to the latest: ^1.2.6

Then I followed the ReadMe:
Enable on-chain program log: $ export RUST_LOG=...

Start a local Solana cluster: $ solana-test-validator --log

$ yarn install
$ yarn run build:program-rust
$ yarn run start
Then I got this:

yarn run v1.22.4
$ ts-node src/client/main.ts
Let's say hello to a Solana account...
FetchError: request to http://localhost:8899/ failed, reason: connect ECONNREFUSED 127.0.0.1:8899
at ClientRequest. (/mnt/sda5/0Programming/Solana/example-helloworld/node_modules/node-fetch/lib/index.js:1461:11)
at ClientRequest.emit (node:events:369:20)
at ClientRequest.emit (node:domain:470:12)
at Socket.socketErrorListener (node:_http_client:472:9)
at Socket.emit (node:events:369:20)
at Socket.emit (node:domain:470:12)
at emitErrorNT (node:internal/streams/destroy:188:8)
at emitErrorCloseNT (node:internal/streams/destroy:153:3)
at processTicksAndRejections (node:internal/process/task_queues:81:21) {
type: 'system',
errno: 'ECONNREFUSED',
code: 'ECONNREFUSED'
}
It seems the Solana node is not running...
I have also tried those but still not working:
$ yarn run cluster:localnet

$ solana config get
Config File: /home/user1/.config/solana/cli/config.yml
RPC URL: https://api.mainnet-beta.solana.com
WebSocket URL: wss://api.mainnet-beta.solana.com/ (computed)
Keypair Path: /home/user1/.config/solana/id.json
Commitment: confirmed

$ solana --version
solana-cli 1.6.4 (src:b04ce802; feat:3342604240)

$ solana cluster-version
1.5.19

Did you miss that in the Readme? how to fix this? Please help. Thank you

npm run build:program-rust -> infinite recursion detected

npm run build:program-rust

> [email protected] build:program-rust /tmp/example-helloworld
> cargo build-bpf --manifest-path=./src/program-rust/Cargo.toml --bpf-out-dir=dist/program

BPF SDK: ~/.local/share/solana/install/releases/1.7.12/solana-release/bin/sdk/bpf
Running: rustup toolchain list -v
Running: cargo +bpf build --target bpfel-unknown-unknown --release
error: process didn't exit successfully: `rustc -vV` (exit status: 1)
--- stderr
error: infinite recursion detected

ENV:

$rustc -vV
rustc 1.55.0 (c8dfcfe04 2021-09-06)
binary: rustc
commit-hash: c8dfcfe046a7680554bf4eb612bad840e7631c4b
commit-date: 2021-09-06
host: x86_64-unknown-linux-gnu
release: 1.55.0
LLVM version: 12.0.1


$ cargo -vV
cargo 1.55.0 (32da73ab1 2021-08-23)
release: 1.55.0
commit-hash: 32da73ab19417aa89686e1d85c1440b72fdf877d
commit-date: 2021-08-23

tested on 1.7.9-1.7.12 versions of solana

Validator process aborted. The validator log may contain further details

solana-test-validator
Validator process aborted. The validator log may contain further details

I did everything under System Tuning (automatic and manual) but i still get this error.

~$ cat test-ledger/validator.log
[2021-08-29T02:05:18.830290897Z WARN  solana_core::validator] CUDA is disabled
[2021-08-29T02:05:18.830321426Z INFO  solana_core::validator] AVX detected
[2021-08-29T02:05:18.830327087Z ERROR solana_core::validator] Incompatible CPU detected: missing AVX2 support. Please build from source on the target

https://github.com/solana-labs/example-helloworld#start-local-solana-cluster
Ubuntu 20.04.3 LTS
AMDยฎ Fx(tm)-8120 eight-core processor ร— 8

Edit: I tried on my laptop and everything works. I guess my desktop CPU doesn't have AVX2 support and someone would have to rebuild solona on my CPU to get it to work.

Edit: Will try to build from source using https://github.com/solana-labs/solana#building

Connection Reset by Peer

Thanks for the very straightforward README file!

This fail happens at sudo npm run localnet:up. Here is what emits from stdout:

> [email protected] localnet:up /home/micah/example-helloworld
> set -x; solana-localnet down; set -e; solana-localnet up

+ solana-localnet down
Docker version 19.03.6, build 369ce74a3c
++ docker ps --filter 'name=^solana-localnet$' -q
+ [[ -n 0c5b224cf5c4 ]]
+ docker stop --time 0 solana-localnet
solana-localnet
+ set -e
+ solana-localnet up
Docker version 19.03.6, build 369ce74a3c
+ RUST_LOG=solana=info
+ ARGS=(--detach --name solana-localnet --rm --publish 8899:8899 --publish 8900:8900 --publish 9900:9900 --tty --env "RUST_LOG=$RUST_LOG")
+ [[ -n '' ]]
+ docker run --detach --name solana-localnet --rm --publish 8899:8899 --publish 8900:8900 --publish 9900:9900 --tty --env RUST_LOG=solana=info solanalabs/solana:v1.2.1
e1bb7e7180b1a57a914970030451f16b1e38189292a859ebef6df2f5d034fa65
+ for _ in 1 2 3 4 5
+ curl -X POST -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0","id":1, "method":"getTransactionCount"}' http://localhost:8899
curl: (56) Recv failure: Connection reset by peer
+ sleep 1
+ for _ in 1 2 3 4 5
+ curl -X POST -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0","id":1, "method":"getTransactionCount"}' http://localhost:8899
curl: (56) Recv failure: Connection reset by peer
+ sleep 1
+ for _ in 1 2 3 4 5
+ curl -X POST -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0","id":1, "method":"getTransactionCount"}' http://localhost:8899
{"jsonrpc":"2.0","result":0,"id":1}
+ break

I ran all of the prior instructions in the README file without problems, besides having to use sudo a couple times.

no such subcommand: `+bpf`

im new to solana and rust,whenever i try to build the rust program using npm scripts or going to the rust program directory to manually run 'cargo build-bpf', it says - no such subcommand: +bpf.

Screenshot at 2021-07-31 17-13-53

Rustup installation step is missing in hello world tutorial

Hi, I just want to leave a comment here thinking that it may help to make the onboarding process easier for other new comers to the solana world like me. When I tried to follow instructions on README.md for this hello world program, I noticed that I wasn't able to run it. Because correct rustup, cargo version weren't installed on my system. That's why I am writing the errors I came accross and then how I fixed it as follows. If it is possible to include rustup installation steps on README.md, I think it would be more smooth experience for the people who would like to test solana tools.

After running npm run build:program-rust

I came accross with following issue:

> [email protected] build:program-rust
> cargo build-bpf --manifest-path=./src/program-rust/Cargo.toml --bpf-out-dir=dist/program

sh: 1: cargo: not found

I fixed this by installing rustup from snap with
sudo snap install rustup --classic

but rustup version on snap was out of date for solana

> [email protected] build:program-rust
> cargo build-bpf --manifest-path=./src/program-rust/Cargo.toml --bpf-out-dir=dist/program

error: no override and no default toolchain set

and to fix this, I had to run

rustup toolchain add 1.53
and the issue is resolved.

reference: https://stackoverflow.com/questions/68599747/rust-solana-build-error-no-such-subcommand-bpf

dyld: Library not loaded: /usr/local/opt/[email protected]/lib/libssl.1.1.dylib

I am using Solana-CLI version 1.7.1 and rustc version 1.52.1 on a MacBook Pro M1. I am trying to run the 'hello-world' example. All step go well except on running

$ solana-test-validator

I get

dyld: Library not loaded: /usr/local/opt/[email protected]/lib/libssl.1.1.dylib
  Referenced from: /Users/prashantdandriyal/.local/share/solana/install/active_release/bin/solana-test-validator
  Reason: image not found
zsh: abort      solana-test-validator

This StackOverflow question suggests downgrading OpenSSL but it seems that Apple has stopped support for OpenSSL and its not possible to downgrade.

The Solana docs do not specify if M1 is compatible with Solana or not.

error following step by step instructions

$ npm run build:program-rust

> [email protected] build:program-rust
> cargo build-bpf --manifest-path=./src/program-rust/Cargo.toml --bpf-out-dir=dist/program

BPF SDK: /Users/tobowers/.local/share/solana/install/releases/stable-40fc14471debe19f602b2b991dd2849e2b1a8497/solana-release/bin/sdk/bpf
Running: rustup toolchain list -v
Running: rustup toolchain link bpf /Users/tobowers/.local/share/solana/install/releases/stable-40fc14471debe19f602b2b991dd2849e2b1a8497/solana-release/bin/sdk/bpf/dependencies/bpf-tools/rust
Running: cargo +bpf build --target bpfel-unknown-unknown --release
    Updating crates.io index
error: failed to download `solana-frozen-abi v1.7.9`

Caused by:
  unable to get packages from source

Caused by:
  failed to parse manifest at `/Users/tobowers/.cargo/registry/src/github.com-1ecc6299db9ec823/solana-frozen-abi-1.7.9/Cargo.toml`

Caused by:
  feature `resolver` is required

  consider adding `cargo-features = ["resolver"]` to the manifest

$ cargo -V
cargo 1.56.0-nightly (b51439fd8 2021-08-09)
info: The currently active rustc version is rustc 1.56.0-nightly (2d2bc94c8 2021-08-15)

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.