Any smart contract support?

#1

Hi all,
Nice to see all you guy here!
I’m Jinserk Baik, a research staff in Prof. Synho Do’s lab from MGH.
I’ve followed up and successfully installed goal and run a node here. I guess the node is syncing well from the log, but couldn’t get any tokens from your dispenser. How can I get some to make any transaction on the testnet?
In addition, I’d like to ask you have any smart contract support in your API. By a quick look, I couldn’t figure out any kind of smart contract features or VM to support general purpose dApp. If I misunderstood, please let me know to learn howto.

Thanks again for inviting us!

Best regards,
Jinserk

#2

Hi Jinserk, welcome. :slightly_smiling_face:

You should first create a wallet goal wallet new, and then create an account goal account new.
Then you can do goal account list to see the address of your created account (and balance).

You can use that address in the Algorand dispenser. Be sure to check the Captcha and have a 200 response. Wait some seconds and run again goal account list to see if your balance has changed.

Regarding smart contracts, I’ll quote @ChaseHunter which replied a similar question in the Telegram group:

No, Algorand is taking a bottom up approach in order to ensure each layer is secure and scalable.
Doing it this way should lead to long-term sustainability of the platform.
So smart contracts won’t be implemented to begin, and not until they are thoroughly tested on the TestNet.
At which point, a proposal would be made to add them to mainnet, and stakers would be able to vote them into the next protocol upgrade using their Participation Keys.

Regards,
Ignacio

1 Like
#3

Thank you for prompt response, @ihagopian!
I think I made my wallet and account in it successfully, but now the goal account list shows:

[offline]       Unnamed-0       P3VYVTKISPV5UJVSLAKVHSJIHF7SAJO4XBCNPAMTTAFHVXMPHIOTETSXM4      0       *Default

I guess the balance is not changed since the account is regarded as “offline”. What does this mean and how to change it as online?

Jinserk

#4

I checked using goal ledger balances and see that you a > 0 balance:

AFAIK, the online status is a choice of the node to participate in consensus. To be precise, to have a chance greater than zero of being elected within the cryptographic sortition to be a block proposer or vote-committee. In order to be online you should generate a participation key which are different from the account keys. I don’t think being online is necessary to receive transactions.

Just to be sure, if you run: goal node status, which is the output?

1 Like
#5

Here is the output:

$ ./goal node status -d data
Last committed block: 31885
Time since last block: 0.3s
Sync Time: 10701.9s
Last consensus protocol: v1
Next consensus protocol: v1
Round for next consensus protocol: 31886
Next consensus protocol supported: true

is it normal?

#6

Your node seems to be in the process of syncing. Your Sync time metric shows that it’s syncing for approx 3hs and hasn’t finished (if ==0, it has finished). Also, your last committed block it’s definitely lower than mine:

Last committed block: 81110
Time since last block: 3.2s
Sync Time: 0.0s
Last consensus protocol: v1
Next consensus protocol: v1
Round for next consensus protocol: 81111
Next consensus protocol supported: true

You can run that command again and see if the last committed block is increasing. If that’s the case, you should wait until it finishes. If it isn’t increasing, the carpenter command can give a better insight into what’s happening.

#7

Got it. I checked the status this morning and confirm that the sync has been done. I confirmed also that the Dispenser sent me 9e6 tokens correclty to my account:

$ ./goal node status -d data
Last committed block: 82283
Time since last block: 5.1s
Sync Time: 0.0s
Last consensus protocol: v1
Next consensus protocol: v1
Round for next consensus protocol: 82284
Next consensus protocol supported: true
$ ./goal account list -d data
Please enter the password for wallet 'anonymous': 
[offline]       Unnamed-0       P3VYVTKISPV5UJVSLAKVHSJIHF7SAJO4XBCNPAMTTAFHVXMPHIOTETSXM4      9000000 *Default

Thank you for your help!!

1 Like
#8

Awesome! Thanks for your help, @ihagopian! Welcome to Algorand, @jinserk!

#9

Good to know you @ChaseHunter, thanks!

#10

I have another question. Can I change the port 8080 of the algod to the other one like 8888 or else? It conflicts former web service so want to change it, but goal node start has no port option like that.

#11

Check out https://developer.algorand.org/docs/node-configuration-settings - the EndPoint address field in the config.json (rename or copy config.json.example to config.json) controls that port.

1 Like
#12

Also on Smart Contracts. If you are trying to write a layer 2 application you can always use the note field in a transaction to add any data you want, up to 1k. This can be used for things like NFTs, deeds, package tracking, etc

3 Likes
#13

As it stated above in the example of putting a deed number on the note field of transaction, what is the layer that makes the deed number was not changed from transaction to transaction, when this traferred from one wallet to another?

Algorand's Execution Environment
#14

Once a transaction is committed, it is immutable and public for all time - this includes the note field. So, if some data was posted to the chain using a transaction, that data is immutable.

In the deed example, the initial deed creation, a data payload declaring “I have a deed with such-and-such properties”, can never be changed. To transfer the deed, I would have to post a second payload to the chain, saying “I hereby transfer the deed to Praveen”. An outside observer would have to read these data payloads and interpret them, to make sure I am not doing anything “funny” with the deed transfer.

Maybe someone can step in with a better analogy, but it’s sort of like how a cryptographic package can provide signatures and checksums to prove authenticity of data, but then it is on users to actually check the signatures.

To summarize (I hope this answers your question!) : properties like immutability of data are provided by layer 1, and it is layer 2 that decides how to use the tools provided by layer 1.

2 Likes
#15

Thank you @Evan. In the context of smart contract, first I thought note field can be used to store and change the state but apparently not.

#16

Yes, the note field is part of the transactional nature of the data, not the state.

At the current moment you can think the blockchain as a relational database where you only have a transaction log. In order to have the current state of the database you should apply all the transaction logs in order.

As @Evan mentioned, you can build a system in Layer 2 that reacts to new transactions in Layer 1 and keep alive the current state of the system (in order to avoid reprocessing all the history every time you want to query something). Moving state to layer 2 have some implications, but that’s another discussion.

I don’t know how Algorand will implement smart contracts in the future, but afaik is in the roadmap.