solana-labs / solana-solidity.js

Compile, deploy, and use Solidity contracts on Solana
https://solana-labs.github.io/solana-solidity.js
Apache License 2.0
115 stars 39 forks source link

how to deploy to the devnet? #20

Open javamr123 opened 2 years ago

javamr123 commented 2 years ago

how to deploy to the "https://api.devnet.solana.com"?

I edit "const connection = new Connection('http://localhost:8899', 'confirmed');" to "const connection = new Connection('https://api.devnet.solana.com', 'confirmed');"

Error : Connecting to your local Solana node ... Airdropping SOL to a new wallet ...

/Users/leilei/Downloads/solana-solidity.js-master/node_modules/node-fetch/lib/index.js:1461 reject(new FetchError(request to ${request.url} failed, reason: ${err.message}, 'system', err)); ^ FetchError: request to https://api.devnet.solana.com/ failed, reason: Client network socket disconnected before secure TLS connection was established at ClientRequest. (/Users/leilei/Downloads/solana-solidity.js-master/node_modules/node-fetch/lib/index.js:1461:11) at ClientRequest.emit (node:events:390:28) at TLSSocket.socketErrorListener (node:_http_client:447:9) at TLSSocket.emit (node:events:390:28) at emitErrorNT (node:internal/streams/destroy:164:8) at emitErrorCloseNT (node:internal/streams/destroy:129:3) at processTicksAndRejections (node:internal/process/task_queues:83:21) { type: 'system', errno: 'ECONNRESET', code: 'ECONNRESET' }

Node.js v17.0.1

javamr123 commented 2 years ago

my solana --version solana-cli 1.8.2 (src:42a2c292; feat:52865992)

seanyoung commented 2 years ago

There are some features waiting to be activated on devnet:

$ solana -u devnet feature status | grep -e return_data -e log_data -e ed25519
BJVXq6NdLC7jCDGjfqJv7M1XHD4Y13VrpDqRF2U7UBcC | inactive                    | enable sol_{set,get}_return_data syscall
E1TvTNipX8TKNHrhRC8SMuAwQmGY58TZ4drdztP3Gxwc | inactive                    | enable builtin ed25519 signature verify program
HYPs7jyJ3KwQFdDpuSzMtVKf1MLJDaZRv3CSWvfUqdFo | inactive                    | enable sol_log_data syscall

I wrote these features and totally messed up the keys for enabling the features. 🤦‍♂️ So these are going to have to get new feature keys. This is already in the next release so we just need to wait for that to be enabled.

Abubakar672 commented 2 years ago

I am facing this error while deploying the contract on dev net, Although i have around 13 sol tokens in my account

{'code': -32002, 'message': 'Transaction simulation failed: Attempt to debit an account but found no record of a prior credit.', 'data': {'accounts': None, 'err': 'AccountNotFound', 'logs': []}}

Is there any solution

seanyoung commented 2 years ago

@Abubakar672 the error looks like there is an airdrop attempted to account for more than 1 SOL, which is not allowed.

What exactly are you running?

javamr123 commented 2 years ago

There are some features waiting to be activated on devnet:

$ solana -u devnet feature status | grep -e return_data -e log_data -e ed25519
BJVXq6NdLC7jCDGjfqJv7M1XHD4Y13VrpDqRF2U7UBcC | inactive                    | enable sol_{set,get}_return_data syscall
E1TvTNipX8TKNHrhRC8SMuAwQmGY58TZ4drdztP3Gxwc | inactive                    | enable builtin ed25519 signature verify program
HYPs7jyJ3KwQFdDpuSzMtVKf1MLJDaZRv3CSWvfUqdFo | inactive                    | enable sol_log_data syscall

I wrote these features and totally messed up the keys for enabling the features. 🤦‍♂️ So these are going to have to get new feature keys. This is already in the next release so we just need to wait for that to be enabled.

Can it be deployed on the mainnet?

seanyoung commented 2 years ago

Can it be deployed on the mainnet?

Yes:

$ solana -u mainnet-beta feature status | grep -e return_data -e log_data -e ed25519
6ppMXNYLhVd7GcsZ5uV11wQEW7spppiMVfqQv5SXhDpX | active since slot 117936008 | enable builtin ed25519 signature verify program
6uaHcKPGUy4J7emLBgUTeufhJdiwhngW6a1R9B7c2ob9 | active since slot 117936008 | enable sol_log_data syscall
DwScAzPUjuv65TMbDnFY7AgwmotzWy3xpEJMXM3hZFaB | active since slot 117936008 | enable sol_{set,get}_return_data syscall
javamr123 commented 2 years ago

Can it be deployed on the mainnet?

Yes:

