Getting started overview
Steem provides a blockchain platform for building decentralized social applications and content monetization tools. To begin development, you will need to create a Steem account, understand the various key types, and use one of the official SDKs to interact with the blockchain. This getting started guide outlines the initial steps to configure your environment and execute a basic operation, such as broadcasting a transaction.
The core process involves:
- Account Creation: Registering a unique username on the Steem blockchain.
- Key Management: Understanding and securing the different private keys associated with your account.
- Environment Setup: Installing a Steem SDK in your preferred programming language.
- First Request: Making a programmatic call to the Steem blockchain, such as posting a comment or voting.
This streamlined approach aims to get developers interacting with the Steem network efficiently. For comprehensive details on Steem's architecture and advanced features, refer to the Steem developer documentation.
Create an account and get keys
Interacting with the Steem blockchain requires a user account, which serves as your identity and holds your assets and permissions. Unlike traditional centralized services, Steem accounts are managed via cryptographic key pairs.
Account Registration
New accounts on Steem are typically created by existing users or through a service that provides account creation. This is due to the resource-intensive nature of account creation on the blockchain. Once an account is created, you receive a set of cryptographic keys.
For detailed instructions on obtaining a new account, consult the Steem account creation guide.
Understanding Steem Keys
Steem uses a system of multiple keys, each with specific permissions, to enhance security:
- Owner Key: The highest-level key, capable of changing all other keys, including itself. It should be kept offline in cold storage and used only for emergencies or account recovery.
- Active Key: Used for transferring funds, voting for witnesses, and performing power-up/power-down operations. It has permissions for financial transactions but cannot change the Owner key.
- Posting Key: The most frequently used key, granting permissions to post, comment, edit, vote, and follow. This key has limited power, making it safer for daily use in applications.
- Memo Key: Used for encrypting and decrypting memos in transfers.
Upon account creation, you will typically receive a master password from which all these keys can be generated. It is crucial to backup your master password and individual private keys securely. Loss of these keys means permanent loss of access to your account and its funds.
For a deeper understanding of Steem's cryptographic key system and security best practices, review the Steem key management documentation.
Your first request
To make your first programmatic interaction with the Steem blockchain, you will utilize one of the official SDKs. This example focuses on broadcasting a simple transaction: posting a comment.
Environment Setup
Steem provides SDKs for JavaScript and Python. Choose the one that aligns with your development stack.
JavaScript (Node.js)
- Install Node.js: Ensure you have Node.js installed. Refer to the official Node.js download page for installation instructions.
- Install
steem-js: Open your terminal or command prompt and run:
npm install steem
Python
- Install Python: Ensure you have Python 3 installed. Refer to the official Python downloads page for installation instructions.
- Install
steem-python: Open your terminal or command prompt and run:
pip install steem-python
Broadcasting a Comment Transaction
This example demonstrates how to post a comment using the Posting Key. This is a common first transaction, as it requires lower privileges compared to financial operations.
JavaScript Example (steem-js)
Create a file named post_comment.js:
const steem = require('steem');
// Configure Steem to use the production network
steem.api.setOptions({
url: 'https://api.steemit.com'
});
// Replace with your Steem account details
const postingKey = 'YOUR_POSTING_PRIVATE_KEY'; // REQUIRED: Your private Posting Key
const author = 'YOUR_STEEM_USERNAME'; // REQUIRED: Your Steem username
const permlink = 'my-first-comment-' + Date.now(); // A unique identifier for the comment
const parentAuthor = ''; // For a top-level post, this is empty
const parentPermlink = 'test'; // For a top-level post, use a common tag or a valid parent post's permlink
const title = ''; // For a comment, title is empty
const body = 'Hello, Steem! This is my first comment via steem-js SDK.';
const jsonMetadata = JSON.stringify({
tags: ['test', 'steem-js'],
app: 'my-steem-app/1.0.0'
});
steem.broadcast.comment(
postingKey,
parentAuthor,
parentPermlink,
author,
permlink,
title,
body,
jsonMetadata,
function(err, result) {
if (err) {
console.error('Error broadcasting comment:', err);
} else {
console.log('Comment broadcast successful! Transaction ID:', result.id);
console.log('Block Number:', result.block_num);
}
}
);
To run this example, save the file and execute from your terminal:
node post_comment.js
Python Example (steem-python)
Create a file named post_comment.py:
from steem import Steem
from steem.comment import Comment
# Configure Steem to use the production network
s = Steem(nodes=['https://api.steemit.com'], keys=['YOUR_POSTING_PRIVATE_KEY'])
# Replace with your Steem account details
author = 'YOUR_STEEM_USERNAME' # REQUIRED: Your Steem username
permlink = 'my-first-comment-' + str(s.util.amount.Time.now()).replace(':', '').replace('.', '') # A unique identifier
parent_author = '' # For a top-level post, this is empty
parent_permlink = 'test' # For a top-level post, use a common tag or a valid parent post's permlink
title = '' # For a comment, title is empty
body = 'Hello, Steem! This is my first comment via steem-python SDK.'
json_metadata = {'tags': ['test', 'steem-python'], 'app': 'my-steem-app/1.0.0'}
# For a simple comment, use the 'reply' method
try:
comment = Comment(parent_permlink, steem_instance=s)
comment.reply(body, author=author, meta=json_metadata)
print(f"Comment posted successfully by {author} with permlink {permlink}")
except Exception as e:
print(f"Error posting comment: {e}")
To run this example, save the file and execute from your terminal:
python post_comment.py
Important: Always replace 'YOUR_POSTING_PRIVATE_KEY' and 'YOUR_STEEM_USERNAME' with your actual credentials. For security, never hardcode private keys in production applications. Instead, use environment variables or secure configuration management.
Common next steps
After successfully broadcasting your first transaction, consider these common next steps to further your development on Steem:
- Explore Other Transaction Types: Experiment with voting, transferring tokens, or creating new posts. The Steem API reference details all available blockchain operations.
- Integrate with a Steem Frontend: Develop a user interface for your application. Many existing Steem DApps can serve as inspiration.
- Learn About Smart Media Tokens (SMTs): Understand how to issue and manage your own tokens on the Steem blockchain for advanced monetization and community features. Information on SMTs is available within the Steem developer documentation.
- Secure Key Management: Implement robust security practices for handling private keys in your application. Consider using secure key storage solutions or delegating key management to users through client-side applications. The OAuth 2.0 framework, while not directly integrated into Steem's core, provides an industry standard for delegated authorization that can inform secure practices in web application contexts, as described by the OAuth 2.0 specification.
- Monitor Blockchain Activity: Learn how to query the blockchain for specific account activity, posts, or other data relevant to your application.
Troubleshooting the first call
Encountering issues during your first Steem API call is not uncommon. Here are some troubleshooting tips:
| Step | What to do | Where to check |
|---|---|---|
| Verify Keys | Double-check that you are using the correct private Posting Key and that it matches the author username. | Your account's key management section or an authorized Steem wallet. |
| Network Connectivity | Ensure your internet connection is stable and that the Steem API node (e.g., https://api.steemit.com) is reachable. |
Ping the API endpoint from your terminal, check the Steem status page (if available), or Steem community forums. |
| SDK Installation | Confirm that the steem-js or steem-python SDK is correctly installed and updated. |
Run npm list steem or pip show steem-python in your project directory. |
| Error Messages | Read the error message carefully. It often provides clues about what went wrong (e.g., invalid key, duplicate permlink, insufficient bandwidth). | Your application's console output. |
| Unique Permlink | Ensure the permlink for your comment is unique. Blockchain transactions require unique identifiers. |
Check the generated permlink in your code, try appending a timestamp or a random string. |
| Community Support | If issues persist, seek help from the Steem developer community. | Steem forums, Discord channels, or GitHub issue trackers for the SDKs. |
| Bandwidth Issues | Steem accounts consume 'bandwidth' for transactions. If an account is new or hasn't transacted recently, it might have low bandwidth. | Check your account details on a Steem block explorer or wallet; wait a short period for bandwidth to regenerate. |
Always refer to the official Steem API documentation for the most accurate and up-to-date information on error codes and best practices.