$ solana -u mainnet-beta feature status | grep -e return_data -e log_data -e ed25519
6ppMXNYLhVd7GcsZ5uV11wQEW7spppiMVfqQv5SXhDpX | active since slot 117936008 | enable builtin ed25519 signature verify program
6uaHcKPGUy4J7emLBgUTeufhJdiwhngW6a1R9B7c2ob9 | active since slot 117936008 | enable sol_log_data syscall
DwScAzPUjuv65TMbDnFY7AgwmotzWy3xpEJMXM3hZFaB | active since slot 117936008 | enable sol_{set,get}_return_data syscall

I use the erc20 token written in solidity to deploy to solana with this tool, is my token still recognized?

seanyoung commented 2 years ago

I use the erc20 token written in solidity to deploy to solana with this tool, is my token still recognized?

You can deploy an erc20 solidity contract on Solana and it will work as a contract. However Solana uses spl-token for tokens (I'm working on spl-token compatibility right now). Does that help?

https://github.com/hyperledger-labs/solang/issues/607

javamr123 commented 2 years ago

I use the erc20 token written in solidity to deploy to solana with this tool, is my token still recognized?

You can deploy an erc20 solidity contract on Solana and it will work as a contract. However Solana uses spl-token for tokens (I'm working on spl-token compatibility right now). Does that help?

hyperledger-labs/solang#607

I don't seem to understand the content of your reply in hyperledger-labs/solang#607. But I think some solidity plugin might need to be done to achieve the following 2 functions:

  1. Solidity can receive spl-token.
  2. Solidity can transfer spl-token.
  3. Solidity can call all functions of spl-token, similar to the communication between solidity and rust, solidity can call rust methods
seanyoung commented 2 years ago

I don't seem to understand the content of your reply in hyperledger-labs/solang#607. But I think some solidity plugin might need to be done to achieve the following 2 functions:

1. Solidity can receive spl-token.

2. Solidity can transfer spl-token.

3. Solidity can call all functions of spl-token, similar to the communication between solidity and rust, solidity can call rust methods

Yes, you are right. We currently working on exactly this.

javamr123 commented 2 years ago

I don't seem to understand the content of your reply in hyperledger-labs/solang#607. But I think some solidity plugin might need to be done to achieve the following 2 functions:

1. Solidity can receive spl-token.

2. Solidity can transfer spl-token.

3. Solidity can call all functions of spl-token, similar to the communication between solidity and rust, solidity can call rust methods

Yes, you are right. We currently working on exactly this.

Thank you, these functions are very practical and important for the start of the business. If you have finished developing it, I hope you will take the initiative to notify me to close this issue, thank you again!

bhawikyudiz commented 2 years ago

I am facing this error while calling smart contract function.

TypeError: Cannot read properties of undefined (reading 'numRequiredSignatures') at Function.populate (/Users/bhawik/Documents/solana-solidity.js/node_modules/@solana/web3.js/lib/index.cjs.js:1979:24) at Connection.simulateTransaction (/Users/yudiz-bhawik/Documents/solana-solidity.js/node_modules/@solana/web3.js/lib/index.cjs.js:6538:33) at /Users/bhawik/Documents/solana-solidity.js/node_modules/@solana/solidity/lib/logs.js:98:41 at Generator.next () at /Users/bhawik/Documents/solana-solidity.js/node_modules/@solana/solidity/lib/logs.js:8:71 at new Promise () at __awaiter (/Users/bhawik/Documents/solana-solidity.js/node_modules/@solana/solidity/lib/logs.js:4:12) at simulateTransactionWithLogs (/Users/yudiz-bhawik/Documents/solana-solidity.js/node_modules/@solana/solidity/lib/logs.js:97:12) at Contract. (/Users/yudiz-bhawik/Documents/solana-solidity.js/node_modules/@solana/solidity/lib/contract.js:372:64) at Generator.next ()

seanyoung commented 2 years ago

I am facing this error while calling smart contract function.

TypeError: Cannot read properties of undefined (reading 'numRequiredSignatures') at Function.populate (/Users/bhawik/Documents/solana-solidity.js/node_modules/@solana/web3.js/lib/index.cjs.js:1979:24) at Connection.simulateTransaction (/Users/yudiz-bhawik/Documents/solana-solidity.js/node_modules/@solana/web3.js/lib/index.cjs.js:6538:33) at /Users/bhawik/Documents/solana-solidity.js/node_modules/@solana/solidity/lib/logs.js:98:41 at Generator.next () at /Users/bhawik/Documents/solana-solidity.js/node_modules/@solana/solidity/lib/logs.js:8:71 at new Promise () at __awaiter (/Users/bhawik/Documents/solana-solidity.js/node_modules/@solana/solidity/lib/logs.js:4:12) at simulateTransactionWithLogs (/Users/yudiz-bhawik/Documents/solana-solidity.js/node_modules/@solana/solidity/lib/logs.js:97:12) at Contract. (/Users/yudiz-bhawik/Documents/solana-solidity.js/node_modules/@solana/solidity/lib/contract.js:372:64) at Generator.next ()

Hi @bhawikyudiz can you please show us exactly what you are running. Thanks!